X-Git-Url: http://git.salome-platform.org/gitweb/?p=modules%2Fsmesh.git;a=blobdiff_plain;f=src%2FSMDS%2FSMDS_Mesh.cxx;h=ffb2926b9016757bfdf694052d5c2c00f21899bf;hp=74148811fa0e8194e50a0663830cd13d60060a54;hb=21af9b3a2c317f5693f228cd8ed55c2bb44b0a07;hpb=1c1bbf6798782cb24bcab45d519817cff125ae5c diff --git a/src/SMDS/SMDS_Mesh.cxx b/src/SMDS/SMDS_Mesh.cxx index 74148811f..ffb2926b9 100644 --- a/src/SMDS/SMDS_Mesh.cxx +++ b/src/SMDS/SMDS_Mesh.cxx @@ -56,7 +56,7 @@ #include using namespace std; -#ifndef WIN32 +#if !defined WIN32 && !defined __APPLE__ #include #endif @@ -77,7 +77,7 @@ int SMDS_Mesh::chunkSize = 1024; int SMDS_Mesh::CheckMemory(const bool doNotRaise) throw (std::bad_alloc) { -#ifndef WIN32 +#if !defined WIN32 && !defined __APPLE__ struct sysinfo si; int err = sysinfo( &si ); if ( err ) @@ -2570,6 +2570,13 @@ int SMDS_Mesh::NbNodes() const return myInfo.NbNodes(); } +/////////////////////////////////////////////////////////////////////////////// +/// Return the number of elements +/////////////////////////////////////////////////////////////////////////////// +int SMDS_Mesh::NbElements() const +{ + return myInfo.NbElements(); +} /////////////////////////////////////////////////////////////////////////////// /// Return the number of 0D elements /////////////////////////////////////////////////////////////////////////////// @@ -2812,7 +2819,7 @@ namespace { IdSortedIterator(const SMDS_MeshElementIDFactory& fact, const SMDSAbs_ElementType type, // SMDSAbs_All NOT allowed!!! const int totalNb) - :myIDFact( fact ), + :myIDFact( const_cast(fact) ), myID(1), myMaxID( myIDFact.GetMaxID() ),myNbFound(0), myTotalNb( totalNb ), myType( type ), myElem(0) @@ -3322,14 +3329,14 @@ void SMDS_Mesh::RemoveElement(const SMDS_MeshElement * elem, void SMDS_Mesh::RemoveFreeElement(const SMDS_MeshElement * elem) { int elemId = elem->GetID(); - int vtkId = elem->getVtkId(); + int vtkId = elem->getVtkId(); SMDSAbs_ElementType aType = elem->GetType(); - SMDS_MeshElement* todest = (SMDS_MeshElement*)(elem); - if (aType == SMDSAbs_Node) { + SMDS_MeshElement* todest = (SMDS_MeshElement*)(elem); + if ( aType == SMDSAbs_Node ) + { // only free node can be removed by this method const SMDS_MeshNode* n = static_cast(todest); - SMDS_ElemIteratorPtr itFe = n->GetInverseElementIterator(); - if (!itFe->more()) { // free node + if ( n->NbInverseElements() == 0 ) { // free node myNodes[elemId] = 0; myInfo.myNbNodes--; ((SMDS_MeshNode*) n)->SetPosition(SMDS_SpacePosition::originSpacePosition()); @@ -3337,7 +3344,9 @@ void SMDS_Mesh::RemoveFreeElement(const SMDS_MeshElement * elem) myNodePool->destroy(static_cast(todest)); myNodeIDFactory->ReleaseID(elemId, vtkId); } - } else { + } + else + { if (hasConstructionEdges() || hasConstructionFaces()) // this methods is only for meshes without descendants return; @@ -4708,7 +4717,7 @@ void SMDS_Mesh::Modified() } //! get last modification timeStamp -unsigned long SMDS_Mesh::GetMTime() const +vtkMTimeType SMDS_Mesh::GetMTime() const { return this->myModifTime; }