// Copyright (C) 2003 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 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
-//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+// 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 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
+//
+// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
#include "SALOME_ExtractGeometry.h"
using namespace std;
+#if defined __GNUC__
+ #if __GNUC__ == 2
+ #define __GNUC_2__
+ #endif
+#endif
+
vtkStandardNewMacro(SALOME_ExtractGeometry);
SALOME_ExtractGeometry::SALOME_ExtractGeometry()
{}
+SALOME_ExtractGeometry::~SALOME_ExtractGeometry()
+{}
-SALOME_ExtractGeometry::~SALOME_ExtractGeometry(){}
+vtkIdType SALOME_ExtractGeometry::GetElemObjId(int theVtkID)
+{
+ if (myElemVTK2ObjIds.empty())
+ return theVtkID;
+ if (theVtkID < 0 || myElemVTK2ObjIds.size() <= theVtkID)
+ return -1;
-vtkIdType SALOME_ExtractGeometry::GetElemObjId(int theID){
- if(myElemVTK2ObjIds.empty() || theID > myElemVTK2ObjIds.size())
- return theID;
- return myElemVTK2ObjIds[theID];
+#if defined __GNUC_2__
+ return myElemVTK2ObjIds[theVtkID];
+#else
+ return myElemVTK2ObjIds.at(theVtkID);
+#endif
}
-vtkIdType SALOME_ExtractGeometry::GetNodeObjId(int theID){
- if(myNodeVTK2ObjIds.empty() || theID > myNodeVTK2ObjIds.size())
- return theID;
- return myNodeVTK2ObjIds[theID];
+vtkIdType SALOME_ExtractGeometry::GetNodeObjId(int theVtkID)
+{
+ if (myNodeVTK2ObjIds.empty())
+ return theVtkID;
+
+ if (theVtkID < 0 || myNodeVTK2ObjIds.size() <= theVtkID)
+ return -1;
+
+#if defined __GNUC_2__
+ return myNodeVTK2ObjIds[theVtkID];
+#else
+ return myNodeVTK2ObjIds.at(theVtkID);
+#endif
}
if(myImplicitBoolean.GetPointer()){
if(vtkImplicitFunctionCollection* aFunction = myImplicitBoolean->GetFunction()){
if(aFunction->GetNumberOfItems() == 0){
+ myElemVTK2ObjIds.clear();
+ myNodeVTK2ObjIds.clear();
+
vtkDebugMacro(<< "Extracting geometry - ShallowCopy");
GetOutput()->ShallowCopy(GetInput());
+ Modified();
return;
}
}
int npts;
numCells = input->GetNumberOfCells();
numPts = input->GetNumberOfPoints();
-
+
vtkDebugMacro(<< "Extracting geometry");
if ( ! this->ImplicitFunction )
{
multiplier = 1.0;
}
- else
+ else
{
multiplier = -1.0;
}
outputPD->CopyAllocate(pd);
outputCD->CopyAllocate(cd);
vtkFloatArray *newScalars = NULL;
-
+
if(myStoreMapping){
myElemVTK2ObjIds.clear();
myElemVTK2ObjIds.reserve(numCells);
}
}
} //if don't want to extract boundary cells
-
+
else //want boundary cells
{
for ( npts=0, i=0; i < numCellPts; i++ )
}
}//a boundary or interior cell
}//if mapping boundary cells
-
+
if ( npts >= numCellPts || (this->ExtractBoundaryCells && npts > 0) )
{
newCellId = output->InsertNextCell(cell->GetCellType(),newCellPts);
newCellPts->Delete();
output->SetPoints(newPts);
newPts->Delete();
-
+
if ( this->ExtractBoundaryCells )
{
newScalars->Delete();
// Copyright (C) 2003 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 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
-//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+// 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 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
+//
+// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
#ifndef SALOME_ExtractGeometry_H
#define SALOME_ExtractGeometry_H
#include <vtkExtractGeometry.h>
#include <vtkSmartPointer.h>
+#include <vtkImplicitBoolean.h>
+
#include <vector>
-class vtkImplicitBoolean;
+//class vtkImplicitBoolean;
-class SALOME_ExtractGeometry : public vtkExtractGeometry{
+class SALOME_ExtractGeometry : public vtkExtractGeometry
+{
public:
vtkTypeMacro(SALOME_ExtractGeometry,vtkExtractGeometry);
static SALOME_ExtractGeometry *New();
void SetImplicitBoolean(vtkImplicitBoolean* theImplicitBoolean);
- vtkImplicitBoolean* GetImplicitBoolean() const {
+ vtkImplicitBoolean* GetImplicitBoolean() const {
return myImplicitBoolean.GetPointer();
}
void SetStoreMapping(bool theStoreMapping);
- bool GetStoreMapping() const {
+ bool GetStoreMapping() const {
return myStoreMapping;
}
void Execute2();
private:
- bool myStoreMapping;
+ bool myStoreMapping;
typedef std::vector<vtkIdType> TVectorId;
TVectorId myElemVTK2ObjIds;
TVectorId myNodeVTK2ObjIds;
void operator=(const SALOME_ExtractGeometry&); // Not implemented.
};
-
#endif
-
-