mirror of
https://git.salome-platform.org/gitpub/modules/smesh.git
synced 2025-04-08 18:07:27 +05:00
0020511: EDF 1101 SMESH : Add CGNS to Mesh Format Supported
This commit is contained in:
parent
e17197e86b
commit
111c7a0cd2
@ -48,6 +48,8 @@
|
|||||||
#include "DriverMED_R_SMESHDS_Mesh.h"
|
#include "DriverMED_R_SMESHDS_Mesh.h"
|
||||||
#include "DriverUNV_R_SMDS_Mesh.h"
|
#include "DriverUNV_R_SMDS_Mesh.h"
|
||||||
#include "DriverSTL_R_SMDS_Mesh.h"
|
#include "DriverSTL_R_SMDS_Mesh.h"
|
||||||
|
#include "DriverCGNS_Read.hxx"
|
||||||
|
#include "DriverCGNS_Write.hxx"
|
||||||
|
|
||||||
#undef _Precision_HeaderFile
|
#undef _Precision_HeaderFile
|
||||||
#include <BRepBndLib.hxx>
|
#include <BRepBndLib.hxx>
|
||||||
@ -441,6 +443,31 @@ int SMESH_Mesh::STLToMesh(const char* theFileName)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//================================================================================
|
||||||
|
/*!
|
||||||
|
* \brief Reads the given mesh from the CGNS file
|
||||||
|
* \param theFileName - name of the file
|
||||||
|
* \retval int - Driver_Mesh::Status
|
||||||
|
*/
|
||||||
|
//================================================================================
|
||||||
|
|
||||||
|
int SMESH_Mesh::CGNSToMesh(const char* theFileName,
|
||||||
|
const int theMeshIndex,
|
||||||
|
std::string& theMeshName)
|
||||||
|
{
|
||||||
|
DriverCGNS_Read myReader;
|
||||||
|
myReader.SetMesh(_myMeshDS);
|
||||||
|
myReader.SetFile(theFileName);
|
||||||
|
myReader.SetMeshId(theMeshIndex);
|
||||||
|
int res = myReader.Perform();
|
||||||
|
theMeshName = myReader.GetMeshName();
|
||||||
|
|
||||||
|
// create groups
|
||||||
|
SynchronizeGroups();
|
||||||
|
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
/*!
|
/*!
|
||||||
*
|
*
|
||||||
@ -1220,6 +1247,23 @@ void SMESH_Mesh::ExportSTL(const char * file,
|
|||||||
myWriter.Perform();
|
myWriter.Perform();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//================================================================================
|
||||||
|
/*!
|
||||||
|
* \brief Export the mesh to the CGNS file
|
||||||
|
*/
|
||||||
|
//================================================================================
|
||||||
|
|
||||||
|
void SMESH_Mesh::ExportCGNS(const char * file,
|
||||||
|
const SMESHDS_Mesh* meshDS)
|
||||||
|
{
|
||||||
|
DriverCGNS_Write myWriter;
|
||||||
|
myWriter.SetFile( file );
|
||||||
|
myWriter.SetMesh( const_cast<SMESHDS_Mesh*>( meshDS ));
|
||||||
|
myWriter.SetMeshName( SMESH_Comment("Mesh_") << meshDS->GetPersistentId());
|
||||||
|
if ( myWriter.Perform() != Driver_Mesh::DRS_OK )
|
||||||
|
throw SALOME_Exception("Export failed");
|
||||||
|
}
|
||||||
|
|
||||||
//================================================================================
|
//================================================================================
|
||||||
/*!
|
/*!
|
||||||
* \brief Return number of nodes in the mesh
|
* \brief Return number of nodes in the mesh
|
||||||
@ -1432,6 +1476,32 @@ SMESH_Group* SMESH_Mesh::AddGroup (const SMDSAbs_ElementType theType,
|
|||||||
return aGroup;
|
return aGroup;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//================================================================================
|
||||||
|
/*!
|
||||||
|
* \brief Creates SMESH_Groups for not wrapped SMESHDS_Groups
|
||||||
|
* \retval bool - true if new SMESH_Groups have been created
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
//================================================================================
|
||||||
|
|
||||||
|
bool SMESH_Mesh::SynchronizeGroups()
|
||||||
|
{
|
||||||
|
int nbGroups = _mapGroup.size();
|
||||||
|
const set<SMESHDS_GroupBase*>& groups = _myMeshDS->GetGroups();
|
||||||
|
set<SMESHDS_GroupBase*>::const_iterator gIt = groups.begin();
|
||||||
|
for ( ; gIt != groups.end(); ++gIt )
|
||||||
|
{
|
||||||
|
SMESHDS_GroupBase* groupDS = (SMESHDS_GroupBase*) *gIt;
|
||||||
|
_groupId = groupDS->GetID();
|
||||||
|
if ( !_mapGroup.count( _groupId ))
|
||||||
|
_mapGroup[_groupId] = new SMESH_Group( groupDS );
|
||||||
|
}
|
||||||
|
if ( !_mapGroup.empty() )
|
||||||
|
_groupId = _mapGroup.rbegin()->first + 1;
|
||||||
|
|
||||||
|
return nbGroups < _mapGroup.size();
|
||||||
|
}
|
||||||
|
|
||||||
//================================================================================
|
//================================================================================
|
||||||
/*!
|
/*!
|
||||||
* \brief Return iterator on all existing groups
|
* \brief Return iterator on all existing groups
|
||||||
|
@ -108,14 +108,17 @@ public:
|
|||||||
*/
|
*/
|
||||||
void ClearSubMesh(const int theShapeId);
|
void ClearSubMesh(const int theShapeId);
|
||||||
|
|
||||||
int UNVToMesh(const char* theFileName);
|
|
||||||
/*!
|
/*!
|
||||||
* consult DriverMED_R_SMESHDS_Mesh::ReadStatus for returned value
|
* consult DriverMED_R_SMESHDS_Mesh::ReadStatus for returned value
|
||||||
*/
|
*/
|
||||||
|
int UNVToMesh(const char* theFileName);
|
||||||
|
|
||||||
int MEDToMesh(const char* theFileName, const char* theMeshName);
|
int MEDToMesh(const char* theFileName, const char* theMeshName);
|
||||||
|
|
||||||
int STLToMesh(const char* theFileName);
|
int STLToMesh(const char* theFileName);
|
||||||
|
|
||||||
|
int CGNSToMesh(const char* theFileName, const int theMeshIndex, std::string& theMeshName);
|
||||||
|
|
||||||
SMESH_Hypothesis::Hypothesis_Status
|
SMESH_Hypothesis::Hypothesis_Status
|
||||||
AddHypothesis(const TopoDS_Shape & aSubShape, int anHypId)
|
AddHypothesis(const TopoDS_Shape & aSubShape, int anHypId)
|
||||||
throw(SALOME_Exception);
|
throw(SALOME_Exception);
|
||||||
@ -231,6 +234,8 @@ public:
|
|||||||
void ExportSTL(const char * file,
|
void ExportSTL(const char * file,
|
||||||
const bool isascii,
|
const bool isascii,
|
||||||
const SMESHDS_Mesh* meshPart = 0) throw(SALOME_Exception);
|
const SMESHDS_Mesh* meshPart = 0) throw(SALOME_Exception);
|
||||||
|
void ExportCGNS(const char * file,
|
||||||
|
const SMESHDS_Mesh* mesh);
|
||||||
|
|
||||||
int NbNodes() const throw(SALOME_Exception);
|
int NbNodes() const throw(SALOME_Exception);
|
||||||
|
|
||||||
@ -286,6 +291,8 @@ public:
|
|||||||
};
|
};
|
||||||
void SetRemoveGroupCallUp( TRmGroupCallUp * upCaller );
|
void SetRemoveGroupCallUp( TRmGroupCallUp * upCaller );
|
||||||
|
|
||||||
|
bool SynchronizeGroups();
|
||||||
|
|
||||||
|
|
||||||
SMDSAbs_ElementType GetElementType( const int id, const bool iselem );
|
SMDSAbs_ElementType GetElementType( const int id, const bool iselem );
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user