-// Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 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
// 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.
+// version 2.1 of the License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
const SMDS_PositionPtr& SMDS_MeshNode::GetPosition() const
{
- return myPosition;
+ return myPosition;
}
//=======================================================================
SMDS_MeshNode_MyInvIterator(SMDS_Mesh *mesh, vtkIdType* cells, int ncells, SMDSAbs_ElementType type) :
myMesh(mesh), myCells(cells), myNcells(ncells), myType(type), iter(0)
{
- //MESSAGE("SMDS_MeshNode_MyInvIterator : ncells " << myNcells);
- cellList.clear();
+ cellList.reserve( ncells );
if (type == SMDSAbs_All)
+ cellList.assign( cells, cells + ncells );
+ else
for (int i = 0; i < ncells; i++)
- cellList.push_back(cells[i]);
- else for (int i = 0; i < ncells; i++)
{
int vtkId = cells[i];
int smdsId = myMesh->fromVtkToSmds(vtkId);
const SMDS_MeshElement* elem = myMesh->FindElement(smdsId);
if (elem->GetType() == type)
- {
- //MESSAGE("Add element vtkId " << vtkId << " " << elem->GetType())
- cellList.push_back(vtkId);
- }
+ {
+ cellList.push_back(vtkId);
+ }
}
- myCells = &cellList[0];
+ myCells = cellList.empty() ? 0 : &cellList[0];
myNcells = cellList.size();
- //MESSAGE("myNcells="<<myNcells);
}
bool more()
{
- //MESSAGE("iter " << iter << " ncells " << myNcells);
return (iter < myNcells);
}