X-Git-Url: http://git.salome-platform.org/gitweb/?p=modules%2Fsmesh.git;a=blobdiff_plain;f=src%2FSMESH_I%2FSMESH_Mesh_i.cxx;h=13c602d92236e2149961b4aad33e877a31a5106c;hp=c03151e8b1a3a5d3cf29d3ed5e51e5ddf903249c;hb=HEAD;hpb=ed49807f170bded5dffd1f25be7b8c5799cdab6b diff --git a/src/SMESH_I/SMESH_Mesh_i.cxx b/src/SMESH_I/SMESH_Mesh_i.cxx index c03151e8b..e1c8ca916 100644 --- a/src/SMESH_I/SMESH_Mesh_i.cxx +++ b/src/SMESH_I/SMESH_Mesh_i.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2020 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2024 CEA, EDF, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -57,6 +57,7 @@ #include "SMESH_PreMeshInfo.hxx" #include "SMESH_PythonDump.hxx" #include "SMESH_subMesh_i.hxx" +#include "SMESH_Meshio.h" #include #include @@ -84,17 +85,18 @@ #include -// to pass CORBA exception through SMESH_TRY -#define SMY_OWN_CATCH catch( SALOME::SALOME_Exception& se ) { throw se; } +// to pass CORBA exception and TooLargeForExport exception through SMESH_TRY +#define SMY_OWN_CATCH \ + catch( SALOME::SALOME_Exception& se ) { throw se; } \ + catch( ::SMESH_Mesh::TooLargeForExport& ex ) \ + { SALOME::ExceptionStruct se = { \ + SALOME::COMM, \ + CORBA::string_dup(SMESH_Comment("Mesh is too large for export in format ") << ex.what()), \ + CORBA::string_dup(SMESH_Comment("format=") << ex.what() ), 0 }; \ + throw SALOME::SALOME_Exception( se ); } #include "SMESH_TryCatch.hxx" // include after OCCT headers! -#ifdef _DEBUG_ -static int MYDEBUG = 0; -#else -static int MYDEBUG = 0; -#endif - using namespace std; using SMESH::TPythonDump; using SMESH::TVar; @@ -461,8 +463,7 @@ SMESH::DriverMED_ReadStatus SMESH_Mesh_i::ImportCGNSFile( const char* theFileNa char* SMESH_Mesh_i::GetVersionString(CORBA::Long minor, CORBA::Short nbDigits) { - string ver = DriverMED_W_SMESHDS_Mesh::GetVersionString(minor, - nbDigits); + string ver = DriverMED_W_SMESHDS_Mesh::GetVersionString(minor, nbDigits); return CORBA::string_dup( ver.c_str() ); } @@ -640,7 +641,7 @@ SMESH_Mesh_i::AddHypothesis(GEOM::GEOM_Object_ptr aSubShape, { Unexpect aCatch(SALOME_SalomeException); - const int prevNbMeshEnt = NbNodes() + NbElements(); + const smIdType prevNbMeshEnt = NbNodes() + NbElements(); if ( _preMeshInfo ) _preMeshInfo->ForgetOrLoad(); @@ -658,7 +659,7 @@ SMESH_Mesh_i::AddHypothesis(GEOM::GEOM_Object_ptr aSubShape, if ( prevNbMeshEnt > 0 /*newNbMeshEnt != prevNbMeshEnt*/ ) _gen_i->UpdateIcons( mesh ); } - if(MYDEBUG) MESSAGE( " AddHypothesis(): status = " << status ); + MESSAGE( " AddHypothesis(): status = " << status ); // Update Python script TPythonDump() << "status = " << mesh << ".AddHypothesis( " @@ -678,7 +679,7 @@ SMESH_Mesh_i::addHypothesis(GEOM::GEOM_Object_ptr aSubShape, SMESH::SMESH_Hypothesis_ptr anHyp, std::string* anErrorText) { - if(MYDEBUG) MESSAGE("addHypothesis"); + MESSAGE("addHypothesis"); if (CORBA::is_nil( aSubShape ) && HasShapeToMesh()) THROW_SALOME_CORBA_EXCEPTION("bad Sub-shape reference",SALOME::BAD_PARAM); @@ -764,7 +765,7 @@ SMESH_Hypothesis::Hypothesis_Status SMESH_Mesh_i::removeHypothesis(GEOM::GEOM_Object_ptr aSubShape, SMESH::SMESH_Hypothesis_ptr anHyp) { - if(MYDEBUG) MESSAGE("removeHypothesis()"); + MESSAGE("removeHypothesis()"); if (CORBA::is_nil( aSubShape ) && HasShapeToMesh()) THROW_SALOME_CORBA_EXCEPTION("bad Sub-shape reference", SALOME::BAD_PARAM); @@ -810,7 +811,7 @@ SMESH::ListOfHypothesis * SMESH_Mesh_i::GetHypothesisList(GEOM::GEOM_Object_ptr aSubShape) { Unexpect aCatch(SALOME_SalomeException); - if (MYDEBUG) MESSAGE("GetHypothesisList"); + MESSAGE("GetHypothesisList"); if (_impl->HasShapeToMesh() && CORBA::is_nil(aSubShape)) THROW_SALOME_CORBA_EXCEPTION("bad Sub-shape reference", SALOME::BAD_PARAM); @@ -850,7 +851,7 @@ SMESH_Mesh_i::GetHypothesisList(GEOM::GEOM_Object_ptr aSubShape) SMESH::submesh_array* SMESH_Mesh_i::GetSubMeshes() { Unexpect aCatch(SALOME_SalomeException); - if (MYDEBUG) MESSAGE("GetSubMeshes"); + MESSAGE("GetSubMeshes"); SMESH::submesh_array_var aList = new SMESH::submesh_array(); @@ -1148,11 +1149,11 @@ void SMESH_Mesh_i::RemoveGroupWithContents( SMESH::SMESH_GroupBase_ptr theGroup THROW_SALOME_CORBA_EXCEPTION( "RemoveGroupWithContents(): group does not belong to this mesh", SALOME::BAD_PARAM); - vector nodeIds; // to remove nodes becoming free + vector nodeIds; // to remove nodes becoming free bool isNodal = ( theGroup->GetType() == SMESH::NODE ); if ( !isNodal && !theGroup->IsEmpty() ) { - CORBA::Long elemID = theGroup->GetID( 1 ); + SMESH::smIdType elemID = theGroup->GetID( 1 ); int nbElemNodes = GetElemNbNodes( elemID ); if ( nbElemNodes > 0 ) nodeIds.reserve( theGroup->Size() * nbElemNodes ); @@ -1214,7 +1215,7 @@ void SMESH_Mesh_i::RemoveGroupWithContents( SMESH::SMESH_GroupBase_ptr theGroup SMESH::ListOfGroups * SMESH_Mesh_i::GetGroups() { Unexpect aCatch(SALOME_SalomeException); - if (MYDEBUG) MESSAGE("GetGroups"); + MESSAGE("GetGroups"); SMESH::ListOfGroups_var aList = new SMESH::ListOfGroups(); @@ -1857,7 +1858,7 @@ SMESH_Mesh_i::CreateDimGroup(const SMESH::ListOfIDSources& theGroups, SMDS_ElemIteratorPtr nIt = elOfType->nodesIterator(); for ( nbChecked = 1; nIt->more() && !toStopChecking; ++nbChecked ) { - const int nID = nIt->next()->GetID(); + const smIdType nID = nIt->next()->GetID(); if ( nID < isNodeInGroupsSize && isNodeInGroups[ nID ] && isToInclude( nbChecked, ++nbCommon, nbNodes, nbCorners, toStopChecking )) { @@ -2059,7 +2060,7 @@ void SMESH_Mesh_i::ReplaceShape(GEOM::GEOM_Object_ptr theNewGeom) } typedef struct { - int shapeID, fromID, toID; // indices of elements of a sub-mesh + int shapeID; smIdType fromID, toID; // indices of elements of a sub-mesh } TRange; std::vector< TRange > elemRanges, nodeRanges; // elements of sub-meshes std::vector< SMDS_PositionPtr > positions; // node positions @@ -2090,7 +2091,7 @@ void SMESH_Mesh_i::ReplaceShape(GEOM::GEOM_Object_ptr theNewGeom) while ( elemIt->more() ) { const SMDS_MeshElement* e = elemIt->next(); - const int elemID = e->GetID(); + const smIdType elemID = e->GetID(); const int shapeID = e->GetShapeID(); TRange & lastRange = ranges.back(); if ( lastRange.shapeID != shapeID || @@ -2407,11 +2408,13 @@ void SMESH_Mesh_i::CheckGeomModif( bool theIsBreakLink ) if ( !theIsBreakLink ) if ( mainGO->GetType() == GEOM_GROUP || !geomChanged ) // is group or not modified { - int nb = NbNodes() + NbElements(); + smIdType nb = NbNodes() + NbElements(); CheckGeomGroupModif(); - if ( nb != NbNodes() + NbElements() ) // something removed due to hypotheses change + bool updated = ( nb != NbNodes() + NbElements() ); + if ( updated ) // something removed due to hypotheses change _gen_i->UpdateIcons( me ); - return; + if ( updated == geomChanged || nb == 0 ) + return; } // Update after shape modification or breakLink w/o geometry change @@ -2498,7 +2501,7 @@ void SMESH_Mesh_i::CheckGeomModif( bool theIsBreakLink ) } old2newShapeMap.Bind( group->GetShape(), groupsData.back()._shape ); } - + } } // store assigned hypotheses @@ -2795,7 +2798,7 @@ void SMESH_Mesh_i::CheckGeomGroupModif() if ( !_impl->HasShapeToMesh() ) return; - CORBA::Long nbEntities = NbNodes() + NbElements(); + SMESH::smIdType nbEntities = NbNodes() + NbElements(); // Check if group contents changed @@ -2997,7 +3000,7 @@ void SMESH_Mesh_i::CheckGeomGroupModif() // Update icons - CORBA::Long newNbEntities = NbNodes() + NbElements(); + SMESH::smIdType newNbEntities = NbNodes() + NbElements(); list< SALOMEDS::SObject_wrap > soToUpdateIcons; if ( newNbEntities != nbEntities ) { @@ -3114,7 +3117,7 @@ SMESH::SMESH_Group_ptr SMESH_Mesh_i::ConvertToStandalone( SMESH::SMESH_GroupBase SMESH::SMESH_subMesh_ptr SMESH_Mesh_i::createSubMesh( GEOM::GEOM_Object_ptr theSubShapeObject ) { - if(MYDEBUG) MESSAGE( "createSubMesh" ); + MESSAGE( "createSubMesh" ); TopoDS_Shape myLocSubShape = _gen_i->GeomObjectToShape(theSubShapeObject); ::SMESH_subMesh * mySubMesh = _impl->GetSubMesh(myLocSubShape); int subMeshId = 0; @@ -3146,8 +3149,7 @@ SMESH::SMESH_subMesh_ptr SMESH_Mesh_i::createSubMesh( GEOM::GEOM_Object_ptr theS // register CORBA object for persistence int nextId = _gen_i->RegisterObject( subMesh ); - if(MYDEBUG) { MESSAGE( "Add submesh to map with id = "<< nextId); } - else { (void)nextId; } // avoid "unused variable" warning + MESSAGE( "Add submesh to map with id = "<< nextId); // to track changes of GEOM groups if ( subMeshId > 0 ) @@ -3283,8 +3285,7 @@ SMESH::SMESH_GroupBase_ptr SMESH_Mesh_i::createGroup (SMESH::ElementType // register CORBA object for persistence int nextId = _gen_i->RegisterObject( aGroup ); - if(MYDEBUG) { MESSAGE( "Add group to map with id = "<< nextId); } - else { nextId = ( nextId > 0 ); } // avoid "unused variable" warning in release mode + MESSAGE( "Add group to map with id = "<< nextId); // to track changes of GEOM groups if ( !theShape.IsNull() ) { @@ -3305,7 +3306,7 @@ SMESH::SMESH_GroupBase_ptr SMESH_Mesh_i::createGroup (SMESH::ElementType void SMESH_Mesh_i::removeGroup( const int theId ) { - if(MYDEBUG) MESSAGE("SMESH_Mesh_i::removeGroup()" ); + MESSAGE("SMESH_Mesh_i::removeGroup()"); if ( _mapGroups.find( theId ) != _mapGroups.end() ) { SMESH::SMESH_GroupBase_var group = _mapGroups[theId]; _mapGroups.erase( theId ); @@ -3342,10 +3343,10 @@ SMESH::log_array * SMESH_Mesh_i::GetLog(CORBA::Boolean clearAfterGet) while(its != logDS.end()){ SMESHDS_Command *com = *its; int comType = com->GetType(); - int lgcom = com->GetNumber(); - const list < int >&intList = com->GetIndexes(); + smIdType lgcom = com->GetNumber(); + const list < smIdType >&intList = com->GetIndexes(); int inum = intList.size(); - list < int >::const_iterator ii = intList.begin(); + list < smIdType >::const_iterator ii = intList.begin(); const list < double >&coordList = com->GetCoords(); int rnum = coordList.size(); list < double >::const_iterator ir = coordList.begin(); @@ -3472,7 +3473,7 @@ void SMESH_Mesh_i::onHypothesisModified(int theHypID, bool theUpdateIcons) void SMESH_Mesh_i::SetImpl(::SMESH_Mesh * impl) { - if(MYDEBUG) MESSAGE("SMESH_Mesh_i::SetImpl"); + MESSAGE("SMESH_Mesh_i::SetImpl"); _impl = impl; if ( _impl ) _impl->SetCallUp( new TCallUp_i(this)); @@ -3486,7 +3487,7 @@ void SMESH_Mesh_i::SetImpl(::SMESH_Mesh * impl) ::SMESH_Mesh & SMESH_Mesh_i::GetImpl() { - if(MYDEBUG) MESSAGE("SMESH_Mesh_i::GetImpl()"); + MESSAGE("SMESH_Mesh_i::GetImpl()"); return *_impl; } @@ -3678,6 +3679,25 @@ void SMESH_Mesh_i::PrepareForWriting (const char* file, bool overwrite) } } +/*! + Return a MeshName + */ +std::string SMESH_Mesh_i::generateMeshName() +{ + string aMeshName = "Mesh"; + SALOMEDS::Study_var aStudy = SMESH_Gen_i::GetSMESHGen()->getStudyServant(); + if ( !aStudy->_is_nil() ) + { + SALOMEDS::SObject_wrap aMeshSO = _gen_i->ObjectToSObject( _this() ); + if ( !aMeshSO->_is_nil() ) + { + CORBA::String_var name = aMeshSO->GetName(); + aMeshName = name; + } + } + return aMeshName; +} + //================================================================================ /*! * \brief Prepare a file for export and pass names of mesh groups from study to mesh DS @@ -3692,13 +3712,11 @@ string SMESH_Mesh_i::prepareMeshNameAndGroups(const char* file, { // Perform Export PrepareForWriting(file, overwrite); - string aMeshName = "Mesh"; + string aMeshName(this->generateMeshName()); SALOMEDS::Study_var aStudy = SMESH_Gen_i::GetSMESHGen()->getStudyServant(); if ( !aStudy->_is_nil() ) { SALOMEDS::SObject_wrap aMeshSO = _gen_i->ObjectToSObject( _this() ); if ( !aMeshSO->_is_nil() ) { - CORBA::String_var name = aMeshSO->GetName(); - aMeshName = name; // asv : 27.10.04 : fix of 6903: check for StudyLocked before adding attributes if ( !aStudy->GetProperties()->IsLocked() ) { @@ -3732,11 +3750,11 @@ string SMESH_Mesh_i::prepareMeshNameAndGroups(const char* file, */ //================================================================================ -void SMESH_Mesh_i::ExportMED(const char* file, - CORBA::Boolean auto_groups, - CORBA::Long version, - CORBA::Boolean overwrite, - CORBA::Boolean autoDimension) +void SMESH_Mesh_i::ExportMED(const char* file, + CORBA::Boolean auto_groups, + CORBA::Long version, + CORBA::Boolean overwrite, + CORBA::Boolean autoDimension) { //MESSAGE("MED minor version: "<< minor); SMESH_TRY; @@ -3757,46 +3775,46 @@ void SMESH_Mesh_i::ExportMED(const char* file, SMESH_CATCH( SMESH::throwCorbaException ); } -//================================================================================ -/*! - * \brief Export a mesh to a SAUV file - */ -//================================================================================ - -void SMESH_Mesh_i::ExportSAUV (const char* file, - CORBA::Boolean auto_groups) +CORBA::LongLong SMESH_Mesh_i::ExportMEDCoupling(CORBA::Boolean auto_groups, CORBA::Boolean autoDimension) { - Unexpect aCatch(SALOME_SalomeException); + MEDCoupling::MCAuto data; + SMESH_TRY; + // TODO : Fix me ! 2 next lines are required + if( !this->_gen_i->isSSLMode() ) + SMESH::throwCorbaException("SMESH_Mesh_i::ExportMEDCoupling : only for embedded mode !"); if ( _preMeshInfo ) _preMeshInfo->FullLoadFromFile(); - string aMeshName = prepareMeshNameAndGroups(file, true); - TPythonDump() << SMESH::SMESH_Mesh_var( _this()) - << ".ExportSAUV( r'" << file << "', " << auto_groups << " )"; - _impl->ExportSAUV(file, aMeshName.c_str(), auto_groups); + string aMeshName = this->generateMeshName(); + data = _impl->ExportMEDCoupling( aMeshName.c_str(), auto_groups, 0, autoDimension ); + SMESH_CATCH( SMESH::throwCorbaException ); + MEDCoupling::DataArrayByte *ret(data.retn()); + return reinterpret_cast(ret); } - //================================================================================ /*! * \brief Export a mesh to a DAT file */ //================================================================================ -void SMESH_Mesh_i::ExportDAT (const char *file) +void SMESH_Mesh_i::ExportDAT (const char *file, CORBA::Boolean renumber ) { - Unexpect aCatch(SALOME_SalomeException); + SMESH_TRY; if ( _preMeshInfo ) _preMeshInfo->FullLoadFromFile(); - // Update Python script // check names of groups checkGroupNames(); - TPythonDump() << SMESH::SMESH_Mesh_var(_this()) << ".ExportDAT( r'" << file << "' )"; + // Update Python script + TPythonDump() << SMESH::SMESH_Mesh_var(_this()) + << ".ExportDAT( r'" << file<< ", " << renumber << "' )"; // Perform Export - PrepareForWriting(file); - _impl->ExportDAT(file); + PrepareForWriting( file ); + _impl->ExportDAT( file, /*part=*/nullptr, renumber ); + + SMESH_CATCH( SMESH::throwCorbaException ); } //================================================================================ @@ -3805,20 +3823,23 @@ void SMESH_Mesh_i::ExportDAT (const char *file) */ //================================================================================ -void SMESH_Mesh_i::ExportUNV (const char *file) +void SMESH_Mesh_i::ExportUNV (const char *file, CORBA::Boolean renumber) { - Unexpect aCatch(SALOME_SalomeException); + SMESH_TRY; if ( _preMeshInfo ) _preMeshInfo->FullLoadFromFile(); - // Update Python script // check names of groups checkGroupNames(); - TPythonDump() << SMESH::SMESH_Mesh_var(_this()) << ".ExportUNV( r'" << file << "' )"; + // Update Python script + TPythonDump() << SMESH::SMESH_Mesh_var(_this()) + << ".ExportUNV( r'" << file << "', " << renumber << " )"; // Perform Export - PrepareForWriting(file); - _impl->ExportUNV(file); + PrepareForWriting( file ); + _impl->ExportUNV( file, /*part=*/nullptr, renumber ); + + SMESH_CATCH( SMESH::throwCorbaException ); } //================================================================================ @@ -3829,13 +3850,13 @@ void SMESH_Mesh_i::ExportUNV (const char *file) void SMESH_Mesh_i::ExportSTL (const char *file, const bool isascii) { - Unexpect aCatch(SALOME_SalomeException); + SMESH_TRY; if ( _preMeshInfo ) _preMeshInfo->FullLoadFromFile(); - // Update Python script // check names of groups checkGroupNames(); + // Update Python script TPythonDump() << SMESH::SMESH_Mesh_var(_this()) << ".ExportSTL( r'" << file << "', " << isascii << " )"; @@ -3847,25 +3868,68 @@ void SMESH_Mesh_i::ExportSTL (const char *file, const bool isascii) // Perform Export PrepareForWriting( file ); _impl->ExportSTL( file, isascii, name.in() ); + + SMESH_CATCH( SMESH::throwCorbaException ); } +//================================================================================ + +class MEDFileSpeCls +{ +public: + MEDFileSpeCls(const char * file, + CORBA::Boolean overwrite, + CORBA::Long version) + :_file(file), _overwrite(overwrite), _version(version) + {} + std::string prepareMeshNameAndGroups(SMESH_Mesh_i& self) + { + return self.prepareMeshNameAndGroups(_file.c_str(),_overwrite); + } + + void exportTo(SMESH_Mesh *mesh, const std::string& aMeshName, CORBA::Boolean auto_groups, + SMESH_MeshPartDS* partDS, CORBA::Boolean autoDimension, bool have0dField, + CORBA::Double ZTolerance, CORBA::Boolean saveNumbers ) + { + mesh->ExportMED( _file.c_str(), aMeshName.c_str(), auto_groups, _version, + partDS, autoDimension, have0dField, ZTolerance, saveNumbers ); + } + + void exportField(SMESH_Mesh_i& self, const std::string& aMeshName, bool have0dField, + SMESHDS_Mesh *meshDS, const GEOM::ListOfFields& fields, + const char*geomAssocFields) + { + DriverMED_W_Field fieldWriter; + fieldWriter.SetFile( _file.c_str() ); + fieldWriter.SetMeshName( aMeshName ); + fieldWriter.AddODOnVertices( have0dField ); + self.exportMEDFields( fieldWriter, meshDS, fields, geomAssocFields ); + } + + void prepareForWriting(SMESH_Mesh_i& self) { self.PrepareForWriting(_file.c_str(), _overwrite); } + +private: + std::string _file; + CORBA::Boolean _overwrite; + CORBA::Long _version; +}; + //================================================================================ /*! * \brief Export a part of mesh to a med file */ //================================================================================ -void SMESH_Mesh_i::ExportPartToMED(SMESH::SMESH_IDSource_ptr meshPart, - const char* file, - CORBA::Boolean auto_groups, - CORBA::Long version, - CORBA::Boolean overwrite, - CORBA::Boolean autoDimension, - const GEOM::ListOfFields& fields, - const char* geomAssocFields, - CORBA::Double ZTolerance) +template +void SMESH_Mesh_i::ExportPartToMEDCommon(SPECLS& speCls, + SMESH::SMESH_IDSource_ptr meshPart, + CORBA::Boolean auto_groups, + CORBA::Boolean autoDimension, + const GEOM::ListOfFields& fields, + const char* geomAssocFields, + CORBA::Double ZTolerance, + CORBA::Boolean saveNumbers) { - MESSAGE("MED version: "<< version); SMESH_TRY; if ( _preMeshInfo ) _preMeshInfo->FullLoadFromFile(); @@ -3887,8 +3951,7 @@ void SMESH_Mesh_i::ExportPartToMED(SMESH::SMESH_IDSource_ptr meshPart, if ( fieldShape->_is_nil() ) THROW_SALOME_CORBA_EXCEPTION( "Null shape under a field", SALOME::INTERNAL_ERROR ); if ( !fieldShape->IsSame( shapeToMesh ) ) - THROW_SALOME_CORBA_EXCEPTION - ( "Field defined not on shape", SALOME::BAD_PARAM); + THROW_SALOME_CORBA_EXCEPTION( "Field defined not on shape", SALOME::BAD_PARAM); if ( fields[i]->GetDimension() == 0 ) have0dField = true; } @@ -3911,10 +3974,9 @@ void SMESH_Mesh_i::ExportPartToMED(SMESH::SMESH_IDSource_ptr meshPart, if ( CORBA::is_nil( meshPart ) || SMESH::DownCast< SMESH_Mesh_i* >( meshPart )) { - aMeshName = prepareMeshNameAndGroups(file, overwrite); - _impl->ExportMED( file, aMeshName.c_str(), auto_groups, version, - 0, autoDimension, /*addODOnVertices=*/have0dField, - ZTolerance); + aMeshName = speCls.prepareMeshNameAndGroups(*this); + speCls.exportTo(_impl, aMeshName, auto_groups, nullptr, autoDimension, + have0dField, ZTolerance, saveNumbers ); meshDS = _impl->GetMeshDS(); } else @@ -3922,7 +3984,7 @@ void SMESH_Mesh_i::ExportPartToMED(SMESH::SMESH_IDSource_ptr meshPart, if ( _preMeshInfo ) _preMeshInfo->FullLoadFromFile(); - PrepareForWriting(file, overwrite); + speCls.prepareForWriting(*this); SALOMEDS::SObject_wrap SO = _gen_i->ObjectToSObject( meshPart ); if ( !SO->_is_nil() ) { @@ -3931,8 +3993,8 @@ void SMESH_Mesh_i::ExportPartToMED(SMESH::SMESH_IDSource_ptr meshPart, } SMESH_MeshPartDS* partDS = new SMESH_MeshPartDS( meshPart ); - _impl->ExportMED( file, aMeshName.c_str(), auto_groups, version, - partDS, autoDimension, /*addODOnVertices=*/have0dField, ZTolerance); + speCls.exportTo(_impl, aMeshName, auto_groups, partDS, autoDimension, + have0dField, ZTolerance, saveNumbers); meshDS = tmpDSDeleter._obj = partDS; } @@ -3940,15 +4002,35 @@ void SMESH_Mesh_i::ExportPartToMED(SMESH::SMESH_IDSource_ptr meshPart, if ( _impl->HasShapeToMesh() ) { - DriverMED_W_Field fieldWriter; - fieldWriter.SetFile( file ); - fieldWriter.SetMeshName( aMeshName ); - fieldWriter.AddODOnVertices( have0dField ); - - exportMEDFields( fieldWriter, meshDS, fields, geomAssocFields ); + speCls.exportField( *this, aMeshName, have0dField, meshDS, fields, geomAssocFields); } + SMESH_CATCH( SMESH::throwCorbaException ); +} + +//================================================================================ +/*! + * \brief Export a part of mesh to a med file + */ +//================================================================================ +void SMESH_Mesh_i::ExportPartToMED(SMESH::SMESH_IDSource_ptr meshPart, + const char* file, + CORBA::Boolean auto_groups, + CORBA::Long version, + CORBA::Boolean overwrite, + CORBA::Boolean autoDimension, + const GEOM::ListOfFields& fields, + const char* geomAssocFields, + CORBA::Double ZTolerance, + CORBA::Boolean saveNumbers) +{ + MESSAGE("MED version: "<< version); + + MEDFileSpeCls spe( file, overwrite, version ); + this->ExportPartToMEDCommon( spe, meshPart, auto_groups, autoDimension, fields, + geomAssocFields, ZTolerance, saveNumbers ); // dump + SMESH_TRY; GEOM::ListOfGBO_var goList = new GEOM::ListOfGBO; goList->length( fields.length() ); for ( size_t i = 0; i < fields.length(); ++i ) @@ -3965,10 +4047,123 @@ void SMESH_Mesh_i::ExportPartToMED(SMESH::SMESH_IDSource_ptr meshPart, << autoDimension << ", " << goList << ", '" << ( geomAssocFields ? geomAssocFields : "" ) << "'," - << TVar( ZTolerance ) + << TVar( ZTolerance ) << ", " + << saveNumbers << " )"; + SMESH_CATCH( SMESH::throwCorbaException ); +} + +//================================================================================ +/*! + * \brief Export a part of mesh to a file with meshio library + */ +//================================================================================ + +void SMESH_Mesh_i::ExportPartToMESHIO(SMESH::SMESH_IDSource_ptr meshPart, + const char* file, + const char* selectedFilter) +{ + // Get default MED version + SMESH::long_array_var medVersions = GetMEDVersionsCompatibleForAppend(); + const CORBA::Long version = medVersions[0]; + MESSAGE("Export part with meshio through MED version: " << version); + + // Default values are the same as for MED export + const bool auto_groups = false; + const bool overwrite = true; + const bool autoDimension = true; + const GEOM::ListOfFields fields; + const char* geomAssocFields = ""; + const double ZTolerance = -1.0; + const bool saveNumbers = true; + + // Create an object that holds a temp file name and + // removes the file when goes out of scope. + SMESH_Meshio meshio(selectedFilter); + const QString tempFileName = meshio.CreateTempFileName(file); + + // Export a given mesh into the temp file + MEDFileSpeCls spe(tempFileName.toUtf8().data(), overwrite, version); + this->ExportPartToMEDCommon(spe, meshPart, auto_groups, autoDimension, fields, + geomAssocFields, ZTolerance, saveNumbers); + + // Convert temp file into a target one with meshio command + meshio.Convert(tempFileName, file); + + // Prepare python dump + SMESH_TRY; + + TPythonDump() << _this() << ".ExportPartToMESHIO(" + << meshPart << ", r'" + << file << "', '" + << selectedFilter << "'" + << ")"; + + SMESH_CATCH(SMESH::throwCorbaException); +} + +//================================================================================ + +class MEDFileMemSpeCls +{ +public: + std::string prepareMeshNameAndGroups(SMESH_Mesh_i& self) { return self.generateMeshName(); } + + void exportTo(SMESH_Mesh *mesh, const std::string& aMeshName, CORBA::Boolean auto_groups, + SMESH_MeshPartDS* partDS, CORBA::Boolean autoDimension, bool have0dField, + CORBA::Double ZTolerance, CORBA::Boolean saveNumbers ) + { + _res = mesh->ExportMEDCoupling(aMeshName.c_str(), auto_groups, partDS, + autoDimension, have0dField, ZTolerance, saveNumbers ); + } + void prepareForWriting(SMESH_Mesh_i& /*self*/) { /* nothing here */ } + + void exportField(SMESH_Mesh_i& self, const std::string& aMeshName, bool have0dField, + SMESHDS_Mesh *meshDS, const GEOM::ListOfFields& fields, + const char*geomAssocFields) + { + DriverMED_W_Field_Mem fieldWriter(_res); + fieldWriter.SetMeshName( aMeshName ); + fieldWriter.AddODOnVertices( have0dField ); + self.exportMEDFields( fieldWriter, meshDS, fields, geomAssocFields ); + _res = fieldWriter.getData(); + } +public: + MEDCoupling::MCAuto getData() { return _res; } + +private: + MEDCoupling::MCAuto _res; +}; + +//================================================================================ +/*! + * \brief Export a part of mesh to a MEDCoupling DS + */ +//================================================================================ + +CORBA::LongLong SMESH_Mesh_i::ExportPartToMEDCoupling(SMESH::SMESH_IDSource_ptr meshPart, + CORBA::Boolean auto_groups, + CORBA::Boolean autoDimension, + const GEOM::ListOfFields& fields, + const char* geomAssocFields, + CORBA::Double ZTolerance, + CORBA::Boolean saveNumbers) +{ + MEDCoupling::MCAuto data; + + SMESH_TRY; + if( !this->_gen_i->isSSLMode() ) + SMESH::throwCorbaException("SMESH_Mesh_i::ExportPartToMEDCoupling : only for embedded mode !"); + + MEDFileMemSpeCls spe; + this->ExportPartToMEDCommon( spe, meshPart, auto_groups, autoDimension, fields, geomAssocFields, + ZTolerance, saveNumbers ); + data = spe.getData(); SMESH_CATCH( SMESH::throwCorbaException ); + + MEDCoupling::DataArrayByte *ret(data.retn()); + return reinterpret_cast(ret); } //================================================================================ @@ -4246,20 +4441,19 @@ void SMESH_Mesh_i::exportMEDFields( DriverMED_W_Field& fieldWriter, */ //================================================================================ -void SMESH_Mesh_i::ExportPartToDAT(::SMESH::SMESH_IDSource_ptr meshPart, - const char* file) +void SMESH_Mesh_i::ExportPartToDAT(SMESH::SMESH_IDSource_ptr meshPart, + const char* file, + CORBA::Boolean renumber ) { - Unexpect aCatch(SALOME_SalomeException); - if ( _preMeshInfo ) - _preMeshInfo->FullLoadFromFile(); - - PrepareForWriting(file); + SMESH_TRY; SMESH_MeshPartDS partDS( meshPart ); - _impl->ExportDAT(file,&partDS); + _impl->ExportDAT( file, &partDS, renumber ); TPythonDump() << SMESH::SMESH_Mesh_var(_this()) - << ".ExportPartToDAT( " << meshPart << ", r'" << file << "' )"; + << ".ExportPartToDAT( " << meshPart << ", r'" << file << ", " << renumber << "' )"; + + SMESH_CATCH( SMESH::throwCorbaException ); } //================================================================================ /*! @@ -4267,20 +4461,23 @@ void SMESH_Mesh_i::ExportPartToDAT(::SMESH::SMESH_IDSource_ptr meshPart, */ //================================================================================ -void SMESH_Mesh_i::ExportPartToUNV(::SMESH::SMESH_IDSource_ptr meshPart, - const char* file) +void SMESH_Mesh_i::ExportPartToUNV(SMESH::SMESH_IDSource_ptr meshPart, + const char* file, + CORBA::Boolean renumber) { - Unexpect aCatch(SALOME_SalomeException); + SMESH_TRY; if ( _preMeshInfo ) _preMeshInfo->FullLoadFromFile(); PrepareForWriting(file); SMESH_MeshPartDS partDS( meshPart ); - _impl->ExportUNV(file, &partDS); + _impl->ExportUNV(file, &partDS, renumber ); TPythonDump() << SMESH::SMESH_Mesh_var(_this()) - << ".ExportPartToUNV( " << meshPart<< ", r'" << file << "' )"; + << ".ExportPartToUNV( " << meshPart<< ", r'" << file << ", " << renumber << "' )"; + + SMESH_CATCH( SMESH::throwCorbaException ); } //================================================================================ /*! @@ -4292,7 +4489,7 @@ void SMESH_Mesh_i::ExportPartToSTL(::SMESH::SMESH_IDSource_ptr meshPart, const char* file, ::CORBA::Boolean isascii) { - Unexpect aCatch(SALOME_SalomeException); + SMESH_TRY; if ( _preMeshInfo ) _preMeshInfo->FullLoadFromFile(); @@ -4308,6 +4505,8 @@ void SMESH_Mesh_i::ExportPartToSTL(::SMESH::SMESH_IDSource_ptr meshPart, TPythonDump() << SMESH::SMESH_Mesh_var(_this()) << ".ExportPartToSTL( " << meshPart<< ", r'" << file << "', " << isascii << ")"; + + SMESH_CATCH( SMESH::throwCorbaException ); } //================================================================================ @@ -4322,7 +4521,7 @@ void SMESH_Mesh_i::ExportCGNS(::SMESH::SMESH_IDSource_ptr meshPart, CORBA::Boolean groupElemsByType) { #ifdef WITH_CGNS - Unexpect aCatch(SALOME_SalomeException); + SMESH_TRY; if ( _preMeshInfo ) _preMeshInfo->FullLoadFromFile(); @@ -4344,6 +4543,9 @@ void SMESH_Mesh_i::ExportCGNS(::SMESH::SMESH_IDSource_ptr meshPart, TPythonDump() << SMESH::SMESH_Mesh_var(_this()) << ".ExportCGNS( " << meshPart<< ", r'" << file << "', " << overwrite << ")"; + + SMESH_CATCH( SMESH::throwCorbaException ); + #else THROW_SALOME_CORBA_EXCEPTION("CGNS library is unavailable", SALOME::INTERNAL_ERROR); #endif @@ -4359,7 +4561,7 @@ void SMESH_Mesh_i::ExportGMF(::SMESH::SMESH_IDSource_ptr meshPart, const char* file, bool withRequiredGroups) { - Unexpect aCatch(SALOME_SalomeException); + SMESH_TRY; if ( _preMeshInfo ) _preMeshInfo->FullLoadFromFile(); @@ -4372,6 +4574,8 @@ void SMESH_Mesh_i::ExportGMF(::SMESH::SMESH_IDSource_ptr meshPart, << meshPart<< ", r'" << file << "', " << withRequiredGroups << ")"; + + SMESH_CATCH( SMESH::throwCorbaException ); } //============================================================================= @@ -4396,7 +4600,7 @@ CORBA::Double SMESH_Mesh_i::GetComputeProgress() */ //================================================================================ -CORBA::Long SMESH_Mesh_i::NbNodes() +SMESH::smIdType SMESH_Mesh_i::NbNodes() { Unexpect aCatch(SALOME_SalomeException); if ( _preMeshInfo ) @@ -4411,7 +4615,7 @@ CORBA::Long SMESH_Mesh_i::NbNodes() */ //================================================================================ -CORBA::Long SMESH_Mesh_i::NbElements() +SMESH::smIdType SMESH_Mesh_i::NbElements() { Unexpect aCatch(SALOME_SalomeException); if ( _preMeshInfo ) @@ -4426,7 +4630,7 @@ CORBA::Long SMESH_Mesh_i::NbElements() */ //================================================================================ -CORBA::Long SMESH_Mesh_i::Nb0DElements() +SMESH::smIdType SMESH_Mesh_i::Nb0DElements() { Unexpect aCatch(SALOME_SalomeException); if ( _preMeshInfo ) @@ -4441,7 +4645,7 @@ CORBA::Long SMESH_Mesh_i::Nb0DElements() */ //================================================================================ -CORBA::Long SMESH_Mesh_i::NbBalls() +SMESH::smIdType SMESH_Mesh_i::NbBalls() { Unexpect aCatch(SALOME_SalomeException); if ( _preMeshInfo ) @@ -4456,7 +4660,7 @@ CORBA::Long SMESH_Mesh_i::NbBalls() */ //================================================================================ -CORBA::Long SMESH_Mesh_i::NbEdges() +SMESH::smIdType SMESH_Mesh_i::NbEdges() { Unexpect aCatch(SALOME_SalomeException); if ( _preMeshInfo ) @@ -4471,7 +4675,7 @@ CORBA::Long SMESH_Mesh_i::NbEdges() */ //================================================================================ -CORBA::Long SMESH_Mesh_i::NbEdgesOfOrder(SMESH::ElementOrder order) +SMESH::smIdType SMESH_Mesh_i::NbEdgesOfOrder(SMESH::ElementOrder order) { Unexpect aCatch(SALOME_SalomeException); if ( _preMeshInfo ) @@ -4486,7 +4690,7 @@ CORBA::Long SMESH_Mesh_i::NbEdgesOfOrder(SMESH::ElementOrder order) */ //================================================================================ -CORBA::Long SMESH_Mesh_i::NbFaces() +SMESH::smIdType SMESH_Mesh_i::NbFaces() { Unexpect aCatch(SALOME_SalomeException); if ( _preMeshInfo ) @@ -4501,7 +4705,7 @@ CORBA::Long SMESH_Mesh_i::NbFaces() */ //================================================================================ -CORBA::Long SMESH_Mesh_i::NbTriangles() +SMESH::smIdType SMESH_Mesh_i::NbTriangles() { Unexpect aCatch(SALOME_SalomeException); if ( _preMeshInfo ) @@ -4516,7 +4720,7 @@ CORBA::Long SMESH_Mesh_i::NbTriangles() */ //================================================================================ -CORBA::Long SMESH_Mesh_i::NbBiQuadTriangles() +SMESH::smIdType SMESH_Mesh_i::NbBiQuadTriangles() { Unexpect aCatch(SALOME_SalomeException); if ( _preMeshInfo ) @@ -4525,7 +4729,7 @@ CORBA::Long SMESH_Mesh_i::NbBiQuadTriangles() return _impl->NbBiQuadTriangles(); } -CORBA::Long SMESH_Mesh_i::NbQuadrangles() +SMESH::smIdType SMESH_Mesh_i::NbQuadrangles() { Unexpect aCatch(SALOME_SalomeException); if ( _preMeshInfo ) @@ -4534,7 +4738,7 @@ CORBA::Long SMESH_Mesh_i::NbQuadrangles() return _impl->NbQuadrangles(); } -CORBA::Long SMESH_Mesh_i::NbBiQuadQuadrangles() +SMESH::smIdType SMESH_Mesh_i::NbBiQuadQuadrangles() { Unexpect aCatch(SALOME_SalomeException); if ( _preMeshInfo ) @@ -4543,7 +4747,7 @@ CORBA::Long SMESH_Mesh_i::NbBiQuadQuadrangles() return _impl->NbBiQuadQuadrangles(); } -CORBA::Long SMESH_Mesh_i::NbPolygons() +SMESH::smIdType SMESH_Mesh_i::NbPolygons() { Unexpect aCatch(SALOME_SalomeException); if ( _preMeshInfo ) @@ -4552,7 +4756,7 @@ CORBA::Long SMESH_Mesh_i::NbPolygons() return _impl->NbPolygons(); } -CORBA::Long SMESH_Mesh_i::NbPolygonsOfOrder(SMESH::ElementOrder order) +SMESH::smIdType SMESH_Mesh_i::NbPolygonsOfOrder(SMESH::ElementOrder order) { Unexpect aCatch(SALOME_SalomeException); if ( _preMeshInfo ) @@ -4561,7 +4765,7 @@ CORBA::Long SMESH_Mesh_i::NbPolygonsOfOrder(SMESH::ElementOrder order) return _impl->NbPolygons((SMDSAbs_ElementOrder)order); } -CORBA::Long SMESH_Mesh_i::NbFacesOfOrder(SMESH::ElementOrder order) +SMESH::smIdType SMESH_Mesh_i::NbFacesOfOrder(SMESH::ElementOrder order) { Unexpect aCatch(SALOME_SalomeException); if ( _preMeshInfo ) @@ -4570,7 +4774,7 @@ CORBA::Long SMESH_Mesh_i::NbFacesOfOrder(SMESH::ElementOrder order) return _impl->NbFaces( (SMDSAbs_ElementOrder) order); } -CORBA::Long SMESH_Mesh_i::NbTrianglesOfOrder(SMESH::ElementOrder order) +SMESH::smIdType SMESH_Mesh_i::NbTrianglesOfOrder(SMESH::ElementOrder order) { Unexpect aCatch(SALOME_SalomeException); if ( _preMeshInfo ) @@ -4579,7 +4783,7 @@ CORBA::Long SMESH_Mesh_i::NbTrianglesOfOrder(SMESH::ElementOrder order) return _impl->NbTriangles( (SMDSAbs_ElementOrder) order); } -CORBA::Long SMESH_Mesh_i::NbQuadranglesOfOrder(SMESH::ElementOrder order) +SMESH::smIdType SMESH_Mesh_i::NbQuadranglesOfOrder(SMESH::ElementOrder order) { Unexpect aCatch(SALOME_SalomeException); if ( _preMeshInfo ) @@ -4590,7 +4794,7 @@ CORBA::Long SMESH_Mesh_i::NbQuadranglesOfOrder(SMESH::ElementOrder order) //============================================================================= -CORBA::Long SMESH_Mesh_i::NbVolumes() +SMESH::smIdType SMESH_Mesh_i::NbVolumes() { Unexpect aCatch(SALOME_SalomeException); if ( _preMeshInfo ) @@ -4599,7 +4803,7 @@ CORBA::Long SMESH_Mesh_i::NbVolumes() return _impl->NbVolumes(); } -CORBA::Long SMESH_Mesh_i::NbTetras() +SMESH::smIdType SMESH_Mesh_i::NbTetras() { Unexpect aCatch(SALOME_SalomeException); if ( _preMeshInfo ) @@ -4608,7 +4812,7 @@ CORBA::Long SMESH_Mesh_i::NbTetras() return _impl->NbTetras(); } -CORBA::Long SMESH_Mesh_i::NbHexas() +SMESH::smIdType SMESH_Mesh_i::NbHexas() { Unexpect aCatch(SALOME_SalomeException); if ( _preMeshInfo ) @@ -4617,7 +4821,7 @@ CORBA::Long SMESH_Mesh_i::NbHexas() return _impl->NbHexas(); } -CORBA::Long SMESH_Mesh_i::NbTriQuadraticHexas() +SMESH::smIdType SMESH_Mesh_i::NbTriQuadraticHexas() { Unexpect aCatch(SALOME_SalomeException); if ( _preMeshInfo ) @@ -4626,7 +4830,7 @@ CORBA::Long SMESH_Mesh_i::NbTriQuadraticHexas() return _impl->NbTriQuadraticHexas(); } -CORBA::Long SMESH_Mesh_i::NbPyramids() +SMESH::smIdType SMESH_Mesh_i::NbPyramids() { Unexpect aCatch(SALOME_SalomeException); if ( _preMeshInfo ) @@ -4635,7 +4839,7 @@ CORBA::Long SMESH_Mesh_i::NbPyramids() return _impl->NbPyramids(); } -CORBA::Long SMESH_Mesh_i::NbPrisms() +SMESH::smIdType SMESH_Mesh_i::NbPrisms() { Unexpect aCatch(SALOME_SalomeException); if ( _preMeshInfo ) @@ -4644,7 +4848,7 @@ CORBA::Long SMESH_Mesh_i::NbPrisms() return _impl->NbPrisms(); } -CORBA::Long SMESH_Mesh_i::NbHexagonalPrisms() +SMESH::smIdType SMESH_Mesh_i::NbHexagonalPrisms() { Unexpect aCatch(SALOME_SalomeException); if ( _preMeshInfo ) @@ -4653,7 +4857,7 @@ CORBA::Long SMESH_Mesh_i::NbHexagonalPrisms() return _impl->NbHexagonalPrisms(); } -CORBA::Long SMESH_Mesh_i::NbPolyhedrons() +SMESH::smIdType SMESH_Mesh_i::NbPolyhedrons() { Unexpect aCatch(SALOME_SalomeException); if ( _preMeshInfo ) @@ -4662,7 +4866,7 @@ CORBA::Long SMESH_Mesh_i::NbPolyhedrons() return _impl->NbPolyhedrons(); } -CORBA::Long SMESH_Mesh_i::NbVolumesOfOrder(SMESH::ElementOrder order) +SMESH::smIdType SMESH_Mesh_i::NbVolumesOfOrder(SMESH::ElementOrder order) { Unexpect aCatch(SALOME_SalomeException); if ( _preMeshInfo ) @@ -4671,7 +4875,7 @@ CORBA::Long SMESH_Mesh_i::NbVolumesOfOrder(SMESH::ElementOrder order) return _impl->NbVolumes( (SMDSAbs_ElementOrder) order); } -CORBA::Long SMESH_Mesh_i::NbTetrasOfOrder(SMESH::ElementOrder order) +SMESH::smIdType SMESH_Mesh_i::NbTetrasOfOrder(SMESH::ElementOrder order) { Unexpect aCatch(SALOME_SalomeException); if ( _preMeshInfo ) @@ -4680,7 +4884,7 @@ CORBA::Long SMESH_Mesh_i::NbTetrasOfOrder(SMESH::ElementOrder order) return _impl->NbTetras( (SMDSAbs_ElementOrder) order); } -CORBA::Long SMESH_Mesh_i::NbHexasOfOrder(SMESH::ElementOrder order) +SMESH::smIdType SMESH_Mesh_i::NbHexasOfOrder(SMESH::ElementOrder order) { Unexpect aCatch(SALOME_SalomeException); if ( _preMeshInfo ) @@ -4689,7 +4893,7 @@ CORBA::Long SMESH_Mesh_i::NbHexasOfOrder(SMESH::ElementOrder order) return _impl->NbHexas( (SMDSAbs_ElementOrder) order); } -CORBA::Long SMESH_Mesh_i::NbPyramidsOfOrder(SMESH::ElementOrder order) +SMESH::smIdType SMESH_Mesh_i::NbPyramidsOfOrder(SMESH::ElementOrder order) { Unexpect aCatch(SALOME_SalomeException); if ( _preMeshInfo ) @@ -4698,7 +4902,7 @@ CORBA::Long SMESH_Mesh_i::NbPyramidsOfOrder(SMESH::ElementOrder order) return _impl->NbPyramids( (SMDSAbs_ElementOrder) order); } -CORBA::Long SMESH_Mesh_i::NbPrismsOfOrder(SMESH::ElementOrder order) +SMESH::smIdType SMESH_Mesh_i::NbPrismsOfOrder(SMESH::ElementOrder order) { Unexpect aCatch(SALOME_SalomeException); if ( _preMeshInfo ) @@ -4713,7 +4917,7 @@ CORBA::Long SMESH_Mesh_i::NbPrismsOfOrder(SMESH::ElementOrder order) */ //============================================================================= -CORBA::Long SMESH_Mesh_i::NbSubMesh() +SMESH::smIdType SMESH_Mesh_i::NbSubMesh() { Unexpect aCatch(SALOME_SalomeException); return _mapSubMesh_i.size(); @@ -4738,7 +4942,7 @@ char* SMESH_Mesh_i::Dump() */ //============================================================================= -SMESH::long_array* SMESH_Mesh_i::GetIDs() +SMESH::smIdType_array* SMESH_Mesh_i::GetIDs() { return GetElementsId(); } @@ -4749,22 +4953,22 @@ SMESH::long_array* SMESH_Mesh_i::GetIDs() */ //============================================================================= -SMESH::long_array* SMESH_Mesh_i::GetElementsId() +SMESH::smIdType_array* SMESH_Mesh_i::GetElementsId() { Unexpect aCatch(SALOME_SalomeException); if ( _preMeshInfo ) _preMeshInfo->FullLoadFromFile(); - SMESH::long_array_var aResult = new SMESH::long_array(); + SMESH::smIdType_array_var aResult = new SMESH::smIdType_array(); SMESHDS_Mesh* aSMESHDS_Mesh = _impl->GetMeshDS(); if ( aSMESHDS_Mesh == NULL ) return aResult._retn(); - long nbElements = NbElements(); + smIdType nbElements = NbElements(); aResult->length( nbElements ); SMDS_ElemIteratorPtr anIt = aSMESHDS_Mesh->elementsIterator(); - for ( int i = 0, n = nbElements; i < n && anIt->more(); i++ ) + for ( smIdType i = 0, n = nbElements; i < n && anIt->more(); i++ ) aResult[i] = anIt->next()->GetID(); return aResult._retn(); @@ -4777,19 +4981,19 @@ SMESH::long_array* SMESH_Mesh_i::GetElementsId() */ //============================================================================= -SMESH::long_array* SMESH_Mesh_i::GetElementsByType( SMESH::ElementType theElemType ) +SMESH::smIdType_array* SMESH_Mesh_i::GetElementsByType( SMESH::ElementType theElemType ) { Unexpect aCatch(SALOME_SalomeException); if ( _preMeshInfo ) _preMeshInfo->FullLoadFromFile(); - SMESH::long_array_var aResult = new SMESH::long_array(); + SMESH::smIdType_array_var aResult = new SMESH::smIdType_array(); SMESHDS_Mesh* aSMESHDS_Mesh = _impl->GetMeshDS(); if ( aSMESHDS_Mesh == NULL ) return aResult._retn(); - long nbElements = NbElements(); + smIdType nbElements = NbElements(); // No sense in returning ids of elements along with ids of nodes: // when theElemType == SMESH::ALL, return node ids only if @@ -4799,7 +5003,7 @@ SMESH::long_array* SMESH_Mesh_i::GetElementsByType( SMESH::ElementType theElemTy aResult->length( nbElements ); - int i = 0; + smIdType i = 0; SMDS_ElemIteratorPtr anIt = aSMESHDS_Mesh->elementsIterator( (SMDSAbs_ElementType)theElemType ); while ( i < nbElements && anIt->more() ) @@ -4816,22 +5020,22 @@ SMESH::long_array* SMESH_Mesh_i::GetElementsByType( SMESH::ElementType theElemTy */ //============================================================================= -SMESH::long_array* SMESH_Mesh_i::GetNodesId() +SMESH::smIdType_array* SMESH_Mesh_i::GetNodesId() { Unexpect aCatch(SALOME_SalomeException); if ( _preMeshInfo ) _preMeshInfo->FullLoadFromFile(); - SMESH::long_array_var aResult = new SMESH::long_array(); + SMESH::smIdType_array_var aResult = new SMESH::smIdType_array(); SMESHDS_Mesh* aMeshDS = _impl->GetMeshDS(); if ( aMeshDS == NULL ) return aResult._retn(); - long nbNodes = NbNodes(); + smIdType nbNodes = NbNodes(); aResult->length( nbNodes ); SMDS_NodeIteratorPtr anIt = aMeshDS->nodesIterator(); - for ( int i = 0, n = nbNodes; i < n && anIt->more(); i++ ) + for ( smIdType i = 0, n = nbNodes; i < n && anIt->more(); i++ ) aResult[i] = anIt->next()->GetID(); return aResult._retn(); @@ -4843,7 +5047,7 @@ SMESH::long_array* SMESH_Mesh_i::GetNodesId() */ //============================================================================= -SMESH::ElementType SMESH_Mesh_i::GetElementType( const CORBA::Long id, const bool iselem ) +SMESH::ElementType SMESH_Mesh_i::GetElementType( const SMESH::smIdType id, const bool iselem ) { SMESH::ElementType type = SMESH::ALL; SMESH_TRY; @@ -4864,7 +5068,7 @@ SMESH::ElementType SMESH_Mesh_i::GetElementType( const CORBA::Long id, const boo */ //============================================================================= -SMESH::EntityType SMESH_Mesh_i::GetElementGeomType( const CORBA::Long id ) +SMESH::EntityType SMESH_Mesh_i::GetElementGeomType( const SMESH::smIdType id ) { if ( _preMeshInfo ) _preMeshInfo->FullLoadFromFile(); @@ -4882,7 +5086,7 @@ SMESH::EntityType SMESH_Mesh_i::GetElementGeomType( const CORBA::Long id ) */ //============================================================================= -SMESH::GeometryType SMESH_Mesh_i::GetElementShape( const CORBA::Long id ) +SMESH::GeometryType SMESH_Mesh_i::GetElementShape( const SMESH::smIdType id ) { if ( _preMeshInfo ) _preMeshInfo->FullLoadFromFile(); @@ -4900,9 +5104,9 @@ SMESH::GeometryType SMESH_Mesh_i::GetElementShape( const CORBA::Long id ) */ //============================================================================= -SMESH::long_array* SMESH_Mesh_i::GetSubMeshElementsId(const CORBA::Long ShapeID) +SMESH::smIdType_array* SMESH_Mesh_i::GetSubMeshElementsId(const CORBA::Long ShapeID) { - SMESH::long_array_var aResult = new SMESH::long_array(); + SMESH::smIdType_array_var aResult = new SMESH::smIdType_array(); SMESH_TRY; if ( _preMeshInfo ) @@ -4917,7 +5121,7 @@ SMESH::long_array* SMESH_Mesh_i::GetSubMeshElementsId(const CORBA::Long ShapeID) aResult->length(SDSM->NbElements()); SMDS_ElemIteratorPtr eIt = SDSM->GetElements(); - int i = 0; + smIdType i = 0; while ( eIt->more() ) { aResult[i++] = eIt->next()->GetID(); } @@ -4935,10 +5139,10 @@ SMESH::long_array* SMESH_Mesh_i::GetSubMeshElementsId(const CORBA::Long ShapeID) */ //============================================================================= -SMESH::long_array* SMESH_Mesh_i::GetSubMeshNodesId(const CORBA::Long ShapeID, +SMESH::smIdType_array* SMESH_Mesh_i::GetSubMeshNodesId(const CORBA::Long ShapeID, CORBA::Boolean all) { - SMESH::long_array_var aResult = new SMESH::long_array(); + SMESH::smIdType_array_var aResult = new SMESH::smIdType_array(); SMESH_TRY; if ( _preMeshInfo ) @@ -4950,7 +5154,7 @@ SMESH::long_array* SMESH_Mesh_i::GetSubMeshNodesId(const CORBA::Long ShapeID, SMESHDS_SubMesh* SDSM = SM->GetSubMeshDS(); if(!SDSM) return aResult._retn(); - set theElems; + set theElems; if( !all || (SDSM->NbElements()==0) ) { // internal nodes or vertex submesh SMDS_NodeIteratorPtr nIt = SDSM->GetNodes(); while ( nIt->more() ) { @@ -4971,8 +5175,8 @@ SMESH::long_array* SMESH_Mesh_i::GetSubMeshNodesId(const CORBA::Long ShapeID, } aResult->length(theElems.size()); - set::iterator itElem; - int i = 0; + set::iterator itElem; + smIdType i = 0; for ( itElem = theElems.begin(); itElem != theElems.end(); itElem++ ) aResult[i++] = *itElem; @@ -5027,7 +5231,7 @@ CORBA::LongLong SMESH_Mesh_i::GetMeshPtr() _preMeshInfo->FullLoadFromFile(); CORBA::LongLong pointeur = CORBA::LongLong(_impl); - if ( MYDEBUG ) MESSAGE("CORBA::LongLong SMESH_Mesh_i::GetMeshPtr() "<FullLoadFromFile(); @@ -5070,13 +5274,13 @@ SMESH::double_array* SMESH_Mesh_i::GetNodeXYZ(const CORBA::Long id) */ //============================================================================= -SMESH::long_array* SMESH_Mesh_i::GetNodeInverseElements(const CORBA::Long id, - SMESH::ElementType elemType) +SMESH::smIdType_array* SMESH_Mesh_i::GetNodeInverseElements(const SMESH::smIdType id, + SMESH::ElementType elemType) { if ( _preMeshInfo ) _preMeshInfo->FullLoadFromFile(); - SMESH::long_array_var aResult = new SMESH::long_array(); + SMESH::smIdType_array_var aResult = new SMESH::smIdType_array(); SMESHDS_Mesh* aMeshDS = _impl->GetMeshDS(); if ( aMeshDS == NULL ) return aResult._retn(); @@ -5090,7 +5294,7 @@ SMESH::long_array* SMESH_Mesh_i::GetNodeInverseElements(const CORBA::Long id, SMDSAbs_ElementType type = SMDSAbs_ElementType( elemType ); SMDS_ElemIteratorPtr eIt = aNode->GetInverseElementIterator( type ); aResult->length( aNode->NbInverseElements( type )); - for( int i = 0; eIt->more(); ++i ) + for( smIdType i = 0; eIt->more(); ++i ) { const SMDS_MeshElement* elem = eIt->next(); aResult[ i ] = elem->GetID(); @@ -5104,7 +5308,7 @@ SMESH::long_array* SMESH_Mesh_i::GetNodeInverseElements(const CORBA::Long id, */ //============================================================================= -SMESH::NodePosition* SMESH_Mesh_i::GetNodePosition(CORBA::Long NodeID) +SMESH::NodePosition* SMESH_Mesh_i::GetNodePosition(SMESH::smIdType NodeID) { if ( _preMeshInfo ) _preMeshInfo->FullLoadFromFile(); @@ -5157,7 +5361,7 @@ SMESH::NodePosition* SMESH_Mesh_i::GetNodePosition(CORBA::Long NodeID) */ //============================================================================= -SMESH::ElementPosition SMESH_Mesh_i::GetElementPosition(CORBA::Long ElemID) +SMESH::ElementPosition SMESH_Mesh_i::GetElementPosition(SMESH::smIdType ElemID) { if ( _preMeshInfo ) _preMeshInfo->FullLoadFromFile(); @@ -5204,7 +5408,7 @@ SMESH::ElementPosition SMESH_Mesh_i::GetElementPosition(CORBA::Long ElemID) */ //============================================================================= -CORBA::Long SMESH_Mesh_i::GetShapeID(const CORBA::Long id) +CORBA::Long SMESH_Mesh_i::GetShapeID(const SMESH::smIdType id) { if ( _preMeshInfo ) _preMeshInfo->FullLoadFromFile(); @@ -5231,7 +5435,7 @@ CORBA::Long SMESH_Mesh_i::GetShapeID(const CORBA::Long id) */ //============================================================================= -CORBA::Long SMESH_Mesh_i::GetShapeIDForElem(const CORBA::Long id) +CORBA::Long SMESH_Mesh_i::GetShapeIDForElem(const SMESH::smIdType id) { if ( _preMeshInfo ) _preMeshInfo->FullLoadFromFile(); @@ -5261,7 +5465,7 @@ CORBA::Long SMESH_Mesh_i::GetShapeIDForElem(const CORBA::Long id) */ //============================================================================= -CORBA::Long SMESH_Mesh_i::GetElemNbNodes(const CORBA::Long id) +CORBA::Short SMESH_Mesh_i::GetElemNbNodes(const SMESH::smIdType id) { if ( _preMeshInfo ) _preMeshInfo->FullLoadFromFile(); @@ -5283,7 +5487,7 @@ CORBA::Long SMESH_Mesh_i::GetElemNbNodes(const CORBA::Long id) */ //============================================================================= -CORBA::Long SMESH_Mesh_i::GetElemNode(const CORBA::Long id, const CORBA::Long index) +SMESH::smIdType SMESH_Mesh_i::GetElemNode(const SMESH::smIdType id, const CORBA::Short index) { if ( _preMeshInfo ) _preMeshInfo->FullLoadFromFile(); @@ -5302,12 +5506,12 @@ CORBA::Long SMESH_Mesh_i::GetElemNode(const CORBA::Long id, const CORBA::Long in */ //============================================================================= -SMESH::long_array* SMESH_Mesh_i::GetElemNodes(const CORBA::Long id) +SMESH::smIdType_array* SMESH_Mesh_i::GetElemNodes(const SMESH::smIdType id) { if ( _preMeshInfo ) _preMeshInfo->FullLoadFromFile(); - SMESH::long_array_var aResult = new SMESH::long_array(); + SMESH::smIdType_array_var aResult = new SMESH::smIdType_array(); if ( SMESHDS_Mesh* aMeshDS = _impl->GetMeshDS() ) { if ( const SMDS_MeshElement* elem = aMeshDS->FindElement(id) ) @@ -5328,7 +5532,7 @@ SMESH::long_array* SMESH_Mesh_i::GetElemNodes(const CORBA::Long id) */ //============================================================================= -CORBA::Boolean SMESH_Mesh_i::IsMediumNode(const CORBA::Long ide, const CORBA::Long idn) +CORBA::Boolean SMESH_Mesh_i::IsMediumNode(const SMESH::smIdType ide, const SMESH::smIdType idn) { if ( _preMeshInfo ) _preMeshInfo->FullLoadFromFile(); @@ -5353,7 +5557,7 @@ CORBA::Boolean SMESH_Mesh_i::IsMediumNode(const CORBA::Long ide, const CORBA::Lo */ //============================================================================= -CORBA::Boolean SMESH_Mesh_i::IsMediumNodeOfAnyElem(const CORBA::Long idn, +CORBA::Boolean SMESH_Mesh_i::IsMediumNodeOfAnyElem(const SMESH::smIdType idn, SMESH::ElementType theElemType) { if ( _preMeshInfo ) @@ -5384,7 +5588,7 @@ CORBA::Boolean SMESH_Mesh_i::IsMediumNodeOfAnyElem(const CORBA::Long idn, */ //============================================================================= -CORBA::Long SMESH_Mesh_i::ElemNbEdges(const CORBA::Long id) +CORBA::Long SMESH_Mesh_i::ElemNbEdges(const SMESH::smIdType id) { if ( _preMeshInfo ) _preMeshInfo->FullLoadFromFile(); @@ -5403,7 +5607,7 @@ CORBA::Long SMESH_Mesh_i::ElemNbEdges(const CORBA::Long id) */ //============================================================================= -CORBA::Long SMESH_Mesh_i::ElemNbFaces(const CORBA::Long id) +CORBA::Long SMESH_Mesh_i::ElemNbFaces(const SMESH::smIdType id) { if ( _preMeshInfo ) _preMeshInfo->FullLoadFromFile(); @@ -5421,13 +5625,13 @@ CORBA::Long SMESH_Mesh_i::ElemNbFaces(const CORBA::Long id) */ //================================================================================ -SMESH::long_array* SMESH_Mesh_i::GetElemFaceNodes(CORBA::Long elemId, - CORBA::Short faceIndex) +SMESH::smIdType_array* SMESH_Mesh_i::GetElemFaceNodes(SMESH::smIdType elemId, + CORBA::Short faceIndex) { if ( _preMeshInfo ) _preMeshInfo->FullLoadFromFile(); - SMESH::long_array_var aResult = new SMESH::long_array(); + SMESH::smIdType_array_var aResult = new SMESH::smIdType_array(); if ( SMESHDS_Mesh* aMeshDS = _impl->GetMeshDS() ) { if ( const SMDS_MeshElement* elem = aMeshDS->FindElement(elemId) ) @@ -5479,7 +5683,7 @@ SMESH::double_array* SMESH_Mesh_i::GetFaceNormal(CORBA::Long elemId, */ //================================================================================ -CORBA::Long SMESH_Mesh_i::FindElementByNodes(const SMESH::long_array& nodes) +SMESH::smIdType SMESH_Mesh_i::FindElementByNodes(const SMESH::smIdType_array& nodes) { if ( _preMeshInfo ) _preMeshInfo->FullLoadFromFile(); @@ -5509,13 +5713,13 @@ CORBA::Long SMESH_Mesh_i::FindElementByNodes(const SMESH::long_array& nodes) */ //================================================================================ -SMESH::long_array* SMESH_Mesh_i::GetElementsByNodes(const SMESH::long_array& nodes, - SMESH::ElementType elemType) +SMESH::smIdType_array* SMESH_Mesh_i::GetElementsByNodes(const SMESH::smIdType_array& nodes, + SMESH::ElementType elemType) { if ( _preMeshInfo ) _preMeshInfo->FullLoadFromFile(); - SMESH::long_array_var result = new SMESH::long_array(); + SMESH::smIdType_array_var result = new SMESH::smIdType_array(); if ( SMESHDS_Mesh* mesh = _impl->GetMeshDS() ) { @@ -5538,7 +5742,7 @@ SMESH::long_array* SMESH_Mesh_i::GetElementsByNodes(const SMESH::long_array& nod */ //============================================================================= -CORBA::Boolean SMESH_Mesh_i::IsPoly(const CORBA::Long id) +CORBA::Boolean SMESH_Mesh_i::IsPoly(const SMESH::smIdType id) { if ( _preMeshInfo ) _preMeshInfo->FullLoadFromFile(); @@ -5557,7 +5761,7 @@ CORBA::Boolean SMESH_Mesh_i::IsPoly(const CORBA::Long id) */ //============================================================================= -CORBA::Boolean SMESH_Mesh_i::IsQuadratic(const CORBA::Long id) +CORBA::Boolean SMESH_Mesh_i::IsQuadratic(const SMESH::smIdType id) { if ( _preMeshInfo ) _preMeshInfo->FullLoadFromFile(); @@ -5575,7 +5779,7 @@ CORBA::Boolean SMESH_Mesh_i::IsQuadratic(const CORBA::Long id) */ //============================================================================= -CORBA::Double SMESH_Mesh_i::GetBallDiameter(CORBA::Long id) +CORBA::Double SMESH_Mesh_i::GetBallDiameter(SMESH::smIdType id) { if ( _preMeshInfo ) _preMeshInfo->FullLoadFromFile(); @@ -5593,7 +5797,7 @@ CORBA::Double SMESH_Mesh_i::GetBallDiameter(CORBA::Long id) */ //============================================================================= -SMESH::double_array* SMESH_Mesh_i::BaryCenter(const CORBA::Long id) +SMESH::double_array* SMESH_Mesh_i::BaryCenter(const SMESH::smIdType id) { if ( _preMeshInfo ) _preMeshInfo->FullLoadFromFile(); @@ -5769,8 +5973,7 @@ void SMESH_Mesh_i::CreateGroupServants() // register CORBA object for persistence int nextId = _gen_i->RegisterObject( groupVar ); - if(MYDEBUG) { MESSAGE( "Add group to map with id = "<< nextId); } - else { (void)nextId; } // avoid "unused variable" warning in release mode + MESSAGE( "Add group to map with id = "<< nextId); // publishing the groups in the study GEOM::GEOM_Object_var shapeVar = _gen_i->ShapeToGeomObject( shape ); @@ -5801,7 +6004,7 @@ void SMESH_Mesh_i::CreateGroupServants() */ //============================================================================= -bool SMESH_Mesh_i::IsComputedOK() +CORBA::Boolean SMESH_Mesh_i::IsComputedOK() { return _impl->IsComputedOK(); } @@ -6008,8 +6211,8 @@ SMESH::SMESH_Mesh_ptr SMESH_Mesh_i::GetMesh() /*! * \brief Return false if GetMeshInfo() return incorrect information that may * happen if mesh data is not yet fully loaded from the file of study. - * - * + * + * */ //================================================================================ @@ -6024,12 +6227,12 @@ bool SMESH_Mesh_i::IsMeshInfoCorrect() */ //============================================================================= -SMESH::long_array* SMESH_Mesh_i::GetMeshInfo() +SMESH::smIdType_array* SMESH_Mesh_i::GetMeshInfo() { if ( _preMeshInfo ) return _preMeshInfo->GetMeshInfo(); - SMESH::long_array_var aRes = new SMESH::long_array(); + SMESH::smIdType_array_var aRes = new SMESH::smIdType_array(); aRes->length(SMESH::Entity_Last); for (int i = SMESH::Entity_Node; i < SMESH::Entity_Last; i++) aRes[i] = 0; @@ -6048,11 +6251,11 @@ SMESH::long_array* SMESH_Mesh_i::GetMeshInfo() */ //============================================================================= -SMESH::long_array* SMESH_Mesh_i::GetNbElementsByType() +SMESH::smIdType_array* SMESH_Mesh_i::GetNbElementsByType() { - SMESH::long_array_var aRes = new SMESH::long_array(); + SMESH::smIdType_array_var aRes = new SMESH::smIdType_array(); aRes->length(SMESH::NB_ELEMENT_TYPES); - for (int i = 0; i < SMESH::NB_ELEMENT_TYPES; i++) + for (smIdType i = 0; i < SMESH::NB_ELEMENT_TYPES; i++) aRes[ i ] = 0; const SMDS_MeshInfo* meshInfo = 0; @@ -6062,7 +6265,7 @@ SMESH::long_array* SMESH_Mesh_i::GetNbElementsByType() meshInfo = & meshDS->GetMeshInfo(); if (meshInfo) - for (int i = 0; i < SMESH::NB_ELEMENT_TYPES; i++) + for (smIdType i = 0; i < SMESH::NB_ELEMENT_TYPES; i++) aRes[i] = meshInfo->NbElements((SMDSAbs_ElementType)i); return aRes._retn(); @@ -6075,7 +6278,7 @@ SMESH::long_array* SMESH_Mesh_i::GetNbElementsByType() //============================================================================= void SMESH_Mesh_i::CollectMeshInfo(const SMDS_ElemIteratorPtr theItr, - SMESH::long_array& theInfo) + SMESH::smIdType_array& theInfo) { if (!theItr) return; while (theItr->more()) @@ -6155,25 +6358,25 @@ namespace /* Iterators used in SMESH_Mesh_i::GetElements(SMESH::SMESH_IDSource_v //----------------------------------------------------------------------------- struct IDSourceIterator : public SMDS_ElemIterator { - const CORBA::Long* _idPtr; - const CORBA::Long* _idEndPtr; - SMESH::long_array_var _idArray; - const SMDS_Mesh* _mesh; - const SMDSAbs_ElementType _type; - const SMDS_MeshElement* _elem; - - IDSourceIterator( const SMDS_Mesh* mesh, - const CORBA::Long* ids, - const int nbIds, - SMDSAbs_ElementType type): + const SMESH::smIdType* _idPtr; + const SMESH::smIdType* _idEndPtr; + SMESH::smIdType_array_var _idArray; + const SMDS_Mesh* _mesh; + const SMDSAbs_ElementType _type; + const SMDS_MeshElement* _elem; + + IDSourceIterator( const SMDS_Mesh* mesh, + const SMESH::smIdType* ids, + const smIdType nbIds, + SMDSAbs_ElementType type): _idPtr( ids ), _idEndPtr( ids + nbIds ), _mesh( mesh ), _type( type ), _elem( 0 ) { if ( _idPtr && nbIds && _mesh ) next(); } - IDSourceIterator( const SMDS_Mesh* mesh, - SMESH::long_array* idArray, - SMDSAbs_ElementType type): + IDSourceIterator( const SMDS_Mesh* mesh, + SMESH::smIdType_array* idArray, + SMDSAbs_ElementType type): _idPtr( 0 ), _idEndPtr( 0 ), _idArray( idArray), _mesh( mesh ), _type( type ), _elem( 0 ) { if ( idArray && _mesh ) @@ -6324,13 +6527,13 @@ SMDS_ElemIteratorPtr SMESH_Mesh_i::GetElements(SMESH::SMESH_IDSource_ptr theObje SMDSAbs_ElementType iterType = isNodes ? SMDSAbs_Node : elemType; if ( SMESH_MeshEditor_i::IsTemporaryIDSource( theObject )) { - int nbIds; - if ( CORBA::Long* ids = SMESH_MeshEditor_i::GetTemporaryIDs( theObject, nbIds )) + SMESH::smIdType nbIds; + if ( SMESH::smIdType* ids = SMESH_MeshEditor_i::GetTemporaryIDs( theObject, nbIds )) elemIt = SMDS_ElemIteratorPtr( new IDSourceIterator( meshDS, ids, nbIds, iterType )); } else { - SMESH::long_array_var ids = theObject->GetIDs(); + SMESH::smIdType_array_var ids = theObject->GetIDs(); elemIt = SMDS_ElemIteratorPtr( new IDSourceIterator( meshDS, ids._retn(), iterType )); } typeOK = ( isNodes == ( elemType == SMDSAbs_Node )) || ( elemType == SMDSAbs_All ); @@ -6875,6 +7078,7 @@ TListOfListOfInt SMESH_Mesh_i::findConcurrentSubMeshes() return res; } + //============================================================================= /*! * \brief Convert submesh ids into submesh interfaces @@ -6978,7 +7182,7 @@ SMESH_MeshPartDS::SMESH_MeshPartDS(SMESH::SMESH_IDSource_ptr meshPart): else { TMeshInfo tmpInfo; - SMESH::long_array_var anIDs = meshPart->GetIDs(); + SMESH::smIdType_array_var anIDs = meshPart->GetIDs(); SMESH::array_of_ElementType_var types = meshPart->GetTypes(); if ( types->length() == 1 && types[0] == SMESH::NODE ) // group of nodes { @@ -7057,35 +7261,35 @@ bool SMESH_MeshPartDS::HasNumerationHoles() MaxElementID() != NbElements() ); } // ------------------------------------------------------------------------------------- -int SMESH_MeshPartDS::MaxNodeID() const +smIdType SMESH_MeshPartDS::MaxNodeID() const { if ( _meshDS ) return _meshDS->MaxNodeID(); return NbNodes() == 0 ? 0 : (*_elements[ SMDSAbs_Node ].rbegin())->GetID(); } // ------------------------------------------------------------------------------------- -int SMESH_MeshPartDS::MinNodeID() const +smIdType SMESH_MeshPartDS::MinNodeID() const { if ( _meshDS ) return _meshDS->MinNodeID(); return NbNodes() == 0 ? 0 : (*_elements[ SMDSAbs_Node ].begin())->GetID(); -} +} // ------------------------------------------------------------------------------------- -int SMESH_MeshPartDS::MaxElementID() const +smIdType SMESH_MeshPartDS::MaxElementID() const { if ( _meshDS ) return _meshDS->MaxElementID(); - int maxID = 0; + smIdType maxID = 0; for ( int iType = SMDSAbs_Edge; iType < SMDSAbs_NbElementTypes; ++iType ) if ( !_elements[ iType ].empty() ) - maxID = Max( maxID, (*_elements[ iType ].rbegin())->GetID() ); + maxID = std::max( maxID, (*_elements[ iType ].rbegin())->GetID() ); return maxID; } // ------------------------------------------------------------------------------------- -int SMESH_MeshPartDS::MinElementID() const +smIdType SMESH_MeshPartDS::MinElementID() const { if ( _meshDS ) return _meshDS->MinElementID(); - int minID = 0; + smIdType minID = 0; for ( int iType = SMDSAbs_Edge; iType < SMDSAbs_NbElementTypes; ++iType ) if ( !_elements[ iType ].empty() ) - minID = Min( minID, (*_elements[ iType ].begin())->GetID() ); + minID = std::min( minID, (*_elements[ iType ].begin())->GetID() ); return minID; } // -------------------------------------------------------------------------------------