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/applications/solvers/incompressible/boundaryFoam/interrogateWallPatches.H b/applications/solvers/incompressible/boundaryFoam/interrogateWallPatches.H index 27ddd24544..10855d9cc6 100644 --- a/applications/solvers/incompressible/boundaryFoam/interrogateWallPatches.H +++ b/applications/solvers/incompressible/boundaryFoam/interrogateWallPatches.H @@ -11,7 +11,7 @@ forAll(patches, patchi) { const fvPatch& currPatch = patches[patchi]; - if (isType(currPatch)) + if (isA(currPatch)) { const vectorField nf = currPatch.nf(); 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/mesh/conversion/ansysToFoam/ansysToFoam.L b/applications/utilities/mesh/conversion/ansysToFoam/ansysToFoam.L index f452a9f083..6cbe8aac27 100644 --- a/applications/utilities/mesh/conversion/ansysToFoam/ansysToFoam.L +++ b/applications/utilities/mesh/conversion/ansysToFoam/ansysToFoam.L @@ -91,23 +91,20 @@ cspace ","{space} alpha [_A-Za-z] digit [0-9] -dec_digit [0-9] -octal_digit [0-7] -hex_digit [0-9a-fA-F] identifier {alpha}({alpha}|{digit})* -integer {dec_digit}+ -label [1-9]{dec_digit}* +integer {digit}+ +label [1-9]{digit}* exponent_part [eE][-+]?{digit}+ fractional_constant [-+]?(({digit}*"."{digit}+)|({digit}+"."?)) -double (({fractional_constant}{exponent_part}?)|({digit}+{exponent_part})) +floatNum (({fractional_constant}{exponent_part}?)|({digit}+{exponent_part})) -x {double} -y {double} -z {double} -value {double} +x {floatNum} +y {floatNum} +z {floatNum} +value {floatNum} node ^{space}"N"{cspace} element ^{space}"EN"{cspace} 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/gambitToFoam/gambitToFoam.L b/applications/utilities/mesh/conversion/gambitToFoam/gambitToFoam.L index 36be409753..6a4447e677 100644 --- a/applications/utilities/mesh/conversion/gambitToFoam/gambitToFoam.L +++ b/applications/utilities/mesh/conversion/gambitToFoam/gambitToFoam.L @@ -95,24 +95,14 @@ int yyFlexLexer::yywrap() one_space [ \t\f\r] space {one_space}* some_space {one_space}+ -cspace ","{space} spaceNl ({space}|\n)* alpha [_[:alpha:]] digit [[:digit:]] -dec_digit [[:digit:]] -octal_digit [0-7] -hex_digit [[:xdigit:]] -lbrac "(" -rbrac ")" -quote \" -dash "-" -dotColonDash [.:-] +dotColonDash [.:-] -identifier {alpha}({alpha}|{digit})* -integer {dec_digit}+ -label [0-9]{dec_digit}* +label [0-9]{digit}* zeroLabel {digit}* word ({alpha}|{digit}|{dotColonDash})* @@ -120,14 +110,14 @@ word ({alpha}|{digit}|{dotColonDash})* exponent_part [eE][-+]?{digit}+ fractional_constant [-+]?(({digit}*"."{digit}+)|({digit}+"."?)) -double ((({fractional_constant}{exponent_part}?)|({digit}+{exponent_part}))|0) +floatNum ((({fractional_constant}{exponent_part}?)|({digit}+{exponent_part}))|0) + +x {floatNum} +y {floatNum} +z {floatNum} -x {double} -y {double} -z {double} -scalar {double} labelListElement {space}{zeroLabel} -scalarListElement {space}{double} +scalarListElement {space}{floatNum} labelList ({labelListElement}+{space}) scalarList ({scalarListElement}+{space}) diff --git a/applications/utilities/mesh/conversion/polyDualMesh/polyDualMeshApp.C b/applications/utilities/mesh/conversion/polyDualMesh/polyDualMeshApp.C index 0ccb7a6862..03832883cc 100644 --- a/applications/utilities/mesh/conversion/polyDualMesh/polyDualMeshApp.C +++ b/applications/utilities/mesh/conversion/polyDualMesh/polyDualMeshApp.C @@ -358,9 +358,22 @@ int main(int argc, char *argv[]) timeSelector::addOptions(true, false); argList::validArgs.append("feature angle[0-180]"); - argList::addBoolOption("splitAllFaces"); - argList::addBoolOption("concaveMultiCells"); - argList::addBoolOption("doNotPreserveFaceZones"); + argList::addBoolOption + ( + "splitAllFaces", + "have multiple faces inbetween cells" + ); + argList::addBoolOption + ( + "concaveMultiCells", + "split cells on concave boundary edges into multiple cells" + ); + argList::addBoolOption + ( + "doNotPreserveFaceZones", + "disable the default behaviour of preserving faceZones by having" + " multiple faces inbetween cells" + ); # include "setRootCase.H" # include "createTime.H" diff --git a/applications/utilities/mesh/conversion/star3ToFoam/createCoupleMatches.C b/applications/utilities/mesh/conversion/star3ToFoam/createCoupleMatches.C index ba13659a18..ad4bffa3b7 100644 --- a/applications/utilities/mesh/conversion/star3ToFoam/createCoupleMatches.C +++ b/applications/utilities/mesh/conversion/star3ToFoam/createCoupleMatches.C @@ -884,7 +884,7 @@ void starMesh::createCoupleMatches() << "newSlaveEdges: " << newSlaveEdges << endl; # endif - edge startEdge; + edge startEdge(-1, -1); // Remember where the start edge was found: // 0 for not found 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/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 = \ 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, diff --git a/applications/utilities/parallelProcessing/redistributeMeshPar/Make/options b/applications/utilities/parallelProcessing/redistributeMeshPar/Make/options index 45ab666e24..8f8010fff7 100644 --- a/applications/utilities/parallelProcessing/redistributeMeshPar/Make/options +++ b/applications/utilities/parallelProcessing/redistributeMeshPar/Make/options @@ -8,5 +8,4 @@ EXE_LIBS = \ -lfiniteVolume \ -ldecompositionMethods \ -lmeshTools \ - -ldynamicMesh \ - -L$(FOAM_MPI_LIBBIN) -lparMetisDecompositionMethod + -ldynamicMesh 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 + + + +inline void vtkOpenFOAMTupleRemap(float vec[]); + + +// a symmTensor specialization to remap OpenFOAM -> ParaView naming order +// Qt/Core/pqScalarBarRepresentation.cxx defines this order +// { "XX", "YY", "ZZ", "XY", "YZ", "XZ" } +// in pqScalarBarRepresentation::getDefaultComponentLabel() +// whereas OpenFOAM uses this order +// { XX, XY, XZ, YY, YZ, ZZ } +// +// for extra safety, assert that symmTensor indeed has 6 components +StaticAssert(Foam::symmTensor::nComponents == 6); + + +// Template specialization for symmTensor +template<> +inline void vtkOpenFOAMTupleRemap(float vec[]) +{ + Foam::Swap(vec[1], vec[3]); // swap XY <-> YY + Foam::Swap(vec[2], vec[5]); // swap XZ <-> ZZ +} + + +template +inline void vtkOpenFOAMTupleRemap(float vec[]) +{} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/vtkPV3Foam/vtkPV3Foam.C b/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/vtkPV3Foam/vtkPV3Foam.C index 41933d5ebf..a78f380bcb 100644 --- a/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/vtkPV3Foam/vtkPV3Foam.C +++ b/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/vtkPV3Foam/vtkPV3Foam.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 diff --git a/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/vtkPV3Foam/vtkPV3Foam.H b/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/vtkPV3Foam/vtkPV3Foam.H index 6037e78781..577edfc310 100644 --- a/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/vtkPV3Foam/vtkPV3Foam.H +++ b/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/vtkPV3Foam/vtkPV3Foam.H @@ -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 diff --git a/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/vtkPV3Foam/vtkPV3FoamAddToSelection.H b/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/vtkPV3Foam/vtkPV3FoamAddToSelection.H index b945d6c6a0..3a4ea56739 100644 --- a/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/vtkPV3Foam/vtkPV3FoamAddToSelection.H +++ b/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/vtkPV3Foam/vtkPV3FoamAddToSelection.H @@ -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 diff --git a/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/vtkPV3Foam/vtkPV3FoamFaceField.H b/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/vtkPV3Foam/vtkPV3FoamFaceField.H index 68f551ae5a..79c8b1aa97 100644 --- a/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/vtkPV3Foam/vtkPV3FoamFaceField.H +++ b/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/vtkPV3Foam/vtkPV3FoamFaceField.H @@ -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 @@ -36,6 +36,8 @@ InClass #include "vtkMultiBlockDataSet.h" #include "vtkPolyData.h" +#include "vtkOpenFOAMTupleRemap.H" + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // template @@ -80,7 +82,7 @@ void Foam::vtkPV3Foam::convertFaceField { Type t = 0.5*(tf[faceOwner[faceNo]] + tf[faceNeigh[faceNo]]); - for (direction d=0; d(vec); cellData->InsertTuple(faceI, vec); } @@ -152,7 +155,7 @@ void Foam::vtkPV3Foam::convertFaceField { Type t = 0.5*(tf[faceOwner[faceNo]] + tf[faceNeigh[faceNo]]); - for (direction d=0; d(vec); cellData->InsertTuple(faceI, vec); ++faceI; diff --git a/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/vtkPV3Foam/vtkPV3FoamFields.C b/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/vtkPV3Foam/vtkPV3FoamFields.C index 936d1aed26..02319d9f11 100644 --- a/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/vtkPV3Foam/vtkPV3FoamFields.C +++ b/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/vtkPV3Foam/vtkPV3FoamFields.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 diff --git a/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/vtkPV3Foam/vtkPV3FoamLagrangianFields.H b/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/vtkPV3Foam/vtkPV3FoamLagrangianFields.H index 9bd18ea353..c3013022e8 100644 --- a/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/vtkPV3Foam/vtkPV3FoamLagrangianFields.H +++ b/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/vtkPV3Foam/vtkPV3FoamLagrangianFields.H @@ -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 @@ -32,6 +32,8 @@ InClass #include "Cloud.H" +#include "vtkOpenFOAMTupleRemap.H" + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // template @@ -86,10 +88,11 @@ void Foam::vtkPV3Foam::convertLagrangianField forAll(tf, i) { const Type& t = tf[i]; - for (direction d=0; d(vec); pointData->InsertTuple(i, vec); } diff --git a/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/vtkPV3Foam/vtkPV3FoamMesh.C b/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/vtkPV3Foam/vtkPV3FoamMesh.C index cc78346b40..14f85ad656 100644 --- a/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/vtkPV3Foam/vtkPV3FoamMesh.C +++ b/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/vtkPV3Foam/vtkPV3FoamMesh.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 diff --git a/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/vtkPV3Foam/vtkPV3FoamMeshLagrangian.C b/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/vtkPV3Foam/vtkPV3FoamMeshLagrangian.C index 25d31b64dc..187daa4613 100644 --- a/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/vtkPV3Foam/vtkPV3FoamMeshLagrangian.C +++ b/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/vtkPV3Foam/vtkPV3FoamMeshLagrangian.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 diff --git a/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/vtkPV3Foam/vtkPV3FoamMeshPatch.C b/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/vtkPV3Foam/vtkPV3FoamMeshPatch.C index ace25f527f..3039fd2552 100644 --- a/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/vtkPV3Foam/vtkPV3FoamMeshPatch.C +++ b/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/vtkPV3Foam/vtkPV3FoamMeshPatch.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 diff --git a/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/vtkPV3Foam/vtkPV3FoamMeshSet.C b/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/vtkPV3Foam/vtkPV3FoamMeshSet.C index 431df1f9c5..ab2e6fdc02 100644 --- a/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/vtkPV3Foam/vtkPV3FoamMeshSet.C +++ b/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/vtkPV3Foam/vtkPV3FoamMeshSet.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 diff --git a/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/vtkPV3Foam/vtkPV3FoamMeshVolume.C b/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/vtkPV3Foam/vtkPV3FoamMeshVolume.C index b39dfd453f..8cba50347a 100644 --- a/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/vtkPV3Foam/vtkPV3FoamMeshVolume.C +++ b/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/vtkPV3Foam/vtkPV3FoamMeshVolume.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 @@ -25,6 +25,7 @@ License \*---------------------------------------------------------------------------*/ #include "vtkPV3Foam.H" +#include "vtkPV3FoamReader.h" // Foam includes #include "fvMesh.H" @@ -33,6 +34,7 @@ License // VTK includes #include "vtkCellArray.h" +#include "vtkIdTypeArray.h" #include "vtkUnstructuredGrid.h" // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // @@ -79,35 +81,40 @@ vtkUnstructuredGrid* Foam::vtkPV3Foam::volumeVTKMesh { Info<< "... scanning" << endl; } - forAll(cellShapes, cellI) + + // count number of cells to decompose + if (!reader_->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]; @@ -194,10 +201,15 @@ vtkUnstructuredGrid* Foam::vtkPV3Foam::volumeVTKMesh } else if (cellModel == prism) { - for (int j = 0; j < 6; j++) - { - nodeIds[j] = cellShape[j]; - } + // VTK has a different node order - their triangles point outwards! + + nodeIds[0] = cellShape[0]; + nodeIds[1] = cellShape[2]; + nodeIds[2] = cellShape[1]; + nodeIds[3] = cellShape[3]; + nodeIds[4] = cellShape[5]; + nodeIds[5] = cellShape[4]; + vtkmesh->InsertNextCell ( VTK_WEDGE, @@ -256,6 +268,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