X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FSMDS%2FSMDS_Mesh.cxx;h=d70ff4bcdf59aebdf0e0fbcaf26a83f0033fae89;hb=7ea81bbe6e068500dbaf7ff693dd05f33b974c53;hp=95871d37af7bfc9a1282fe0a4fadd1014c0a8e81;hpb=dd0d39d752a4d5ba58ed2e417651093764bb8d09;p=modules%2Fsmesh.git diff --git a/src/SMDS/SMDS_Mesh.cxx b/src/SMDS/SMDS_Mesh.cxx index 95871d37a..d70ff4bcd 100644 --- a/src/SMDS/SMDS_Mesh.cxx +++ b/src/SMDS/SMDS_Mesh.cxx @@ -130,7 +130,6 @@ SMDS_Mesh::SMDS_Mesh(): myNodeIDFactory(new SMDS_MeshNodeIDFactory()), myElementIDFactory(new SMDS_MeshElementIDFactory()), myModified(false), myModifTime(0), myCompactTime(0), - myNodeMin(0), myNodeMax(0), myHasConstructionEdges(false), myHasConstructionFaces(false), myHasInverseElements(true), xmin(0), xmax(0), ymin(0), ymax(0), zmin(0), zmax(0) @@ -160,7 +159,7 @@ SMDS_Mesh::SMDS_Mesh(): points->SetNumberOfPoints(0 /*SMDS_Mesh::chunkSize*/); myGrid->SetPoints( points ); points->Delete(); - myGrid->BuildLinks(); + //myGrid->BuildLinks(); this->Modified(); // initialize static maps in SMDS_MeshCell, to be thread-safe @@ -2672,52 +2671,26 @@ SMDS_Mesh::~SMDS_Mesh() void SMDS_Mesh::Clear() { if (myParent!=NULL) - { + { SMDS_ElemIteratorPtr eIt = elementsIterator(); while ( eIt->more() ) - { - const SMDS_MeshElement *elem = eIt->next(); - myElementIDFactory->ReleaseID(elem->GetID(), elem->getVtkId()); - } + { + const SMDS_MeshElement *elem = eIt->next(); + myElementIDFactory->ReleaseID(elem->GetID(), elem->getVtkId()); + } SMDS_NodeIteratorPtr itn = nodesIterator(); while (itn->more()) - { - const SMDS_MeshNode *node = itn->next(); - myNodeIDFactory->ReleaseID(node->GetID(), node->getVtkId()); - } + { + const SMDS_MeshNode *node = itn->next(); + myNodeIDFactory->ReleaseID(node->GetID(), node->getVtkId()); } + } else - { + { myNodeIDFactory->Clear(); myElementIDFactory->Clear(); - } + } - // SMDS_ElemIteratorPtr itv = elementsIterator(); - // while (itv->more()) - // { - // SMDS_MeshElement* elem = (SMDS_MeshElement*)(itv->next()); - // SMDSAbs_ElementType aType = elem->GetType(); - // switch (aType) - // { - // case SMDSAbs_0DElement: - // delete elem; - // break; - // case SMDSAbs_Edge: - // myEdgePool->destroy(static_cast(elem)); - // break; - // case SMDSAbs_Face: - // myFacePool->destroy(static_cast(elem)); - // break; - // case SMDSAbs_Volume: - // myVolumePool->destroy(static_cast(elem)); - // break; - // case SMDSAbs_Ball: - // myBallPool->destroy(static_cast(elem)); - // break; - // default: - // break; - // } - // } myVolumePool->clear(); myFacePool->clear(); myEdgePool->clear(); @@ -2728,11 +2701,11 @@ void SMDS_Mesh::Clear() SMDS_NodeIteratorPtr itn = nodesIterator(); while (itn->more()) - { - SMDS_MeshNode *node = (SMDS_MeshNode*)(itn->next()); - node->SetPosition(SMDS_SpacePosition::originSpacePosition()); - //myNodePool->destroy(node); - } + { + SMDS_MeshNode *node = (SMDS_MeshNode*)(itn->next()); + node->SetPosition(SMDS_SpacePosition::originSpacePosition()); + //myNodePool->destroy(node); + } myNodePool->clear(); clearVector( myNodes ); @@ -2754,10 +2727,10 @@ void SMDS_Mesh::Clear() // rnv: to fix bug "21125: EDF 1233 SMESH: Degrardation of precision in a test case for quadratic conversion" // using double type for storing coordinates of nodes instead float. points->SetDataType(VTK_DOUBLE); - points->SetNumberOfPoints(0 /*SMDS_Mesh::chunkSize*/); + points->SetNumberOfPoints( 0 ); myGrid->SetPoints( points ); points->Delete(); - myGrid->BuildLinks(); + myGrid->DeleteLinks(); } /////////////////////////////////////////////////////////////////////////////// @@ -2767,7 +2740,7 @@ void SMDS_Mesh::Clear() /////////////////////////////////////////////////////////////////////////////// bool SMDS_Mesh::hasConstructionEdges() { - return myHasConstructionEdges; + return myHasConstructionEdges; } /////////////////////////////////////////////////////////////////////////////// @@ -2779,7 +2752,7 @@ bool SMDS_Mesh::hasConstructionEdges() /////////////////////////////////////////////////////////////////////////////// bool SMDS_Mesh::hasConstructionFaces() { - return myHasConstructionFaces; + return myHasConstructionFaces; } /////////////////////////////////////////////////////////////////////////////// @@ -2788,7 +2761,7 @@ bool SMDS_Mesh::hasConstructionFaces() /////////////////////////////////////////////////////////////////////////////// bool SMDS_Mesh::hasInverseElements() { - return myHasInverseElements; + return myHasInverseElements; } /////////////////////////////////////////////////////////////////////////////// @@ -2797,7 +2770,7 @@ bool SMDS_Mesh::hasInverseElements() /////////////////////////////////////////////////////////////////////////////// void SMDS_Mesh::setConstructionEdges(bool b) { - myHasConstructionEdges=b; + myHasConstructionEdges=b; } /////////////////////////////////////////////////////////////////////////////// @@ -2806,7 +2779,7 @@ void SMDS_Mesh::setConstructionEdges(bool b) /////////////////////////////////////////////////////////////////////////////// void SMDS_Mesh::setConstructionFaces(bool b) { - myHasConstructionFaces=b; + myHasConstructionFaces=b; } /////////////////////////////////////////////////////////////////////////////// @@ -3424,7 +3397,7 @@ void SMDS_Mesh::RemoveFreeElement(const SMDS_MeshElement * elem) */ bool SMDS_Mesh::Contains (const SMDS_MeshElement* elem) const { - // we should not imply on validity of *elem, so iterate on containers + // we should not rely on validity of *elem, so iterate on containers // of all types in the hope of finding somewhere there SMDS_NodeIteratorPtr itn = nodesIterator(); while (itn->more()) @@ -3444,7 +3417,7 @@ bool SMDS_Mesh::Contains (const SMDS_MeshElement* elem) const int SMDS_Mesh::MaxNodeID() const { - return myNodeMax; + return myNodeIDFactory->GetMaxID(); } //======================================================================= @@ -3454,7 +3427,7 @@ int SMDS_Mesh::MaxNodeID() const int SMDS_Mesh::MinNodeID() const { - return myNodeMin; + return myNodeIDFactory->GetMinID(); } //======================================================================= @@ -4632,44 +4605,6 @@ SMDS_MeshVolume* SMDS_Mesh::AddVolumeWithID(const SMDS_MeshNode * n1, return volvtk; } - -void SMDS_Mesh::updateNodeMinMax() -{ - myNodeMin = 0; - if (myNodes.size() == 0) - { - myNodeMax=0; - return; - } - while ( !myNodes[myNodeMin] && myNodeMin < (int)myNodes.size() ) - myNodeMin++; - myNodeMax=myNodes.size()-1; - while (!myNodes[myNodeMax] && (myNodeMin>=0)) - myNodeMin--; -} - -void SMDS_Mesh::incrementNodesCapacity(int nbNodes) -{ -// int val = myCellIdSmdsToVtk.size(); -// MESSAGE(" ------------------- resize myCellIdSmdsToVtk " << val << " --> " << val + nbNodes); -// myCellIdSmdsToVtk.resize(val + nbNodes, -1); // fill new elements with -1 - int val = myNodes.size(); - myNodes.resize(val +nbNodes, 0); -} - -void SMDS_Mesh::incrementCellsCapacity(int nbCells) -{ - int val = myCellIdVtkToSmds.size(); - myCellIdVtkToSmds.resize(val + nbCells, -1); // fill new elements with -1 - val = myCells.size(); - myNodes.resize(val +nbCells, 0); -} - -void SMDS_Mesh::adjustStructure() -{ - myGrid->GetPoints()->GetData()->SetNumberOfTuples(myNodeIDFactory->GetMaxID()); -} - void SMDS_Mesh::dumpGrid(string ficdump) { // vtkUnstructuredGridWriter* aWriter = vtkUnstructuredGridWriter::New(); @@ -4702,7 +4637,7 @@ void SMDS_Mesh::dumpGrid(string ficdump) ficcon << endl; } ficcon << "-------------------------------- connectivity " << nbPoints << endl; - vtkCellLinks *links = myGrid->GetCellLinks(); + vtkCellLinks *links = myGrid->GetLinks(); for (int i=0; iGetNcells(i); @@ -4711,8 +4646,8 @@ void SMDS_Mesh::dumpGrid(string ficdump) for (int j=0; jmyCompactTime = this->myModifTime; } int SMDS_Mesh::fromVtkToSmds(int vtkid) @@ -4730,28 +4665,28 @@ int SMDS_Mesh::fromVtkToSmds(int vtkid) throw SALOME_Exception(LOCALIZED ("vtk id out of bounds")); } -void SMDS_Mesh::updateBoundingBox() -{ - xmin = 0; xmax = 0; - ymin = 0; ymax = 0; - zmin = 0; zmax = 0; - vtkPoints *points = myGrid->GetPoints(); - int myNodesSize = this->myNodes.size(); - for (int i = 0; i < myNodesSize; i++) - { - if (SMDS_MeshNode *n = myNodes[i]) - { - double coords[3]; - points->GetPoint(n->myVtkID, coords); - if (coords[0] < xmin) xmin = coords[0]; - else if (coords[0] > xmax) xmax = coords[0]; - if (coords[1] < ymin) ymin = coords[1]; - else if (coords[1] > ymax) ymax = coords[1]; - if (coords[2] < zmin) zmin = coords[2]; - else if (coords[2] > zmax) zmax = coords[2]; - } - } -} +// void SMDS_Mesh::updateBoundingBox() +// { +// xmin = 0; xmax = 0; +// ymin = 0; ymax = 0; +// zmin = 0; zmax = 0; +// vtkPoints *points = myGrid->GetPoints(); +// int myNodesSize = this->myNodes.size(); +// for (int i = 0; i < myNodesSize; i++) +// { +// if (SMDS_MeshNode *n = myNodes[i]) +// { +// double coords[3]; +// points->GetPoint(n->myVtkID, coords); +// if (coords[0] < xmin) xmin = coords[0]; +// else if (coords[0] > xmax) xmax = coords[0]; +// if (coords[1] < ymin) ymin = coords[1]; +// else if (coords[1] > ymax) ymax = coords[1]; +// if (coords[2] < zmin) zmin = coords[2]; +// else if (coords[2] > zmax) zmax = coords[2]; +// } +// } +// } double SMDS_Mesh::getMaxDim() { @@ -4773,17 +4708,12 @@ void SMDS_Mesh::Modified() } //! get last modification timeStamp -unsigned long SMDS_Mesh::GetMTime() const +vtkMTimeType SMDS_Mesh::GetMTime() const { return this->myModifTime; } bool SMDS_Mesh::isCompacted() { - if (this->myModifTime > this->myCompactTime) - { - this->myCompactTime = this->myModifTime; - return false; - } - return true; + return this->myCompactTime == this->myModifTime; }