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

+  SMESH::SMESH_Mesh_ptr CreateMeshesFromGMF( const char*             theFileName,
+                                             SMESH::ComputeError_out theError)
This commit is contained in:
eap 2012-09-24 11:31:06 +00:00
parent 1cf0520025
commit bbc0ed28d2
2 changed files with 42 additions and 2 deletions

View File

@ -1222,6 +1222,41 @@ SMESH::mesh_array* SMESH_Gen_i::CreateMeshesFromCGNS( const char* theFileName,
return aResult._retn();
}
//================================================================================
/*!
* \brief Create a mesh and import data from a GMF file
*/
//================================================================================
SMESH::SMESH_Mesh_ptr
SMESH_Gen_i::CreateMeshesFromGMF( const char* theFileName,
SMESH::ComputeError_out theError)
throw ( SALOME::SALOME_Exception )
{
Unexpect aCatch(SALOME_SalomeException);
SMESH::SMESH_Mesh_var aMesh = createMesh();
string aFileName = basename( theFileName );
// publish mesh in the study
if ( CanPublishInStudy( aMesh ) ) {
SALOMEDS::StudyBuilder_var aStudyBuilder = myCurrentStudy->NewBuilder();
aStudyBuilder->NewCommand(); // There is a transaction
SALOMEDS::SObject_var aSO = PublishInStudy
( myCurrentStudy, SALOMEDS::SObject::_nil(), aMesh.in(), aFileName.c_str() );
aStudyBuilder->CommitCommand();
if ( !aSO->_is_nil() ) {
// Update Python script
TPythonDump() << aSO << " = " << this << ".CreateMeshesFromGMF(r'" << theFileName << "')";
}
}
SMESH_Mesh_i* aServant = dynamic_cast<SMESH_Mesh_i*>( GetServant( aMesh ).in() );
ASSERT( aServant );
theError = aServant->ImportGMFFile( theFileName );
aServant->GetImpl().GetMeshDS()->Modified();
return aMesh._retn();
}
//=============================================================================
/*!
* SMESH_Gen_i::IsReadyToCompute

View File

@ -238,7 +238,7 @@ public:
SMESH::SMESH_Mesh_ptr CreateEmptyMesh()
throw ( SALOME::SALOME_Exception );
// Create mesh(es) and import data from UNV fileter
// Create a mesh and import data from an UNV file
SMESH::SMESH_Mesh_ptr CreateMeshesFromUNV( const char* theFileName )
throw ( SALOME::SALOME_Exception );
@ -252,7 +252,7 @@ public:
SMESH::DriverMED_ReadStatus& theStatus )
throw ( SALOME::SALOME_Exception );
// Create mesh(es) and import data from STL file
// Create a mesh and import data from a STL file
SMESH::SMESH_Mesh_ptr CreateMeshesFromSTL( const char* theFileName )
throw ( SALOME::SALOME_Exception );
@ -261,6 +261,11 @@ public:
SMESH::DriverMED_ReadStatus& theStatus )
throw ( SALOME::SALOME_Exception );
// Create a mesh and import data from a GMF file
SMESH::SMESH_Mesh_ptr CreateMeshesFromGMF( const char* theFileName,
SMESH::ComputeError_out theError)
throw ( SALOME::SALOME_Exception );
// Copy a part of mesh
SMESH::SMESH_Mesh_ptr CopyMesh(SMESH::SMESH_IDSource_ptr meshPart,
const char* meshName,