gstlearn  0.3.2
Geostatistics & Machine Learning toolbox
All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules
AMesh Class Referenceabstract

TODO : Dependency to csparse to be removed. More...

#include <AMesh.hpp>

Inheritance diagram for AMesh:
AStringable ASerializable MeshEStandard MeshETurbo MeshManifold MeshSpherical MeshSphericalExt

Public Member Functions

 AMesh ()
 
 AMesh (const AMesh &m)
 
AMeshoperator= (const AMesh &m)
 
virtual ~AMesh ()
 
virtual String toString (const AStringFormat *strfmt=nullptr) const override
 Interface to AStringable. More...
 
virtual int getNApexPerMesh () const
 Interface for AMesh. More...
 
virtual int getNApices () const =0
 
virtual int getNMeshes () const =0
 
virtual int getApex (int imesh, int rank) const =0
 
virtual double getCoor (int imesh, int rank, int idim) const =0
 
virtual void getCoordinatesInPlace (int imesh, int rank, VectorDouble &coords) const
 
virtual double getApexCoor (int i, int idim) const =0
 
virtual void getApexCoordinatesInPlace (int i, VectorDouble &coords) const
 
virtual double getMeshSize (int imesh) const =0
 
virtual cs * getMeshToDb (const Db *db, bool verbose=false) const =0
 
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
 
std::vector< VectorIntgetNeighborhoodPerMesh () const
 TODO : replace by VectorVectorInt ? More...
 
std::vector< VectorIntgetNeighborhoodPerApex () const
 
void dumpNeighborhood (std::vector< VectorInt > &Vmesh)
 
- 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
 

Protected Member Functions

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)
 
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
 
- 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

bool _isSpaceDimensionValid (int idim) const
 
void _printMeshListByIndices (int nline_max=-1) const
 
void _printMeshListByCoordinates (int nline_max=-1) const
 

Private Attributes

int _nDim
 
VectorDouble _extendMin
 
VectorDouble _extendMax
 

Additional Inherited Members

- 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=String(), 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)
 
- 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

TODO : Dependency to csparse to be removed.

Constructor & Destructor Documentation

◆ AMesh() [1/2]

AMesh::AMesh ( )

◆ AMesh() [2/2]

AMesh::AMesh ( const AMesh m)

◆ ~AMesh()

AMesh::~AMesh ( )
virtual

Member Function Documentation

◆ _deserialize()

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

Interface for ASerializable.

Implements ASerializable.

Reimplemented in MeshSpherical, MeshManifold, MeshManifold, MeshETurbo, and MeshEStandard.

◆ _getMeshUnit()

double AMesh::_getMeshUnit ( const VectorVectorDouble corners) const
protected

Returns the size of the Mesh 'imesh'

Returns
mesh dimension
Parameters
[in]cornersVector of coordinates of mesh apices

◆ _getNFName()

String AMesh::_getNFName ( ) const
inlineoverrideprotectedvirtual

Implements ASerializable.

Reimplemented in MeshSpherical, MeshManifold, MeshETurbo, and MeshEStandard.

◆ _isSpaceDimensionValid()

bool AMesh::_isSpaceDimensionValid ( int  idim) const
private

◆ _printMeshListByCoordinates()

void AMesh::_printMeshListByCoordinates ( int  nline_max = -1) const
private

◆ _printMeshListByIndices()

void AMesh::_printMeshListByIndices ( int  nline_max = -1) const
private

◆ _recopy()

void AMesh::_recopy ( const AMesh m)
protected

◆ _serialize()

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

◆ _setExtend()

int AMesh::_setExtend ( const VectorDouble  extendmin,
const VectorDouble  extendmax 
)
protected

◆ _setNDim()

void AMesh::_setNDim ( int  ndim)
inlineprotected

◆ _weightsInMesh()

bool AMesh::_weightsInMesh ( const VectorDouble coor,
const VectorVectorDouble corners,
double  meshsize,
VectorDouble weights,
double  eps = EPSILON5 
) const
protected

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

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

◆ dumpNeighborhood()

void AMesh::dumpNeighborhood ( std::vector< VectorInt > &  Vmesh)

◆ getAllApices()

MatrixRectangular AMesh::getAllApices ( ) const

Returns the information about all apices:

  • the first dimension is the number of meshes (nrow)
  • the second dimension if the space dimension (ncol)
    Returns

◆ getAllCenterCoordinates()

VectorVectorDouble AMesh::getAllCenterCoordinates ( ) const

◆ getAllCoordinates()

VectorVectorDouble AMesh::getAllCoordinates ( ) const

Returns the coordinates of all meshes:

  • the first dimension if the space dimension
  • the second dimension is the number of apices
    Returns

◆ getAllMeshes()

MatrixInt AMesh::getAllMeshes ( ) const

Returns the information of all meshes:

  • the first dimension is the number of apices (nrow)
  • the second dimension if the space dimension (ncol)
    Returns

◆ getApex()

virtual int AMesh::getApex ( int  imesh,
int  rank 
) const
pure virtual

Returns the rank of apex 'rank' for mesh 'imesh'

Implemented in MeshSpherical, MeshManifold, MeshETurbo, and MeshEStandard.

◆ getApexCoor()

virtual double AMesh::getApexCoor ( int  i,
int  idim 
) const
pure virtual

Returns coordinate 'idim' of apex 'i'

Implemented in MeshSpherical, MeshManifold, MeshETurbo, and MeshEStandard.

◆ getApexCoordinates()

VectorDouble AMesh::getApexCoordinates ( int  iapex) const

Returns the coordinates of an Apex

◆ getApexCoordinatesInPlace()

void AMesh::getApexCoordinatesInPlace ( int  i,
VectorDouble coords 
) const
virtual

Returns coordinates of apex 'i'

Reimplemented in MeshETurbo.

◆ getCenterCoordinate()

double AMesh::getCenterCoordinate ( int  imesh,
int  idim 
) const

Returns the coordinates of the Center of Gravity of a Mesh

Parameters
imeshRank of the Mesh
idimIndex of the space dimension
Returns

◆ getCoor()

virtual double AMesh::getCoor ( int  imesh,
int  rank,
int  idim 
) const
pure virtual

Returns coordinate 'idim' of apex 'rank' of mesh 'imesh'

Implemented in MeshSpherical, MeshManifold, MeshETurbo, and MeshEStandard.

◆ getCoordinates()

VectorDouble AMesh::getCoordinates ( int  idim) const

Returns Vector of Apex coordinates for space index

◆ getCoordinatesInPlace()

void AMesh::getCoordinatesInPlace ( int  imesh,
int  rank,
VectorDouble coords 
) const
virtual

Returns coordinate 'idim' of apex 'rank' of mesh 'imesh'

Reimplemented in MeshETurbo.

◆ getCoordinatesPerMesh() [1/2]

VectorVectorDouble AMesh::getCoordinatesPerMesh ( int  imesh) const

◆ getCoordinatesPerMesh() [2/2]

VectorDouble AMesh::getCoordinatesPerMesh ( int  imesh,
int  idim,
bool  flagClose = false 
) const

Returns the vector of coordinates for a mesh

◆ getDistances()

VectorDouble AMesh::getDistances ( int  iapex0,
const VectorInt japices = VectorInt() 
)

◆ getElements()

void AMesh::getElements ( MatrixRectangular apices,
MatrixInt meshes 
) const

Returns the list of apexes and meshes

Extract the elements of the meshing

Parameters
[out]apicesPointer on the array of Apices
[out]meshesPointer on the array of Meshes

◆ getEmbeddedCoordinatesPerApex()

VectorVectorDouble AMesh::getEmbeddedCoordinatesPerApex ( ) const

Returns the coordinates of the Mesh apices expressed in the embedded space The returned vector is organized by coordinate

Returns

◆ getEmbeddedCoordinatesPerMesh()

VectorVectorDouble AMesh::getEmbeddedCoordinatesPerMesh ( int  imesh = 0) const

Returns the array of coordinates of all apices of any mesh in embedded space Its dimensions are: ncorner * ndim

Parameters
imeshMesh rank
Returns

◆ getEmbeddedCoordinatesPerMeshInPlace()

void AMesh::getEmbeddedCoordinatesPerMeshInPlace ( int  imesh,
VectorVectorDouble vec 
) const

Fill the array of coordinates of all apices of a mesh in embedded space Storage [ndim, ncorner]

Parameters
imeshMesh rank
vecReturned array

◆ getEmbeddedCoorPerApex()

void AMesh::getEmbeddedCoorPerApex ( int  iapex,
VectorDouble coords 
) const
virtual

Fill the coordinates of an apex in embedded space

Parameters
iapexApex index
coordsArray of coordinates

Reimplemented in MeshSpherical, and MeshManifold.

◆ getEmbeddedCoorPerMesh()

void AMesh::getEmbeddedCoorPerMesh ( int  imesh,
int  ic,
VectorDouble coords 
) const
virtual

Fill the coordinates of a corner of a mesh in embedded space

Parameters
imeshMesh rank
icCorner index
coordsArray of coordinates

Reimplemented in MeshSpherical, and MeshManifold.

◆ getEmbeddedNDim()

virtual int AMesh::getEmbeddedNDim ( ) const
inlinevirtual

Reimplemented in MeshSpherical, and MeshManifold.

◆ getExtendMax()

double AMesh::getExtendMax ( int  idim) const
inline

Returns the maximum of the Bounding box for a given space dimension

◆ getExtendMin()

double AMesh::getExtendMin ( int  idim) const
inline

Returns the minimum of the Bounding box for a given space dimension

◆ getExtrema()

VectorDouble AMesh::getExtrema ( int  idim) const

Returns the Vector of Extrema of the Bounding Box

◆ getMeshByApexPair()

VectorInt AMesh::getMeshByApexPair ( int  apex1,
int  apex2 
) const

Returns the list of indices of Meshes sharing the same Apex

◆ getMeshSize()

virtual double AMesh::getMeshSize ( int  imesh) const
pure virtual

Returns the mesh size

Implemented in MeshSpherical, MeshETurbo, MeshEStandard, and MeshManifold.

◆ getMeshSizes()

VectorDouble AMesh::getMeshSizes ( ) const

◆ getMeshToDb()

virtual cs* AMesh::getMeshToDb ( const Db db,
bool  verbose = false 
) const
pure virtual

Returns the Sparse Matrix for projecting a Mesh to a Db

Implemented in MeshSpherical, MeshManifold, MeshETurbo, and MeshEStandard.

◆ getNApexPerMesh()

virtual int AMesh::getNApexPerMesh ( ) const
inlinevirtual

Interface for AMesh.

Returns the number of apex per mesh

◆ getNApices()

virtual int AMesh::getNApices ( ) const
pure virtual

Returns the number of apices

Implemented in MeshSpherical, MeshManifold, MeshETurbo, and MeshEStandard.

◆ getNDim()

int AMesh::getNDim ( ) const
inline

Returns the space dimension

◆ getNeighborhoodPerApex()

std::vector< VectorInt > AMesh::getNeighborhoodPerApex ( ) const

Returns the list of neighboring apices This is a complex structure which stands as a vector of vectors of integers

  • the first dimension is the number of apices
  • for each apex, the second vector gives the indices of the neighboring apices
    Returns

◆ getNeighborhoodPerMesh()

std::vector< VectorInt > AMesh::getNeighborhoodPerMesh ( ) const

TODO : replace by VectorVectorInt ?

Returns the list of neighboring meshes This is a complex structure which stands as a vector of vectors of integers

  • the first dimension is the number of apices
  • for each apex, the second vector gives the indices of the neighboring meshes
    Returns

◆ getNMeshes()

virtual int AMesh::getNMeshes ( ) const
pure virtual

Returns the number of meshes

Implemented in MeshSpherical, MeshManifold, MeshETurbo, and MeshEStandard.

◆ getVariety()

virtual int AMesh::getVariety ( ) const
inlinevirtual

Returns the space variety

Reimplemented in MeshSpherical, and MeshManifold.

◆ isCompatibleDb()

int AMesh::isCompatibleDb ( const Db db) const

Checks that the Db is compatible with the Meshing

Returns
1 if Db and Meshing are incompatible; 0 otherwise
Parameters
[in]dbDb structure

◆ operator=()

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

◆ printMesh()

void AMesh::printMesh ( int  imesh0) const

Print the list of meshes and apices

◆ printMeshes()

void AMesh::printMeshes ( int  level = 0,
int  nline_max = -1 
) const

◆ toString()

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

Interface to AStringable.

Reimplemented from AStringable.

Reimplemented in MeshSpherical, MeshManifold, MeshETurbo, and MeshEStandard.

Member Data Documentation

◆ _extendMax

VectorDouble AMesh::_extendMax
private

◆ _extendMin

VectorDouble AMesh::_extendMin
private

◆ _nDim

int AMesh::_nDim
private

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