CreateGroupServants();
int major, minor, release;
- if( !MED::getMEDVersion( theFileName, major, minor, release ) )
- major = minor = release = -1;
+ major = minor = release = 0;
+ MED::GetMEDVersion(theFileName, major, minor, release);
_medFileInfo = new SMESH::MedFileInfo();
_medFileInfo->fileName = theFileName;
_medFileInfo->fileSize = 0;
return ConvertDriverMEDReadStatus(status);
}
-//================================================================================
-/*!
- * \brief Return string representation of a MED file version comprising nbDigits
- */
-//================================================================================
-
-char* SMESH_Mesh_i::GetVersionString(SMESH::MED_VERSION version, CORBA::Short nbDigits)
-{
- string ver = DriverMED_W_SMESHDS_Mesh::GetVersionString(MED::EVersion(version),
- nbDigits);
- return CORBA::string_dup( ver.c_str() );
-}
-
//=============================================================================
/*!
* ImportUNVFile
//================================================================================
/*!
- * \brief Export to med file
+ * \brief Export to MED file
*/
//================================================================================
-void SMESH_Mesh_i::ExportToMEDX (const char* file,
- CORBA::Boolean auto_groups,
- SMESH::MED_VERSION theVersion,
- CORBA::Boolean overwrite,
- CORBA::Boolean autoDimension)
+void SMESH_Mesh_i::ExportMED(const char* file,
+ CORBA::Boolean auto_groups,
+ CORBA::Boolean overwrite,
+ CORBA::Boolean autoDimension)
throw(SALOME::SALOME_Exception)
{
+ //MESSAGE("SMESH::MED_VERSION:"<< theVersion);
SMESH_TRY;
if ( _preMeshInfo )
_preMeshInfo->FullLoadFromFile();
string aMeshName = prepareMeshNameAndGroups(file, overwrite);
- _impl->ExportMED( file, aMeshName.c_str(), auto_groups, theVersion, 0, autoDimension );
+ _impl->ExportMED( file, aMeshName.c_str(), auto_groups, 0, autoDimension );
- TPythonDump() << SMESH::SMESH_Mesh_var(_this()) << ".ExportToMEDX( r'"
+ TPythonDump() << SMESH::SMESH_Mesh_var(_this()) << ".ExportMED( r'"
<< file << "', " << auto_groups << ", "
- << theVersion << ", " << overwrite << ", "
+ << overwrite << ", "
<< autoDimension << " )";
SMESH_CATCH( SMESH::throwCorbaException );
}
-//================================================================================
-/*!
- * \brief Export a mesh to a med file
- */
-//================================================================================
-
-void SMESH_Mesh_i::ExportToMED (const char* file,
- CORBA::Boolean auto_groups,
- SMESH::MED_VERSION theVersion)
- throw(SALOME::SALOME_Exception)
-{
- ExportToMEDX(file,auto_groups,theVersion,true);
-}
-
-//================================================================================
-/*!
- * \brief Export a mesh to a med file
- */
-//================================================================================
-
-void SMESH_Mesh_i::ExportMED (const char* file,
- CORBA::Boolean auto_groups)
- throw(SALOME::SALOME_Exception)
-{
- ExportToMEDX(file,auto_groups,SMESH::MED_V2_2,true);
-}
-
//================================================================================
/*!
* \brief Export a mesh to a SAUV file
void SMESH_Mesh_i::ExportPartToMED(SMESH::SMESH_IDSource_ptr meshPart,
const char* file,
CORBA::Boolean auto_groups,
- SMESH::MED_VERSION version,
CORBA::Boolean overwrite,
CORBA::Boolean autoDimension,
const GEOM::ListOfFields& fields,
{
aMeshName = prepareMeshNameAndGroups(file, overwrite);
_impl->ExportMED( file, aMeshName.c_str(), auto_groups,
- version, 0, autoDimension, /*addODOnVertices=*/have0dField);
+ 0, autoDimension, /*addODOnVertices=*/have0dField);
meshDS = _impl->GetMeshDS();
}
else
SMESH_MeshPartDS* partDS = new SMESH_MeshPartDS( meshPart );
_impl->ExportMED( file, aMeshName.c_str(), auto_groups,
- version, partDS, autoDimension, /*addODOnVertices=*/have0dField);
+ partDS, autoDimension, /*addODOnVertices=*/have0dField);
meshDS = tmpDSDeleter._obj = partDS;
}
}
TPythonDump() << _this() << ".ExportPartToMED( "
<< meshPart << ", r'" << file << "', "
- << auto_groups << ", " << version << ", " << overwrite << ", "
+ << auto_groups << ", " << overwrite << ", "
<< autoDimension << ", " << goList
<< ", '" << ( geomAssocFields ? geomAssocFields : "" ) << "'" << " )";
void SMESH_Mesh_i::ExportCGNS(::SMESH::SMESH_IDSource_ptr meshPart,
const char* file,
- CORBA::Boolean overwrite)
+ CORBA::Boolean overwrite,
+ CORBA::Boolean groupElemsByType)
throw (SALOME::SALOME_Exception)
{
#ifdef WITH_CGNS
CORBA::String_var name = so->GetName();
meshName = name.in();
}
+ SMESH_TRY;
+
SMESH_MeshPartDS partDS( meshPart );
- _impl->ExportCGNS(file, &partDS, meshName.c_str() );
+ _impl->ExportCGNS(file, &partDS, meshName.c_str(), groupElemsByType );
+
+ SMESH_CATCH( SMESH::throwCorbaException );
TPythonDump() << SMESH::SMESH_Mesh_var(_this()) << ".ExportCGNS( "
<< meshPart<< ", r'" << file << "', " << overwrite << ")";
SMESH::SMESH_Mesh_var mesh = meshPart->GetMesh();
SMESH_Mesh_i* mesh_i = SMESH::DownCast<SMESH_Mesh_i*>( mesh );
+ mesh_i->Load();
_meshDS = mesh_i->GetImpl().GetMeshDS();
SetPersistentId( _meshDS->GetPersistentId() );
myInfo = tmpInfo;
}
// -------------------------------------------------------------------------------------
+const SMDS_MeshElement * SMESH_MeshPartDS::FindElement(int IDelem) const
+{
+ if ( _meshDS ) return _meshDS->FindElement( IDelem );
+
+ TElemID elem( IDelem );
+ for ( int iType = SMDSAbs_Edge; iType < SMDSAbs_NbElementTypes; ++iType )
+ if ( !_elements[ iType ].empty() )
+ {
+ TIDSortedElemSet::const_iterator it = _elements[ iType ].find( &elem );
+ if ( it != _elements[ iType ].end() )
+ return *it;
+ }
+ return 0;
+}
+// -------------------------------------------------------------------------------------
SMDS_ElemIteratorPtr SMESH_MeshPartDS::elementGeomIterator(SMDSAbs_GeometryType geomType) const
{
if ( _meshDS ) return _meshDS->elementGeomIterator( geomType );