From f319ddfa61bad8d0b770fba0c1c0565173d781fc Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Wed, 24 Feb 2010 15:24:32 +0100 Subject: [PATCH] ENH: begin initial coding for using upcoming vtkPolyhedron --- .../conversion/foamToStarMesh/Make/options | 3 +- .../mesh/conversion/star4ToFoam/Make/options | 3 +- .../PV3FoamReader/PV3FoamReader_SM.xml | 13 ++ .../PV3FoamReader/pqPV3FoamReaderPanel.cxx | 2 +- .../PV3FoamReader/pqPV3FoamReaderPanel.h | 2 +- .../PV3FoamReader/vtkPV3FoamReader.cxx | 3 +- .../PV3FoamReader/vtkPV3FoamReader.h | 8 +- .../vtkPV3Foam/vtkOpenFOAMPoints.H | 2 +- .../PV3FoamReader/vtkPV3Foam/vtkPV3Foam.C | 2 +- .../PV3FoamReader/vtkPV3Foam/vtkPV3Foam.H | 2 +- .../vtkPV3Foam/vtkPV3FoamAddToSelection.H | 2 +- .../vtkPV3Foam/vtkPV3FoamFaceField.H | 2 +- .../vtkPV3Foam/vtkPV3FoamFields.C | 2 +- .../vtkPV3Foam/vtkPV3FoamLagrangianFields.H | 2 +- .../PV3FoamReader/vtkPV3Foam/vtkPV3FoamMesh.C | 2 +- .../vtkPV3Foam/vtkPV3FoamMeshLagrangian.C | 2 +- .../vtkPV3Foam/vtkPV3FoamMeshPatch.C | 2 +- .../vtkPV3Foam/vtkPV3FoamMeshSet.C | 2 +- .../vtkPV3Foam/vtkPV3FoamMeshVolume.C | 129 ++++++++++++++---- .../vtkPV3Foam/vtkPV3FoamMeshZone.C | 2 +- .../vtkPV3Foam/vtkPV3FoamPatchField.H | 2 +- .../vtkPV3Foam/vtkPV3FoamPointFields.H | 2 +- .../vtkPV3Foam/vtkPV3FoamUpdateInfo.C | 2 +- .../vtkPV3Foam/vtkPV3FoamUpdateInfoFields.H | 2 +- .../vtkPV3Foam/vtkPV3FoamUtils.C | 2 +- .../vtkPV3Foam/vtkPV3FoamVolFields.H | 2 +- src/conversion/Make/options | 2 + src/conversion/ensight/file/ensightFile.C | 2 +- src/conversion/ensight/file/ensightFile.H | 2 +- src/conversion/ensight/file/ensightGeoFile.C | 2 +- src/conversion/ensight/file/ensightGeoFile.H | 2 +- src/conversion/ensight/part/ensightPart.C | 2 +- src/conversion/ensight/part/ensightPart.H | 4 +- .../ensight/part/ensightPartCells.C | 6 +- .../ensight/part/ensightPartCells.H | 4 +- .../ensight/part/ensightPartFaces.C | 6 +- .../ensight/part/ensightPartFaces.H | 4 +- src/conversion/ensight/part/ensightPartI.H | 2 +- src/conversion/ensight/part/ensightPartIO.C | 2 +- src/conversion/ensight/part/ensightParts.C | 2 +- src/conversion/ensight/part/ensightParts.H | 2 +- src/conversion/ensight/part/ensightPartsI.H | 2 +- src/conversion/meshReader/calcPointCells.C | 2 +- .../meshReader/createPolyBoundary.C | 2 +- src/conversion/meshReader/createPolyCells.C | 2 +- src/conversion/meshReader/meshReader.C | 2 +- src/conversion/meshReader/meshReader.H | 2 +- src/conversion/meshReader/meshReaderAux.C | 2 +- .../meshReader/starcd/STARCDMeshReader.C | 4 +- .../meshReader/starcd/STARCDMeshReader.H | 2 +- src/conversion/meshTables/boundaryRegion.C | 2 +- src/conversion/meshTables/boundaryRegion.H | 2 +- src/conversion/meshTables/cellTable.C | 2 +- src/conversion/meshTables/cellTable.H | 2 +- src/conversion/meshWriter/meshWriter.C | 2 +- .../meshWriter/starcd/STARCDMeshWriter.H | 2 +- src/conversion/polyDualMesh/polyDualMesh.C | 2 +- src/conversion/polyDualMesh/polyDualMesh.H | 2 +- 58 files changed, 192 insertions(+), 87 deletions(-) diff --git a/applications/utilities/mesh/conversion/foamToStarMesh/Make/options b/applications/utilities/mesh/conversion/foamToStarMesh/Make/options index 1567290170..e3af2fe661 100644 --- a/applications/utilities/mesh/conversion/foamToStarMesh/Make/options +++ b/applications/utilities/mesh/conversion/foamToStarMesh/Make/options @@ -1,6 +1,7 @@ EXE_INC = \ -I$(LIB_SRC)/meshTools/lnInclude \ - -I$(LIB_SRC)/conversion/lnInclude + -I$(LIB_SRC)/conversion/lnInclude \ + -I$(LIB_SRC)/fileFormats/lnInclude EXE_LIBS = \ -lconversion diff --git a/applications/utilities/mesh/conversion/star4ToFoam/Make/options b/applications/utilities/mesh/conversion/star4ToFoam/Make/options index 1567290170..e3af2fe661 100644 --- a/applications/utilities/mesh/conversion/star4ToFoam/Make/options +++ b/applications/utilities/mesh/conversion/star4ToFoam/Make/options @@ -1,6 +1,7 @@ EXE_INC = \ -I$(LIB_SRC)/meshTools/lnInclude \ - -I$(LIB_SRC)/conversion/lnInclude + -I$(LIB_SRC)/conversion/lnInclude \ + -I$(LIB_SRC)/fileFormats/lnInclude EXE_LIBS = \ -lconversion diff --git a/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/PV3FoamReader/PV3FoamReader_SM.xml b/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/PV3FoamReader/PV3FoamReader_SM.xml index 18bccb0398..41aa21e674 100644 --- a/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/PV3FoamReader/PV3FoamReader_SM.xml +++ b/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/PV3FoamReader/PV3FoamReader_SM.xml @@ -82,6 +82,19 @@ + + + + + Use vtkPolyhedron instead of decomposing polyhedra + + + GetUseVTKPolyhedron()) { - const cellModel& model = cellShapes[cellI].model(); - - if - ( - model != hex - && model != wedge - && model != prism - && model != pyr - && model != tet - && model != tetWedge - ) + forAll(cellShapes, cellI) { - const cell& cFaces = mesh.cells()[cellI]; + const cellModel& model = cellShapes[cellI].model(); - forAll(cFaces, cFaceI) + if + ( + model != hex + && model != wedge + && model != prism + && model != pyr + && model != tet + && model != tetWedge + ) { - const face& f = mesh.faces()[cFaces[cFaceI]]; + const cell& cFaces = mesh.cells()[cellI]; - label nFacePoints = f.size(); + forAll(cFaces, cFaceI) + { + const face& f = mesh.faces()[cFaces[cFaceI]]; - label nQuads = (nFacePoints - 2)/2; - label nTris = (nFacePoints - 2)%2; - nAddCells += nQuads + nTris; + label nFacePoints = f.size(); + + label nQuads = (nFacePoints - 2)/2; + label nTris = (nFacePoints - 2)%2; + nAddCells += nQuads + nTris; + } + + nAddCells--; + nAddPoints++; } - - nAddCells--; - nAddPoints++; } } @@ -155,7 +162,7 @@ vtkUnstructuredGrid* Foam::vtkPV3Foam::volumeVTKMesh // Set counters for additional points and additional cells label addPointI = 0, addCellI = 0; - // Create storage for points - needed for mapping from Foam to VTK + // Create storage for points - needed for mapping from OpenFOAM to VTK // data types - max 'order' = hex = 8 points vtkIdType nodeIds[8]; @@ -256,6 +263,80 @@ vtkUnstructuredGrid* Foam::vtkPV3Foam::volumeVTKMesh nodeIds ); } + else if (reader_->GetUseVTKPolyhedron()) + { + // Polyhedral cell - use VTK_POLYHEDRON + const labelList& cFaces = mesh.cells()[cellI]; + + vtkIdType nFaces = cFaces.size(); + vtkIdType nodeCount = 0; + vtkIdType nLabels = nFaces; + + // count size for face stream + forAll(cFaces, cFaceI) + { + const face& f = mesh.faces()[cFaces[cFaceI]]; + nLabels += f.size(); + } + + // unique node ids - approximately equal to the number of point ids + DynamicList uniqueNodeIds(nLabels-nFaces); + + // zero-based index into uniqueNodeIds + DynamicList faceLabels(nLabels); + + // localized point id within the cell + Map