-// Copyright (C) 2007-2016 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2019 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
// Reading groups (sub-meshes are out of scope of MED import functionality)
std::list<TNameAndType> aGroupNames = myReader.GetGroupNamesAndTypes();
- int anId;
std::list<TNameAndType>::iterator name_type = aGroupNames.begin();
for ( ; name_type != aGroupNames.end(); name_type++ )
{
- SMESH_Group* aGroup = AddGroup( name_type->second, name_type->first.c_str(), anId );
+ SMESH_Group* aGroup = AddGroup( name_type->second, name_type->first.c_str() );
if ( aGroup ) {
SMESHDS_Group* aGroupDS = dynamic_cast<SMESHDS_Group*>( aGroup->GetGroupDS() );
if ( aGroupDS ) {
if ( !GetMeshDS()->IsUsedHypothesis( hyp ))
return;
- if (_callUp && hyp)
- _callUp->HypothesisModified( hyp->GetID() );
-
SMESH_Algo *algo;
const SMESH_HypoFilter* compatibleHypoKind;
std::list <const SMESHDS_Hypothesis * > usedHyps;
}
HasModificationsToDiscard(); // to reset _isModified flag if mesh becomes empty
GetMeshDS()->Modified();
+
+ if (_callUp && hyp)
+ _callUp->HypothesisModified( hyp->GetID() );
}
//=============================================================================
* The major version (x, where version is x.y.z) cannot be changed.
* \param [in] meshPart - mesh data to export
* \param [in] theAutoDimension - if \c true, a space dimension of a MED mesh can be either
- * - 1D if all mesh nodes lie on OX coordinate axis, or
- * - 2D if all mesh nodes lie on XOY coordinate plane, or
- * - 3D in the rest cases.
- * If \a theAutoDimension is \c false, the space dimension is always 3.
+ * - 1D if all mesh nodes lie on OX coordinate axis, or
+ * - 2D if all mesh nodes lie on XOY coordinate plane, or
+ * - 3D in the rest cases.
+ * If \a theAutoDimension is \c false, the space dimension is always 3.
* \param [in] theAddODOnVertices - to create 0D elements on all vertices
* \param [in] theAllElemsToGroup - to make every element to belong to any group (PAL23413)
+ * \param [in] ZTolerance - tolerance in Z direction. If Z coordinate of a node is close to zero
+ * within a given tolerance, the coordinate is set to zero.
+ * If \a ZTolerance is negative, the node coordinates are kept as is.
* \return int - mesh index in the file
*/
//================================================================================
-void SMESH_Mesh::ExportMED(const char * file,
- const char* theMeshName,
+void SMESH_Mesh::ExportMED(const char * file,
+ const char* theMeshName,
bool theAutoGroups,
- int theMinor,
+ int theVersion,
const SMESHDS_Mesh* meshPart,
bool theAutoDimension,
bool theAddODOnVertices,
+ double theZTolerance,
bool theAllElemsToGroup)
- throw(SALOME_Exception)
+throw(SALOME_Exception)
{
- //MESSAGE("MED_VERSION:"<< theVersion);
+ MESSAGE("MED_VERSION:"<< theVersion);
SMESH_TRY;
DriverMED_W_SMESHDS_Mesh myWriter;
- myWriter.SetFile ( file , theMinor);
+ myWriter.SetFile ( file , theVersion);
myWriter.SetMesh ( meshPart ? (SMESHDS_Mesh*) meshPart : _myMeshDS );
myWriter.SetAutoDimension( theAutoDimension );
myWriter.AddODOnVertices ( theAddODOnVertices );
- if ( !theMeshName )
+ myWriter.SetZTolerance ( theZTolerance );
+ if ( !theMeshName )
myWriter.SetMeshId ( _id );
else {
myWriter.SetMeshId ( -1 );
system(cmd.c_str());
ExportMED(medfilename.c_str(), theMeshName, theAutoGroups, /*minor=*/-1,
/*meshPart=*/NULL, /*theAutoDimension=*/false, /*theAddODOnVertices=*/false,
- /*theAllElemsToGroup=*/true ); // theAllElemsToGroup is for PAL0023413
+ /*zTol=*/-1, /*theAllElemsToGroup=*/true ); // theAllElemsToGroup is for PAL0023413
#ifdef WIN32
cmd = "%PYTHONBIN% ";
#else
SMESH_Group* SMESH_Mesh::AddGroup (const SMDSAbs_ElementType theType,
const char* theName,
- int& theId,
+ const int theId,
const TopoDS_Shape& theShape,
const SMESH_PredicatePtr& thePredicate)
{
- if (_mapGroup.count(_groupId))
+ if ( _mapGroup.count( theId ))
return NULL;
- theId = _groupId;
- SMESH_Group* aGroup = new SMESH_Group (theId, this, theType, theName, theShape, thePredicate);
+ int id = ( theId < 0 ) ? _groupId : theId;
+ SMESH_Group* aGroup = new SMESH_Group ( id, this, theType, theName, theShape, thePredicate );
GetMeshDS()->AddGroup( aGroup->GetGroupDS() );
- _mapGroup[_groupId++] = aGroup;
+ _mapGroup[ id ] = aGroup;
+ _groupId = 1 + _mapGroup.rbegin()->first;
return aGroup;
}
SMESH_Group* SMESH_Mesh::AddGroup (SMESHDS_GroupBase* groupDS) throw(SALOME_Exception)
{
- if ( !groupDS )
+ if ( !groupDS )
throw SALOME_Exception(LOCALIZED ("SMESH_Mesh::AddGroup(): NULL SMESHDS_GroupBase"));
std::map <int, SMESH_Group*>::iterator i_g = _mapGroup.find( groupDS->GetID() );
/*!
* \brief Creates SMESH_Groups for not wrapped SMESHDS_Groups
* \retval bool - true if new SMESH_Groups have been created
- *
+ *
*/
//================================================================================
_mapGroup[_groupId] = new SMESH_Group( groupDS );
}
if ( !_mapGroup.empty() )
- _groupId = _mapGroup.rbegin()->first + 1;
+ _groupId = 1 + _mapGroup.rbegin()->first;
return nbGroups < _mapGroup.size();
}
*/
//=============================================================================
-SMESH_Group* SMESH_Mesh::GetGroup (const int theGroupID)
+SMESH_Group* SMESH_Mesh::GetGroup (const int theGroupID) const
{
- if (_mapGroup.find(theGroupID) == _mapGroup.end())
+ std::map <int, SMESH_Group*>::const_iterator id_grp = _mapGroup.find( theGroupID );
+ if ( id_grp == _mapGroup.end() )
return NULL;
- return _mapGroup[theGroupID];
+ return id_grp->second;
}