Version: 8.3.0
SMESH_PreMeshInfo Class Reference

Class loading and holding information of a mesh object (mesh, group, submesh) not yet loaded from HDF file of study. More...

#include <SMESH_PreMeshInfo.hxx>

Inheritance diagram for SMESH_PreMeshInfo:

Public Member Functions

void FullLoadFromFile () const
 Reads all data and remove all SMESH_PreMeshInfo fields from objects. More...
 
void ForgetAllData () const
 Remove all SMESH_PreMeshInfo fields from objects w/o data loading. More...
 
void ForgetOrLoad () const
 Calls either FullLoadFromFile() or ForgetAllData() depending on preferences. More...
 
SMESH::array_of_ElementTypeGetTypes () const
 Method of SMESH_IDSource interface. More...
 
SMESH::long_arrayGetMeshInfo () const
 Method of SMESH_IDSource interface returning nb elements by element type. More...
 
bool IsMeshInfoCorrect () const
 Returns false if GetMeshInfo() returns incorrect information that may happen if mesh data is not yet fully loaded from the file of study. More...
 
 ~SMESH_PreMeshInfo ()
 Release temporary files. More...
 
void Clear ()
 
int NbElements (SMDSAbs_ElementType type=SMDSAbs_All) const
 
int NbElements (SMDSAbs_EntityType type) const
 
int NbElements (SMDSAbs_GeometryType type) const
 
int NbEntities (SMDSAbs_EntityType type) const
 
int NbElementsOfGeom (SMDSAbs_GeometryType geom) const
 
int NbNodes () const
 
int Nb0DElements () const
 
int NbBalls () const
 
int NbEdges (SMDSAbs_ElementOrder order=ORDER_ANY) const
 
int NbFaces (SMDSAbs_ElementOrder order=ORDER_ANY) const
 
int NbTriangles (SMDSAbs_ElementOrder order=ORDER_ANY) const
 
int NbQuadrangles (SMDSAbs_ElementOrder order=ORDER_ANY) const
 
int NbBiQuadTriangles () const
 
int NbBiQuadQuadrangles () const
 
int NbPolygons (SMDSAbs_ElementOrder order=ORDER_ANY) const
 
int NbVolumes (SMDSAbs_ElementOrder order=ORDER_ANY) const
 
int NbTetras (SMDSAbs_ElementOrder order=ORDER_ANY) const
 
int NbHexas (SMDSAbs_ElementOrder order=ORDER_ANY) const
 
int NbPyramids (SMDSAbs_ElementOrder order=ORDER_ANY) const
 
int NbPrisms (SMDSAbs_ElementOrder order=ORDER_ANY) const
 
int NbHexPrisms (SMDSAbs_ElementOrder order=ORDER_ANY) const
 
int NbTriQuadHexas () const
 
int NbPolyhedrons () const
 

Static Public Member Functions

static void LoadFromFile (SMESH_Mesh_i *mesh, const int meshID, const std::string &medFile, const std::string &hdfFile, const bool toRemoveFiles)
 fills SMESH_PreMeshInfo field of all objects of mesh More...
 
static void SaveToFile (SMESH_Mesh_i *mesh, const int meshID, HDFfile *hdfFile)
 Saves SMESH_PreMeshInfo to the study file. More...
 
static void ForgetAllData (SMESH_Mesh_i *mesh)
 remove all SMESH_PreMeshInfo fields from mesh and its child objects w/o data loading More...
 
static void RemoveStudyFiles_TMP_METHOD (SALOMEDS::SComponent_ptr smeshComp)
 TEMPORARY method to remove study files on closing study; RIGHT WAY: study files are remove automatically when meshes are destroyed. More...
 

Protected Member Functions

void addWithPoly (const SMDS_MeshElement *el)
 
void setNb (const SMDSAbs_EntityType geomType, const int nb)
 

Private Member Functions

 SMESH_PreMeshInfo (SMESH_Mesh_i *mesh, const int meshID, const std::string &medFile, const std::string &hdfFile)
 Constructor callable by SMESH_PreMeshInfo only. More...
 
SMESH_PreMeshInfonewInstance ()
 
bool readPreInfoFromHDF ()
 Tries to read all SMESH_PreMeshInfo from a HDF file. More...
 
void hdf2meshInfo (const std::string &dataSetName, HDFgroup *infoHdfGroup)
 Reads meshInfo from a HDF file. More...
 
bool readMeshInfo ()
 Reads mesh info of mesh from the med file. More...
 
void readGroupInfo ()
 Reads info of groups from the med file. More...
 
void readSubMeshInfo ()
 Reads info of sub-meshes from hdf file of old study. More...
 
SMDSAbs_EntityType getElemType (const TopAbs_ShapeEnum shapeType, const int nbElemsInSubMesh, bool &isKoType) const
 Return type of element for sub-mesh on a shape of given type. More...
 
void readSubMeshes (DriverMED_R_SMESHDS_Mesh *reader) const
 Reads full data of sub-meshes. More...
 

Private Attributes

std::string _medFileName
 
std::string _hdfFileName
 
bool _toRemoveFiles
 
int _meshID
 
SMESH_Mesh_i_mesh
 
bool _isInfoOk
 
int _elemCounter
 

Detailed Description

Class loading and holding information of a mesh object (mesh, group, submesh) not yet loaded from HDF file of study.

Usage scenario:

Constructor & Destructor Documentation

SMESH_PreMeshInfo::~SMESH_PreMeshInfo ( )

Release temporary files.

References _hdfFileName, _medFileName, _mesh, and _toRemoveFiles.

SMESH_PreMeshInfo::SMESH_PreMeshInfo ( SMESH_Mesh_i mesh,
const int  meshID,
const std::string &  medFile,
const std::string &  hdfFile 
)
private

Constructor callable by SMESH_PreMeshInfo only.

Referenced by LoadFromFile(), and newInstance().

Member Function Documentation

void SMESH_PreMeshInfo::ForgetAllData ( SMESH_Mesh_i mesh)
static

remove all SMESH_PreMeshInfo fields from mesh and its child objects w/o data loading

References SMESH_Mesh_i::changePreMeshInfo(), and ForgetAllData().

Referenced by ForgetAllData().

void SMESH_PreMeshInfo::ForgetAllData ( ) const
void SMESH_PreMeshInfo::FullLoadFromFile ( ) const

Reads all data and remove all SMESH_PreMeshInfo fields from objects.

References _medFileName, _mesh, _meshID, SMESH_Mesh_i::changePreMeshInfo(), SMESH::doNothing(), ForgetAllData(), DriverMED_R_SMESHDS_Mesh::GetGroup(), SMESHDS_Mesh::GetGroups(), SMESH_Mesh_i::GetImpl(), SMDS_Mesh::Modified(), MYDEBUGOUT, DriverMED_R_SMESHDS_Mesh::Perform(), readSubMeshes(), Driver_Mesh::SetFile(), Driver_SMESHDS_Mesh::SetMesh(), Driver_Mesh::SetMeshId(), SMESH_CATCH, SMESH_TRY, and SMESH_subMesh::SUBMESH_LOADED.

Referenced by SMESH_Group_i::Add(), SMESH_Group_i::AddByPredicate(), SMESH_Group_i::AddFrom(), SMESH_Mesh_i::BaryCenter(), SMESH_Group_i::Clear(), SMESH_GroupBase_i::Contains(), SMESH_Mesh_i::ElemNbEdges(), SMESH_Mesh_i::ElemNbFaces(), SMESH_Mesh_i::FindElementByNodes(), ForgetOrLoad(), SMESH_Mesh_i::GetBallDiameter(), SMESH_Mesh_i::GetElementPosition(), SMESH_subMesh_i::GetElementsId(), SMESH_Mesh_i::GetElementsId(), SMESH_Mesh_i::GetElemFaceNodes(), SMESH_Mesh_i::GetElemNbNodes(), SMESH_Mesh_i::GetElemNode(), SMESH_Mesh_i::GetElemNodes(), SMESH_Mesh_i::GetFaceNormal(), SMESH_GroupBase_i::GetID(), SMESH_GroupBase_i::GetListOfID(), SMESH_GroupOnFilter_i::GetListOfID(), SMESH_Mesh_i::GetMeshEditor(), SMESH_Mesh_i::GetMeshEditPreviewer(), SMESH_Mesh_i::GetMeshPtr(), SMESH_GroupBase_i::GetNodeIDs(), SMESH_Mesh_i::GetNodeInverseElements(), SMESH_Mesh_i::GetNodePosition(), SMESH_Mesh_i::GetNodesId(), SMESH_Mesh_i::GetNodeXYZ(), SMESH_GroupBase_i::GetNumberOfNodes(), SMESH_Mesh_i::GetShapeID(), SMESH_Mesh_i::GetShapeIDForElem(), SMESH_Mesh_i::IsMediumNode(), SMESH_Mesh_i::IsMediumNodeOfAnyElem(), SMESH_Mesh_i::IsPoly(), SMESH_Mesh_i::IsQuadratic(), SMESH_Mesh_i::Load(), LoadFromFile(), SMESH_GroupOnFilter_i::OnBaseObjModified(), SMESH_Group_i::Remove(), and SMESH_Group_i::RemoveByPredicate().

SMDSAbs_EntityType SMESH_PreMeshInfo::getElemType ( const TopAbs_ShapeEnum  shapeType,
const int  nbElemsInSubMesh,
bool isKoType 
) const
private
SMESH::long_array * SMESH_PreMeshInfo::GetMeshInfo ( ) const
void SMESH_PreMeshInfo::hdf2meshInfo ( const std::string &  dataSetName,
HDFgroup *  infoHdfGroup 
)
private

Reads meshInfo from a HDF file.

References SMDSEntity_Last, and SMDSEntity_Node.

Referenced by readPreInfoFromHDF().

bool SMESH_PreMeshInfo::IsMeshInfoCorrect ( ) const

Returns false if GetMeshInfo() returns incorrect information that may happen if mesh data is not yet fully loaded from the file of study.

References _isInfoOk.

Referenced by SMESH_GroupBase_i::IsMeshInfoCorrect(), SMESH_subMesh_i::IsMeshInfoCorrect(), and SMESH_Mesh_i::IsMeshInfoCorrect().

void SMESH_PreMeshInfo::LoadFromFile ( SMESH_Mesh_i mesh,
const int  meshID,
const std::string &  medFile,
const std::string &  hdfFile,
const bool  toRemoveFiles 
)
static
int SMDS_MeshInfo::Nb0DElements ( ) const
inherited
int SMDS_MeshInfo::NbBalls ( ) const
inherited
int SMDS_MeshInfo::NbBiQuadQuadrangles ( ) const
inherited
int SMDS_MeshInfo::NbBiQuadTriangles ( ) const
inherited
int SMDS_MeshInfo::NbElements ( SMDSAbs_ElementType  type = SMDSAbs_All) const
inherited

References SMDS_MeshInfo::index(), SMDS_MeshInfo::myNb, SMDS_MeshInfo::myNb0DElements, SMDS_MeshInfo::myNbBalls, SMDS_MeshInfo::myNbBiQuadQuadrangles, SMDS_MeshInfo::myNbBiQuadTriangles, SMDS_MeshInfo::myNbEdges, SMDS_MeshInfo::myNbHexas, SMDS_MeshInfo::myNbHexPrism, SMDS_MeshInfo::myNbNodes, SMDS_MeshInfo::myNbPolygons, SMDS_MeshInfo::myNbPolyhedrons, SMDS_MeshInfo::myNbPrisms, SMDS_MeshInfo::myNbPyramids, SMDS_MeshInfo::myNbQuadEdges, SMDS_MeshInfo::myNbQuadHexas, SMDS_MeshInfo::myNbQuadPolygons, SMDS_MeshInfo::myNbQuadPrisms, SMDS_MeshInfo::myNbQuadPyramids, SMDS_MeshInfo::myNbQuadQuadrangles, SMDS_MeshInfo::myNbQuadrangles, SMDS_MeshInfo::myNbQuadTetras, SMDS_MeshInfo::myNbQuadTriangles, SMDS_MeshInfo::myNbTetras, SMDS_MeshInfo::myNbTriangles, SMDS_MeshInfo::myNbTriQuadHexas, SMDSAbs_0DElement, SMDSAbs_All, SMDSAbs_Ball, SMDSAbs_Edge, SMDSAbs_Face, SMDSAbs_Node, and SMDSAbs_Volume.

Referenced by SMESH_Gen_i::CopyMesh(), SMESH_MeshEditor::DoubleElements(), SMESHDS_GroupOnFilter::GetElements(), MeshEditor_I::getElementsAround(), SMESH::Controls::NumericalFunctor::GetHistogram(), SMESH_GroupOnFilter_i::GetListOfID(), SMESH_GroupBase_i::GetNbElementsByType(), SMESH_subMesh_i::GetNbElementsByType(), SMESH_Mesh_i::GetNbElementsByType(), SMESHGUI_PreVisualObj::GetNbEntities(), SMESH_subMesh_i::GetNumberOfElements(), SMESH_MeshEditor_i::GetPreviewData(), SMESH_ElementSearcherImpl::getTolerance(), SMESHDS_GroupBase::IsEmpty(), SMESH::Controls::ConnectedElements::IsSatisfy(), SMESH_Mesh_i::NbElements(), SMDS_Mesh::NbElements(), DriverCGNS_Write::Perform(), DriverCGNS_Read::Perform(), DriverGMF_Read::Perform(), SMESH::Controls::ElementsOnSurface::process(), SMESH_Gen_i::Save(), SaveToFile(), DriverMED_W_Field::Set(), and SMESH_GroupBase_i::Size().

int SMDS_MeshInfo::NbElements ( SMDSAbs_EntityType  type) const
inherited
int SMDS_MeshInfo::NbElements ( SMDSAbs_GeometryType  type) const
inherited
int SMDS_MeshInfo::NbEntities ( SMDSAbs_EntityType  type) const
inherited

References SMDS_MeshInfo::myNb0DElements, SMDS_MeshInfo::myNbBalls, SMDS_MeshInfo::myNbBiQuadQuadrangles, SMDS_MeshInfo::myNbBiQuadTriangles, SMDS_MeshInfo::myNbEdges, SMDS_MeshInfo::myNbHexas, SMDS_MeshInfo::myNbHexPrism, SMDS_MeshInfo::myNbNodes, SMDS_MeshInfo::myNbPolygons, SMDS_MeshInfo::myNbPolyhedrons, SMDS_MeshInfo::myNbPrisms, SMDS_MeshInfo::myNbPyramids, SMDS_MeshInfo::myNbQuadEdges, SMDS_MeshInfo::myNbQuadHexas, SMDS_MeshInfo::myNbQuadPolygons, SMDS_MeshInfo::myNbQuadPrisms, SMDS_MeshInfo::myNbQuadPyramids, SMDS_MeshInfo::myNbQuadQuadrangles, SMDS_MeshInfo::myNbQuadrangles, SMDS_MeshInfo::myNbQuadTetras, SMDS_MeshInfo::myNbQuadTriangles, SMDS_MeshInfo::myNbTetras, SMDS_MeshInfo::myNbTriangles, SMDS_MeshInfo::myNbTriQuadHexas, SMDSEntity_0D, SMDSEntity_Ball, SMDSEntity_BiQuad_Quadrangle, SMDSEntity_BiQuad_Triangle, SMDSEntity_Edge, SMDSEntity_Hexa, SMDSEntity_Hexagonal_Prism, SMDSEntity_Last, SMDSEntity_Node, SMDSEntity_Penta, SMDSEntity_Polygon, SMDSEntity_Polyhedra, SMDSEntity_Pyramid, SMDSEntity_Quad_Edge, SMDSEntity_Quad_Hexa, SMDSEntity_Quad_Penta, SMDSEntity_Quad_Polygon, SMDSEntity_Quad_Polyhedra, SMDSEntity_Quad_Pyramid, SMDSEntity_Quad_Quadrangle, SMDSEntity_Quad_Tetra, SMDSEntity_Quad_Triangle, SMDSEntity_Quadrangle, SMDSEntity_Tetra, SMDSEntity_Triangle, and SMDSEntity_TriQuad_Hexa.

Referenced by StdMeshers_Import_1D::Evaluate(), StdMeshers_Import_1D2D::Evaluate(), getElemType(), GetMeshInfo(), SMESH_Mesh_i::GetMeshInfo(), SMESH_ProxyMesh::NbFaces(), and readGroupInfo().

int SMDS_MeshInfo::NbPolyhedrons ( ) const
inherited
int SMDS_MeshInfo::NbTriQuadHexas ( ) const
inherited
SMESH_PreMeshInfo* SMESH_PreMeshInfo::newInstance ( )
private
void SMESH_PreMeshInfo::readGroupInfo ( )
private
bool SMESH_PreMeshInfo::readMeshInfo ( )
private

Reads mesh info of mesh from the med file.

References _isInfoOk, _medFileName, _meshID, MED::CrWrapper(), SMDS_MeshInfo::setNb(), and SMDSEntity_Node.

Referenced by LoadFromFile().

bool SMESH_PreMeshInfo::readPreInfoFromHDF ( )
private

Tries to read all SMESH_PreMeshInfo from a HDF file.

Return values
bool- true if succeeded

This method is symmetrical to SaveToFile()

References _hdfFileName, SMESH_Mesh_i::_mapGroups, SMESH_Mesh_i::_mapSubMeshIor, _mesh, _meshID, SMESH_Mesh_i::changePreMeshInfo(), hdf2meshInfo(), and newInstance().

Referenced by LoadFromFile().

void SMESH_PreMeshInfo::RemoveStudyFiles_TMP_METHOD ( SALOMEDS::SComponent_ptr  smeshComp)
static

TEMPORARY method to remove study files on closing study; RIGHT WAY: study files are remove automatically when meshes are destroyed.

References SMESH_Gen_i::SObjectToObject().

Referenced by SMESH_Gen_i::Close().

Field Documentation

int SMESH_PreMeshInfo::_elemCounter
private

Referenced by readGroupInfo(), and readSubMeshInfo().

std::string SMESH_PreMeshInfo::_hdfFileName
private
bool SMESH_PreMeshInfo::_isInfoOk
private
std::string SMESH_PreMeshInfo::_medFileName
private
bool SMESH_PreMeshInfo::_toRemoveFiles
private

Referenced by LoadFromFile(), and ~SMESH_PreMeshInfo().