gstlearn  1.0.0
CCC
MeshETurbo Class Reference

#include <MeshETurbo.hpp>

Inheritance diagram for MeshETurbo:
AMesh AStringable ASerializable

Public Member Functions

 MeshETurbo (int mode=1)
 
 MeshETurbo (const VectorInt &nx, const VectorDouble &dx=VectorDouble(), const VectorDouble &x0=VectorDouble(), const VectorDouble &rotmat=VectorDouble(), bool flag_polarized=false, bool verbose=false, int mode=1)
 
 MeshETurbo (const DbGrid *dbgrid, bool flag_polarized=false, bool verbose=false, int mode=1)
 
 MeshETurbo (const MeshETurbo &m)
 
MeshETurbooperator= (const MeshETurbo &r)
 
virtual ~MeshETurbo ()
 
virtual String toString (const AStringFormat *strfmt=nullptr) const override
 Interface to AStringable. More...
 
int getNApices () const override
 Interface to AMesh. More...
 
int getNMeshes () const override
 
int getApex (int imesh, int rank) const override
 
double getCoor (int imesh, int rank, int idim) const override
 
void getCoordinatesInPlace (int imesh, int rank, VectorDouble &coords) const
 
double getApexCoor (int i, int idim) const override
 
void getApexCoordinatesInPlace (int i, VectorDouble &coords) const override
 
double getMeshSize (int imesh) const override
 
cs * getMeshToDb (const Db *db, int rankZ=-1, bool verbose=false) const override
 
void setPolarized (bool flag)
 
int initFromExtend (const VectorDouble &extendmin, const VectorDouble &extendmax, const VectorDouble &cellsize, const VectorDouble &rotmat=VectorDouble(), bool flag_polarized=false, bool verbose=false)
 
int initFromGrid (const VectorInt &nx, const VectorDouble &dx=VectorDouble(), const VectorDouble &x0=VectorDouble(), const VectorDouble &rotmat=VectorDouble(), const VectorDouble &sel=VectorDouble(), bool flag_polarized=false, bool verbose=false)
 
int initFromCova (const CovAniso &cova, const Db *field, double ratio, int nbExt=0, bool useSel=true, bool flagNoStatRot=false, bool verbose=false)
 
const GridgetGrid () const
 
const IndirectiongetGridIndirect () const
 
const IndirectiongetMeshIndirect () 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 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 MeshETurbocreate (const VectorInt &nx, const VectorDouble &dx=VectorDouble(), const VectorDouble &x0=VectorDouble(), const VectorDouble &rotmat=VectorDouble(), bool flag_polarized=false, bool verbose=false)
 
static MeshETurbocreateFromNF (const String &neutralFilename, bool verbose=true)
 
static MeshETurbocreateFromGrid (const DbGrid *dbgrid, bool flag_polarized=false, bool verbose=false, int mode=1)
 
static MeshETurbocreateFromGridInfo (const Grid *grid, bool flag_polarized=false, bool verbose=false, int mode=1)
 
static MeshETurbocreateFromCova (const CovAniso &cova, const Db *field, double ratio, int nbExt=0, bool useSel=true, bool flagNoStatRot=false, 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
 
- 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

int _defineGrid (const VectorDouble &cellsize)
 
void _setNumberElementPerCell ()
 
int _getPolarized (VectorInt indg) const
 
int _addWeights (int icas, const VectorInt &indg0, const VectorDouble &coor, VectorInt &indices, VectorDouble &lambda, bool verbose=false) const
 
void _deallocate ()
 
void _getGridFromMesh (int imesh, int *node, int *icas) const
 
void _buildMaskInMeshing (const VectorDouble &sel)
 
int _nmeshInCompleteGrid () const
 
bool _addElementToCS (cs *ATriplet, int iech, const VectorDouble &coor, const VectorInt &indg0, bool verbose) const
 

Private Attributes

Grid _grid
 
int _nPerCell
 
bool _isPolarized
 
Indirection _meshIndirect
 
Indirection _gridIndirect
 

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 as a Turbo based on a Regular Grid It actually avoids storing all the meshing information and produces quicker methods

Constructor & Destructor Documentation

◆ MeshETurbo() [1/4]

MeshETurbo::MeshETurbo ( int  mode = 1)

◆ MeshETurbo() [2/4]

MeshETurbo::MeshETurbo ( const VectorInt nx,
const VectorDouble dx = VectorDouble(),
const VectorDouble x0 = VectorDouble(),
const VectorDouble rotmat = VectorDouble(),
bool  flag_polarized = false,
bool  verbose = false,
int  mode = 1 
)

◆ MeshETurbo() [3/4]

MeshETurbo::MeshETurbo ( const DbGrid dbgrid,
bool  flag_polarized = false,
bool  verbose = false,
int  mode = 1 
)

◆ MeshETurbo() [4/4]

MeshETurbo::MeshETurbo ( const MeshETurbo m)

◆ ~MeshETurbo()

MeshETurbo::~MeshETurbo ( )
virtual

Member Function Documentation

◆ _addElementToCS()

bool MeshETurbo::_addElementToCS ( cs *  ATriplet,
int  iech,
const VectorDouble coor,
const VectorInt indg0,
bool  verbose 
) const
private

◆ _addWeights()

int MeshETurbo::_addWeights ( int  icas,
const VectorInt indg0,
const VectorDouble coor,
VectorInt indices,
VectorDouble lambda,
bool  verbose = false 
) const
private

Return the weights assigned to the corners

Parameters
icasCorner indication
indg0Indices of the starting grid node
coorCoordinates of the targte point
indicesGrid indices of the target (in active ranks)
lambdaWeights
verboseVerbose flag
Returns
Remarks
The function returns 1 if:
- the grid node corresponding to a mesh apex is outside the grid
- the grid node corresponding to a mesh apex is not active

◆ _buildMaskInMeshing()

void MeshETurbo::_buildMaskInMeshing ( const VectorDouble sel)
private

◆ _deallocate()

void MeshETurbo::_deallocate ( )
private

◆ _defineGrid()

int MeshETurbo::_defineGrid ( const VectorDouble cellsize)
private

Define the internal grid

Parameters
[in]cellsizeArray giving the cell size (see details)

◆ _deserialize()

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

Interface for ASerializable.

Reimplemented from AMesh.

◆ _getGridFromMesh()

void MeshETurbo::_getGridFromMesh ( int  imesh,
int *  node,
int *  icas 
) const
private

Returns the (starting) grid node, given the absolute rank of the mesh

Parameters
imeshAbsolute Rank of the mesh
nodeStarting grid node
icasSorting used for reviewing grid meshes (takes polarization into account)

◆ _getNFName()

String MeshETurbo::_getNFName ( ) const
inlineoverrideprotectedvirtual

Reimplemented from AMesh.

◆ _getPolarized()

int MeshETurbo::_getPolarized ( VectorInt  indg) const
private

◆ _nmeshInCompleteGrid()

int MeshETurbo::_nmeshInCompleteGrid ( ) const
private

Returns the total number of possible meshes built using the whole grid (not accounting for possible mask on triangles)

Returns

◆ _serialize()

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

Reimplemented from AMesh.

◆ _setNumberElementPerCell()

void MeshETurbo::_setNumberElementPerCell ( )
private

◆ create()

MeshETurbo * MeshETurbo::create ( const VectorInt nx,
const VectorDouble dx = VectorDouble(),
const VectorDouble x0 = VectorDouble(),
const VectorDouble rotmat = VectorDouble(),
bool  flag_polarized = false,
bool  verbose = false 
)
static

◆ createFromCova()

MeshETurbo * MeshETurbo::createFromCova ( const CovAniso cova,
const Db field,
double  ratio,
int  nbExt = 0,
bool  useSel = true,
bool  flagNoStatRot = false,
bool  verbose = false 
)
static

◆ createFromGrid()

MeshETurbo * MeshETurbo::createFromGrid ( const DbGrid dbgrid,
bool  flag_polarized = false,
bool  verbose = false,
int  mode = 1 
)
static

◆ createFromGridInfo()

MeshETurbo * MeshETurbo::createFromGridInfo ( const Grid grid,
bool  flag_polarized = false,
bool  verbose = false,
int  mode = 1 
)
static

◆ createFromNF()

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

Create a MeshETurbo by loading the contents of a Neutral File

Parameters
neutralFilenameName of the Neutral File (MeshEStandard format)
verboseVerbose

◆ getApex()

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

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

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

Implements AMesh.

◆ getApexCoor()

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

Returns coordinate 'idim' of apex 'i'

Implements AMesh.

◆ getApexCoordinatesInPlace()

void MeshETurbo::getApexCoordinatesInPlace ( int  i,
VectorDouble coords 
) const
overridevirtual

Returns coordinates of apex 'i'

Reimplemented from AMesh.

◆ getCoor()

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

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

Implements AMesh.

◆ getCoordinatesInPlace()

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

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

Reimplemented from AMesh.

◆ getGrid()

const Grid& MeshETurbo::getGrid ( ) const
inline

◆ getGridIndirect()

const Indirection& MeshETurbo::getGridIndirect ( ) const
inline

◆ getMeshIndirect()

const Indirection& MeshETurbo::getMeshIndirect ( ) const
inline

◆ getMeshSize()

double MeshETurbo::getMeshSize ( int  imesh) const
overridevirtual

Returns the mesh size

Implements AMesh.

◆ getMeshToDb()

cs * MeshETurbo::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 MeshETurbo::getNApices ( ) const
overridevirtual

Interface to AMesh.

Returns the total number of apices of the whole grid (not accounting for possible mask on meshes)

Returns

Implements AMesh.

◆ getNMeshes()

int MeshETurbo::getNMeshes ( ) const
overridevirtual

Actual number of (active) meshes

Returns

Implements AMesh.

◆ initFromCova()

int MeshETurbo::initFromCova ( const CovAniso cova,
const Db field,
double  ratio,
int  nbExt = 0,
bool  useSel = true,
bool  flagNoStatRot = false,
bool  verbose = false 
)

◆ initFromExtend()

int MeshETurbo::initFromExtend ( const VectorDouble extendmin,
const VectorDouble extendmax,
const VectorDouble cellsize,
const VectorDouble rotmat = VectorDouble(),
bool  flag_polarized = false,
bool  verbose = false 
)

Create the meshing

Parameters
[in]extendminMinimum of the dilated rotated bounding box
[in]extendmaxMinimum of the dilated rotated bounding box
[in]cellsizeArray giving the cell size (see details)
[in]rotmatRotation matrix (optional)
[in]flag_polarizedSwitching ON/OFF the polarization
[in]verboseVerbose flag

◆ initFromGrid()

int MeshETurbo::initFromGrid ( const VectorInt nx,
const VectorDouble dx = VectorDouble(),
const VectorDouble x0 = VectorDouble(),
const VectorDouble rotmat = VectorDouble(),
const VectorDouble sel = VectorDouble(),
bool  flag_polarized = false,
bool  verbose = false 
)

◆ operator=()

MeshETurbo & MeshETurbo::operator= ( const MeshETurbo r)

◆ setPolarized()

void MeshETurbo::setPolarized ( bool  flag)
inline

◆ toString()

String MeshETurbo::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

◆ _grid

Grid MeshETurbo::_grid
private

◆ _gridIndirect

Indirection MeshETurbo::_gridIndirect
private

◆ _isPolarized

bool MeshETurbo::_isPolarized
private

◆ _meshIndirect

Indirection MeshETurbo::_meshIndirect
private

◆ _nPerCell

int MeshETurbo::_nPerCell
private

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