From e5d9fd13c206d34f810be2be0dcb1fee33b1d8b2 Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Wed, 9 Nov 2016 23:33:24 +0100 Subject: [PATCH 01/84] ENH: relocate meshSubsetHelper into dynamicMesh for re-use - reuse for foamToTecplot360 and foamToVTK. - remove dependency on vtkMesh where possible. --- .../dataConversion/foamToEnsight/Make/files | 2 - .../foamToEnsight/foamToEnsight.C | 2 +- .../foamToTecplot360/Make/files | 1 - .../foamToTecplot360/foamToTecplot360.C | 102 +++++----- .../foamToTecplot360/readFields.C | 31 ++- .../foamToTecplot360/readFields.H | 10 +- .../dataConversion/foamToTecplot360/vtkMesh.C | 83 -------- .../dataConversion/foamToTecplot360/vtkMesh.H | 178 ------------------ .../dataConversion/foamToVTK/foamToVTK.C | 17 +- .../foamToVTK/foamToVTK/Make/files | 1 - .../foamToVTK/foamToVTK/internalWriter.H | 2 - .../foamToVTK/foamToVTK/lagrangianWriter.C | 10 +- .../foamToVTK/foamToVTK/lagrangianWriter.H | 9 +- .../foamToVTK/lagrangianWriterTemplates.C | 4 +- .../foamToVTK/foamToVTK/patchWriter.C | 11 +- .../foamToVTK/foamToVTK/patchWriter.H | 10 +- .../foamToVTK/foamToVTK/readFields.C | 21 +-- .../foamToVTK/foamToVTK/readFields.H | 6 +- .../foamToVTK/foamToVTK/surfaceMeshWriter.H | 3 - .../foamToVTK/surfaceMeshWriterTemplates.C | 3 +- .../foamToVTK/foamToVTK/vtkMesh.C | 82 -------- .../foamToVTK/foamToVTK/vtkMesh.H | 86 +++------ .../foamToVTK/foamToVTK/writeFaceSet.C | 8 +- .../foamToVTK/foamToVTK/writeFaceSet.H | 6 +- .../foamToVTK/foamToVTK/writePointSet.C | 4 +- .../foamToVTK/foamToVTK/writePointSet.H | 6 +- .../foamToVTK/foamToVTK/writeSurfFields.C | 6 +- .../foamToVTK/foamToVTK/writeSurfFields.H | 4 +- src/dynamicMesh/Make/files | 1 + .../meshSubsetHelper}/meshSubsetHelper.C | 29 ++- .../meshSubsetHelper}/meshSubsetHelper.H | 33 +++- .../meshSubsetHelperTemplates.C | 21 +++ 32 files changed, 209 insertions(+), 583 deletions(-) delete mode 100644 applications/utilities/postProcessing/dataConversion/foamToTecplot360/vtkMesh.C delete mode 100644 applications/utilities/postProcessing/dataConversion/foamToTecplot360/vtkMesh.H delete mode 100644 applications/utilities/postProcessing/dataConversion/foamToVTK/foamToVTK/vtkMesh.C rename {applications/utilities/postProcessing/dataConversion/foamToEnsight => src/dynamicMesh/meshSubsetHelper}/meshSubsetHelper.C (88%) rename {applications/utilities/postProcessing/dataConversion/foamToEnsight => src/dynamicMesh/meshSubsetHelper}/meshSubsetHelper.H (86%) rename {applications/utilities/postProcessing/dataConversion/foamToEnsight => src/dynamicMesh/meshSubsetHelper}/meshSubsetHelperTemplates.C (89%) diff --git a/applications/utilities/postProcessing/dataConversion/foamToEnsight/Make/files b/applications/utilities/postProcessing/dataConversion/foamToEnsight/Make/files index 044aa6ae43..a474a8fcfc 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToEnsight/Make/files +++ b/applications/utilities/postProcessing/dataConversion/foamToEnsight/Make/files @@ -1,6 +1,4 @@ ensightOutputCloud.C -meshSubsetHelper.C - foamToEnsight.C EXE = $(FOAM_APPBIN)/foamToEnsight diff --git a/applications/utilities/postProcessing/dataConversion/foamToEnsight/foamToEnsight.C b/applications/utilities/postProcessing/dataConversion/foamToEnsight/foamToEnsight.C index 1d0f6c3beb..5080d840eb 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToEnsight/foamToEnsight.C +++ b/applications/utilities/postProcessing/dataConversion/foamToEnsight/foamToEnsight.C @@ -291,7 +291,7 @@ int main(int argc, char *argv[]) << mesh.boundaryMesh()[0].name() << ")" << endl; } - meshSubsetHelper myMesh(mesh, cellZoneName); + meshSubsetHelper myMesh(mesh, meshSubsetHelper::ZONE, cellZoneName); // // Open new ensight case file, initialize header etc. diff --git a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/Make/files b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/Make/files index 270e84931b..3eb58f1773 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/Make/files +++ b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/Make/files @@ -1,5 +1,4 @@ tecplotWriter.C -vtkMesh.C foamToTecplot360.C EXE = $(FOAM_APPBIN)/foamToTecplot360 diff --git a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/foamToTecplot360.C b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/foamToTecplot360.C index 6ec9aff277..5dbe1581ca 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/foamToTecplot360.C +++ b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/foamToTecplot360.C @@ -3,7 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation - \\/ M anipulation | + \\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -68,9 +68,6 @@ Usage information as a single argument. The double quotes denote a regular expression. - - \par -useTimeName - use the time index in the VTK file name instead of the time index - \*---------------------------------------------------------------------------*/ #include "pointMesh.H" @@ -86,7 +83,7 @@ Usage #include "stringListOps.H" #include "wordRe.H" -#include "vtkMesh.H" +#include "meshSubsetHelper.H" #include "readFields.H" #include "tecplotWriter.H" @@ -99,7 +96,7 @@ Usage // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // template -void print(const char* msg, Ostream& os, const PtrList& flds) +void print(const char* msg, Ostream& os, const PtrList& flds) { if (flds.size()) { @@ -140,7 +137,7 @@ labelList getSelectedPatches if ( isType(pp) - || (Pstream::parRun() && isType(pp)) + || (Pstream::parRun() && isType(pp)) ) { Info<< " discarding empty/processor patch " << patchi @@ -161,8 +158,7 @@ labelList getSelectedPatches } - - +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // int main(int argc, char *argv[]) { @@ -170,10 +166,8 @@ int main(int argc, char *argv[]) ( "Tecplot binary file format writer" ); - timeSelector::addOptions(); #include "addRegionOption.H" - argList::addOption ( "fields", @@ -190,7 +184,7 @@ int main(int argc, char *argv[]) ( "faceSet", "name", - "restrict conversion to the specified cellSet" + "restrict conversion to the specified faceSet" ); argList::addBoolOption ( @@ -248,7 +242,8 @@ int main(int argc, char *argv[]) } word cellSetName; - string vtkName; + word faceSetName; + string vtkName = runTime.caseName(); if (args.optionReadIfPresent("cellSet", cellSetName)) { @@ -266,11 +261,7 @@ int main(int argc, char *argv[]) vtkName = vtkName.substr(i); } } - else - { - vtkName = runTime.caseName(); - } - + args.optionReadIfPresent("faceSet", faceSetName); instantList timeDirs = timeSelector::select0(runTime, args); @@ -294,10 +285,11 @@ int main(int argc, char *argv[]) args.optionFound("time") || args.optionFound("latestTime") || cellSetName.size() + || faceSetName.size() || regionName != polyMesh::defaultRegion ) { - Info<< "Keeping old files in " << fvPath << nl << endl; + Info<< "Keeping old tecplot files in " << fvPath << nl << endl; } else { @@ -309,9 +301,8 @@ int main(int argc, char *argv[]) mkDir(fvPath); - - // mesh wrapper; does subsetting and decomposition - vtkMesh vMesh(mesh, cellSetName); + // Mesh wrapper: does subsetting + meshSubsetHelper myMesh(mesh, meshSubsetHelper::SET, cellSetName); forAll(timeDirs, timeI) { @@ -319,13 +310,12 @@ int main(int argc, char *argv[]) Info<< "Time: " << runTime.timeName() << endl; - const word timeDesc = name(timeI); //name(runTime.timeIndex()); + const word timeDesc = name(timeI); // Foam::name(runTime.timeIndex()); // Check for new polyMesh/ and update mesh, fvMeshSubset and cell // decomposition. - polyMesh::readUpdateState meshState = vMesh.readUpdate(); - - const fvMesh& mesh = vMesh.mesh(); + polyMesh::readUpdateState meshState = myMesh.readUpdate(); + const fvMesh& mesh = myMesh.mesh(); INTEGER4 nFaceNodes = 0; forAll(mesh.faces(), facei) @@ -348,24 +338,24 @@ int main(int argc, char *argv[]) // Construct the vol fields (on the original mesh if subsetted) - PtrList vsf; - readFields(vMesh, vMesh.baseMesh(), objects, selectedFields, vsf); + PtrList vsf; + readFields(myMesh, myMesh.baseMesh(), objects, selectedFields, vsf); print(" volScalarFields :", Info, vsf); - PtrList vvf; - readFields(vMesh, vMesh.baseMesh(), objects, selectedFields, vvf); + PtrList vvf; + readFields(myMesh, myMesh.baseMesh(), objects, selectedFields, vvf); print(" volVectorFields :", Info, vvf); - PtrList vSpheretf; - readFields(vMesh, vMesh.baseMesh(), objects, selectedFields, vSpheretf); + PtrList vSpheretf; + readFields(myMesh, myMesh.baseMesh(), objects, selectedFields, vSpheretf); print(" volSphericalTensorFields :", Info, vSpheretf); - PtrList vSymmtf; - readFields(vMesh, vMesh.baseMesh(), objects, selectedFields, vSymmtf); + PtrList vSymmtf; + readFields(myMesh, myMesh.baseMesh(), objects, selectedFields, vSymmtf); print(" volSymmTensorFields :", Info, vSymmtf); - PtrList vtf; - readFields(vMesh, vMesh.baseMesh(), objects, selectedFields, vtf); + PtrList vtf; + readFields(myMesh, myMesh.baseMesh(), objects, selectedFields, vtf); print(" volTensorFields :", Info, vtf); @@ -379,11 +369,11 @@ int main(int argc, char *argv[]) << " (\"-noPointValues\" (at your option)\n"; } - PtrList psf; - PtrList pvf; - //PtrList pSpheretf; - //PtrList pSymmtf; - //PtrList ptf; + PtrList psf; + PtrList pvf; + //PtrList pSpheretf; + //PtrList pSymmtf; + //PtrList ptf; if (!noPointValues) @@ -418,8 +408,8 @@ int main(int argc, char *argv[]) readFields ( - vMesh, - pointMesh::New(vMesh.baseMesh()), + myMesh, + pointMesh::New(myMesh.baseMesh()), objects, selectedFields, psf @@ -428,8 +418,8 @@ int main(int argc, char *argv[]) readFields ( - vMesh, - pointMesh::New(vMesh.baseMesh()), + myMesh, + pointMesh::New(myMesh.baseMesh()), objects, selectedFields, pvf @@ -438,8 +428,8 @@ int main(int argc, char *argv[]) //readFields //( - // vMesh, - // pointMesh::New(vMesh.baseMesh()), + // myMesh, + // pointMesh::New(myMesh.baseMesh()), // objects, // selectedFields, // pSpheretf @@ -448,8 +438,8 @@ int main(int argc, char *argv[]) // //readFields //( - // vMesh, - // pointMesh::New(vMesh.baseMesh()), + // myMesh, + // pointMesh::New(myMesh.baseMesh()), // objects, // selectedFields, // pSymmtf @@ -458,8 +448,8 @@ int main(int argc, char *argv[]) // //readFields //( - // vMesh, - // pointMesh::New(vMesh.baseMesh()), + // myMesh, + // pointMesh::New(myMesh.baseMesh()), // objects, // selectedFields, // ptf @@ -769,11 +759,10 @@ int main(int argc, char *argv[]) // //--------------------------------------------------------------------- - if (args.optionFound("faceSet")) + if (faceSetName.size()) { // Load the faceSet - const word setName = args["faceSet"]; - labelList faceLabels(faceSet(mesh, setName).toc()); + labelList faceLabels(faceSet(mesh, faceSetName).toc()); // Filename as if patch with same name. mkDir(fvPath/setName); @@ -886,7 +875,6 @@ int main(int argc, char *argv[]) } - //--------------------------------------------------------------------- // // Write patches as multi-zone file @@ -901,7 +889,7 @@ int main(int argc, char *argv[]) fileName patchFileName; - if (vMesh.useSubMesh()) + if (myMesh.useSubMesh()) { patchFileName = fvPath/"boundaryMesh"/cellSetName @@ -1072,7 +1060,7 @@ int main(int argc, char *argv[]) fileName patchFileName; - if (vMesh.useSubMesh()) + if (myMesh.useSubMesh()) { patchFileName = fvPath/"faceZoneMesh"/cellSetName diff --git a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/readFields.C b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/readFields.C index c677fe439c..172a83cf23 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/readFields.C +++ b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/readFields.C @@ -2,8 +2,8 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation - \\/ M anipulation | + \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation + \\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -36,37 +36,32 @@ namespace Foam template void readFields ( - const vtkMesh& vMesh, + const meshSubsetHelper& helper, const typename GeoField::Mesh& mesh, const IOobjectList& objects, const HashSet& selectedFields, - PtrList& fields + PtrList& fields ) { - // Search list of objects for volScalarFields + // Search list of objects for fields of type GeomField IOobjectList fieldObjects(objects.lookupClass(GeoField::typeName)); - // Construct the vol scalar fields - label nFields = fields.size(); - fields.setSize(nFields + fieldObjects.size()); + // Construct the fields + fields.setSize(fieldObjects.size()); + label nFields = 0; - forAllIter(IOobjectList, fieldObjects, iter) + forAllConstIter(IOobjectList, fieldObjects, iter) { if (selectedFields.empty() || selectedFields.found(iter()->name())) { fields.set ( - nFields, - vMesh.interpolate + nFields++, + helper.interpolate ( - GeoField - ( - *iter(), - mesh - ) - ) + GeoField(*iter(), mesh) + ).ptr() ); - nFields++; } } diff --git a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/readFields.H b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/readFields.H index b25c56755c..510bd11d25 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/readFields.H +++ b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/readFields.H @@ -2,8 +2,8 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation - \\/ M anipulation | + \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation + \\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -34,7 +34,7 @@ SourceFiles #ifndef readFields_H #define readFields_H -#include "fvMesh.H" +#include "meshSubsetHelper.H" #include "PtrList.H" #include "IOobjectList.H" #include "HashSet.H" @@ -48,11 +48,11 @@ namespace Foam template void readFields ( - const vtkMesh& vMesh, + const meshSubsetHelper&, const typename GeoField::Mesh& mesh, const IOobjectList& objects, const HashSet& selectedFields, - PtrList& fields + PtrList& fields ); } // End namespace Foam diff --git a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/vtkMesh.C b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/vtkMesh.C deleted file mode 100644 index 0a58e5d523..0000000000 --- a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/vtkMesh.C +++ /dev/null @@ -1,83 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation - \\/ 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 3 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, see . - -\*---------------------------------------------------------------------------*/ - -#include "vtkMesh.H" -#include "fvMeshSubset.H" -#include "Time.H" -#include "cellSet.H" - -// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // - -// Construct from components -Foam::vtkMesh::vtkMesh -( - fvMesh& baseMesh, - const word& setName -) -: - baseMesh_(baseMesh), - subsetter_(baseMesh), - setName_(setName) -{ - if (setName.size()) - { - // Read cellSet using whole mesh - cellSet currentSet(baseMesh_, setName_); - - // Set current subset - subsetter_.setLargeCellSubset(currentSet); - } -} - - -// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // - -Foam::polyMesh::readUpdateState Foam::vtkMesh::readUpdate() -{ - polyMesh::readUpdateState meshState = baseMesh_.readUpdate(); - - if (meshState != polyMesh::UNCHANGED) - { - // Note: since fvMeshSubset has no movePoints() functionality - // reconstruct the subset even if only movement. - -// topoPtr_.clear(); - - if (setName_.size()) - { - Info<< "Subsetting mesh based on cellSet " << setName_ << endl; - - // Read cellSet using whole mesh - cellSet currentSet(baseMesh_, setName_); - - subsetter_.setLargeCellSubset(currentSet); - } - } - - return meshState; -} - - -// ************************************************************************* // diff --git a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/vtkMesh.H b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/vtkMesh.H deleted file mode 100644 index ec6045b534..0000000000 --- a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/vtkMesh.H +++ /dev/null @@ -1,178 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation - \\/ 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 3 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, see . - -Class - Foam::vtkMesh - -Description - Encapsulation of VTK mesh data. Holds mesh or meshsubset and - polyhedral-cell decomposition on it. - -SourceFiles - vtkMesh.C - -\*---------------------------------------------------------------------------*/ - -#ifndef vtkMesh_H -#define vtkMesh_H - -#include "fvMeshSubset.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - -// Forward declaration of classes -class Time; - -/*---------------------------------------------------------------------------*\ - Class vtkMesh Declaration -\*---------------------------------------------------------------------------*/ - -class vtkMesh -{ - // Private data - - //- Reference to mesh - fvMesh& baseMesh_; - - //- Subsetting engine + sub-fvMesh - fvMeshSubset subsetter_; - - //- Current cellSet (or empty) - const word setName_; - -// //- Current decomposition of topology -// mutable autoPtr topoPtr_; - - - - // Private Member Functions - - //- Disallow default bitwise copy construct - vtkMesh(const vtkMesh&); - - //- Disallow default bitwise assignment - void operator=(const vtkMesh&); - - -public: - - // Constructors - - //- Construct from components - vtkMesh(fvMesh& baseMesh, const word& setName = ""); - - - // Member Functions - - // Access - - //- Whole mesh - const fvMesh& baseMesh() const - { - return baseMesh_; - } - - const fvMeshSubset& subsetter() const - { - return subsetter_; - } - - //- Check if running subMesh - bool useSubMesh() const - { - return setName_.size(); - } - -// //- topology -// const vtkTopo& topo() const -// { -// if (topoPtr_.empty()) -// { -// topoPtr_.reset(new vtkTopo(mesh())); -// } -// return topoPtr_(); -// } - - //- Access either mesh or submesh - const fvMesh& mesh() const - { - if (useSubMesh()) - { - return subsetter_.subMesh(); - } - else - { - return baseMesh_; - } - } - -// //- Number of field cells -// label nFieldCells() const -// { -// return topo().vertLabels().size(); -// } -// -// //- Number of field points -// label nFieldPoints() const -// { -// return mesh().nPoints() + topo().addPointCellLabels().size(); -// } - - - // Edit - - //- Read mesh - polyMesh::readUpdateState readUpdate(); - - - //- Map volume field (does in fact do very little interpolation; - // just copied from fvMeshSubset) - template - tmp interpolate(const GeoField& fld) const - { - if (useSubMesh()) - { - tmp subFld = subsetter_.interpolate(fld); - subFld.ref().rename(fld.name()); - return subFld; - } - else - { - return fld; - } - } -}; - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#endif - -// ************************************************************************* // diff --git a/applications/utilities/postProcessing/dataConversion/foamToVTK/foamToVTK.C b/applications/utilities/postProcessing/dataConversion/foamToVTK/foamToVTK.C index 4e42b5afbf..c2a6f3b298 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToVTK/foamToVTK.C +++ b/applications/utilities/postProcessing/dataConversion/foamToVTK/foamToVTK.C @@ -410,7 +410,6 @@ int main(int argc, char *argv[]) args.optionReadIfPresent("pointSet", pointSetName); - instantList timeDirs = timeSelector::select0(runTime, args); #include "createNamedMesh.H" @@ -450,7 +449,7 @@ int main(int argc, char *argv[]) mkDir(fvPath); - // Mesh wrapper; does subsetting and decomposition + // Mesh wrapper: does subsetting and decomposition vtkMesh vMesh(mesh, cellSetName); Info<< "VTK mesh topology: " @@ -503,7 +502,7 @@ int main(int argc, char *argv[]) Info<< " FaceSet : " << patchFileName << endl; - writeFaceSet(binary, vMesh, set, patchFileName); + writeFaceSet(binary, vMesh.mesh(), set, patchFileName); continue; } @@ -526,7 +525,7 @@ int main(int argc, char *argv[]) Info<< " pointSet : " << patchFileName << endl; - writePointSet(binary, vMesh, set, patchFileName); + writePointSet(binary, vMesh.mesh(), set, patchFileName); continue; } @@ -849,7 +848,7 @@ int main(int argc, char *argv[]) writeSurfFields ( binary, - vMesh, + vMesh.mesh(), surfFileName, svf ); @@ -892,7 +891,7 @@ int main(int argc, char *argv[]) patchWriter writer ( - vMesh, + vMesh.mesh(), binary, nearCellValue, patchFileName, @@ -970,7 +969,7 @@ int main(int argc, char *argv[]) patchWriter writer ( - vMesh, + vMesh.mesh(), binary, nearCellValue, patchFileName, @@ -1188,7 +1187,7 @@ int main(int argc, char *argv[]) lagrangianWriter writer ( - vMesh, + vMesh.mesh(), binary, lagrFileName, cloudName, @@ -1218,7 +1217,7 @@ int main(int argc, char *argv[]) { lagrangianWriter writer ( - vMesh, + vMesh.mesh(), binary, lagrFileName, cloudName, diff --git a/applications/utilities/postProcessing/dataConversion/foamToVTK/foamToVTK/Make/files b/applications/utilities/postProcessing/dataConversion/foamToVTK/foamToVTK/Make/files index 4deaaa68f0..02de5b47e6 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToVTK/foamToVTK/Make/files +++ b/applications/utilities/postProcessing/dataConversion/foamToVTK/foamToVTK/Make/files @@ -6,7 +6,6 @@ writeFuns.C writeFaceSet.C writePointSet.C writeSurfFields.C -vtkMesh.C vtkTopo.C writeVTK/writeVTK.C diff --git a/applications/utilities/postProcessing/dataConversion/foamToVTK/foamToVTK/internalWriter.H b/applications/utilities/postProcessing/dataConversion/foamToVTK/foamToVTK/internalWriter.H index b61cfd6377..b1836afb60 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToVTK/foamToVTK/internalWriter.H +++ b/applications/utilities/postProcessing/dataConversion/foamToVTK/foamToVTK/internalWriter.H @@ -41,8 +41,6 @@ SourceFiles #include "pointFields.H" #include "vtkMesh.H" -using namespace Foam; - // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // namespace Foam diff --git a/applications/utilities/postProcessing/dataConversion/foamToVTK/foamToVTK/lagrangianWriter.C b/applications/utilities/postProcessing/dataConversion/foamToVTK/foamToVTK/lagrangianWriter.C index 6c168a2280..6eab8f1646 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToVTK/foamToVTK/lagrangianWriter.C +++ b/applications/utilities/postProcessing/dataConversion/foamToVTK/foamToVTK/lagrangianWriter.C @@ -3,7 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation - \\/ M anipulation | + \\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -32,23 +32,21 @@ License Foam::lagrangianWriter::lagrangianWriter ( - const vtkMesh& vMesh, + const fvMesh& mesh, const bool binary, const fileName& fName, const word& cloudName, const bool dummyCloud ) : - vMesh_(vMesh), + mesh_(mesh), binary_(binary), fName_(fName), cloudName_(cloudName), os_(fName.c_str()) { - const fvMesh& mesh = vMesh_.mesh(); - // Write header - writeFuns::writeHeader(os_, binary_, mesh.time().caseName()); + writeFuns::writeHeader(os_, binary_, mesh_.time().caseName()); os_ << "DATASET POLYDATA" << std::endl; if (dummyCloud) diff --git a/applications/utilities/postProcessing/dataConversion/foamToVTK/foamToVTK/lagrangianWriter.H b/applications/utilities/postProcessing/dataConversion/foamToVTK/foamToVTK/lagrangianWriter.H index 113bfe43b0..24dd4a3228 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToVTK/foamToVTK/lagrangianWriter.H +++ b/applications/utilities/postProcessing/dataConversion/foamToVTK/foamToVTK/lagrangianWriter.H @@ -3,7 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation - \\/ M anipulation | + \\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -40,9 +40,6 @@ SourceFiles #include "Cloud.H" #include "volFields.H" #include "pointFields.H" -#include "vtkMesh.H" - -using namespace Foam; // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -57,7 +54,7 @@ class volPointInterpolation; class lagrangianWriter { - const vtkMesh& vMesh_; + const fvMesh& mesh_; const bool binary_; @@ -77,7 +74,7 @@ public: //- Construct from components lagrangianWriter ( - const vtkMesh&, + const fvMesh&, const bool binary, const fileName&, const word&, diff --git a/applications/utilities/postProcessing/dataConversion/foamToVTK/foamToVTK/lagrangianWriterTemplates.C b/applications/utilities/postProcessing/dataConversion/foamToVTK/foamToVTK/lagrangianWriterTemplates.C index 8d34517dca..86cec10dc3 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToVTK/foamToVTK/lagrangianWriterTemplates.C +++ b/applications/utilities/postProcessing/dataConversion/foamToVTK/foamToVTK/lagrangianWriterTemplates.C @@ -39,9 +39,9 @@ void Foam::lagrangianWriter::writeIOField(const wordList& objects) IOobject header ( object, - vMesh_.mesh().time().timeName(), + mesh_.time().timeName(), cloud::prefix/cloudName_, - vMesh_.mesh(), + mesh_, IOobject::MUST_READ, IOobject::NO_WRITE, false diff --git a/applications/utilities/postProcessing/dataConversion/foamToVTK/foamToVTK/patchWriter.C b/applications/utilities/postProcessing/dataConversion/foamToVTK/foamToVTK/patchWriter.C index 4a9840c1e2..d099745aa2 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToVTK/foamToVTK/patchWriter.C +++ b/applications/utilities/postProcessing/dataConversion/foamToVTK/foamToVTK/patchWriter.C @@ -3,7 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation - \\/ M anipulation | + \\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -30,21 +30,20 @@ License Foam::patchWriter::patchWriter ( - const vtkMesh& vMesh, + const fvMesh& mesh, const bool binary, const bool nearCellValue, const fileName& fName, const labelList& patchIDs ) : - vMesh_(vMesh), + mesh_(mesh), binary_(binary), nearCellValue_(nearCellValue), fName_(fName), patchIDs_(patchIDs), os_(fName.c_str()) { - const fvMesh& mesh = vMesh_.mesh(); const polyBoundaryMesh& patches = mesh.boundaryMesh(); // Write header @@ -115,8 +114,6 @@ Foam::patchWriter::patchWriter void Foam::patchWriter::writePatchIDs() { - const fvMesh& mesh = vMesh_.mesh(); - DynamicList fField(nFaces_); os_ << "patchID 1 " << nFaces_ << " float" << std::endl; @@ -125,7 +122,7 @@ void Foam::patchWriter::writePatchIDs() { label patchi = patchIDs_[i]; - const polyPatch& pp = mesh.boundaryMesh()[patchi]; + const polyPatch& pp = mesh_.boundaryMesh()[patchi]; if (!isA(pp)) { diff --git a/applications/utilities/postProcessing/dataConversion/foamToVTK/foamToVTK/patchWriter.H b/applications/utilities/postProcessing/dataConversion/foamToVTK/foamToVTK/patchWriter.H index e25bbb1122..aab8075da8 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToVTK/foamToVTK/patchWriter.H +++ b/applications/utilities/postProcessing/dataConversion/foamToVTK/foamToVTK/patchWriter.H @@ -3,7 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation - \\/ M anipulation | + \\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -40,12 +40,9 @@ SourceFiles #include "OFstream.H" #include "volFields.H" #include "pointFields.H" -#include "vtkMesh.H" #include "indirectPrimitivePatch.H" #include "PrimitivePatchInterpolation.H" -using namespace Foam; - // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // namespace Foam @@ -59,7 +56,8 @@ class volPointInterpolation; class patchWriter { - const vtkMesh& vMesh_; + //- Reference to the OpenFOAM mesh (or subset) + const fvMesh& mesh_; const bool binary_; @@ -82,7 +80,7 @@ public: //- Construct from components patchWriter ( - const vtkMesh&, + const fvMesh&, const bool binary, const bool nearCellValue, const fileName&, diff --git a/applications/utilities/postProcessing/dataConversion/foamToVTK/foamToVTK/readFields.C b/applications/utilities/postProcessing/dataConversion/foamToVTK/foamToVTK/readFields.C index 8d515ab056..172a83cf23 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToVTK/foamToVTK/readFields.C +++ b/applications/utilities/postProcessing/dataConversion/foamToVTK/foamToVTK/readFields.C @@ -3,7 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation - \\/ M anipulation | + \\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -36,37 +36,32 @@ namespace Foam template void readFields ( - const vtkMesh& vMesh, + const meshSubsetHelper& helper, const typename GeoField::Mesh& mesh, const IOobjectList& objects, const HashSet& selectedFields, PtrList& fields ) { - // Search list of objects for volScalarFields + // Search list of objects for fields of type GeomField IOobjectList fieldObjects(objects.lookupClass(GeoField::typeName)); - // Construct the vol scalar fields + // Construct the fields fields.setSize(fieldObjects.size()); label nFields = 0; - forAllIter(IOobjectList, fieldObjects, iter) + forAllConstIter(IOobjectList, fieldObjects, iter) { if (selectedFields.empty() || selectedFields.found(iter()->name())) { fields.set ( - nFields, - vMesh.interpolate + nFields++, + helper.interpolate ( - GeoField - ( - *iter(), - mesh - ) + GeoField(*iter(), mesh) ).ptr() ); - nFields++; } } diff --git a/applications/utilities/postProcessing/dataConversion/foamToVTK/foamToVTK/readFields.H b/applications/utilities/postProcessing/dataConversion/foamToVTK/foamToVTK/readFields.H index 31b7e2632c..510bd11d25 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToVTK/foamToVTK/readFields.H +++ b/applications/utilities/postProcessing/dataConversion/foamToVTK/foamToVTK/readFields.H @@ -3,7 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation - \\/ M anipulation | + \\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -34,7 +34,7 @@ SourceFiles #ifndef readFields_H #define readFields_H -#include "fvMesh.H" +#include "meshSubsetHelper.H" #include "PtrList.H" #include "IOobjectList.H" #include "HashSet.H" @@ -48,7 +48,7 @@ namespace Foam template void readFields ( - const vtkMesh& vMesh, + const meshSubsetHelper&, const typename GeoField::Mesh& mesh, const IOobjectList& objects, const HashSet& selectedFields, diff --git a/applications/utilities/postProcessing/dataConversion/foamToVTK/foamToVTK/surfaceMeshWriter.H b/applications/utilities/postProcessing/dataConversion/foamToVTK/foamToVTK/surfaceMeshWriter.H index f06da45c3f..0a5589c26e 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToVTK/foamToVTK/surfaceMeshWriter.H +++ b/applications/utilities/postProcessing/dataConversion/foamToVTK/foamToVTK/surfaceMeshWriter.H @@ -40,11 +40,8 @@ SourceFiles #include "OFstream.H" #include "volFields.H" #include "surfaceFields.H" -#include "vtkMesh.H" #include "indirectPrimitivePatch.H" -using namespace Foam; - // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // namespace Foam diff --git a/applications/utilities/postProcessing/dataConversion/foamToVTK/foamToVTK/surfaceMeshWriterTemplates.C b/applications/utilities/postProcessing/dataConversion/foamToVTK/foamToVTK/surfaceMeshWriterTemplates.C index 68fd29d257..92d878f229 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToVTK/foamToVTK/surfaceMeshWriterTemplates.C +++ b/applications/utilities/postProcessing/dataConversion/foamToVTK/foamToVTK/surfaceMeshWriterTemplates.C @@ -29,7 +29,8 @@ License // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // template -Foam::tmp> Foam::surfaceMeshWriter::getFaceField +Foam::tmp> +Foam::surfaceMeshWriter::getFaceField ( const GeometricField& sfld ) const diff --git a/applications/utilities/postProcessing/dataConversion/foamToVTK/foamToVTK/vtkMesh.C b/applications/utilities/postProcessing/dataConversion/foamToVTK/foamToVTK/vtkMesh.C deleted file mode 100644 index d13a96df3d..0000000000 --- a/applications/utilities/postProcessing/dataConversion/foamToVTK/foamToVTK/vtkMesh.C +++ /dev/null @@ -1,82 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation - \\/ 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 3 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, see . - -\*---------------------------------------------------------------------------*/ - -#include "vtkMesh.H" -#include "fvMeshSubset.H" -#include "Time.H" -#include "cellSet.H" - -// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // - -Foam::vtkMesh::vtkMesh -( - fvMesh& baseMesh, - const word& setName -) -: - baseMesh_(baseMesh), - subsetter_(baseMesh), - setName_(setName) -{ - if (setName.size()) - { - // Read cellSet using whole mesh - cellSet currentSet(baseMesh_, setName_); - - // Set current subset - subsetter_.setLargeCellSubset(currentSet); - } -} - - -// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // - -Foam::polyMesh::readUpdateState Foam::vtkMesh::readUpdate() -{ - polyMesh::readUpdateState meshState = baseMesh_.readUpdate(); - - if (meshState != polyMesh::UNCHANGED) - { - // Note: since fvMeshSubset has no movePoints() functionality, - // reconstruct the subset even if only movement. - - topoPtr_.clear(); - - if (setName_.size()) - { - Info<< "Subsetting mesh based on cellSet " << setName_ << endl; - - // Read cellSet using whole mesh - cellSet currentSet(baseMesh_, setName_); - - subsetter_.setLargeCellSubset(currentSet); - } - } - - return meshState; -} - - -// ************************************************************************* // diff --git a/applications/utilities/postProcessing/dataConversion/foamToVTK/foamToVTK/vtkMesh.H b/applications/utilities/postProcessing/dataConversion/foamToVTK/foamToVTK/vtkMesh.H index f536ae04fa..f0a80db4ea 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToVTK/foamToVTK/vtkMesh.H +++ b/applications/utilities/postProcessing/dataConversion/foamToVTK/foamToVTK/vtkMesh.H @@ -3,7 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation - \\/ M anipulation | + \\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -36,46 +36,35 @@ SourceFiles #ifndef vtkMesh_H #define vtkMesh_H +#include "meshSubsetHelper.H" #include "vtkTopo.H" -#include "fvMeshSubset.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // namespace Foam { -// Forward declaration of classes -class Time; - /*---------------------------------------------------------------------------*\ Class vtkMesh Declaration \*---------------------------------------------------------------------------*/ class vtkMesh +: + public meshSubsetHelper { // Private data - //- Reference to mesh - fvMesh& baseMesh_; - - //- Subsetting engine + sub-fvMesh - fvMeshSubset subsetter_; - - //- Current cellSet (or empty) - const word setName_; - //- Current decomposition of topology mutable autoPtr topoPtr_; - // Private Member Functions //- Disallow default bitwise copy construct - vtkMesh(const vtkMesh&); + vtkMesh(const vtkMesh&) = delete; //- Disallow default bitwise assignment - void operator=(const vtkMesh&); + void operator=(const vtkMesh&) = delete; public: @@ -83,31 +72,17 @@ public: // Constructors //- Construct from components - vtkMesh(fvMesh& baseMesh, const word& setName = ""); + vtkMesh(fvMesh& baseMesh, const word& setName = word::null) + : + meshSubsetHelper(baseMesh, meshSubsetHelper::SET, setName) + {} // Member Functions // Access - //- Whole mesh - const fvMesh& baseMesh() const - { - return baseMesh_; - } - - const fvMeshSubset& subsetter() const - { - return subsetter_; - } - - //- Check if running subMesh - bool useSubMesh() const - { - return setName_.size(); - } - - //- topology + //- Topology const vtkTopo& topo() const { if (topoPtr_.empty()) @@ -117,18 +92,6 @@ public: return topoPtr_(); } - //- Access either mesh or submesh - const fvMesh& mesh() const - { - if (useSubMesh()) - { - return subsetter_.subMesh(); - } - else - { - return baseMesh_; - } - } //- Number of field cells label nFieldCells() const @@ -136,6 +99,7 @@ public: return topo().cellTypes().size(); } + //- Number of field points label nFieldPoints() const { @@ -145,26 +109,20 @@ public: // Edit - //- Read mesh - polyMesh::readUpdateState readUpdate(); - - - //- Map volume field (does in fact do very little interpolation; - // just copied from fvMeshSubset) - template - tmp interpolate(const GeoField& fld) const + //- Read mesh, forcing topo update if necessary + polyMesh::readUpdateState readUpdate() { - if (useSubMesh()) + polyMesh::readUpdateState meshState + = meshSubsetHelper::readUpdate(); + + if (meshState != polyMesh::UNCHANGED) { - tmp subFld = subsetter_.interpolate(fld); - subFld.ref().rename(fld.name()); - return subFld; - } - else - { - return fld; + topoPtr_.clear(); } + + return meshState; } + }; diff --git a/applications/utilities/postProcessing/dataConversion/foamToVTK/foamToVTK/writeFaceSet.C b/applications/utilities/postProcessing/dataConversion/foamToVTK/foamToVTK/writeFaceSet.C index 4ad78d96a0..0556b7aaf2 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToVTK/foamToVTK/writeFaceSet.C +++ b/applications/utilities/postProcessing/dataConversion/foamToVTK/foamToVTK/writeFaceSet.C @@ -3,7 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation - \\/ M anipulation | + \\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -32,12 +32,12 @@ License void Foam::writeFaceSet ( const bool binary, - const vtkMesh& vMesh, + const fvMesh& mesh, const faceSet& set, const fileName& fileName ) { - const faceList& faces = vMesh.mesh().faces(); + const faceList& faces = mesh.faces(); std::ofstream ostr(fileName.c_str()); @@ -69,7 +69,7 @@ void Foam::writeFaceSet setFaces[setFacei] = faces[iter.key()]; setFacei++; } - primitiveFacePatch fp(setFaces, vMesh.mesh().points()); + primitiveFacePatch fp(setFaces, mesh.points()); // Write points and faces as polygons diff --git a/applications/utilities/postProcessing/dataConversion/foamToVTK/foamToVTK/writeFaceSet.H b/applications/utilities/postProcessing/dataConversion/foamToVTK/foamToVTK/writeFaceSet.H index eb7c452031..73ca4f0741 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToVTK/foamToVTK/writeFaceSet.H +++ b/applications/utilities/postProcessing/dataConversion/foamToVTK/foamToVTK/writeFaceSet.H @@ -3,7 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation - \\/ M anipulation | + \\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -36,7 +36,7 @@ SourceFiles #ifndef writeFaceSet_H #define writeFaceSet_H -#include "vtkMesh.H" +#include "fvMesh.H" #include "faceSet.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -48,7 +48,7 @@ namespace Foam void writeFaceSet ( const bool binary, - const vtkMesh& vMesh, + const fvMesh&, const faceSet& set, const fileName& fileName ); diff --git a/applications/utilities/postProcessing/dataConversion/foamToVTK/foamToVTK/writePointSet.C b/applications/utilities/postProcessing/dataConversion/foamToVTK/foamToVTK/writePointSet.C index 4cafa01f0a..e5fffb5366 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToVTK/foamToVTK/writePointSet.C +++ b/applications/utilities/postProcessing/dataConversion/foamToVTK/foamToVTK/writePointSet.C @@ -37,7 +37,7 @@ namespace Foam void writePointSet ( const bool binary, - const vtkMesh& vMesh, + const fvMesh& mesh, const pointSet& set, const fileName& fileName ) @@ -68,7 +68,7 @@ void writePointSet writeFuns::insert ( - UIndirectList(vMesh.mesh().points(), set.toc())(), + UIndirectList(mesh.points(), set.toc())(), ptField ); diff --git a/applications/utilities/postProcessing/dataConversion/foamToVTK/foamToVTK/writePointSet.H b/applications/utilities/postProcessing/dataConversion/foamToVTK/foamToVTK/writePointSet.H index 32ffd981f6..d1ad15efe6 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToVTK/foamToVTK/writePointSet.H +++ b/applications/utilities/postProcessing/dataConversion/foamToVTK/foamToVTK/writePointSet.H @@ -3,7 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation - \\/ M anipulation | + \\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -36,7 +36,7 @@ SourceFiles #ifndef writePointSet_H #define writePointSet_H -#include "vtkMesh.H" +#include "fvMesh.H" #include "pointSet.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -48,7 +48,7 @@ namespace Foam void writePointSet ( const bool binary, - const vtkMesh& vMesh, + const fvMesh& mesh, const pointSet& set, const fileName& fileName ); diff --git a/applications/utilities/postProcessing/dataConversion/foamToVTK/foamToVTK/writeSurfFields.C b/applications/utilities/postProcessing/dataConversion/foamToVTK/foamToVTK/writeSurfFields.C index 4144a579a5..9dc889adf4 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToVTK/foamToVTK/writeSurfFields.C +++ b/applications/utilities/postProcessing/dataConversion/foamToVTK/foamToVTK/writeSurfFields.C @@ -3,7 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation - \\/ M anipulation | + \\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -35,13 +35,11 @@ License void Foam::writeSurfFields ( const bool binary, - const vtkMesh& vMesh, + const fvMesh& mesh, const fileName& fileName, const UPtrList& surfVectorFields ) { - const fvMesh& mesh = vMesh.mesh(); - std::ofstream str(fileName.c_str()); writeFuns::writeHeader diff --git a/applications/utilities/postProcessing/dataConversion/foamToVTK/foamToVTK/writeSurfFields.H b/applications/utilities/postProcessing/dataConversion/foamToVTK/foamToVTK/writeSurfFields.H index 798e335fd3..7740e15f78 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToVTK/foamToVTK/writeSurfFields.H +++ b/applications/utilities/postProcessing/dataConversion/foamToVTK/foamToVTK/writeSurfFields.H @@ -35,7 +35,7 @@ SourceFiles #ifndef writeSurfFields_H #define writeSurfFields_H -#include "vtkMesh.H" +#include "fvMesh.H" #include "surfaceMesh.H" #include "surfaceFieldsFwd.H" @@ -48,7 +48,7 @@ namespace Foam void writeSurfFields ( const bool binary, - const vtkMesh& vMesh, + const fvMesh&, const fileName& fileName, const UPtrList& surfVectorFields ); diff --git a/src/dynamicMesh/Make/files b/src/dynamicMesh/Make/files index 215d35048d..de8f61296c 100644 --- a/src/dynamicMesh/Make/files +++ b/src/dynamicMesh/Make/files @@ -90,6 +90,7 @@ polyMeshAdder/polyMeshAdder.C fvMeshTools/fvMeshTools.C fvMeshSubset/fvMeshSubset.C +meshSubsetHelper/meshSubsetHelper.C motionSmoother/motionSmoother.C motionSmoother/motionSmootherAlgo.C diff --git a/applications/utilities/postProcessing/dataConversion/foamToEnsight/meshSubsetHelper.C b/src/dynamicMesh/meshSubsetHelper/meshSubsetHelper.C similarity index 88% rename from applications/utilities/postProcessing/dataConversion/foamToEnsight/meshSubsetHelper.C rename to src/dynamicMesh/meshSubsetHelper/meshSubsetHelper.C index 05bdc9420b..0f3760654c 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToEnsight/meshSubsetHelper.C +++ b/src/dynamicMesh/meshSubsetHelper/meshSubsetHelper.C @@ -28,21 +28,34 @@ License #include "cellSet.H" #include "cellZone.H" #include "Time.H" -#include "IOstreams.H" // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // Foam::meshSubsetHelper::meshSubsetHelper ( - fvMesh& baseMesh, - const word& name, - const bool isCellSet + fvMesh& baseMesh ) : baseMesh_(baseMesh), subsetter_(baseMesh), - name_(name), - type_(name_.empty() ? 0 : isCellSet ? 1 : 2) + type_(NONE), + name_() +{ + correct(); +} + + +Foam::meshSubsetHelper::meshSubsetHelper +( + fvMesh& baseMesh, + const subsetType type, + const word& name +) +: + baseMesh_(baseMesh), + subsetter_(baseMesh), + type_(name.empty() ? NONE : type), + name_(name) { correct(); } @@ -52,7 +65,7 @@ Foam::meshSubsetHelper::meshSubsetHelper void Foam::meshSubsetHelper::correct(bool verbose) { - if (type_ == 1) + if (type_ == SET) { if (verbose) { @@ -62,7 +75,7 @@ void Foam::meshSubsetHelper::correct(bool verbose) cellSet subset(baseMesh_, name_); subsetter_.setLargeCellSubset(subset); } - else if (type_ == 2) + else if (type_ == ZONE) { if (verbose) { diff --git a/applications/utilities/postProcessing/dataConversion/foamToEnsight/meshSubsetHelper.H b/src/dynamicMesh/meshSubsetHelper/meshSubsetHelper.H similarity index 86% rename from applications/utilities/postProcessing/dataConversion/foamToEnsight/meshSubsetHelper.H rename to src/dynamicMesh/meshSubsetHelper/meshSubsetHelper.H index 43112a5a18..891e6d94a6 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToEnsight/meshSubsetHelper.H +++ b/src/dynamicMesh/meshSubsetHelper/meshSubsetHelper.H @@ -54,6 +54,17 @@ class Time; class meshSubsetHelper { +public: + + //- Internal book-keeping for subset type + enum subsetType + { + NONE, //::Internal& df + >::Internal& ); @@ -174,6 +188,11 @@ public: >::Internal& ) const; + + //- Map volume field (does in fact do very little interpolation; + // just copied from fvMeshSubset) + template + tmp interpolate(const GeoField& fld) const; }; diff --git a/applications/utilities/postProcessing/dataConversion/foamToEnsight/meshSubsetHelperTemplates.C b/src/dynamicMesh/meshSubsetHelper/meshSubsetHelperTemplates.C similarity index 89% rename from applications/utilities/postProcessing/dataConversion/foamToEnsight/meshSubsetHelperTemplates.C rename to src/dynamicMesh/meshSubsetHelper/meshSubsetHelperTemplates.C index d588118d0f..25a6d1301b 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToEnsight/meshSubsetHelperTemplates.C +++ b/src/dynamicMesh/meshSubsetHelper/meshSubsetHelperTemplates.C @@ -116,4 +116,25 @@ Foam::meshSubsetHelper::interpolate } +template +Foam::tmp +Foam::meshSubsetHelper::interpolate +( + const GeoField& fld +) const +{ + if (subsetter_.hasSubMesh()) + { + tmp subFld = subsetter_.interpolate(fld); + subFld.ref().checkOut(); + subFld.ref().rename(fld.name()); + return subFld; + } + else + { + return fld; + } +} + + // ************************************************************************* // From 74f2d7f0a3f68edf5fa13054581cf6010fe2ee24 Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Fri, 5 Aug 2016 10:35:55 +0200 Subject: [PATCH 02/84] ENH: cleanup starcd (prostar) mesh conversion (issue #204) - Reduce code duplication by moving out common functionality into STARCDCore. --- .../foamToStarMesh/foamToStarMesh.C | 24 +-- .../mesh/conversion/star4ToFoam/star4ToFoam.C | 41 ++-- src/conversion/common/reader/meshReader.C | 8 +- src/conversion/common/reader/meshReader.H | 2 +- src/conversion/common/writer/meshWriter.C | 19 +- src/conversion/common/writer/meshWriter.H | 35 +--- src/conversion/starcd/STARCDMeshReader.C | 151 ++++++--------- src/conversion/starcd/STARCDMeshReader.H | 82 +++----- src/conversion/starcd/STARCDMeshWriter.C | 182 ++++++++---------- src/conversion/starcd/STARCDMeshWriter.H | 61 +++--- .../edgeMeshFormats/starcd/STARCDedgeFormat.C | 30 +-- .../edgeMeshFormats/starcd/STARCDedgeFormat.H | 24 +-- src/fileFormats/starcd/STARCDCore.C | 144 +++++++++++--- src/fileFormats/starcd/STARCDCore.H | 109 +++++++++-- .../starcd/STARCDsurfaceFormat.C | 39 ++-- .../starcd/STARCDsurfaceFormat.H | 15 +- .../starcd/STARCDsurfaceFormatCore.C | 7 +- 17 files changed, 507 insertions(+), 466 deletions(-) diff --git a/applications/utilities/mesh/conversion/foamToStarMesh/foamToStarMesh.C b/applications/utilities/mesh/conversion/foamToStarMesh/foamToStarMesh.C index b4692d201a..f8fe44f19f 100644 --- a/applications/utilities/mesh/conversion/foamToStarMesh/foamToStarMesh.C +++ b/applications/utilities/mesh/conversion/foamToStarMesh/foamToStarMesh.C @@ -94,15 +94,9 @@ int main(int argc, char *argv[]) exportName += '-' + args.globalCaseName(); } - // default: rescale from [m] to [mm] - scalar scaleFactor = 1000; - if (args.optionReadIfPresent("scale", scaleFactor)) - { - if (scaleFactor <= 0) - { - scaleFactor = 1; - } - } + // Default rescale from [m] to [mm] + const scalar scaleFactor = args.optionLookupOrDefault("scale", 1000.0); + const bool writeBndFile = !args.optionFound("noBnd"); #include "createPolyMesh.H" @@ -116,12 +110,12 @@ int main(int argc, char *argv[]) if (!timeI || state != polyMesh::UNCHANGED) { - fileFormats::STARCDMeshWriter writer(mesh, scaleFactor); - - if (args.optionFound("noBnd")) - { - writer.noBoundary(); - } + fileFormats::STARCDMeshWriter writer + ( + mesh, + scaleFactor, + writeBndFile + ); fileName meshName(exportName); if (state != polyMesh::UNCHANGED) diff --git a/applications/utilities/mesh/conversion/star4ToFoam/star4ToFoam.C b/applications/utilities/mesh/conversion/star4ToFoam/star4ToFoam.C index af57977d78..65261399d0 100644 --- a/applications/utilities/mesh/conversion/star4ToFoam/star4ToFoam.C +++ b/applications/utilities/mesh/conversion/star4ToFoam/star4ToFoam.C @@ -48,7 +48,7 @@ Usage Note Baffles are written as interfaces for later use -See Also +See also Foam::cellTable, Foam::meshReader and Foam::fileFormats::STARCDMeshReader \*---------------------------------------------------------------------------*/ @@ -88,32 +88,35 @@ int main(int argc, char *argv[]) "retain solid cells and treat them like fluid cells" ); + argList args(argc, argv); Time runTime(args.rootPath(), args.caseName()); - // default rescale from [mm] to [m] - scalar scaleFactor = args.optionLookupOrDefault("scale", 0.001); - if (scaleFactor <= 0) - { - scaleFactor = 1; - } + // Binary output, unless otherwise specified + const IOstream::streamFormat format = + ( + args.optionFound("ascii") + ? IOstream::ASCII + : IOstream::BINARY + ); - fileFormats::STARCDMeshReader::keepSolids = args.optionFound("solids"); - - // default to binary output, unless otherwise specified - IOstream::streamFormat format = IOstream::BINARY; - if (args.optionFound("ascii")) - { - format = IOstream::ASCII; - } - - // increase the precision of the points data + // Increase the precision of the points data IOstream::defaultPrecision(max(10u, IOstream::defaultPrecision())); - // remove extensions and/or trailing '.' + + // Remove extensions and/or trailing '.' const fileName prefix = fileName(args[1]).lessExt(); - fileFormats::STARCDMeshReader reader(prefix, runTime, scaleFactor); + + fileFormats::STARCDMeshReader reader + ( + prefix, + runTime, + // Default rescale from [mm] to [m] + args.optionLookupOrDefault("scale", 0.001), + args.optionFound("solids") + ); + autoPtr mesh = reader.mesh(runTime); reader.writeMesh(mesh, format); diff --git a/src/conversion/common/reader/meshReader.C b/src/conversion/common/reader/meshReader.C index c7e2d67980..4a6356910c 100644 --- a/src/conversion/common/reader/meshReader.C +++ b/src/conversion/common/reader/meshReader.C @@ -213,7 +213,13 @@ Foam::meshReader::meshReader baffleFaces_(0), cellTableId_(0), cellTable_() -{} +{ + // Sanity + if (scaleFactor_ <= VSMALL) + { + scaleFactor_ = 1; + } +} // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // diff --git a/src/conversion/common/reader/meshReader.H b/src/conversion/common/reader/meshReader.H index 54d5876e96..b53d0c1e4d 100644 --- a/src/conversion/common/reader/meshReader.H +++ b/src/conversion/common/reader/meshReader.H @@ -275,7 +275,7 @@ public: // Constructors //- Construct from fileName - meshReader(const fileName&, const scalar scaleFactor = 1.0); + meshReader(const fileName&, const scalar scaling = 1.0); //- Destructor diff --git a/src/conversion/common/writer/meshWriter.C b/src/conversion/common/writer/meshWriter.C index 36d6426757..760cccea7a 100644 --- a/src/conversion/common/writer/meshWriter.C +++ b/src/conversion/common/writer/meshWriter.C @@ -3,7 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation - \\/ M anipulation | + \\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -68,15 +68,24 @@ lookup // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -Foam::meshWriter::meshWriter(const polyMesh& mesh, const scalar scaleFactor) +Foam::meshWriter::meshWriter +( + const polyMesh& mesh, + const scalar scaling +) : mesh_(mesh), - scaleFactor_(scaleFactor), - writeBoundary_(true), + scaleFactor_(scaling), boundaryRegion_(), cellTable_(), cellTableId_() -{} +{ + // Sanity + if (scaleFactor_ <= VSMALL) + { + scaleFactor_ = 1; + } +} // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // diff --git a/src/conversion/common/writer/meshWriter.H b/src/conversion/common/writer/meshWriter.H index 51f4c4014a..d17322fde0 100644 --- a/src/conversion/common/writer/meshWriter.H +++ b/src/conversion/common/writer/meshWriter.H @@ -98,9 +98,6 @@ protected: //- Scaling factor for points (eg, [m] -> [mm]) scalar scaleFactor_; - //- Write bnd file - bool writeBoundary_; - //- boundaryRegion persistent data saved as a dictionary boundaryRegion boundaryRegion_; @@ -125,13 +122,14 @@ public: //- Specify a default mesh name static string defaultMeshName; + // Constructors - //- Create a writer object + //- Create a writer object with given output scaling meshWriter ( const polyMesh&, - const scalar scaleFactor = 1.0 + const scalar scaling = 1.0 ); @@ -141,28 +139,13 @@ public: // Member Functions - // Edit + // Write - //- Set points scaling - void scaleFactor(const scalar scaling) - { - scaleFactor_ = scaling; - } - - //- Suppress writing boundary (bnd) file - void noBoundary() - { - writeBoundary_ = false; - } - - - // Write - - //- Write volume mesh. Subclass must supply this method - virtual bool write - ( - const fileName& timeName = fileName::null - ) const = 0; + //- Write volume mesh. Subclass must supply this method + virtual bool write + ( + const fileName& timeName = fileName::null + ) const = 0; }; diff --git a/src/conversion/starcd/STARCDMeshReader.C b/src/conversion/starcd/STARCDMeshReader.C index e5ddc1bcb5..0229eaa0d2 100644 --- a/src/conversion/starcd/STARCDMeshReader.C +++ b/src/conversion/starcd/STARCDMeshReader.C @@ -3,7 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation - \\/ M anipulation | + \\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -35,26 +35,9 @@ License // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -const char* const Foam::fileFormats::STARCDMeshReader::defaultBoundaryName = - "Default_Boundary_Region"; - -const char* const Foam::fileFormats::STARCDMeshReader::defaultSolidBoundaryName = - "Default_Boundary_Solid"; - -bool Foam::fileFormats::STARCDMeshReader::keepSolids = false; - -const int Foam::fileFormats::STARCDMeshReader::starToFoamFaceAddr[4][6] = -{ - { 4, 5, 2, 3, 0, 1 }, // 11 = pro-STAR hex - { 0, 1, 4, -1, 2, 3 }, // 12 = pro-STAR prism - { 3, -1, 2, -1, 1, 0 }, // 13 = pro-STAR tetra - { 0, -1, 4, 2, 1, 3 } // 14 = pro-STAR pyramid -}; - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -void Foam::fileFormats::STARCDMeshReader::readToNewline(IFstream& is) +//! \cond fileScope +//- Read and discard to newline +static void readToNewline(Foam::IFstream& is) { char ch = '\n'; do @@ -63,34 +46,7 @@ void Foam::fileFormats::STARCDMeshReader::readToNewline(IFstream& is) } while ((is) && ch != '\n'); } - - -bool Foam::fileFormats::STARCDMeshReader::readHeader(IFstream& is, word fileSignature) -{ - if (!is.good()) - { - FatalErrorInFunction - << abort(FatalError); - } - - word header; - label majorVersion; - - is >> header; - is >> majorVersion; - - // skip the rest of the line - readToNewline(is); - - // add other checks ... - if (header != fileSignature) - { - Info<< "header mismatch " << fileSignature << " " << is.name() - << endl; - } - - return true; -} +//! \endcond // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // @@ -118,20 +74,19 @@ Body: [newline] \*---------------------------------------------------------------------------*/ -void Foam::fileFormats::STARCDMeshReader::readPoints +Foam::label Foam::fileFormats::STARCDMeshReader::readPoints ( const fileName& inputName, const scalar scaleFactor ) { - const word fileSignature = "PROSTAR_VERTEX"; label nPoints = 0, maxId = 0; // Pass 1: // get # points and maximum vertex label { IFstream is(inputName); - readHeader(is, fileSignature); + readHeader(is, STARCDCore::HEADER_VRT); label lineLabel; scalar x, y, z; @@ -164,7 +119,7 @@ void Foam::fileFormats::STARCDMeshReader::readPoints if (nPoints > 0) { IFstream is(inputName); - readHeader(is, fileSignature); + readHeader(is, STARCDCore::HEADER_VRT); label lineLabel; @@ -200,6 +155,8 @@ void Foam::fileFormats::STARCDMeshReader::readPoints << "no points in file " << inputName << abort(FatalError); } + + return maxId; } @@ -245,7 +202,6 @@ Strictly speaking, we only need the cellModeller for adding boundaries. void Foam::fileFormats::STARCDMeshReader::readCells(const fileName& inputName) { - const word fileSignature = "PROSTAR_CELL"; label nFluids = 0, nSolids = 0, nBaffles = 0, nShells = 0; label maxId = 0; @@ -257,7 +213,7 @@ void Foam::fileFormats::STARCDMeshReader::readCells(const fileName& inputName) // also see if polyhedral cells were used { IFstream is(inputName); - readHeader(is, fileSignature); + readHeader(is, STARCDCore::HEADER_CEL); label lineLabel, shapeId, nLabels, cellTableId, typeId; @@ -279,7 +235,7 @@ void Foam::fileFormats::STARCDMeshReader::readCells(const fileName& inputName) nLabels -= 8; } - if (typeId == starcdFluidType) + if (typeId == STARCDCore::starcdFluidType) { nFluids++; maxId = max(maxId, starCellId); @@ -290,10 +246,10 @@ void Foam::fileFormats::STARCDMeshReader::readCells(const fileName& inputName) cellTable_.setMaterial(cellTableId, "fluid"); } } - else if (typeId == starcdSolidType) + else if (typeId == STARCDCore::starcdSolidType) { nSolids++; - if (keepSolids) + if (keepSolids_) { maxId = max(maxId, starCellId); } @@ -305,13 +261,13 @@ void Foam::fileFormats::STARCDMeshReader::readCells(const fileName& inputName) } } - else if (typeId == starcdBaffleType) + else if (typeId == STARCDCore::starcdBaffleType) { // baffles have no cellTable entry nBaffles++; maxId = max(maxId, starCellId); } - else if (typeId == starcdShellType) + else if (typeId == STARCDCore::starcdShellType) { nShells++; if (!cellTable_.found(cellTableId)) @@ -326,7 +282,7 @@ void Foam::fileFormats::STARCDMeshReader::readCells(const fileName& inputName) Info<< "Number of fluids = " << nFluids << nl << "Number of baffles = " << nBaffles << nl; - if (keepSolids) + if (keepSolids_) { Info<< "Number of solids = " << nSolids << nl; } @@ -338,7 +294,7 @@ void Foam::fileFormats::STARCDMeshReader::readCells(const fileName& inputName) label nCells; - if (keepSolids) + if (keepSolids_) { nCells = nFluids + nSolids; } @@ -374,7 +330,7 @@ void Foam::fileFormats::STARCDMeshReader::readCells(const fileName& inputName) else { IFstream is(inputName); - readHeader(is, fileSignature); + readHeader(is, STARCDCore::HEADER_CEL); labelList starLabels(64); label lineLabel, shapeId, nLabels, cellTableId, typeId; @@ -407,7 +363,11 @@ void Foam::fileFormats::STARCDMeshReader::readCells(const fileName& inputName) } // skip solid cells - if (typeId == starcdSolidType && !keepSolids) + if + ( + typeId == STARCDCore::starcdSolidType + && !keepSolids_ + ) { continue; } @@ -418,16 +378,16 @@ void Foam::fileFormats::STARCDMeshReader::readCells(const fileName& inputName) // fluid/solid cells switch (shapeId) { - case starcdHex: + case STARCDCore::starcdHex: curModelPtr = hexModel; break; - case starcdPrism: + case STARCDCore::starcdPrism: curModelPtr = prismModel; break; - case starcdTet: + case STARCDCore::starcdTet: curModelPtr = tetModel; break; - case starcdPyr: + case STARCDCore::starcdPyr: curModelPtr = pyrModel; break; } @@ -471,7 +431,7 @@ void Foam::fileFormats::STARCDMeshReader::readCells(const fileName& inputName) cellFaces_[celli] = cellShapes_[celli].faces(); celli++; } - else if (shapeId == starcdPoly) + else if (shapeId == STARCDCore::starcdPoly) { // polyhedral cell label nFaces = starLabels[0] - 1; @@ -548,7 +508,7 @@ void Foam::fileFormats::STARCDMeshReader::readCells(const fileName& inputName) cellFaces_[celli] = faces; celli++; } - else if (typeId == starcdBaffleType) + else if (typeId == STARCDCore::starcdBaffleType) { // baffles @@ -639,7 +599,6 @@ void Foam::fileFormats::STARCDMeshReader::readBoundary const fileName& inputName ) { - const word fileSignature = "PROSTAR_BOUNDARY"; label nPatches = 0, nFaces = 0, nBafflePatches = 0, maxId = 0; label lineLabel, starCellId, cellFaceId, starRegion, configNumber; word patchType; @@ -649,15 +608,17 @@ void Foam::fileFormats::STARCDMeshReader::readBoundary labelList origRegion(1000, label(0)); patchTypes_.setSize(1000); - // this is what we seem to need - // these MUST correspond to starToFoamFaceAddr // - Map