diff --git a/src/conversion/meshReader/createPolyBoundary.C b/src/conversion/meshReader/createPolyBoundary.C index c9a98e8c52f0a4b6a8476b14e45e0241f49b3ad9..7279b73c4135b8e98aabbd9c0ff706fd882ed027 100644 --- a/src/conversion/meshReader/createPolyBoundary.C +++ b/src/conversion/meshReader/createPolyBoundary.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. @@ -90,7 +90,12 @@ void Foam::meshReader::addPolyBoundaryFace const label nCreatedFaces ) { - addPolyBoundaryFace(identifier.cell, identifier.face, nCreatedFaces); + addPolyBoundaryFace + ( + identifier.cellId(), + identifier.faceId(), + nCreatedFaces + ); } @@ -153,7 +158,7 @@ void Foam::meshReader::createPolyBoundary() forAll(idList, bndI) { - label baffleI = idList[bndI].cell - baffleOffset; + label baffleI = idList[bndI].cellId() - baffleOffset; if ( @@ -189,13 +194,13 @@ void Foam::meshReader::createPolyBoundary() else if (patchPhysicalTypes_[patchi] == "monitoring") { // translate the "monitoring" pseudo-boundaries to face sets - List<label> monitoring(idList.size()); + labelList monitoring(idList.size()); label monitorI = 0; forAll(idList, bndI) { - label cellId = idList[bndI].cell; - label faceId = idList[bndI].face; + label cellId = idList[bndI].cellId(); + label faceId = idList[bndI].faceId(); // standard case: volume cells if (cellId < baffleOffset) @@ -215,7 +220,7 @@ void Foam::meshReader::createPolyBoundary() forAll(idList, bndI) { // standard case: volume cells - if (idList[bndI].cell < baffleOffset) + if (idList[bndI].cellId() < baffleOffset) { addPolyBoundaryFace ( diff --git a/src/conversion/meshReader/createPolyCells.C b/src/conversion/meshReader/createPolyCells.C index d9f731ed5501e71b4f8c6f4d05d120fed6cfb1d2..9f9c4072035ba74490e12c00f6cf3d6d29e90642 100644 --- a/src/conversion/meshReader/createPolyCells.C +++ b/src/conversion/meshReader/createPolyCells.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. @@ -138,7 +138,7 @@ void Foam::meshReader::createPolyCells() << endl; #endif - if (baffleIds_[baffleI][side].unused()) + if (baffleIds_[baffleI][side].notUsed()) { baffleIds_[baffleI][side] = cellFaceIdentifier ( @@ -166,8 +166,8 @@ void Foam::meshReader::createPolyCells() { for (label side = 0; side < nNeighbours; ++side) { - label neiCell = baffleIds_[baffleI][side].cell; - label neiFace = baffleIds_[baffleI][side].face; + label neiCell = baffleIds_[baffleI][side].cellId(); + label neiFace = baffleIds_[baffleI][side].faceId(); if (baffleIds_[baffleI][side].used()) { diff --git a/src/conversion/meshReader/meshReader.C b/src/conversion/meshReader/meshReader.C index 611b655d6f46f020b887b009f1f876c98939d6ed..c7e2d67980f6a0419c5a8168a04d274b445aeebd 100644 --- a/src/conversion/meshReader/meshReader.C +++ b/src/conversion/meshReader/meshReader.C @@ -84,13 +84,7 @@ void Foam::meshReader::addFaceZones(polyMesh& mesh) const } nZone = 0; - for - ( - HashTable<List<label>, word, string::hash>::const_iterator - iter = monitoringSets_.begin(); - iter != monitoringSets_.end(); - ++iter - ) + forAllConstIter(HashTable<labelList>, monitoringSets_, iter) { Info<< "faceZone " << nZone << " (size: " << iter().size() << ") name: " @@ -103,7 +97,7 @@ void Foam::meshReader::addFaceZones(polyMesh& mesh) const ( iter.key(), iter(), - List<bool>(iter().size(), false), + boolList(iter().size(), false), nZone, mesh.faceZones() ) @@ -196,15 +190,13 @@ Foam::meshReader::meshReader const fileName& fileOrPrefix, const scalar scaleFactor ) - : +: pointCellsPtr_(nullptr), - nInternalFaces_(0), - patchStarts_(0), - patchSizes_(0), interfaces_(0), baffleIds_(0), - meshFaces_(0), cellPolys_(0), + monitoringSets_(), + // protected geometryFile_(fileOrPrefix), scaleFactor_(scaleFactor), points_(0), @@ -213,6 +205,10 @@ Foam::meshReader::meshReader patchTypes_(0), patchNames_(0), patchPhysicalTypes_(0), + patchStarts_(0), + patchSizes_(0), + nInternalFaces_(0), + meshFaces_(0), cellFaces_(0), baffleFaces_(0), cellTableId_(0), diff --git a/src/conversion/meshReader/meshReader.H b/src/conversion/meshReader/meshReader.H index c07bf3cd9ced06d86e743de58efd268ce4ebb34d..54d5876e96448902374c72fb9fe7b06076da3756 100644 --- a/src/conversion/meshReader/meshReader.H +++ b/src/conversion/meshReader/meshReader.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. @@ -21,13 +21,6 @@ License You should have received a copy of the GNU General Public License along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. -Namespace - Foam::meshReaders - -Description - A namespace for holding various types of mesh readers. - - Class Foam::meshReader @@ -59,7 +52,6 @@ SourceFiles #include "polyMesh.H" #include "HashTable.H" #include "IOstream.H" - #include "cellTable.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -76,66 +68,48 @@ class meshReader protected: //- Identify cell faces in terms of cell Id and face Id - class cellFaceIdentifier + class cellFaceIdentifier : public labelPair { public: - // Public data - - //- Cell Id - label cell; - - //- Face Id - label face; - // Constructors - //- Construct null - cellFaceIdentifier() : cell(-1), face(-1) {} + //- Construct null, as invalid pair + cellFaceIdentifier() : labelPair(-1, -1) {} //- Construct from cell/face components - cellFaceIdentifier(label c, label f) : cell(c), face(f) {} + cellFaceIdentifier(label c, label f) : labelPair(c, f) {} - // Check + // Access - //- Used if cell or face are non-negative - bool used() const + //- The cell id (readonly) + const label& cellId() const { - return (cell >= 0 && face >= 0); + return first(); } - //- Unused if cell or face are negative - bool unused() const + //- The face id (readonly) + const label& faceId() const { - return (cell < 0 || face < 0); + return second(); } - // Member Operators - - bool operator!=(const cellFaceIdentifier& cf) const - { - return (cell != cf.cell || face != cf.face); - } + // Check - bool operator==(const cellFaceIdentifier& cf) const + //- Used if both cell or face are non-negative + bool used() const { - return (cell == cf.cell && face == cf.face); + return (first() >= 0 && second() >= 0); } - // IOstream Operators - - friend Ostream& operator<< - ( - Ostream& os, - const cellFaceIdentifier& cf - ) + //- Unused if either cell or face are negative + bool notUsed() const { - os << "(" << cf.cell << "/" << cf.face << ")"; - return os; + return (first() < 0 || second() < 0); } - }; + }; private: @@ -147,36 +121,26 @@ private: // duplicate cell entries. Use additional checking mutable labelListList* pointCellsPtr_; - //- Number of internal faces for polyMesh - label nInternalFaces_; - - //- Polyhedral mesh boundary patch start indices and dimensions - labelList patchStarts_; - labelList patchSizes_; - //- Association between two faces List<labelPair> interfaces_; //- List of cells/faces id pairs for each baffle List<List<cellFaceIdentifier>> baffleIds_; - //- Global face list for polyMesh - faceList meshFaces_; - //- Cells as polyhedra for polyMesh cellList cellPolys_; //- Face sets for monitoring - HashTable<List<label>, word, string::hash> monitoringSets_; + HashTable<labelList> monitoringSets_; // Private Member Functions //- Disallow default bitwise copy construct - meshReader(const meshReader&); + meshReader(const meshReader&) = delete; //- Disallow default bitwise assignment - void operator=(const meshReader&); + void operator=(const meshReader&) = delete; //- Calculate pointCells void calcPointCells() const; @@ -220,7 +184,7 @@ private: void writeInterfaces(const objectRegistry&) const; - //- Write List<label> in constant/polyMesh + //- Write labelList in constant/polyMesh void writeMeshLabelList ( const objectRegistry& registry, @@ -272,6 +236,16 @@ protected: //- Boundary patch physical types wordList patchPhysicalTypes_; + //- Polyhedral mesh boundary patch start indices and dimensions + labelList patchStarts_; + labelList patchSizes_; + + //- Number of internal faces for polyMesh + label nInternalFaces_; + + //- Global face list for polyMesh + faceList meshFaces_; + //- List of faces for every cell faceListList cellFaces_; diff --git a/src/conversion/meshTables/cellTable.H b/src/conversion/meshTables/cellTable.H index 951575610d6fd09d598d98fe67b39b46baa4b289..0ee17a7c2bba29518503ba6d9f0c0a79c8bbf660 100644 --- a/src/conversion/meshTables/cellTable.H +++ b/src/conversion/meshTables/cellTable.H @@ -49,7 +49,7 @@ Description \endverbatim If the \a Label is missing, a value <tt>cellTable_{ID}</tt> will be - inferred. If the \a MaterialType is missing, the value @a fluid will + inferred. If the \a MaterialType is missing, the value \a fluid will be inferred. SourceFiles diff --git a/src/conversion/meshWriter/meshWriter.H b/src/conversion/meshWriter/meshWriter.H index d7b6ca004a592b5f8c24381e9e88b6d181f7bf29..51f4c4014a911bd39d48b9da74d6796f5aa958a3 100644 --- a/src/conversion/meshWriter/meshWriter.H +++ b/src/conversion/meshWriter/meshWriter.H @@ -3,7 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation - \\/ M anipulation | + \\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -21,19 +21,11 @@ License You should have received a copy of the GNU General Public License along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. -Namespace - Foam::meshWriters - -Description - A namespace for holding various types of mesh writers. - - Class Foam::meshWriter Description - write OpenFOAM meshes and/or results to another CFD format - - currently just STAR-CD + Write OpenFOAM meshes and/or results to another CFD format. \par Files @@ -65,9 +57,7 @@ Description SourceFiles - meshWriterI.H meshWriter.C - meshWriterIO.C \*---------------------------------------------------------------------------*/ @@ -92,10 +82,10 @@ class meshWriter // Private Member Functions //- Disallow default bitwise copy construct - meshWriter(const meshWriter&); + meshWriter(const meshWriter&) = delete; //- Disallow default bitwise assignment - void operator=(const meshWriter&); + void operator=(const meshWriter&) = delete; protected: @@ -137,7 +127,7 @@ public: // Constructors - //- Create a writer obejct + //- Create a writer object meshWriter ( const polyMesh&, @@ -159,12 +149,13 @@ public: scaleFactor_ = scaling; } - //- Suppress writing bnd file + //- Suppress writing boundary (bnd) file void noBoundary() { writeBoundary_ = false; } + // Write //- Write volume mesh. Subclass must supply this method