X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FSMDS%2FSMDS_MeshElementIDFactory.cxx;h=204d7215d41c3abd2ece2a97717195b4f31c6acc;hb=b75ee995abfd3b72215d9701441a34eb5182c241;hp=1278192dc4ec398dea560373f9477fbf9c817a49;hpb=8fa039a796957b302d86d90b22afc0a998573f83;p=modules%2Fsmesh.git diff --git a/src/SMDS/SMDS_MeshElementIDFactory.cxx b/src/SMDS/SMDS_MeshElementIDFactory.cxx index 1278192dc..204d7215d 100644 --- a/src/SMDS/SMDS_MeshElementIDFactory.cxx +++ b/src/SMDS/SMDS_MeshElementIDFactory.cxx @@ -1,23 +1,23 @@ -// Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 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 +// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS // -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. // -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. // -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // // SMESH SMDS : implementaion of Salome mesh data structure @@ -35,9 +35,11 @@ #include "utilities.h" -#include +#include "SMDS_UnstructuredGrid.hxx" #include +#include + using namespace std; //======================================================================= @@ -47,34 +49,6 @@ using namespace std; SMDS_MeshElementIDFactory::SMDS_MeshElementIDFactory(): SMDS_MeshNodeIDFactory() { -// myIDElements.clear(); -// myVtkIndex.clear(); - myVtkCellTypes.clear(); - myVtkCellTypes.reserve(SMDSEntity_Last); - myVtkCellTypes[SMDSEntity_Node] = VTK_VERTEX; - myVtkCellTypes[SMDSEntity_0D] = VTK_VERTEX; - myVtkCellTypes[SMDSEntity_Edge] = VTK_LINE; - myVtkCellTypes[SMDSEntity_Quad_Edge] = VTK_QUADRATIC_EDGE; - myVtkCellTypes[SMDSEntity_Triangle] = VTK_TRIANGLE; - myVtkCellTypes[SMDSEntity_Quad_Triangle] = VTK_QUADRATIC_TRIANGLE; - myVtkCellTypes[SMDSEntity_Quadrangle] = VTK_QUAD; - myVtkCellTypes[SMDSEntity_Quad_Quadrangle] = VTK_QUADRATIC_TRIANGLE; - myVtkCellTypes[SMDSEntity_Polygon] = VTK_POLYGON; - myVtkCellTypes[SMDSEntity_Quad_Polygon] = VTK_POLYGON; // -PR- verifer - myVtkCellTypes[SMDSEntity_Tetra] = VTK_TETRA; - myVtkCellTypes[SMDSEntity_Quad_Tetra] = VTK_QUADRATIC_TETRA; - myVtkCellTypes[SMDSEntity_Pyramid] = VTK_PYRAMID; - myVtkCellTypes[SMDSEntity_Quad_Pyramid] = VTK_CONVEX_POINT_SET; - myVtkCellTypes[SMDSEntity_Hexa] = VTK_HEXAHEDRON; - myVtkCellTypes[SMDSEntity_Quad_Hexa] = VTK_QUADRATIC_HEXAHEDRON; - myVtkCellTypes[SMDSEntity_Penta] = VTK_WEDGE; - myVtkCellTypes[SMDSEntity_Quad_Penta] = VTK_QUADRATIC_WEDGE; -//#ifdef VTK_HAVE_POLYHEDRON - myVtkCellTypes[SMDSEntity_Polyhedra] = VTK_POLYHEDRON; -//#else -// myVtkCellTypes[SMDSEntity_Polyhedra] = VTK_CONVEX_POINT_SET; -//#endif - myVtkCellTypes[SMDSEntity_Quad_Polyhedra] = VTK_CONVEX_POINT_SET; } int SMDS_MeshElementIDFactory::SetInVtkGrid(SMDS_MeshElement * elem) @@ -95,7 +69,8 @@ int SMDS_MeshElementIDFactory::SetInVtkGrid(SMDS_MeshElement * elem) // --- insert cell in vtkUnstructuredGrid vtkUnstructuredGrid * grid = myMesh->getGrid(); - int typ = GetVtkCellType(elem->GetType()); + //int locType = elem->GetType(); + int typ = VTK_VERTEX;//GetVtkCellType(locType); int cellId = grid->InsertNextLinkedCell(typ, nodeIds.size(), &nodeIds[0]); cell->setVtkId(cellId); //MESSAGE("SMDS_MeshElementIDFactory::SetInVtkGrid " << cellId); @@ -126,6 +101,20 @@ SMDS_MeshElement* SMDS_MeshElementIDFactory::MeshElement(int ID) return (SMDS_MeshElement*)(elem); } +//======================================================================= +//function : GetFreeID +//purpose : +//======================================================================= + +int SMDS_MeshElementIDFactory::GetFreeID() +{ + int ID; + do { + ID = SMDS_MeshIDFactory::GetFreeID(); + } while ( MeshElement( ID )); + return ID; +} + //======================================================================= //function : ReleaseID //purpose : @@ -158,7 +147,7 @@ void SMDS_MeshElementIDFactory::ReleaseID(int ID, int vtkId) void SMDS_MeshElementIDFactory::updateMinMax() const { - myMin = IntegerLast(); + myMin = INT_MAX; myMax = 0; for (int i = 0; i < myMesh->myCells.size(); i++) { @@ -171,7 +160,7 @@ void SMDS_MeshElementIDFactory::updateMinMax() const myMin = id; } } - if (myMin == IntegerLast()) + if (myMin == INT_MAX) myMin = 0; } @@ -192,9 +181,3 @@ void SMDS_MeshElementIDFactory::Clear() myMin = myMax = 0; SMDS_MeshIDFactory::Clear(); } - -int SMDS_MeshElementIDFactory::GetVtkCellType(int SMDSType) -{ - assert((SMDSType >=0) && (SMDSType< SMDSEntity_Last)); - return myVtkCellTypes[SMDSType]; -}