1 // Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
3 // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License.
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // Lesser General Public License for more details.
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
22 // SMESH SMDS : implementaion of Salome mesh data structure
23 // File : SMDS_MeshNodeIDFactory.cxx
24 // Author : Jean-Michel BOULCOURT
28 #pragma warning(disable:4786)
31 #include "SMDS_MeshNodeIDFactory.hxx"
32 #include "SMDS_MeshElement.hxx"
33 #include "SMDS_Mesh.hxx"
35 #include <vtkUnstructuredGrid.h>
36 #include <vtkCellType.h>
40 //=======================================================================
41 //function : SMDS_MeshNodeIDFactory
43 //=======================================================================
44 SMDS_MeshNodeIDFactory::SMDS_MeshNodeIDFactory() :
45 SMDS_MeshIDFactory(), myMin(0), myMax(0)
49 //=======================================================================
52 //=======================================================================
53 bool SMDS_MeshNodeIDFactory::BindID(int ID, SMDS_MeshElement * elem)
59 //=======================================================================
60 //function : MeshElement
62 //=======================================================================
63 SMDS_MeshElement* SMDS_MeshNodeIDFactory::MeshElement(int ID)
65 if ((ID < 1) || (ID > myMax))
67 const SMDS_MeshElement* elem = GetMesh()->FindNode(ID);
68 return (SMDS_MeshElement*) (elem);
71 //=======================================================================
72 //function : ReleaseID
74 //=======================================================================
75 void SMDS_MeshNodeIDFactory::ReleaseID(const int ID, int vtkId)
77 SMDS_MeshIDFactory::ReleaseID(ID);
78 myMesh->setMyModified();
80 myMax = 0; // --- force updateMinMax
82 myMax = 0; // --- force updateMinMax
85 //=======================================================================
88 //=======================================================================
90 int SMDS_MeshNodeIDFactory::GetMaxID() const
97 //=======================================================================
100 //=======================================================================
102 int SMDS_MeshNodeIDFactory::GetMinID() const
109 //=======================================================================
110 //function : updateMinMax
112 //=======================================================================
114 void SMDS_MeshNodeIDFactory::updateMinMax() const
116 myMesh->updateNodeMinMax();
117 myMin = myMesh->MinNodeID();
118 myMax = myMesh->MaxNodeID();
121 SMDS_ElemIteratorPtr SMDS_MeshNodeIDFactory::elementsIterator() const
123 return myMesh->elementsIterator(SMDSAbs_Node);
126 void SMDS_MeshNodeIDFactory::Clear()
129 SMDS_MeshIDFactory::Clear();
132 void SMDS_MeshNodeIDFactory::emptyPool(int maxId)
134 SMDS_MeshIDFactory::emptyPool(maxId);