Version: 9.12.0
DriverMED_W_SMESHDS_Mesh Class Reference

Write a mesh to a MED file. More...

#include <DriverMED_W_SMESHDS_Mesh.h>

Inheritance diagram for DriverMED_W_SMESHDS_Mesh:

Public Types

enum  Status {
  DRS_OK , DRS_EMPTY , DRS_WARN_RENUMBER , DRS_WARN_SKIP_ELEM ,
  DRS_WARN_DESCENDING , DRS_FAIL , DRS_TOO_LARGE_MESH
}
 

Public Member Functions

 DriverMED_W_SMESHDS_Mesh ()
 Constructor. More...
 
void SetFile (const std::string &theFileName, int theVersion=-1)
 Set a file name and a version. More...
 
void SetAutoDimension (bool toFindOutDimension)
 
void SetZTolerance (double tol)
 
void SetSaveNumbers (bool toSave)
 
void AddGroupOfNodes ()
 
void AddGroupOfEdges ()
 
void AddGroupOfFaces ()
 
void AddGroupOfVolumes ()
 
void AddGroupOf0DElems ()
 
void AddGroupOfBalls ()
 
void AddGroup (SMESHDS_GroupBase *theGroup)
 functions to prepare adding one mesh More...
 
void AddAllSubMeshes ()
 
void AddSubMesh (SMESHDS_SubMesh *theSubMesh, int theID)
 
void AddODOnVertices (bool toAdd)
 
Status Perform () override
 add one mesh More...
 
template<class LowLevelWriter >
Driver_Mesh::Status PerformInternal (LowLevelWriter myMed)
 Write my mesh. More...
 
void SetMesh (SMESHDS_Mesh *theMesh)
 
void SetMeshId (int theMeshId)
 
virtual void SetFile (const std::string &theFileName)
 
virtual void SetMeshName (const std::string &theMeshName)
 
virtual std::string GetMeshName () const
 
virtual void SetOption (const std::string &, const std::string &)
 
virtual SMESH_ComputeErrorPtr GetError ()
 Return a structure containing description of errors. More...
 

Static Public Member Functions

static std::string GetVersionString (int theMinor, int theNbDigits=2)
 MED version is either the latest available, or with an inferior minor, to ensure backward compatibility on writing med files. More...
 
static bool getNodesOfMissing0DOnVert (SMESHDS_Mesh *mesh, std::vector< const SMDS_MeshElement * > &nodes)
 Returns nodes on VERTEXes where 0D elements are absent. More...
 
template<typename IDTYPE >
static bool IsMeshTooLarge (const SMDS_Mesh *mesh, bool checkIDs)
 

Protected Member Functions

Status addMessage (const std::string &msg, const bool isFatal=false)
 Stores an error message. More...
 

Static Protected Member Functions

static std::string fixUTF8 (const std::string &s)
 Assure a string is UTF-8 valid by replacing invalid chars. More...
 

Protected Attributes

SMESHDS_MeshmyMesh
 
std::string myFile
 
std::string myMeshName
 
int myMeshId
 
std::vector< std::string > myErrorMessages
 
Status myStatus
 

Private Attributes

std::list< SMESHDS_GroupBase * > myGroups
 
bool myAllSubMeshes
 
std::vector< SMESHDS_SubMesh * > mySubMeshes
 
bool myDoGroupOfNodes
 
bool myDoGroupOfEdges
 
bool myDoGroupOfFaces
 
bool myDoGroupOfVolumes
 
bool myDoGroupOf0DElems
 
bool myDoGroupOfBalls
 
bool myAutoDimension
 
bool myAddODOnVertices
 
bool myDoAllInGroups
 
int myVersion
 
double myZTolerance
 
bool mySaveNumbers
 

Detailed Description

Write a mesh to a MED file.

Member Enumeration Documentation

◆ Status

enum Driver_Mesh::Status
inherited
Enumerator
DRS_OK 
DRS_EMPTY 
DRS_WARN_RENUMBER 
DRS_WARN_SKIP_ELEM 
DRS_WARN_DESCENDING 
DRS_FAIL 
DRS_TOO_LARGE_MESH 

Constructor & Destructor Documentation

◆ DriverMED_W_SMESHDS_Mesh()

DriverMED_W_SMESHDS_Mesh::DriverMED_W_SMESHDS_Mesh ( )

Constructor.

Member Function Documentation

◆ AddAllSubMeshes()

void DriverMED_W_SMESHDS_Mesh::AddAllSubMeshes ( )

References myAllSubMeshes.

◆ AddGroup()

void DriverMED_W_SMESHDS_Mesh::AddGroup ( SMESHDS_GroupBase theGroup)

functions to prepare adding one mesh

References myGroups.

Referenced by SMESH_Mesh::exportMEDCommmon(), and SMESH_Gen_i::Save().

◆ AddGroupOf0DElems()

void DriverMED_W_SMESHDS_Mesh::AddGroupOf0DElems ( )

◆ AddGroupOfBalls()

void DriverMED_W_SMESHDS_Mesh::AddGroupOfBalls ( )

◆ AddGroupOfEdges()

void DriverMED_W_SMESHDS_Mesh::AddGroupOfEdges ( )

◆ AddGroupOfFaces()

void DriverMED_W_SMESHDS_Mesh::AddGroupOfFaces ( )

◆ AddGroupOfNodes()

void DriverMED_W_SMESHDS_Mesh::AddGroupOfNodes ( )

◆ AddGroupOfVolumes()

void DriverMED_W_SMESHDS_Mesh::AddGroupOfVolumes ( )

◆ addMessage()

Driver_Mesh::Status Driver_Mesh::addMessage ( const std::string &  msg,
const bool  isFatal = false 
)
protectedinherited

◆ AddODOnVertices()

void DriverMED_W_SMESHDS_Mesh::AddODOnVertices ( bool  toAdd)

◆ AddSubMesh()

void DriverMED_W_SMESHDS_Mesh::AddSubMesh ( SMESHDS_SubMesh theSubMesh,
int  theID 
)

References mySubMeshes.

◆ fixUTF8()

std::string Driver_Mesh::fixUTF8 ( const std::string &  s)
staticprotectedinherited

Assure a string is UTF-8 valid by replacing invalid chars.

◆ GetError()

◆ GetMeshName()

std::string Driver_Mesh::GetMeshName ( ) const
virtualinherited

◆ getNodesOfMissing0DOnVert()

bool DriverMED_W_SMESHDS_Mesh::getNodesOfMissing0DOnVert ( SMESHDS_Mesh mesh,
std::vector< const SMDS_MeshElement * > &  nodes 
)
static

◆ GetVersionString()

string DriverMED_W_SMESHDS_Mesh::GetVersionString ( int  theMinor,
int  theNbDigits = 2 
)
static

MED version is either the latest available, or with an inferior minor, to ensure backward compatibility on writing med files.

Referenced by SMESH_Mesh_i::GetVersionString().

◆ IsMeshTooLarge()

template<typename IDTYPE >
static bool Driver_Mesh::IsMeshTooLarge ( const SMDS_Mesh mesh,
bool  checkIDs 
)
staticinherited

◆ Perform()

Driver_Mesh::Status DriverMED_W_SMESHDS_Mesh::Perform ( )
overridevirtual

add one mesh

Write my mesh to a file.

Implements Driver_Mesh.

Reimplemented in DriverMED_W_SMESHDS_Mesh_Mem.

References MED::CrWrapperW(), Driver_Mesh::myFile, and myVersion.

Referenced by SMESH_Mesh::exportMEDCommmon(), and SMESH_Gen_i::Save().

◆ PerformInternal()

template<class LowLevelWriter >
Driver_Mesh::Status DriverMED_W_SMESHDS_Mesh::PerformInternal ( LowLevelWriter  myMed)

Write my mesh.

References MED::aXGetCoord, MED::aXYGetCoord, MED::aXYZGetCoord, MED::aXZGetCoord, MED::aYGetCoord, MED::aYZGetCoord, MED::aZGetCoord, SMDS_Mesh::DownCast(), Driver_Mesh::DRS_OK, Driver_Mesh::DRS_TOO_LARGE_MESH, MED::eARETE, MED::eBALL, MED::eCART, Edge, MED::eFACE, MED::eFAUX, MED::eFULL_INTERLACE, MED::eHEXA20, MED::eHEXA27, MED::eHEXA8, SMDS_Mesh::elementEntityIterator(), SMDS_Mesh::elementGeomIterator(), SMDS_Mesh::elementsIterator(), MED::eMAILLE, MED::eNOD, MED::eNOEUD_ELEMENT, MED::eOCTA12, MED::ePENTA15, MED::ePENTA18, MED::ePENTA6, MED::ePOINT1, MED::ePOLYEDRE, MED::ePOLYGON2, MED::ePOLYGONE, MED::ePYRA13, MED::ePYRA5, MED::eQUAD4, MED::eQUAD8, MED::eQUAD9, MED::eSEG2, MED::eSEG3, MED::eSTRUCT_ELEMENT, MED::eTETRA10, MED::eTETRA4, MED::eTRIA3, MED::eTRIA6, MED::eTRIA7, MED::eVRAI, Face, SMDS_MeshElement::GetID(), SMDS_Mesh::GetMeshInfo(), MED::GetNbNodes(), SMDS_MeshNode::GetNode(), SMDS_MeshElement::GetNode(), getNodesOfMissing0DOnVert(), SMDS_MeshElement::IsPoly(), DriverMED_Family::MakeFamilies(), SMDS_Mesh::MaxElementID(), myAddODOnVertices, myAllSubMeshes, myAutoDimension, myDoAllInGroups, myDoGroupOf0DElems, myDoGroupOfBalls, myDoGroupOfEdges, myDoGroupOfFaces, myDoGroupOfNodes, myDoGroupOfVolumes, myGroups, Driver_SMESHDS_Mesh::myMesh, Driver_Mesh::myMeshId, Driver_Mesh::myMeshName, mySaveNumbers, mySubMeshes, myZTolerance, SMDS_Mesh::Nb0DElements(), SMDS_MeshInfo::Nb0DElements(), SMDS_Mesh::NbBalls(), SMDS_MeshInfo::NbBalls(), SMDS_MeshInfo::NbBiQuadPrisms(), SMDS_MeshInfo::NbBiQuadQuadrangles(), SMDS_MeshInfo::NbBiQuadTriangles(), SMDS_Mesh::NbEdges(), SMDS_MeshInfo::NbEdges(), SMDS_MeshVolume::NbFaceNodes(), SMDS_Mesh::NbFaces(), SMDS_MeshVolume::NbFaces(), SMDS_MeshElement::NbFaces(), SMDS_MeshInfo::NbHexas(), SMDS_MeshInfo::NbHexPrisms(), SMDS_Mesh::NbNodes(), SMDS_MeshElement::NbNodes(), SMDS_MeshInfo::NbPolygons(), SMDS_MeshInfo::NbPolyhedrons(), SMDS_MeshInfo::NbPrisms(), SMDS_MeshInfo::NbPyramids(), SMDS_MeshInfo::NbQuadPrisms(), SMDS_MeshInfo::NbQuadrangles(), SMDS_MeshInfo::NbTetras(), SMDS_MeshInfo::NbTriangles(), SMDS_MeshInfo::NbTriQuadHexas(), SMDS_Mesh::NbVolumes(), NIG_0DELEM_FAMILY, NIG_BALL_FAMILY, NIG_EDGES_FAMILY, NIG_FACES_FAMILY, NIG_VOLS_FAMILY, SMDS_Mesh::nodesIterator(), SMDS_MeshElement::nodesIterator(), ORDER_LINEAR, ORDER_QUADRATIC, REST_0DELEM_FAMILY, REST_BALL_FAMILY, REST_EDGES_FAMILY, REST_FACES_FAMILY, REST_NODES_FAMILY, REST_VOLUMES_FAMILY, SMESHDS_Mesh::ShapeToMesh(), SMDSAbs_0DElement, SMDSAbs_Ball, SMDSAbs_Edge, SMDSAbs_Face, SMDSAbs_NbElementTypes, SMDSAbs_Node, SMDSAbs_Volume, SMDSEntity_Polygon, SMDSEntity_Quad_Polygon, SMDSGeom_POLYHEDRA, SMESHDS_Mesh::SubMeshes(), SMESHDS_Mesh::SubMeshIndices(), SMDS_MeshNode::X(), SMDS_MeshNode::Y(), and SMDS_MeshNode::Z().

◆ SetAutoDimension()

void DriverMED_W_SMESHDS_Mesh::SetAutoDimension ( bool  toFindOutDimension)

◆ SetFile() [1/2]

◆ SetFile() [2/2]

void DriverMED_W_SMESHDS_Mesh::SetFile ( const std::string &  theFileName,
int  theVersion = -1 
)

Set a file name and a version.

Parameters
[in]theFileName- output file name
[in]theVersion- desired MED file version == major * 10 + minor

References myVersion, and Driver_Mesh::SetFile().

Referenced by SMESH_Mesh::ExportMED(), and SMESH_Gen_i::Save().

◆ SetMesh()

◆ SetMeshId()

◆ SetMeshName()

void Driver_Mesh::SetMeshName ( const std::string &  theMeshName)
virtualinherited

◆ SetOption()

virtual void Driver_Mesh::SetOption ( const std::string &  ,
const std::string &   
)
virtualinherited

◆ SetSaveNumbers()

void DriverMED_W_SMESHDS_Mesh::SetSaveNumbers ( bool  toSave)

◆ SetZTolerance()

void DriverMED_W_SMESHDS_Mesh::SetZTolerance ( double  tol)

Field Documentation

◆ myAddODOnVertices

bool DriverMED_W_SMESHDS_Mesh::myAddODOnVertices
private

Referenced by PerformInternal().

◆ myAllSubMeshes

bool DriverMED_W_SMESHDS_Mesh::myAllSubMeshes
private

Referenced by AddAllSubMeshes(), and PerformInternal().

◆ myAutoDimension

bool DriverMED_W_SMESHDS_Mesh::myAutoDimension
private

Referenced by PerformInternal().

◆ myDoAllInGroups

bool DriverMED_W_SMESHDS_Mesh::myDoAllInGroups
private

Referenced by PerformInternal().

◆ myDoGroupOf0DElems

bool DriverMED_W_SMESHDS_Mesh::myDoGroupOf0DElems
private

◆ myDoGroupOfBalls

bool DriverMED_W_SMESHDS_Mesh::myDoGroupOfBalls
private

Referenced by AddGroupOfBalls(), and PerformInternal().

◆ myDoGroupOfEdges

bool DriverMED_W_SMESHDS_Mesh::myDoGroupOfEdges
private

Referenced by AddGroupOfEdges(), and PerformInternal().

◆ myDoGroupOfFaces

bool DriverMED_W_SMESHDS_Mesh::myDoGroupOfFaces
private

Referenced by AddGroupOfFaces(), and PerformInternal().

◆ myDoGroupOfNodes

bool DriverMED_W_SMESHDS_Mesh::myDoGroupOfNodes
private

Referenced by AddGroupOfNodes(), and PerformInternal().

◆ myDoGroupOfVolumes

bool DriverMED_W_SMESHDS_Mesh::myDoGroupOfVolumes
private

◆ myErrorMessages

std::vector< std::string > Driver_Mesh::myErrorMessages
protectedinherited

◆ myFile

◆ myGroups

std::list<SMESHDS_GroupBase*> DriverMED_W_SMESHDS_Mesh::myGroups
private

Referenced by AddGroup(), and PerformInternal().

◆ myMesh

◆ myMeshId

int Driver_Mesh::myMeshId
protectedinherited

◆ myMeshName

std::string Driver_Mesh::myMeshName
protectedinherited

◆ mySaveNumbers

bool DriverMED_W_SMESHDS_Mesh::mySaveNumbers
private

Referenced by PerformInternal().

◆ myStatus

Status Driver_Mesh::myStatus
protectedinherited

◆ mySubMeshes

std::vector<SMESHDS_SubMesh*> DriverMED_W_SMESHDS_Mesh::mySubMeshes
private

Referenced by AddSubMesh(), and PerformInternal().

◆ myVersion

int DriverMED_W_SMESHDS_Mesh::myVersion
private

Referenced by Perform(), and SetFile().

◆ myZTolerance

double DriverMED_W_SMESHDS_Mesh::myZTolerance
private

Referenced by PerformInternal().