-// Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2014 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
#include <vtkUnstructuredGrid.h>
#include <vtkVoxel.h>
#include <vtkWedge.h>
+#include <vtkVersion.h>
#include <algorithm>
#include <iterator>
}
case VTK_TETRA: {
#ifdef SHOW_COINCIDING_3D_PAL21924
- faceIdsTmp->Reset();
- for (int ai=0; ai<npts; ai++)
- faceIdsTmp->InsertNextId(pts[ai]);
- input->GetCellNeighbors(cellId, faceIdsTmp, cellIdsTmp);
+ faceIdsTmp->Reset();
+ for (int ai=0; ai<npts; ai++)
+ faceIdsTmp->InsertNextId(pts[ai]);
+ input->GetCellNeighbors(cellId, faceIdsTmp, cellIdsTmp);
#endif
for (faceId = 0; faceId < 4; faceId++)
{
numFacePts = 3;
input->GetCellNeighbors(cellId, faceIds, cellIds);
#ifdef SHOW_COINCIDING_3D_PAL21924
- int nbNeighbors = 0;
- for(int ai=0;ai<cellIds->GetNumberOfIds();ai++) {
- if (cellIdsTmp->IsId(cellIds->GetId(ai)) == -1) nbNeighbors++;
- }
+ int nbNeighbors = 0;
+ for(int ai=0;ai<cellIds->GetNumberOfIds();ai++) {
+ if (cellIdsTmp->IsId(cellIds->GetId(ai)) == -1) nbNeighbors++;
+ }
bool process = nbNeighbors <= 0;
#else
bool process = cellIds->GetNumberOfIds() <= 0 || GetAppendCoincident3D();
}
case VTK_VOXEL: {
#ifdef SHOW_COINCIDING_3D_PAL21924
- faceIdsTmp->Reset();
- for (int ai=0; ai<npts; ai++)
- faceIdsTmp->InsertNextId(pts[ai]);
- input->GetCellNeighbors(cellId, faceIdsTmp, cellIdsTmp);
+ faceIdsTmp->Reset();
+ for (int ai=0; ai<npts; ai++)
+ faceIdsTmp->InsertNextId(pts[ai]);
+ input->GetCellNeighbors(cellId, faceIdsTmp, cellIdsTmp);
#endif
for (faceId = 0; faceId < 6; faceId++)
{
numFacePts = 4;
input->GetCellNeighbors(cellId, faceIds, cellIds);
#ifdef SHOW_COINCIDING_3D_PAL21924
- int nbNeighbors = 0;
- for(int ai=0;ai<cellIds->GetNumberOfIds();ai++) {
- if (cellIdsTmp->IsId(cellIds->GetId(ai)) == -1) nbNeighbors++;
- }
+ int nbNeighbors = 0;
+ for(int ai=0;ai<cellIds->GetNumberOfIds();ai++) {
+ if (cellIdsTmp->IsId(cellIds->GetId(ai)) == -1) nbNeighbors++;
+ }
bool process = nbNeighbors <= 0;
#else
bool process = cellIds->GetNumberOfIds() <= 0 || GetAppendCoincident3D();
}
case VTK_HEXAHEDRON: {
#ifdef SHOW_COINCIDING_3D_PAL21924
- faceIdsTmp->Reset();
- for (int ai=0; ai<npts; ai++)
- faceIdsTmp->InsertNextId(pts[ai]);
- input->GetCellNeighbors(cellId, faceIdsTmp, cellIdsTmp);
+ faceIdsTmp->Reset();
+ for (int ai=0; ai<npts; ai++)
+ faceIdsTmp->InsertNextId(pts[ai]);
+ input->GetCellNeighbors(cellId, faceIdsTmp, cellIdsTmp);
#endif
for (faceId = 0; faceId < 6; faceId++)
{
numFacePts = 4;
input->GetCellNeighbors(cellId, faceIds, cellIds);
#ifdef SHOW_COINCIDING_3D_PAL21924
- int nbNeighbors = 0;
- for(int ai=0;ai<cellIds->GetNumberOfIds();ai++) {
- if (cellIdsTmp->IsId(cellIds->GetId(ai)) == -1) nbNeighbors++;
- }
+ int nbNeighbors = 0;
+ for(int ai=0;ai<cellIds->GetNumberOfIds();ai++) {
+ if (cellIdsTmp->IsId(cellIds->GetId(ai)) == -1) nbNeighbors++;
+ }
bool process = nbNeighbors <= 0;
#else
bool process = cellIds->GetNumberOfIds() <= 0 || GetAppendCoincident3D();
}
case VTK_WEDGE: {
#ifdef SHOW_COINCIDING_3D_PAL21924
- faceIdsTmp->Reset();
- for (int ai=0; ai<npts; ai++)
- faceIdsTmp->InsertNextId(pts[ai]);
- input->GetCellNeighbors(cellId, faceIdsTmp, cellIdsTmp);
+ faceIdsTmp->Reset();
+ for (int ai=0; ai<npts; ai++)
+ faceIdsTmp->InsertNextId(pts[ai]);
+ input->GetCellNeighbors(cellId, faceIdsTmp, cellIdsTmp);
#endif
for (faceId = 0; faceId < 5; faceId++)
{
input->GetCellNeighbors(cellId, faceIds, cellIds);
#ifdef SHOW_COINCIDING_3D_PAL21924
- int nbNeighbors = 0;
- for(int ai=0;ai<cellIds->GetNumberOfIds();ai++) {
- if (cellIdsTmp->IsId(cellIds->GetId(ai)) == -1) nbNeighbors++;
- }
+ int nbNeighbors = 0;
+ for(int ai=0;ai<cellIds->GetNumberOfIds();ai++) {
+ if (cellIdsTmp->IsId(cellIds->GetId(ai)) == -1) nbNeighbors++;
+ }
bool process = nbNeighbors <= 0;
#else
bool process = cellIds->GetNumberOfIds() <= 0 || GetAppendCoincident3D();
}
case VTK_HEXAGONAL_PRISM: {
#ifdef SHOW_COINCIDING_3D_PAL21924
- faceIdsTmp->Reset();
- for (int ai=0; ai<npts; ai++)
- faceIdsTmp->InsertNextId(pts[ai]);
- input->GetCellNeighbors(cellId, faceIdsTmp, cellIdsTmp);
+ faceIdsTmp->Reset();
+ for (int ai=0; ai<npts; ai++)
+ faceIdsTmp->InsertNextId(pts[ai]);
+ input->GetCellNeighbors(cellId, faceIdsTmp, cellIdsTmp);
#endif
for (faceId = 0; faceId < 8; faceId++)
{
}
input->GetCellNeighbors(cellId, faceIds, cellIds);
#ifdef SHOW_COINCIDING_3D_PAL21924
- int nbNeighbors = 0;
- for(int ai=0;ai<cellIds->GetNumberOfIds();ai++) {
- if (cellIdsTmp->IsId(cellIds->GetId(ai)) == -1) nbNeighbors++;
- }
+ int nbNeighbors = 0;
+ for(int ai=0;ai<cellIds->GetNumberOfIds();ai++) {
+ if (cellIdsTmp->IsId(cellIds->GetId(ai)) == -1) nbNeighbors++;
+ }
bool process = nbNeighbors <= 0;
#else
bool process = cellIds->GetNumberOfIds() <= 0 || GetAppendCoincident3D();
}
case VTK_PYRAMID: {
#ifdef SHOW_COINCIDING_3D_PAL21924
- faceIdsTmp->Reset();
- for (int ai=0; ai<npts; ai++)
- faceIdsTmp->InsertNextId(pts[ai]);
- input->GetCellNeighbors(cellId, faceIdsTmp, cellIdsTmp);
+ faceIdsTmp->Reset();
+ for (int ai=0; ai<npts; ai++)
+ faceIdsTmp->InsertNextId(pts[ai]);
+ input->GetCellNeighbors(cellId, faceIdsTmp, cellIdsTmp);
#endif
for (faceId = 0; faceId < 5; faceId++)
{
}
input->GetCellNeighbors(cellId, faceIds, cellIds);
#ifdef SHOW_COINCIDING_3D_PAL21924
- int nbNeighbors = 0;
- for(int ai=0;ai<cellIds->GetNumberOfIds();ai++) {
- if (cellIdsTmp->IsId(cellIds->GetId(ai)) == -1) nbNeighbors++;
- }
+ int nbNeighbors = 0;
+ for(int ai=0;ai<cellIds->GetNumberOfIds();ai++) {
+ if (cellIdsTmp->IsId(cellIds->GetId(ai)) == -1) nbNeighbors++;
+ }
bool process = nbNeighbors <= 0;
#else
bool process = cellIds->GetNumberOfIds() <= 0 || GetAppendCoincident3D();
int idp = 0;
input->GetFaceStream(cellId, nFaces, ptIds);
#ifdef SHOW_COINCIDING_3D_PAL21924
- faceIdsTmp->Reset();
- for (int ai=0; ai<npts; ai++)
- faceIdsTmp->InsertNextId(pts[ai]);
- input->GetCellNeighbors(cellId, faceIdsTmp, cellIdsTmp);
+ faceIdsTmp->Reset();
+ for (int ai=0; ai<npts; ai++)
+ faceIdsTmp->InsertNextId(pts[ai]);
+ input->GetCellNeighbors(cellId, faceIdsTmp, cellIdsTmp);
#endif
for (faceId = 0; faceId < nFaces; faceId++)
{
// TODO understand and fix display of several polyhedrons
input->GetCellNeighbors(cellId, faceIds, cellIds);
#ifdef SHOW_COINCIDING_3D_PAL21924
- int nbNeighbors = 0;
- for(int ai=0;ai<cellIds->GetNumberOfIds();ai++) {
- if (cellIdsTmp->IsId(cellIds->GetId(ai)) == -1) nbNeighbors++;
- }
- bool process = nbNeighbors <= 0;
+ int nbNeighbors = 0;
+ for(int ai=0;ai<cellIds->GetNumberOfIds();ai++) {
+ if (cellIdsTmp->IsId(cellIds->GetId(ai)) == -1) nbNeighbors++;
+ }
+ bool process = nbNeighbors <= 0;
#else
- bool process = cellIds->GetNumberOfIds() <= 0 || GetAppendCoincident3D();
+ bool process = cellIds->GetNumberOfIds() <= 0 || GetAppendCoincident3D();
#endif
if (process || myShowInside
|| (!allVisible && !cellVis[cellIds->GetId(0)]))
//Quadratic cells
case VTK_QUADRATIC_EDGE:
case VTK_QUADRATIC_TRIANGLE:
+ case VTK_BIQUADRATIC_TRIANGLE:
case VTK_QUADRATIC_QUAD:
case VTK_BIQUADRATIC_QUAD:
case VTK_QUADRATIC_TETRA:
else //3D nonlinear cell
{
#ifdef SHOW_COINCIDING_3D_PAL21924
- faceIdsTmp->Reset();
- int npts1 = 0;
- switch (aCellType ){
- case VTK_QUADRATIC_TETRA: npts1 = 4; break;
- case VTK_QUADRATIC_HEXAHEDRON: npts1 = 8; break;
- case VTK_TRIQUADRATIC_HEXAHEDRON: npts1 = 8; break;
- case VTK_QUADRATIC_WEDGE: npts1 = 6; break;
- case VTK_QUADRATIC_PYRAMID: npts1 = 5; break;
- }
- if ( npts1 > 0 ) {
- for (int ai=0; ai<npts; ai++)
- faceIdsTmp->InsertNextId(pts[ai]);
- input->GetCellNeighbors(cellId, faceIdsTmp, cellIdsTmp);
- }
+ faceIdsTmp->Reset();
+ int npts1 = 0;
+ switch (aCellType ){
+ case VTK_QUADRATIC_TETRA: npts1 = 4; break;
+ case VTK_QUADRATIC_HEXAHEDRON: npts1 = 8; break;
+ case VTK_TRIQUADRATIC_HEXAHEDRON: npts1 = 8; break;
+ case VTK_QUADRATIC_WEDGE: npts1 = 6; break;
+ case VTK_QUADRATIC_PYRAMID: npts1 = 5; break;
+ }
+ if ( npts1 > 0 ) {
+ for (int ai=0; ai<npts; ai++)
+ faceIdsTmp->InsertNextId(pts[ai]);
+ input->GetCellNeighbors(cellId, faceIdsTmp, cellIdsTmp);
+ }
#endif
aCellType = VTK_TRIANGLE;
numFacePts = 3;
vtkCell *face = cell->GetFace(j);
input->GetCellNeighbors(cellId, face->PointIds, cellIds);
#ifdef SHOW_COINCIDING_3D_PAL21924
- int nbNeighbors = 0;
- for(int ai=0;ai<cellIds->GetNumberOfIds();ai++) {
- if (cellIdsTmp->IsId(cellIds->GetId(ai)) == -1) nbNeighbors++;
- }
- bool process = nbNeighbors <= 0;
+ int nbNeighbors = 0;
+ for(int ai=0;ai<cellIds->GetNumberOfIds();ai++) {
+ if (cellIdsTmp->IsId(cellIds->GetId(ai)) == -1) nbNeighbors++;
+ }
+ bool process = nbNeighbors <= 0;
#else
- bool process = cellIds->GetNumberOfIds() <= 0 || GetAppendCoincident3D();
+ bool process = cellIds->GetNumberOfIds() <= 0 || GetAppendCoincident3D();
#endif
if ( process || myShowInside ) {
face->Triangulate(0,lpts,coords);
outputCD->CopyData(cd,cellId,newCellId);
break;
}
- case VTK_QUADRATIC_TRIANGLE: {
+ case VTK_QUADRATIC_TRIANGLE:
+ case VTK_BIQUADRATIC_TRIANGLE: {
if(!myIsBuildArc) {
aCellType = VTK_POLYGON;
numFacePts = 6;
BuildArcedPolygon(cellId,input,output,aDimension2VTK2ObjIds);
break;
}
- case VTK_BIQUADRATIC_QUAD:
- case VTK_QUADRATIC_QUAD: {
+ case VTK_QUADRATIC_QUAD:
+ case VTK_BIQUADRATIC_QUAD: {
if(!myIsBuildArc) {
aCellType = VTK_POLYGON;
numFacePts = 8;
vtkUnstructuredGrid* input,
vtkPolyData *output,
TMapOfVectorId& theDimension2VTK2ObjIds,
- bool triangulate){
+ bool triangulate)
+{
vtkIdType aCellType = VTK_POLYGON;
vtkIdType *aNewPoints = NULL;
vtkIdType aNbPoints = 0;
vtkDataArray* inputScalars = input->GetPointData()->GetScalars();
vtkDataArray* outputScalars = output->GetPointData()->GetScalars();
- std::vector<vtkPoints*> aCollection;
+ std::vector< vtkSmartPointer<vtkPoints> > aCollection;
std::vector< std::vector<double> > aScalarCollection;
vtkCell* aCell = input->GetCell(cellId);
switch(aCell->GetCellType()) {
case VTK_QUADRATIC_TRIANGLE:
+ case VTK_BIQUADRATIC_TRIANGLE:
{
//Get All points from input cell
Pnt P0 = CreatePnt( aCell, inputScalars, 0 );
aScalarCollection.push_back(aBuilder3.GetScalarValues());
break;
}
- case VTK_BIQUADRATIC_QUAD:
case VTK_QUADRATIC_QUAD:
+ case VTK_BIQUADRATIC_QUAD:
{
//Get All points from input cell
Pnt P0 = CreatePnt( aCell, inputScalars, 0 );