021382: EDF 1985 SMESH: Read/write of .mesh files (GMF format)

+  SMESH_ComputeErrorPtr GMFToMesh(const char* theFileName);
+  void ExportGMF(const char * file, const SMESHDS_Mesh* mesh);
This commit is contained in:
eap 2012-09-24 11:20:01 +00:00
parent cc048fe72d
commit b59ca5c972
2 changed files with 51 additions and 10 deletions

View File

@ -40,14 +40,15 @@
#include "utilities.h"
#include "DriverMED_W_SMESHDS_Mesh.h"
#include "DriverDAT_W_SMDS_Mesh.h"
#include "DriverUNV_W_SMDS_Mesh.h"
#include "DriverSTL_W_SMDS_Mesh.h"
#include "DriverGMF_Read.hxx"
#include "DriverGMF_Write.hxx"
#include "DriverMED_R_SMESHDS_Mesh.h"
#include "DriverUNV_R_SMDS_Mesh.h"
#include "DriverMED_W_SMESHDS_Mesh.h"
#include "DriverSTL_R_SMDS_Mesh.h"
#include "DriverSTL_W_SMDS_Mesh.h"
#include "DriverUNV_R_SMDS_Mesh.h"
#include "DriverUNV_W_SMDS_Mesh.h"
#ifdef WITH_CGNS
#include "DriverCGNS_Read.hxx"
#include "DriverCGNS_Write.hxx"
@ -538,6 +539,26 @@ int SMESH_Mesh::CGNSToMesh(const char* theFileName,
return res;
}
//================================================================================
/*!
* \brief Fill its data by reading a GMF file
*/
//================================================================================
SMESH_ComputeErrorPtr SMESH_Mesh::GMFToMesh(const char* theFileName)
{
DriverGMF_Read myReader;
myReader.SetMesh(_myMeshDS);
myReader.SetFile(theFileName);
myReader.Perform();
//theMeshName = myReader.GetMeshName();
// create groups
SynchronizeGroups();
return myReader.GetError();
}
//=============================================================================
/*!
*
@ -1391,6 +1412,21 @@ void SMESH_Mesh::ExportCGNS(const char * file,
throw SALOME_Exception("Export failed");
}
//================================================================================
/*!
* \brief Export the mesh to a GMF file
*/
//================================================================================
void SMESH_Mesh::ExportGMF(const char * file,
const SMESHDS_Mesh* meshDS)
{
DriverGMF_Write myWriter;
myWriter.SetFile( file );
myWriter.SetMesh( const_cast<SMESHDS_Mesh*>( meshDS ));
myWriter.Perform();
}
//================================================================================
/*!
* \brief Return number of nodes in the mesh

View File

@ -29,12 +29,12 @@
#include "SMESH_SMESH.hxx"
#include "SMESH_Hypothesis.hxx"
#include "SMESH_Controls.hxx"
#include "SMESHDS_Mesh.hxx"
#include "SMESHDS_Command.hxx"
#include "SMDSAbs_ElementType.hxx"
#include "SMESHDS_Command.hxx"
#include "SMESHDS_Mesh.hxx"
#include "SMESH_ComputeError.hxx"
#include "SMESH_Controls.hxx"
#include "SMESH_Hypothesis.hxx"
#include "Utils_SALOME_Exception.hxx"
@ -44,6 +44,7 @@
#include <map>
#include <list>
#ifdef WNT
#pragma warning(disable:4251) // Warning DLL Interface ...
#pragma warning(disable:4290) // Warning Exception ...
@ -121,6 +122,8 @@ public:
int CGNSToMesh(const char* theFileName, const int theMeshIndex, std::string& theMeshName);
SMESH_ComputeErrorPtr GMFToMesh(const char* theFileName);
SMESH_Hypothesis::Hypothesis_Status
AddHypothesis(const TopoDS_Shape & aSubShape, int anHypId)
throw(SALOME_Exception);
@ -240,6 +243,8 @@ public:
const SMESHDS_Mesh* meshPart = 0) throw(SALOME_Exception);
void ExportCGNS(const char * file,
const SMESHDS_Mesh* mesh);
void ExportGMF(const char * file,
const SMESHDS_Mesh* mesh);
void ExportSAUV(const char *file,
const char* theMeshName = NULL,
bool theAutoGroups = true) throw(SALOME_Exception);