gstlearn  1.0.0
CCC
MeshEStandard Class Reference

#include <MeshEStandard.hpp>

Inheritance diagram for MeshEStandard:
AMesh AStringable ASerializable

Public Member Functions

 MeshEStandard ()
 
 MeshEStandard (const MeshEStandard &m)
 
MeshEStandardoperator= (const MeshEStandard &m)
 
virtual ~MeshEStandard ()
 
virtual String toString (const AStringFormat *strfmt=nullptr) const override
 Interface to AStringable. More...
 
int getNApices () const override
 Interface for AMesh. More...
 
int getNMeshes () const override
 
int getApex (int imesh, int rank) const override
 
double getCoor (int imesh, int rank, int idim) const override
 
double getApexCoor (int i, int idim) const override
 
double getMeshSize (int imesh) const override
 
cs * getMeshToDb (const Db *db, int rankZ=-1, bool verbose=false) const override
 
VectorInt getMeshList () const
 
VectorDouble getPointList (bool byCol=true) const
 
int reset (const MatrixRectangular &apices, const MatrixInt &meshes, bool verbose=false)
 
int reset (int ndim, int napexpermesh, const VectorDouble &apices, const VectorInt &meshes, bool byCol=true, bool verbose=false)
 
int resetFromTurbo (const MeshETurbo &turbo, bool verbose=false)
 
const MatrixRectangulargetApices () const
 
const MatrixIntgetMeshes () const
 
- Public Member Functions inherited from AMesh
 AMesh ()
 
 AMesh (const AMesh &m)
 
AMeshoperator= (const AMesh &m)
 
virtual ~AMesh ()
 
virtual int getNApexPerMesh () const
 Interface for AMesh. More...
 
virtual void getCoordinatesInPlace (int imesh, int rank, VectorDouble &coords) const
 
virtual void getApexCoordinatesInPlace (int i, VectorDouble &coords) const
 
virtual int getVariety () const
 
virtual int getEmbeddedNDim () const
 
virtual void getEmbeddedCoorPerMesh (int imesh, int ic, VectorDouble &coords) const
 
virtual void getEmbeddedCoorPerApex (int iapex, VectorDouble &coords) const
 
int getNDim () const
 
double getExtendMin (int idim) const
 
double getExtendMax (int idim) const
 
VectorDouble getExtrema (int idim) const
 
void getElements (MatrixRectangular &apices, MatrixInt &meshes) const
 
int isCompatibleDb (const Db *db) const
 
VectorDouble getMeshSizes () const
 
void printMesh (int imesh0) const
 
void printMeshes (int level=0, int nline_max=-1) const
 
VectorDouble getCoordinates (int idim) const
 
VectorInt getMeshByApexPair (int apex1, int apex2) const
 
VectorDouble getCoordinatesPerMesh (int imesh, int idim, bool flagClose=false) const
 
VectorDouble getApexCoordinates (int iapex) const
 
VectorVectorDouble getCoordinatesPerMesh (int imesh) const
 
VectorVectorDouble getEmbeddedCoordinatesPerMesh (int imesh=0) const
 
void getEmbeddedCoordinatesPerMeshInPlace (int imesh, VectorVectorDouble &coors) const
 
VectorVectorDouble getEmbeddedCoordinatesPerApex () const
 
VectorDouble getDistances (int iapex0, const VectorInt &japices=VectorInt())
 
VectorVectorDouble getAllCoordinates () const
 
MatrixRectangular getAllApices () const
 
MatrixInt getAllMeshes () const
 
double getCenterCoordinate (int imesh, int idim) const
 
VectorVectorDouble getAllCenterCoordinates () const
 
VectorVectorInt getNeighborhoodPerMesh () const
 
VectorVectorInt getNeighborhoodPerApex () const
 
void dumpNeighborhood (std::vector< VectorInt > &Vmesh, int nline_max=1)
 
- Public Member Functions inherited from AStringable
 AStringable ()
 
 AStringable (const AStringable &r)
 
AStringableoperator= (const AStringable &r)
 
virtual ~AStringable ()
 
virtual void display (const AStringFormat *strfmt=nullptr) const final
 
virtual void display (int level) const final
 
- Public Member Functions inherited from ASerializable
 ASerializable ()
 
 ASerializable (const ASerializable &r)
 
ASerializableoperator= (const ASerializable &r)
 
virtual ~ASerializable ()
 
bool deserialize (std::istream &is, bool verbose=true)
 
bool serialize (std::ostream &os, bool verbose=true) const
 
bool dumpToNF (const String &neutralFilename, bool verbose=false) const
 

Static Public Member Functions

static MeshEStandardcreateFromNF (const String &neutralFilename, bool verbose=true)
 
static MeshEStandardcreateFromExternal (const MatrixRectangular &apices, const MatrixInt &meshes, bool verbose=false)
 
- Static Public Member Functions inherited from ASerializable
static String buildFileName (int status, const String &filename, bool ensureDirExist=false)
 
static String getHomeDirectory (const String &sub="")
 
static String getWorkingDirectory ()
 
static String getTestData (const String &subdir, const String &filename)
 
static String getFileIdentity (const String &filename, bool verbose=false)
 
static void setContainerName (bool useDefault, const String &containerName="", bool verbose=false)
 
static void unsetContainerName ()
 
static void setPrefixName (const String &prefixName)
 
static void unsetPrefixName ()
 
static const StringgetContainerName ()
 
static const StringgetPrefixName ()
 
static bool createDirectory (const String &dir)
 
static String getExecDirectory ()
 
static String getDirectory (const String &path)
 

Protected Member Functions

virtual bool _deserialize (std::istream &is, bool verbose=false) override
 Interface for ASerializable. More...
 
virtual bool _serialize (std::ostream &os, bool verbose=false) const override
 
String _getNFName () const override
 
void _defineBoundingBox (void)
 
- Protected Member Functions inherited from AMesh
void _setNDim (int ndim)
 
int _setExtend (const VectorDouble extendmin, const VectorDouble extendmax)
 
bool _weightsInMesh (const VectorDouble &coor, const VectorVectorDouble &corners, double meshsize, VectorDouble &weights, double eps=EPSILON5) const
 
double _getMeshUnit (const VectorVectorDouble &corners) const
 
void _recopy (const AMesh &m)
 
- Protected Member Functions inherited from ASerializable
bool _fileOpenWrite (const String &filename, std::ofstream &os, bool verbose=false) const
 
bool _fileOpenRead (const String &filename, std::ifstream &is, bool verbose=false) const
 

Private Member Functions

VectorDouble _defineUnits () const
 
VectorDouble _defineContainers () const
 
bool _coorInMeshContainer (const VectorDouble &coor, int imesh, const VectorDouble &container) const
 
bool _coorInMesh (const VectorDouble &coor, int imesh, double meshsize, VectorDouble &weights) const
 
void _setContainer (VectorDouble &container, int imesh, int idim, double vmin, double vmax) const
 
void _getContainer (const VectorDouble &container, int imesh, int idim, double *vmin, double *vmax) const
 
void _printContainers (const VectorDouble &container) const
 
void _deallocate ()
 
int _recopy (const MeshEStandard &m)
 
void _checkConsistency () const
 
void _setApex (int imesh, int rank, int value)
 
void _validate ()
 

Private Attributes

MatrixRectangular _apices
 
MatrixInt _meshes
 

Additional Inherited Members

- Static Protected Member Functions inherited from ASerializable
static bool _commentWrite (std::ostream &os, const String &comment)
 
template<typename T >
static bool _recordWrite (std::ostream &os, const String &title, const T &val)
 
template<typename T >
static bool _recordWriteVec (std::ostream &os, const String &title, const VectorT< T > &vec)
 
template<typename T >
static bool _recordRead (std::istream &is, const String &title, T &val)
 
template<typename T >
static bool _recordReadVec (std::istream &is, const String &title, VectorT< T > &vec, int nvalues)
 
static bool _onlyBlanks (char *string)
 
static bool _tableRead (std::istream &is, const String &string, int ntab, double *tab)
 
static bool _tableWrite (std::ostream &os, const String &string, int ntab, const VectorDouble &tab)
 

Detailed Description

Meshing defined in the Euclidean space

Constructor & Destructor Documentation

◆ MeshEStandard() [1/2]

MeshEStandard::MeshEStandard ( )

◆ MeshEStandard() [2/2]

MeshEStandard::MeshEStandard ( const MeshEStandard m)

◆ ~MeshEStandard()

MeshEStandard::~MeshEStandard ( )
virtual

Member Function Documentation

◆ _checkConsistency()

void MeshEStandard::_checkConsistency ( ) const
private

This function checks the consistency between the number of points and the vertices indication

◆ _coorInMesh()

bool MeshEStandard::_coorInMesh ( const VectorDouble coor,
int  imesh,
double  meshsize,
VectorDouble weights 
) const
private

Check if a point, defined by its coordinates, belong to a Mesh

Returns
true if the point belongs to the Mesh; false otherwise
Parameters
[in]coorArray of target coordinates
[in]imeshMesh Index
[in]meshsizeDimension of the mesh
[out]weightsArray of barycentric weights (Dim: NApexPerMesh)
Remarks
The argument 'meshsize' is used to speed the calculations

◆ _coorInMeshContainer()

bool MeshEStandard::_coorInMeshContainer ( const VectorDouble coor,
int  imesh,
const VectorDouble container 
) const
private

Check if a point, defined by its coordinates, belong to the container of a Mesh

Returns
true if the point belongs to the container; false otherwise
Parameters
[in]coorArray of target coordinates
[in]imeshMesh Index
[in]containerArray of containers

◆ _deallocate()

void MeshEStandard::_deallocate ( )
private

◆ _defineBoundingBox()

void MeshEStandard::_defineBoundingBox ( void  )
protected

◆ _defineContainers()

VectorDouble MeshEStandard::_defineContainers ( ) const
private

Define the container for each mesh

Returns
Pointer to the array containing the containers

◆ _defineUnits()

VectorDouble MeshEStandard::_defineUnits ( void  ) const
private

◆ _deserialize()

bool MeshEStandard::_deserialize ( std::istream &  is,
bool  verbose = false 
)
overrideprotectedvirtual

Interface for ASerializable.

Reimplemented from AMesh.

◆ _getContainer()

void MeshEStandard::_getContainer ( const VectorDouble container,
int  imesh,
int  idim,
double *  vmin,
double *  vmax 
) const
private

◆ _getNFName()

String MeshEStandard::_getNFName ( ) const
inlineoverrideprotectedvirtual

Reimplemented from AMesh.

◆ _printContainers()

void MeshEStandard::_printContainers ( const VectorDouble container) const
private

◆ _recopy()

int MeshEStandard::_recopy ( const MeshEStandard m)
private

◆ _serialize()

bool MeshEStandard::_serialize ( std::ostream &  os,
bool  verbose = false 
) const
overrideprotectedvirtual

Reimplemented from AMesh.

◆ _setApex()

void MeshEStandard::_setApex ( int  imesh,
int  rank,
int  value 
)
private

◆ _setContainer()

void MeshEStandard::_setContainer ( VectorDouble container,
int  imesh,
int  idim,
double  vmin,
double  vmax 
) const
private

◆ _validate()

void MeshEStandard::_validate ( )
private

Validate Meshing, in particular when transiting from Old Meshing to New one

Remarks
For safety and considering the rank of Apices stored in 'meshes',
the minimum value is considered
If not equal to 0 or 1, a fatal error is issued
If equal to 1 (old style), values are decreased by 1.

◆ createFromExternal()

MeshEStandard * MeshEStandard::createFromExternal ( const MatrixRectangular apices,
const MatrixInt meshes,
bool  verbose = false 
)
static

◆ createFromNF()

MeshEStandard * MeshEStandard::createFromNF ( const String neutralFilename,
bool  verbose = true 
)
static

Create a MeshEStandard by loading the contents of a Neutral File

Parameters
neutralFilenameName of the Neutral File (MeshEStandard format)
verboseVerbose

◆ getApex()

int MeshEStandard::getApex ( int  imesh,
int  rank 
) const
overridevirtual

Returns the rank of the Apex 'rank' of the Mesh 'imesh'

Returns
The rank of the target apex
Parameters
[in]imeshRank of Mesh (from 0 to _nMeshes-1))
[in]rankRank of Apex within a Mesh (from 0 to _nApexPerMesh)

Implements AMesh.

◆ getApexCoor()

double MeshEStandard::getApexCoor ( int  i,
int  idim 
) const
overridevirtual

Returns coordinate 'idim' of apex 'i'

Implements AMesh.

◆ getApices()

const MatrixRectangular& MeshEStandard::getApices ( ) const
inline

◆ getCoor()

double MeshEStandard::getCoor ( int  imesh,
int  rank,
int  idim 
) const
overridevirtual

Returns the coordinate 'idim' of the Apex 'rank' of the Mesh 'imesh'

Returns
The coordinate of the target apex
Parameters
[in]imeshRank of the Mesh (from 0 to _nMeshes-1))
[in]rankRank of Apex within a Mesh (from 0 to _nApexPerMesh-1)
[in]idimRank of the coordinate (from 0 to _nDim-1)

Implements AMesh.

◆ getMeshes()

const MatrixInt& MeshEStandard::getMeshes ( ) const
inline

◆ getMeshList()

VectorInt MeshEStandard::getMeshList ( ) const
inline

◆ getMeshSize()

double MeshEStandard::getMeshSize ( int  imesh) const
overridevirtual

Returns the size of the Mesh 'imesh'

Returns
mesh dimension
Parameters
[in]imeshRank of the Mesh (from 0 to _nMeshes-1))

Implements AMesh.

◆ getMeshToDb()

cs * MeshEStandard::getMeshToDb ( const Db db,
int  rankZ = -1,
bool  verbose = false 
) const
overridevirtual

Returns the Sparse Matrix used to project a Db onto the Meshing

Returns
A Sparse matrix (cs structure)
Parameters
[in]dbDb structure
[in]rankZRank of the Z-locator to be tested (see remarks)
[in]verboseVerbose flag
Remarks
If rankZ>=0, a sample is only considered if the value
of the corresponding variable is defined

Implements AMesh.

◆ getNApices()

int MeshEStandard::getNApices ( ) const
overridevirtual

Interface for AMesh.

Returns the number of Apices

Returns
Number of apices

Implements AMesh.

◆ getNMeshes()

int MeshEStandard::getNMeshes ( ) const
overridevirtual

Returns the number of Meshes

Returns
Number of meshes

Implements AMesh.

◆ getPointList()

VectorDouble MeshEStandard::getPointList ( bool  byCol = true) const

Returns the list of mesh vertex information This List is organized as a single Vector of Double It is dimensioned to Nrows=getNApices() and Ncols=getNDim()

Parameters
byColtrue if the values must be sorted by column
Returns

◆ operator=()

MeshEStandard & MeshEStandard::operator= ( const MeshEStandard m)

◆ reset() [1/2]

int MeshEStandard::reset ( const MatrixRectangular apices,
const MatrixInt meshes,
bool  verbose = false 
)

Create the meshing (from mesh information)

Parameters
[in]apicesMatrix of Apices
[in]meshesArray of mesh indices
[in]verboseVerbose flag

◆ reset() [2/2]

int MeshEStandard::reset ( int  ndim,
int  napexpermesh,
const VectorDouble apices,
const VectorInt meshes,
bool  byCol = true,
bool  verbose = false 
)

Create the meshing (from mesh information)

Parameters
[in]ndimSpace Dimension
[in]napexpermeshNumber of apices per mesh
[in]apicesVector of Apex information
[in]meshesVector of mesh indices
[in]byColtrue for Column major; false for Row Major
[in]verboseVerbose flag
Remarks
The argument 'byCol' concerns 'apices' and 'meshes'

◆ resetFromTurbo()

int MeshEStandard::resetFromTurbo ( const MeshETurbo turbo,
bool  verbose = false 
)

◆ toString()

String MeshEStandard::toString ( const AStringFormat strfmt = nullptr) const
overridevirtual

Interface to AStringable.

Print the contents of the meshing

Parameters
[in]strfmtFormat for printout

Reimplemented from AMesh.

Member Data Documentation

◆ _apices

MatrixRectangular MeshEStandard::_apices
private

◆ _meshes

MatrixInt MeshEStandard::_meshes
private

The documentation for this class was generated from the following files: