From 068e6779e43e249733bda73fd8dd6d3b29d0a9cc Mon Sep 17 00:00:00 2001 From: andy Date: Mon, 15 Feb 2010 19:22:07 +0000 Subject: [PATCH 01/26] STYLE: Header clean-up for Thermo and Reacting Parcels --- .../parcels/Templates/ReactingParcel/ReactingParcel.H | 5 ----- .../parcels/Templates/ThermoParcel/ThermoParcel.H | 5 ----- 2 files changed, 10 deletions(-) diff --git a/src/lagrangian/intermediate/parcels/Templates/ReactingParcel/ReactingParcel.H b/src/lagrangian/intermediate/parcels/Templates/ReactingParcel/ReactingParcel.H index 1c7ed466d2..986f420b95 100644 --- a/src/lagrangian/intermediate/parcels/Templates/ReactingParcel/ReactingParcel.H +++ b/src/lagrangian/intermediate/parcels/Templates/ReactingParcel/ReactingParcel.H @@ -39,11 +39,6 @@ SourceFiles #ifndef ReactingParcel_H #define ReactingParcel_H -#include "IOstream.H" -#include "autoPtr.H" -#include "interpolationCellPoint.H" -#include "contiguous.H" - #include "ThermoParcel.H" #include "ReactingCloud.H" #include "reactingParcel.H" diff --git a/src/lagrangian/intermediate/parcels/Templates/ThermoParcel/ThermoParcel.H b/src/lagrangian/intermediate/parcels/Templates/ThermoParcel/ThermoParcel.H index 4bcdc43707..7ef2e02016 100644 --- a/src/lagrangian/intermediate/parcels/Templates/ThermoParcel/ThermoParcel.H +++ b/src/lagrangian/intermediate/parcels/Templates/ThermoParcel/ThermoParcel.H @@ -40,11 +40,6 @@ SourceFiles #ifndef ThermoParcel_H #define ThermoParcel_H -#include "IOstream.H" -#include "autoPtr.H" -#include "interpolationCellPoint.H" -#include "contiguous.H" - #include "KinematicParcel.H" #include "ThermoCloud.H" From 78e41f78bd46d1375c5c2a2d739e2212f4f86382 Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Thu, 18 Feb 2010 10:51:56 +0100 Subject: [PATCH 02/26] STYLE: avoid spaces around fileName::operator/ except when split across lines --- applications/test/fileName/fileNameTest.C | 4 ++-- .../reconstructParMesh/reconstructParMesh.C | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/applications/test/fileName/fileNameTest.C b/applications/test/fileName/fileNameTest.C index 81ebd5c255..3a2a134c80 100644 --- a/applications/test/fileName/fileNameTest.C +++ b/applications/test/fileName/fileNameTest.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. + \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -69,7 +69,7 @@ int main() word name; fileName path(SubList(wrdList, wrdList.size()-start, start)); - fileName path2 = "." / path; + fileName path2 = "."/path; IOobject::fileNameComponents ( diff --git a/applications/utilities/parallelProcessing/reconstructParMesh/reconstructParMesh.C b/applications/utilities/parallelProcessing/reconstructParMesh/reconstructParMesh.C index 2bc95be4e7..0333eca079 100644 --- a/applications/utilities/parallelProcessing/reconstructParMesh/reconstructParMesh.C +++ b/applications/utilities/parallelProcessing/reconstructParMesh/reconstructParMesh.C @@ -440,7 +440,7 @@ int main(int argc, char *argv[]) ( databases[procI].findInstance ( - regionDir / polyMesh::meshSubDir, + regionDir/polyMesh::meshSubDir, "points" ) ); @@ -469,10 +469,10 @@ int main(int argc, char *argv[]) "points", databases[procI].findInstance ( - regionDir / polyMesh::meshSubDir, + regionDir/polyMesh::meshSubDir, "points" ), - regionDir / polyMesh::meshSubDir, + regionDir/polyMesh::meshSubDir, databases[procI], IOobject::MUST_READ, IOobject::NO_WRITE, From ac99035a83cae01c01e60528aa3cd4c79ced909c Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Thu, 18 Feb 2010 16:48:49 +0100 Subject: [PATCH 03/26] COMP: make utilities before solvers. - having all utilities available ASAP is more important than having all solvers immediately --- applications/Allwmake | 2 +- tutorials/multiphase/settlingFoam/ras/tank3D/Allclean | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/applications/Allwmake b/applications/Allwmake index 48e66941d3..9b8bf7d803 100755 --- a/applications/Allwmake +++ b/applications/Allwmake @@ -10,7 +10,7 @@ wmakeCheckPwd "$WM_PROJECT_DIR/applications" || { set -x -wmake all solvers wmake all utilities +wmake all solvers # ----------------------------------------------------------------- end-of-file diff --git a/tutorials/multiphase/settlingFoam/ras/tank3D/Allclean b/tutorials/multiphase/settlingFoam/ras/tank3D/Allclean index f73c44df8a..35e38c65c5 100755 --- a/tutorials/multiphase/settlingFoam/ras/tank3D/Allclean +++ b/tutorials/multiphase/settlingFoam/ras/tank3D/Allclean @@ -3,4 +3,4 @@ # Clean time folders only rm -rf *[1-9]* -rm log.* +rm -f log.* 2>/dev/null From 63c3b7067b297a14f2e791008afea5948ed6c085 Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Thu, 18 Feb 2010 16:58:25 +0100 Subject: [PATCH 04/26] STYLE: provide more foam-prefixed aliases - foamApps == app - foamSol == sol - foamTuts == tut - foamUtils == util --- etc/aliases.csh | 7 ++++++- etc/aliases.sh | 7 ++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/etc/aliases.csh b/etc/aliases.csh index fd7f183a36..892bfbaabd 100644 --- a/etc/aliases.csh +++ b/etc/aliases.csh @@ -2,7 +2,7 @@ # ========= | # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox # \\ / O peration | -# \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. +# \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd. # \\/ M anipulation | #------------------------------------------------------------------------------ # License @@ -56,6 +56,11 @@ alias app 'cd $FOAM_APP' alias util 'cd $FOAM_UTILITIES' alias sol 'cd $FOAM_SOLVERS' alias tut 'cd $FOAM_TUTORIALS' + +alias foamApps 'cd $FOAM_APP' +alias foamSol 'cd $FOAM_SOLVERS' +alias foamTuts 'cd $FOAM_TUTORIALS' +alias foamUtils 'cd $FOAM_UTILITIES' alias foam3rdParty 'cd $WM_THIRD_PARTY_DIR' # ----------------------------------------------------------------------------- diff --git a/etc/aliases.sh b/etc/aliases.sh index b193802246..9135fcad0f 100644 --- a/etc/aliases.sh +++ b/etc/aliases.sh @@ -2,7 +2,7 @@ # ========= | # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox # \\ / O peration | -# \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. +# \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd. # \\/ M anipulation | #------------------------------------------------------------------------------ # License @@ -56,6 +56,11 @@ alias app='cd $FOAM_APP' alias util='cd $FOAM_UTILITIES' alias sol='cd $FOAM_SOLVERS' alias tut='cd $FOAM_TUTORIALS' + +alias foamApps='cd $FOAM_APP' +alias foamSol='cd $FOAM_SOLVERS' +alias foamTuts='cd $FOAM_TUTORIALS' +alias foamUtils='cd $FOAM_UTILITIES' alias foam3rdParty='cd $WM_THIRD_PARTY_DIR' # ----------------------------------------------------------------------------- From cf49a74f9c0807e96fea4337fb99f5a3ae216c44 Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Thu, 18 Feb 2010 18:23:54 +0100 Subject: [PATCH 05/26] STYLE: combine removal of .gz file versions in foamClearPolyMesh --- bin/foamClearPolyMesh | 19 ++----------------- 1 file changed, 2 insertions(+), 17 deletions(-) diff --git a/bin/foamClearPolyMesh b/bin/foamClearPolyMesh index 40689539ab..9f6b28f651 100755 --- a/bin/foamClearPolyMesh +++ b/bin/foamClearPolyMesh @@ -114,6 +114,7 @@ fi # # remove files (mesh itself, modifiers, snappyHexMesh ones) and subdirectories +# also remove .gz versions of the same files # echo "Clearing ${caseDir:-.}/$meshDir" 1>&2 @@ -134,25 +135,9 @@ for i in \ pointLevel \ refinementHistory \ surfaceIndex \ - points.gz \ - faces.gz \ - owner.gz \ - neighbour.gz \ - cells.gz \ - boundary.gz \ - pointZones.gz \ - faceZones.gz \ - cellZones.gz \ - meshModifiers.gz \ - parallelData.gz \ - sets.gz \ - cellLevel.gz \ - pointLevel.gz \ - refinementHistory.gz \ - surfaceIndex.gz \ ; do - rm -rf $meshDir/$i + rm -rf $meshDir/$i $meshDir/$i.gz done #------------------------------------------------------------------------------ From 07d070b1fc90e0d777687cf0edfd576e1dc73c60 Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Fri, 19 Feb 2010 06:18:19 +0100 Subject: [PATCH 06/26] STYLE: move some doxygen documentation from foamVersion.H -> foamDoc.H - avoids a full rebuild for simple documentation changes --- src/OpenFOAM/global/foamDoc.H | 58 +++++++++++++++++++++++++++++++ src/OpenFOAM/global/foamVersion.H | 34 ------------------ 2 files changed, 58 insertions(+), 34 deletions(-) create mode 100644 src/OpenFOAM/global/foamDoc.H diff --git a/src/OpenFOAM/global/foamDoc.H b/src/OpenFOAM/global/foamDoc.H new file mode 100644 index 0000000000..82a85d8972 --- /dev/null +++ b/src/OpenFOAM/global/foamDoc.H @@ -0,0 +1,58 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation; either version 2 of the License, or (at your + option) any later version. + + OpenFOAM 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 General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM; if not, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +@mainpage OpenFOAM®: open source CFD + +@section about About OpenFOAM + + OpenFOAM is a free, open source CFD software package produced by + a commercial company, + OpenCFD Ltd. + It has a + large user base across most areas of engineering and science, + from both commercial and academic organisations. OpenFOAM has an + extensive range of features to solve anything from complex fluid + flows involving chemical reactions, turbulence and heat transfer, + to solid dynamics and electromagnetics. + More ... + +@section users Our commitment to the users + + OpenFOAM comes with full commercial support from OpenCFD, including + software support, + contracted developments + and a programme of training courses. + These activities fund the development, maintenance and release of + OpenFOAM to make it an extremely viable commercial open source product. + +@section opensource Our commitment to open source + + OpenCFD is committed to open source software, continually developing and + maintaining OpenFOAM under the + GNU General Public Licence. + OpenFOAM will always be free of charge and open source. + In addition, we endeavour to support other viable open source initiatives + that will benefit science and engineering. + +\*---------------------------------------------------------------------------*/ diff --git a/src/OpenFOAM/global/foamVersion.H b/src/OpenFOAM/global/foamVersion.H index 50bf27591c..4a479b2799 100644 --- a/src/OpenFOAM/global/foamVersion.H +++ b/src/OpenFOAM/global/foamVersion.H @@ -44,40 +44,6 @@ Description SourceFiles global.Cver - -@mainpage OpenFOAM®: open source CFD - -@section about About OpenFOAM - - OpenFOAM is a free, open source CFD software package produced by - a commercial company, - OpenCFD Ltd. - It has a - large user base across most areas of engineering and science, - from both commercial and academic organisations. OpenFOAM has an - extensive range of features to solve anything from complex fluid - flows involving chemical reactions, turbulence and heat transfer, - to solid dynamics and electromagnetics. - More ... - -@section users Our commitment to the users - - OpenFOAM comes with full commercial support from OpenCFD, including - software support, - contracted developments and - a programme of training courses. - These activities fund the development, maintenance and release of - OpenFOAM to make it an extremely viable commercial open source product. - -@section opensource Our commitment to open source - - OpenCFD is committed to open source software, continually developing and - maintaining OpenFOAM under the - GNU General Public Licence. - OpenFOAM will always be free of charge and open source. - In addition, we endeavour to support other viable open source initiatives - that will benefit science and engineering. - \*---------------------------------------------------------------------------*/ #ifndef foamVersion_H From ca7a624fec91c31a2b14d3d32d90ad2648dd3059 Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Mon, 22 Feb 2010 09:11:14 +0100 Subject: [PATCH 07/26] ENH: draft version of paraFoam with -touchAll option --- bin/paraFoam | 38 +++++++++++++++++++++++++++++++++----- 1 file changed, 33 insertions(+), 5 deletions(-) diff --git a/bin/paraFoam b/bin/paraFoam index 623030e167..acff1d1139 100755 --- a/bin/paraFoam +++ b/bin/paraFoam @@ -44,6 +44,7 @@ options: -case specify alternative case directory, default is the cwd -region specify alternative mesh region -touch only create the file (eg, .blockMesh, .OpenFOAM, etc) + -touchAll create .blockMesh, .OpenFOAM files (and for all regions) -help print the usage * start paraview $ParaView_VERSION with the OpenFOAM libraries @@ -52,7 +53,7 @@ USAGE exit 1 } -unset regionName touchOnly +unset regionName touchOpt # reader extension extension=OpenFOAM @@ -83,7 +84,11 @@ do shift 2 ;; -touch) - touchOnly=true + touchOpt=true + shift + ;; + -touchAll) + touchOpt=all shift ;; *) @@ -103,12 +108,35 @@ then fvControls="$fvControls/$regionName" fi -if [ -n "$touchOnly" ] -then +case "${touchOpt:-false}" in +all) + extension=OpenFOAM + if [ -f constant/polyMesh/blockMeshDict ] + then + touch "$caseName.blockMesh" + echo "created '$caseName.blockMesh'" + fi + touch "$caseName.$extension" + echo "created '$caseName.$extension'" + # discover probable regions + for region in constant/* + do + if [ -d $region -a -d $region/polyMesh ] + then + regionName=${region##*/} + touch "$caseName{$regionName}.$extension" + echo "created '$caseName{$regionName}.$extension'" + fi + done + exit 0 + ;; +true) touch "$caseFile" echo "created '$caseFile'" exit 0 -fi + ;; +esac + # parent directory for normal or parallel results case "$caseName" in From 91967fb1965e4d9b8df97ab7b017ee99a6912efb Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Mon, 22 Feb 2010 13:51:17 +0100 Subject: [PATCH 08/26] COMP: compiling setSet directly (without Allwmake) now works --- .../utilities/mesh/manipulation/setSet/Allwmake | 10 ++++++---- .../utilities/mesh/manipulation/setSet/Make/options | 4 +++- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/applications/utilities/mesh/manipulation/setSet/Allwmake b/applications/utilities/mesh/manipulation/setSet/Allwmake index 1e116a3315..ef0a573951 100755 --- a/applications/utilities/mesh/manipulation/setSet/Allwmake +++ b/applications/utilities/mesh/manipulation/setSet/Allwmake @@ -1,15 +1,17 @@ #!/bin/sh cd ${0%/*} || exit 1 # run from this directory -READLINE=0 if [ -f /usr/include/readline/readline.h ] then echo "Found readline/readline.h -- enabling readline support." - READLINE=1 + export READLINE=1 export READLINELINK="-lreadline -lncurses" - break +else + # no readline/readline.h -- disabling readline support + export READLINE=0 + unset READLINELINK fi -export READLINE + wmake # ----------------------------------------------------------------- end-of-file diff --git a/applications/utilities/mesh/manipulation/setSet/Make/options b/applications/utilities/mesh/manipulation/setSet/Make/options index dcb1b5910c..d56c2b57f7 100644 --- a/applications/utilities/mesh/manipulation/setSet/Make/options +++ b/applications/utilities/mesh/manipulation/setSet/Make/options @@ -1,5 +1,7 @@ +/* NB: trailing zero after define improves robustness */ + EXE_INC = \ - -DREADLINE=$(READLINE) \ + -DREADLINE=$(READLINE)0 \ -I$(LIB_SRC)/meshTools/lnInclude EXE_LIBS = \ From f319ddfa61bad8d0b770fba0c1c0565173d781fc Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Wed, 24 Feb 2010 15:24:32 +0100 Subject: [PATCH 09/26] 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