/*!
* \brief Driver reading a mesh from the CGNS file. The mesh to read is selected by
- * an index (counted form 0) set via SetMeshId()
+ * an index (counted from 0) set via SetMeshId()
*/
class MESHDriverCGNS_EXPORT DriverCGNS_Read : public Driver_SMESHDS_Mesh
{
// 0 ------------------ - DON't USE 0!!!
// 1 . * .
// 2 . *
- // 3 . *
- // 4 * . .
+ // 3 . . *
+ // 4 * .
// 5 *
// 6 * .
- // 7 . *
+ // 7 .
// 8 * .
- // 9 . *
+ // 9 .
// 10 *
// 11
// 12 *
// 13 *
// 14
// 15 *
- // 16
- // 17
+ // 16 *
+ // 17 *
// 18 *
// 19 *
// 20 *
myShift.resize(SMDSAbs_NbElementTypes, 0);
myShift[ SMDSAbs_Face ] = +15;// 3->18, 4->19, etc.
- myShift[ SMDSAbs_Edge ] = +5; // 2->7, 4->9
+ myShift[ SMDSAbs_Edge ] = +14;// 2->16, 3->17
myShift[ SMDSAbs_0DElement ] = +2; // 1->3
myShift[ SMDSAbs_Ball ] = +1; // 1->2
myNb[ index( SMDSAbs_Ball,1 )] = & myNbBalls;
myNb[ index( SMDSAbs_Edge,2 )] = & myNbEdges;
- myNb[ index( SMDSAbs_Edge,4 )] = & myNbQuadEdges;
+ myNb[ index( SMDSAbs_Edge,3 )] = & myNbQuadEdges;
myNb[ index( SMDSAbs_Face,3 )] = & myNbTriangles;
myNb[ index( SMDSAbs_Face,4 )] = & myNbQuadrangles;
//================================================================================
void SMESH_Mesh::ExportCGNS(const char * file,
- const SMESHDS_Mesh* meshDS)
+ const SMESHDS_Mesh* meshDS,
+ const char * meshName)
{
int res = Driver_Mesh::DRS_FAIL;
#ifdef WITH_CGNS
myWriter.SetFile( file );
myWriter.SetMesh( const_cast<SMESHDS_Mesh*>( meshDS ));
myWriter.SetMeshName( SMESH_Comment("Mesh_") << meshDS->GetPersistentId());
+ if ( meshName && meshName[0] )
+ myWriter.SetMeshName( meshName );
res = myWriter.Perform();
#endif
if ( res != Driver_Mesh::DRS_OK )
const bool isascii,
const SMESHDS_Mesh* meshPart = 0) throw(SALOME_Exception);
void ExportCGNS(const char * file,
- const SMESHDS_Mesh* mesh);
+ const SMESHDS_Mesh* mesh,
+ const char * meshName = 0);
void ExportGMF(const char * file,
const SMESHDS_Mesh* mesh,
bool withRequiredGroups = true );
const bool isMED = ( theCommandID == SMESHOp::OpExportMED || theCommandID == SMESHOp::OpPopupExportMED );
const bool isUNV = ( theCommandID == SMESHOp::OpExportUNV || theCommandID == SMESHOp::OpPopupExportUNV );
const bool isSTL = ( theCommandID == SMESHOp::OpExportSTL || theCommandID == SMESHOp::OpPopupExportSTL );
- #ifdef WITH_CGNS
+#ifdef WITH_CGNS
const bool isCGNS= ( theCommandID == SMESHOp::OpExportCGNS || theCommandID == SMESHOp::OpPopupExportCGNS );
- #else
+#else
const bool isCGNS= false;
- #endif
+#endif
const bool isSAUV= ( theCommandID == SMESHOp::OpExportSAUV || theCommandID == SMESHOp::OpPopupExportSAUV );
const bool isGMF = ( theCommandID == SMESHOp::OpExportGMF || theCommandID == SMESHOp::OpPopupExportGMF );
- // actually, the following condition can't be met (added for insurance)
- if( selected.Extent() == 0 ||
- ( selected.Extent() > 1 && !isMED && !isSTL ))
+ const bool multiMeshSupported = ( isMED || isCGNS ); // file can hold several meshes
+ if ( selected.Extent() == 0 || ( selected.Extent() > 1 && !multiMeshSupported ))
return;
// get mesh object from selection and check duplication of their names
#ifdef WITH_CGNS
createPopupItem( SMESHOp::OpPopupExportCGNS, OB, mesh_group, multiple_non_empty, anId );
#endif
- createPopupItem( SMESHOp::OpPopupExportSAUV, OB, mesh_group, multiple_non_empty, anId );
- createPopupItem( SMESHOp::OpPopupExportGMF, OB, mesh_group, multiple_non_empty, anId );
- createPopupItem( SMESHOp::OpPopupExportDAT, OB, mesh_group, multiple_non_empty, anId );
+ createPopupItem( SMESHOp::OpPopupExportSAUV, OB, mesh_group, only_one_non_empty, anId );
+ createPopupItem( SMESHOp::OpPopupExportGMF, OB, mesh_group, only_one_non_empty, anId );
+ createPopupItem( SMESHOp::OpPopupExportDAT, OB, mesh_group, only_one_non_empty, anId );
createPopupItem( SMESHOp::OpDelete, OB, mesh_part + " " + hyp_alg );
createPopupItem( SMESHOp::OpDeleteGroup, OB, group );
popupMgr()->insert( separator(), -1, 0 );
groupData.push_back
( make_pair( TIndexedShape( gog->GetID(),gog->GetShape()), gog->GetType()));
}
- // set new shape to mesh -> DS of submeshes and geom groups is deleted
+ // set new shape to mesh -> DS of sub-meshes and geom groups is deleted
+ _impl->ShapeToMesh( TopoDS_Shape() ); // IPAL52730
_impl->ShapeToMesh( newShape );
-
+
// reassign hypotheses
TShapeHypList::iterator indS_hyps = assignedHyps.begin();
for ( ; indS_hyps != assignedHyps.end(); ++indS_hyps )
continue;
for ( hypIt = hyps.begin(); hypIt != hyps.end(); ++hypIt )
_impl->AddHypothesis( geom._shape, (*hypIt)->GetID());
- // care of submeshes
+ // care of sub-meshes
SMESH_subMesh* newSubmesh = _impl->GetSubMesh( geom._shape );
if ( newID != oldID ) {
_mapSubMesh [ newID ] = newSubmesh;
PrepareForWriting(file,overwrite);
+ std::string meshName("");
+ SALOMEDS::Study_var study = _gen_i->GetCurrentStudy();
+ SALOMEDS::SObject_wrap so = _gen_i->ObjectToSObject( study, meshPart );
+ if ( !so->_is_nil() )
+ {
+ CORBA::String_var name = so->GetName();
+ meshName = name.in();
+ }
SMESH_MeshPartDS partDS( meshPart );
- _impl->ExportCGNS(file, &partDS);
+ _impl->ExportCGNS(file, &partDS, meshName.c_str() );
TPythonDump() << SMESH::SMESH_Mesh_var(_this()) << ".ExportCGNS( "
<< meshPart<< ", r'" << file << "', " << overwrite << ")";