From 6578ada113417b575725bab86517f2a317d3d87a Mon Sep 17 00:00:00 2001 From: andy <a.heather@opencfd.co.uk> Date: Wed, 9 Jul 2008 16:36:15 +0100 Subject: [PATCH] minor formatting changes/clean-up --- src/conversion/ensight/file/ensightFile.C | 39 +----- src/conversion/ensight/file/ensightFile.H | 36 +++-- src/conversion/ensight/file/ensightGeoFile.C | 9 +- src/conversion/ensight/file/ensightGeoFile.H | 26 ++-- src/conversion/ensight/part/ensightPart.C | 21 +-- src/conversion/ensight/part/ensightPart.H | 12 +- .../ensight/part/ensightPartCells.C | 29 +--- .../ensight/part/ensightPartCells.H | 9 +- .../ensight/part/ensightPartFaces.C | 24 +--- .../ensight/part/ensightPartFaces.H | 9 +- src/conversion/ensight/part/ensightPartI.H | 3 - src/conversion/ensight/part/ensightPartIO.C | 25 +--- src/conversion/ensight/part/ensightParts.C | 42 +----- src/conversion/ensight/part/ensightParts.H | 10 +- src/conversion/ensight/part/ensightPartsI.H | 3 +- src/conversion/meshReader/calcPointCells.C | 2 - .../meshReader/createPolyBoundary.C | 5 +- src/conversion/meshReader/createPolyCells.C | 2 +- src/conversion/meshReader/meshReader.C | 21 +-- src/conversion/meshReader/meshReader.H | 129 +++++++++++------- src/conversion/meshReader/meshReaderAux.C | 20 +-- .../meshReader/starcd/STARCDMeshReader.C | 50 ++----- .../meshReader/starcd/STARCDMeshReader.H | 38 +++--- src/conversion/meshTables/boundaryRegion.C | 16 +-- src/conversion/meshTables/boundaryRegion.H | 16 +-- src/conversion/meshTables/cellTable.C | 40 ++---- src/conversion/meshTables/cellTable.H | 14 +- src/conversion/meshWriter/meshWriter.C | 34 ++--- src/conversion/meshWriter/meshWriter.H | 93 ++++++------- .../meshWriter/starcd/STARCDMeshWriter.C | 43 +----- .../meshWriter/starcd/STARCDMeshWriter.H | 65 ++++----- 31 files changed, 323 insertions(+), 562 deletions(-) diff --git a/src/conversion/ensight/file/ensightFile.C b/src/conversion/ensight/file/ensightFile.C index 88357ba435a..569cc6bc52d 100644 --- a/src/conversion/ensight/file/ensightFile.C +++ b/src/conversion/ensight/file/ensightFile.C @@ -28,16 +28,12 @@ License // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -// allow undef in results bool Foam::ensightFile::allowUndef_ = false; -// value to represent undef in results Foam::scalar Foam::ensightFile::undefValue_ = Foam::floatScalarVGREAT; - // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -// Construct from pathname Foam::ensightFile::ensightFile ( const fileName& pathname, @@ -55,6 +51,7 @@ Foam::ensightFile::ensightFile precision(5); } + // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // Foam::ensightFile::~ensightFile() @@ -88,7 +85,6 @@ Foam::scalar Foam::ensightFile::undefValue(const scalar& value) } -// binary write Foam::Ostream& Foam::ensightFile::write ( const char* buf, @@ -100,11 +96,7 @@ Foam::Ostream& Foam::ensightFile::write } -// write string as "%80s" or as binary -Foam::Ostream& Foam::ensightFile::write -( - const string& value -) +Foam::Ostream& Foam::ensightFile::write(const string& value) { char buf[80]; @@ -141,11 +133,7 @@ Foam::Ostream& Foam::ensightFile::write } -// write integer as "%10d" or as binary -Foam::Ostream& Foam::ensightFile::write -( - const label& value -) +Foam::Ostream& Foam::ensightFile::write(const label& value) { if (format() == IOstream::BINARY) { @@ -167,7 +155,6 @@ Foam::Ostream& Foam::ensightFile::write } -// write integer with specified width or as binary Foam::Ostream& Foam::ensightFile::write ( const label& value, @@ -194,11 +181,7 @@ Foam::Ostream& Foam::ensightFile::write } -// write float as "%12.5e" or as binary -Foam::Ostream& Foam::ensightFile::write -( - const scalar& value -) +Foam::Ostream& Foam::ensightFile::write(const scalar& value) { if (format() == IOstream::BINARY) { @@ -220,7 +203,6 @@ Foam::Ostream& Foam::ensightFile::write } -// Add carriage return to ascii stream void Foam::ensightFile::newline() { if (format() == IOstream::ASCII) @@ -230,7 +212,6 @@ void Foam::ensightFile::newline() } -// write undef value Foam::Ostream& Foam::ensightFile::writeUndef() { write(undefValue_); @@ -238,11 +219,7 @@ Foam::Ostream& Foam::ensightFile::writeUndef() } -// write element keyword with trailing newline, optionally with undef -Foam::Ostream& Foam::ensightFile::writeKeyword -( - const string& key -) +Foam::Ostream& Foam::ensightFile::writeKeyword(const string& key) { if (allowUndef_) { @@ -260,7 +237,6 @@ Foam::Ostream& Foam::ensightFile::writeKeyword } -// write "C Binary" for binary files Foam::Ostream& Foam::ensightFile::writeBinaryHeader() { if (format() == IOstream::BINARY) @@ -274,8 +250,6 @@ Foam::Ostream& Foam::ensightFile::writeBinaryHeader() // * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * // - -// '*' mask appropriate for subDir Foam::string Foam::ensightFile::mask() { char buf[16] = "********"; @@ -283,7 +257,6 @@ Foam::string Foam::ensightFile::mask() } -// consistent zero-padded numbers for subdirectories Foam::string Foam::ensightFile::subDir(const label n) { char buf[16]; @@ -293,6 +266,4 @@ Foam::string Foam::ensightFile::subDir(const label n) } -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - // ************************************************************************* // diff --git a/src/conversion/ensight/file/ensightFile.H b/src/conversion/ensight/file/ensightFile.H index 9e0271dbf4a..86979dfd4e5 100644 --- a/src/conversion/ensight/file/ensightFile.H +++ b/src/conversion/ensight/file/ensightFile.H @@ -30,12 +30,15 @@ Description Correctly handles binary write as well. \*---------------------------------------------------------------------------*/ + #ifndef ensightFile_H #define ensightFile_H #include "OFstream.H" #include "IOstream.H" +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + namespace Foam { @@ -47,19 +50,26 @@ class ensightFile : public OFstream { - //- allow undef in results - static bool allowUndef_; + // Private data + + //- allow undef in results + static bool allowUndef_; - //- value to represent undef in results - static scalar undefValue_; + //- value to represent undef in results + static scalar undefValue_; - //- Disallow default bitwise assignment - void operator=(const ensightFile&); - //- Disallow default copy constructor - ensightFile(const ensightFile&); + // Private member functions + + //- Disallow default bitwise assignment + void operator=(const ensightFile&); + + //- Disallow default copy constructor + ensightFile(const ensightFile&); + public: + // Constructors //- Construct from pathname @@ -69,10 +79,13 @@ public: IOstream::streamFormat format=IOstream::BINARY ); + // Destructor - ~ensightFile(); + ~ensightFile(); + // Access + //- Return setting for whether 'undef' values are allowed in results static bool allowUndef(); @@ -82,7 +95,9 @@ public: //- consistent zero-padded numbers for subdirectories static string subDir(const label); + // Edit + static bool allowUndef(bool); //- Assign the value to represent undef in the results @@ -90,6 +105,7 @@ public: // NB: do not use values larger than floatScalarVGREAT static scalar undefValue(const scalar&); + // Output //- binary write @@ -125,6 +141,8 @@ public: } // End namespace Foam +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + #endif // ************************************************************************* // diff --git a/src/conversion/ensight/file/ensightGeoFile.C b/src/conversion/ensight/file/ensightGeoFile.C index 72805f553c5..94e69bd9797 100644 --- a/src/conversion/ensight/file/ensightGeoFile.C +++ b/src/conversion/ensight/file/ensightGeoFile.C @@ -28,8 +28,6 @@ License // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // - -// Construct from pathname Foam::ensightGeoFile::ensightGeoFile ( const fileName& pathname, @@ -53,11 +51,7 @@ Foam::ensightGeoFile::~ensightGeoFile() // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -// write keyword with trailing newline -Foam::Ostream& Foam::ensightGeoFile::writeKeyword -( - const string& key -) +Foam::Ostream& Foam::ensightGeoFile::writeKeyword(const string& key) { write(key); newline(); @@ -65,6 +59,5 @@ Foam::Ostream& Foam::ensightGeoFile::writeKeyword return *this; } -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // ************************************************************************* // diff --git a/src/conversion/ensight/file/ensightGeoFile.H b/src/conversion/ensight/file/ensightGeoFile.H index 1c91fa3218e..c87f7d40ff6 100644 --- a/src/conversion/ensight/file/ensightGeoFile.H +++ b/src/conversion/ensight/file/ensightGeoFile.H @@ -29,28 +29,36 @@ Description Specialized Ensight output with extra geometry file header \*---------------------------------------------------------------------------*/ + #ifndef ensightGeoFile_H #define ensightGeoFile_H #include "ensightFile.H" +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + namespace Foam { /*---------------------------------------------------------------------------*\ Class ensightGeoFile Declaration \*---------------------------------------------------------------------------*/ + class ensightGeoFile : public ensightFile { - //- Disallow default bitwise assignment - void operator=(const ensightGeoFile&); + // Private member functions + + //- Disallow default bitwise assignment + void operator=(const ensightGeoFile&); + + //- Disallow default copy constructor + ensightGeoFile(const ensightGeoFile&); - //- Disallow default copy constructor - ensightGeoFile(const ensightGeoFile&); public: + // Constructors //- Construct from pathname @@ -60,21 +68,23 @@ public: IOstream::streamFormat format=IOstream::BINARY ); - // Destructor - ~ensightGeoFile(); + + //- Destructor + ~ensightGeoFile(); + // Output //- write keyword with trailing newline virtual Ostream& writeKeyword(const string& key); - }; // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - } // End namespace Foam +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + #endif // ************************************************************************* // diff --git a/src/conversion/ensight/part/ensightPart.C b/src/conversion/ensight/part/ensightPart.C index 7d2fab64837..5ccb17e8200 100644 --- a/src/conversion/ensight/part/ensightPart.C +++ b/src/conversion/ensight/part/ensightPart.C @@ -41,11 +41,7 @@ Foam::List<Foam::word> Foam::ensightPart::elemTypes_(0); // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // -//- check for fully defined fields -bool Foam::ensightPart::isFieldDefined -( - const List<scalar>& field -) const +bool Foam::ensightPart::isFieldDefined(const List<scalar>& field) const { forAll(elemLists_, elemI) { @@ -67,7 +63,6 @@ bool Foam::ensightPart::isFieldDefined // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -// Null constructor Foam::ensightPart::ensightPart () : @@ -82,7 +77,6 @@ Foam::ensightPart::ensightPart {} -// Construct empty part with number and description Foam::ensightPart::ensightPart ( label partNumber, @@ -100,7 +94,6 @@ Foam::ensightPart::ensightPart {} -// Construct empty part with number and description Foam::ensightPart::ensightPart ( label partNumber, @@ -119,11 +112,7 @@ Foam::ensightPart::ensightPart {} -// Construct as copy -Foam::ensightPart::ensightPart -( - const ensightPart& part -) +Foam::ensightPart::ensightPart(const ensightPart& part) : number_(part.number_), name_(part.name_), @@ -138,7 +127,6 @@ Foam::ensightPart::ensightPart // * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * // -// runtime selection Foam::autoPtr<Foam::ensightPart> Foam::ensightPart::New(Istream& is) { word partType(is); @@ -161,6 +149,7 @@ Foam::autoPtr<Foam::ensightPart> Foam::ensightPart::New(Istream& is) return autoPtr<ensightPart>(cstrIter()(is)); } + // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // Foam::ensightPart::~ensightPart() @@ -169,7 +158,6 @@ Foam::ensightPart::~ensightPart() // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -// reconstruct from Istream void Foam::ensightPart::reconstruct(Istream& is) { dictionary dict(is); @@ -198,7 +186,6 @@ void Foam::ensightPart::reconstruct(Istream& is) } -// renumber elements void Foam::ensightPart::renumber(labelList const& origId) { // transform to global values first @@ -226,6 +213,4 @@ void Foam::ensightPart::renumber(labelList const& origId) } -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - // ************************************************************************* // diff --git a/src/conversion/ensight/part/ensightPart.H b/src/conversion/ensight/part/ensightPart.H index b3186eb3a12..b511c6d095a 100644 --- a/src/conversion/ensight/part/ensightPart.H +++ b/src/conversion/ensight/part/ensightPart.H @@ -63,9 +63,9 @@ class ensightPart // Static data members static List<word> elemTypes_; - // Private Member Functions protected: + // Protected data //- part number @@ -92,6 +92,7 @@ protected: //- mesh reference used const polyMesh* meshPtr_; + // Protected Classes //- track the points used by the part and map global to local indices @@ -155,12 +156,12 @@ protected: ) const {} + public: //- Runtime type information TypeName("ensightPart"); - // Public data // Constructors @@ -206,9 +207,9 @@ public: static autoPtr<ensightPart> New(Istream& is); - // Destructor + //- Destructor + virtual ~ensightPart(); - virtual ~ensightPart(); // Static members @@ -217,6 +218,7 @@ public: return elemTypes_; } + // Access //- number of elements in this part @@ -272,6 +274,7 @@ public: return offset_; } + // Edit //- renumber elements @@ -332,7 +335,6 @@ public: ensightGeoFile&, const ensightPart& ); - }; diff --git a/src/conversion/ensight/part/ensightPartCells.C b/src/conversion/ensight/part/ensightPartCells.C index acbc02665e6..e7c2910f053 100644 --- a/src/conversion/ensight/part/ensightPartCells.C +++ b/src/conversion/ensight/part/ensightPartCells.C @@ -40,7 +40,6 @@ namespace Foam addToRunTimeSelectionTable(ensightPart, ensightPartCells, istream); } -// names for addressable ensight element types Foam::List<Foam::word> Foam::ensightPartCells::elemTypes_ ( IStringStream @@ -52,11 +51,7 @@ Foam::List<Foam::word> Foam::ensightPartCells::elemTypes_ // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // -// classify the cell types, track the points used -void Foam::ensightPartCells::classify -( - const labelList& idList -) +void Foam::ensightPartCells::classify(const labelList& idList) { // References to cell shape models const cellModel& tet = *(cellModeller::lookup("tet")); @@ -229,7 +224,6 @@ void Foam::ensightPartCells::classify // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -// Construct empty part with number and description Foam::ensightPartCells::ensightPartCells ( label partNumber, @@ -240,7 +234,6 @@ Foam::ensightPartCells::ensightPartCells {} -// Construct from polyMesh without zones Foam::ensightPartCells::ensightPartCells ( label partNumber, @@ -253,7 +246,6 @@ Foam::ensightPartCells::ensightPartCells } -// Construct from polyMesh and list of (non-zoned) cells Foam::ensightPartCells::ensightPartCells ( label partNumber, @@ -267,7 +259,6 @@ Foam::ensightPartCells::ensightPartCells } -// Construct from polyMesh and cellZone Foam::ensightPartCells::ensightPartCells ( label partNumber, @@ -281,21 +272,13 @@ Foam::ensightPartCells::ensightPartCells } -// Construct as copy -Foam::ensightPartCells::ensightPartCells -( - const ensightPartCells& part -) +Foam::ensightPartCells::ensightPartCells(const ensightPartCells& part) : ensightPart(part) {} -// Construct from Istream -Foam::ensightPartCells::ensightPartCells -( - Istream& is -) +Foam::ensightPartCells::ensightPartCells(Istream& is) : ensightPart() { @@ -305,15 +288,12 @@ Foam::ensightPartCells::ensightPartCells // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // - Foam::ensightPartCells::~ensightPartCells() {} // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // - -// track the points used Foam::ensightPart::localPoints Foam::ensightPartCells::calcLocalPoints() const { const polyMesh& mesh = *meshPtr_; @@ -362,7 +342,6 @@ Foam::ensightPart::localPoints Foam::ensightPartCells::calcLocalPoints() const } -// write cell connectivities void Foam::ensightPartCells::writeConnectivity ( ensightGeoFile& os, @@ -449,6 +428,4 @@ void Foam::ensightPartCells::writeConnectivity } -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - // ************************************************************************* // diff --git a/src/conversion/ensight/part/ensightPartCells.H b/src/conversion/ensight/part/ensightPartCells.H index a85b2778098..a8a941ad7a6 100644 --- a/src/conversion/ensight/part/ensightPartCells.H +++ b/src/conversion/ensight/part/ensightPartCells.H @@ -52,8 +52,6 @@ class ensightPartCells : public ensightPart { - // Private data - // Private Member Functions //- Disallow default bitwise assignment @@ -77,6 +75,7 @@ class ensightPartCells const labelList& pointMap ) const; + protected: //- addressable Ensight element types @@ -135,9 +134,8 @@ public: } - // Destructor - - virtual ~ensightPartCells(); + //- Destructor + virtual ~ensightPartCells(); // Member Functions @@ -147,7 +145,6 @@ public: { return elemTypes_; } - }; diff --git a/src/conversion/ensight/part/ensightPartFaces.C b/src/conversion/ensight/part/ensightPartFaces.C index 79fd6ceed0b..471e17bc72f 100644 --- a/src/conversion/ensight/part/ensightPartFaces.C +++ b/src/conversion/ensight/part/ensightPartFaces.C @@ -31,13 +31,14 @@ License #include "dictionary.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + namespace Foam { defineTypeNameAndDebug(ensightPartFaces, 0); addToRunTimeSelectionTable(ensightPart, ensightPartFaces, istream); } -// names for addressable ensight element types + Foam::List<Foam::word> Foam::ensightPartFaces::elemTypes_ ( IStringStream @@ -46,9 +47,9 @@ Foam::List<Foam::word> Foam::ensightPartFaces::elemTypes_ )() ); + // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -// Construct empty part with number and description Foam::ensightPartFaces::ensightPartFaces ( label partNumber, @@ -61,7 +62,6 @@ Foam::ensightPartFaces::ensightPartFaces } -// Construct from polyMesh and polyPatch Foam::ensightPartFaces::ensightPartFaces ( label partNumber, @@ -137,22 +137,13 @@ Foam::ensightPartFaces::ensightPartFaces } - -// Construct as copy -Foam::ensightPartFaces::ensightPartFaces -( - const ensightPartFaces &part -) +Foam::ensightPartFaces::ensightPartFaces(const ensightPartFaces &part) : ensightPart(part) {} -// Construct from Istream -Foam::ensightPartFaces::ensightPartFaces -( - Istream& is -) +Foam::ensightPartFaces::ensightPartFaces(Istream& is) : ensightPart() { @@ -160,6 +151,7 @@ Foam::ensightPartFaces::ensightPartFaces reconstruct(is); } + // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // Foam::ensightPartFaces::~ensightPartFaces() @@ -168,7 +160,6 @@ Foam::ensightPartFaces::~ensightPartFaces() // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -// track the points used Foam::ensightPart::localPoints Foam::ensightPartFaces::calcLocalPoints() const { const polyMesh& mesh = *meshPtr_; @@ -212,7 +203,6 @@ Foam::ensightPart::localPoints Foam::ensightPartFaces::calcLocalPoints() const } -// write face connectivities void Foam::ensightPartFaces::writeConnectivity ( ensightGeoFile& os, @@ -258,6 +248,4 @@ void Foam::ensightPartFaces::writeConnectivity } -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - // ************************************************************************* // diff --git a/src/conversion/ensight/part/ensightPartFaces.H b/src/conversion/ensight/part/ensightPartFaces.H index 6f00e0fb567..f41f552d969 100644 --- a/src/conversion/ensight/part/ensightPartFaces.H +++ b/src/conversion/ensight/part/ensightPartFaces.H @@ -51,8 +51,6 @@ class ensightPartFaces : public ensightPart { - // Private data - // Private Member Functions //- Disallow default bitwise assignment @@ -70,6 +68,7 @@ class ensightPartFaces const labelList& pointMap ) const; + protected: //- addressable ensight element types @@ -115,9 +114,8 @@ public: } - // Destructor - - virtual ~ensightPartFaces(); + //- Destructor + virtual ~ensightPartFaces(); // Member Functions @@ -127,7 +125,6 @@ public: { return elemTypes_; } - }; diff --git a/src/conversion/ensight/part/ensightPartI.H b/src/conversion/ensight/part/ensightPartI.H index 6252fdc6baa..162f1b34438 100644 --- a/src/conversion/ensight/part/ensightPartI.H +++ b/src/conversion/ensight/part/ensightPartI.H @@ -31,7 +31,6 @@ Description // * * * * * * * * * * * * * * * Global Functions * * * * * * * * * * * * * // -// write generalized field components template <class Type> void Foam::ensightPart::writeField ( @@ -66,6 +65,4 @@ void Foam::ensightPart::writeField } -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - // ************************************************************************* // diff --git a/src/conversion/ensight/part/ensightPartIO.C b/src/conversion/ensight/part/ensightPartIO.C index 7bb6b3961aa..6141556361d 100644 --- a/src/conversion/ensight/part/ensightPartIO.C +++ b/src/conversion/ensight/part/ensightPartIO.C @@ -33,7 +33,6 @@ Description // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // -// write the part header void Foam::ensightPart::writeHeader ( ensightFile& os, @@ -54,7 +53,6 @@ void Foam::ensightPart::writeHeader } -// write scalar field for idList void Foam::ensightPart::writeFieldList ( ensightFile& os, @@ -80,12 +78,7 @@ void Foam::ensightPart::writeFieldList // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // - -// write summary information about the object -bool Foam::ensightPart::writeSummary -( - Ostream& os -) const +bool Foam::ensightPart::writeSummary(Ostream& os) const { os << indent << type() << nl << indent << token::BEGIN_BLOCK << incrIndent << nl; @@ -102,11 +95,7 @@ bool Foam::ensightPart::writeSummary } -// write reconstruction information for the object -bool Foam::ensightPart::writeData -( - Ostream& os -) const +bool Foam::ensightPart::writeData(Ostream& os) const { os << indent << type() << nl << indent << token::BEGIN_BLOCK << incrIndent << nl; @@ -130,12 +119,7 @@ bool Foam::ensightPart::writeData } - -// write geometry by components -void Foam::ensightPart::writeGeometry -( - ensightGeoFile& os -) const +void Foam::ensightPart::writeGeometry(ensightGeoFile& os) const { if (size() && meshPtr_) { @@ -182,7 +166,6 @@ void Foam::ensightPart::writeGeometry } -// write scalar field void Foam::ensightPart::writeScalarField ( ensightFile& os, @@ -207,7 +190,6 @@ void Foam::ensightPart::writeScalarField } -// write vector field components void Foam::ensightPart::writeVectorField ( ensightFile& os, @@ -259,6 +241,5 @@ Foam::ensightGeoFile& Foam::operator<< return os; } -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // ************************************************************************* // diff --git a/src/conversion/ensight/part/ensightParts.C b/src/conversion/ensight/part/ensightParts.C index 464205a9c85..56004fc60e1 100644 --- a/src/conversion/ensight/part/ensightParts.C +++ b/src/conversion/ensight/part/ensightParts.C @@ -28,11 +28,7 @@ License // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -// Construct from polyMesh -Foam::ensightParts::ensightParts -( - const polyMesh& pMesh -) +Foam::ensightParts::ensightParts(const polyMesh& pMesh) : partsList_() { @@ -40,11 +36,7 @@ Foam::ensightParts::ensightParts } -// Construct from IOobject -Foam::ensightParts::ensightParts -( - const IOobject& ioObj -) +Foam::ensightParts::ensightParts(const IOobject& ioObj) : partsList_() { @@ -61,12 +53,7 @@ Foam::ensightParts::~ensightParts() // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // - -// clear old information and construct anew from polyMesh -void Foam::ensightParts::recalculate -( - const polyMesh& pMesh -) +void Foam::ensightParts::recalculate(const polyMesh& pMesh) { partsList_.clear(); @@ -197,7 +184,6 @@ void Foam::ensightParts::recalculate } -// renumber elements void Foam::ensightParts::renumber ( const labelList& origCellId, @@ -218,11 +204,7 @@ void Foam::ensightParts::renumber } -// write the geometry -void Foam::ensightParts::writeGeometry -( - ensightGeoFile& os -) const +void Foam::ensightParts::writeGeometry( ensightGeoFile& os) const { // with some feedback Info<< "write geometry part:" << nl << flush; @@ -235,11 +217,7 @@ void Foam::ensightParts::writeGeometry } -// write summary information about the objects -bool Foam::ensightParts::writeSummary -( - Ostream& os -) const +bool Foam::ensightParts::writeSummary(Ostream& os) const { forAll(partsList_, partI) { @@ -250,10 +228,7 @@ bool Foam::ensightParts::writeSummary } -void Foam::ensightParts::writeData -( - Ostream& os -) const +void Foam::ensightParts::writeData(Ostream& os) const { // Write size of list os << nl << partsList_.size(); @@ -275,7 +250,6 @@ void Foam::ensightParts::writeData } -// write scalar field void Foam::ensightParts::writeScalarField ( ensightFile& os, @@ -298,7 +272,6 @@ void Foam::ensightParts::writeScalarField } -// write vector field components void Foam::ensightParts::writeVectorField ( ensightFile& os, @@ -322,8 +295,6 @@ void Foam::ensightParts::writeVectorField } } -// * * * * * * * * * * * * * * * Member operators * * * * * * * * * * * * * // - // * * * * * * * * * * * * * * * * IOStream operators * * * * * * * * * * * // @@ -337,6 +308,5 @@ Foam::ensightGeoFile& Foam::operator<< return os; } -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // ************************************************************************* // diff --git a/src/conversion/ensight/part/ensightParts.H b/src/conversion/ensight/part/ensightParts.H index f4ca32d6ff8..48b7e80a900 100644 --- a/src/conversion/ensight/part/ensightParts.H +++ b/src/conversion/ensight/part/ensightParts.H @@ -66,6 +66,7 @@ class ensightParts //- Disallow default bitwise assignment void operator=(const ensightParts&); + public: // Constructors @@ -76,9 +77,12 @@ public: //- Construct from IOobject ensightParts(const IOobject&); - // Destructor - ~ensightParts(); + //- Destructor + ~ensightParts(); + + + // Member functions //- clear old information and construct anew from polyMesh void recalculate(const polyMesh&); @@ -132,6 +136,7 @@ public: const GeometricField<Type, fvPatchField, volMesh>& ) const; + // Friend Operators friend ensightGeoFile& operator<< @@ -139,7 +144,6 @@ public: ensightGeoFile&, const ensightParts& ); - }; diff --git a/src/conversion/ensight/part/ensightPartsI.H b/src/conversion/ensight/part/ensightPartsI.H index bb5a915dec6..b4b9857b9e5 100644 --- a/src/conversion/ensight/part/ensightPartsI.H +++ b/src/conversion/ensight/part/ensightPartsI.H @@ -26,11 +26,11 @@ Description Template to write generalized field components \*---------------------------------------------------------------------------*/ + #include "ensightParts.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -// write generalized field components template <class Type> void Foam::ensightParts::writeField ( @@ -72,6 +72,5 @@ void Foam::ensightParts::writeField } } -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // ************************************************************************* // diff --git a/src/conversion/meshReader/calcPointCells.C b/src/conversion/meshReader/calcPointCells.C index 1b9c673d0eb..59d47a2f3b8 100644 --- a/src/conversion/meshReader/calcPointCells.C +++ b/src/conversion/meshReader/calcPointCells.C @@ -177,7 +177,5 @@ const Foam::labelListList& Foam::meshReader::pointCells() const return *pointCellsPtr_; } -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - // ************************************************************************* // diff --git a/src/conversion/meshReader/createPolyBoundary.C b/src/conversion/meshReader/createPolyBoundary.C index e25ead64c4e..fb5a30da01b 100644 --- a/src/conversion/meshReader/createPolyBoundary.C +++ b/src/conversion/meshReader/createPolyBoundary.C @@ -42,7 +42,6 @@ Description // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -// add in boundary face void Foam::meshReader::addPolyBoundaryFace ( const label cellId, @@ -86,7 +85,6 @@ void Foam::meshReader::addPolyBoundaryFace } -// add in boundary face void Foam::meshReader::addPolyBoundaryFace ( const cellFaceIdentifier& identifier, @@ -96,6 +94,7 @@ void Foam::meshReader::addPolyBoundaryFace addPolyBoundaryFace(identifier.cell, identifier.face, nCreatedFaces); } + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // void Foam::meshReader::createPolyBoundary() @@ -370,6 +369,7 @@ void Foam::meshReader::createPolyBoundary() << "Number of interfaces: " << nInterfaces << endl; } + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // Foam::List<Foam::polyPatch*> @@ -445,6 +445,5 @@ Foam::meshReader::polyBoundaryPatches(const polyMesh& mesh) return p; } -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // ************************************************************************* // diff --git a/src/conversion/meshReader/createPolyCells.C b/src/conversion/meshReader/createPolyCells.C index ca9622cbf2e..8c796caf183 100644 --- a/src/conversion/meshReader/createPolyCells.C +++ b/src/conversion/meshReader/createPolyCells.C @@ -31,6 +31,7 @@ Description - standard connectivity checks - added baffle support + \*---------------------------------------------------------------------------*/ #include "meshReader.H" @@ -325,6 +326,5 @@ void Foam::meshReader::createPolyCells() // added in createPolyBoundary() } -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // ************************************************************************* // diff --git a/src/conversion/meshReader/meshReader.C b/src/conversion/meshReader/meshReader.C index 08a8a9886ab..8449c93e224 100644 --- a/src/conversion/meshReader/meshReader.C +++ b/src/conversion/meshReader/meshReader.C @@ -34,7 +34,6 @@ License // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -// Pointers to cell shape models const Foam::cellModel* Foam::meshReader::unknownModel = Foam::cellModeller:: lookup ( @@ -65,27 +64,17 @@ lookup "hex" ); -// * * * * * * * * * * * * * * Static Functions * * * * * * * * * * * * * * // // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // -// attach cellZones based on the cellTable Id -// - any other values can be extracted later from the cellTable dictionary -void Foam::meshReader::addCellZones -( - polyMesh& mesh -) const +void Foam::meshReader::addCellZones(polyMesh& mesh) const { cellTable_.addCellZones(mesh, cellTableId_); warnDuplicates("cellZones", mesh.cellZones().names()); } -// attach faceZones based on the monitoring boundary conditions -void Foam::meshReader::addFaceZones -( - polyMesh& mesh -) const +void Foam::meshReader::addFaceZones(polyMesh& mesh) const { label nZone = monitoringSets_.size(); mesh.faceZones().setSize(nZone); @@ -128,7 +117,6 @@ void Foam::meshReader::addFaceZones } -// create and access the polyMesh Foam::autoPtr<Foam::polyMesh> Foam::meshReader::mesh ( const objectRegistry& registry @@ -172,7 +160,6 @@ Foam::autoPtr<Foam::polyMesh> Foam::meshReader::mesh } -//- write the polyMesh void Foam::meshReader::writeMesh ( const polyMesh& mesh, @@ -199,7 +186,6 @@ void Foam::meshReader::writeMesh } -// Clear extra storage before creation of the mesh to reduce the memory usage void Foam::meshReader::clearExtraStorage() { cellFaces_.clear(); @@ -241,6 +227,7 @@ Foam::meshReader::meshReader cellTable_() {} + // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // Foam::meshReader::~meshReader() @@ -248,7 +235,5 @@ Foam::meshReader::~meshReader() deleteDemandDrivenData(pointCellsPtr_); } -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - // ************************************************************************* // diff --git a/src/conversion/meshReader/meshReader.H b/src/conversion/meshReader/meshReader.H index 171c547756d..e14ef191375 100644 --- a/src/conversion/meshReader/meshReader.H +++ b/src/conversion/meshReader/meshReader.H @@ -51,6 +51,7 @@ SourceFiles createPolyCells.C meshReader.C meshReaderAux.C + \*---------------------------------------------------------------------------*/ #ifndef meshReader_H @@ -74,54 +75,69 @@ namespace Foam class meshReader { protected: - //- identify cell faces in terms of cell Id and face Id + + //- Identify cell faces in terms of cell Id and face Id class cellFaceIdentifier { public: - //- cell Id - label cell; + // Public data + + //- Cell Id + label cell; + + //- Face Id + label face; - //- face Id - label face; - //- Construct null - cellFaceIdentifier() : cell(-1), face(-1) {} + // Constructors + + //- Construct null + cellFaceIdentifier() : cell(-1), face(-1) {} + + //- Construct from cell/face components + cellFaceIdentifier(label c, label f) : cell(c), face(f) {} - //- Construct from cell/face components - cellFaceIdentifier(label c, label f) : cell(c), face(f) {} // Check - //- used if cell or face are non-negative - bool used() const - { - return (cell >= 0 && face >= 0); - } + //- Used if cell or face are non-negative + bool used() const + { + return (cell >= 0 && face >= 0); + } + + //- Unused if cell or face are negative + bool unused() const + { + return (cell < 0 || face < 0); + } - //- unsed if cell or face are negative - bool unused() const - { - return (cell < 0 || face < 0); - } // Member Operators - bool operator!=(const cellFaceIdentifier& cf) const - { - return (cell != cf.cell || face != cf.face); - } - bool operator==(const cellFaceIdentifier& cf) const - { - return (cell == cf.cell && face == cf.face); - } + bool operator!=(const cellFaceIdentifier& cf) const + { + return (cell != cf.cell || face != cf.face); + } + + bool operator==(const cellFaceIdentifier& cf) const + { + return (cell == cf.cell && face == cf.face); + } // IOstream Operators - friend Ostream& operator<<(Ostream& os, const cellFaceIdentifier& cf) - { - os << "(" << cf.cell << "/" << cf.face << ")"; - return os; - } - }; + + friend Ostream& operator<< + ( + Ostream& os, + const cellFaceIdentifier& cf + ) + { + os << "(" << cf.cell << "/" << cf.face << ")"; + return os; + } + }; + private: @@ -154,6 +170,7 @@ private: //- Face sets for monitoring HashTable<List<label>, word, string::hash> monitoringSets_; + // Private Member Functions //- Disallow default bitwise copy construct @@ -170,7 +187,7 @@ private: //- Make polyhedral cells and global faces if the mesh is polyhedral void createPolyCells(); - //- add in boundary face + //- Add in boundary face void addPolyBoundaryFace ( const label cellId, @@ -178,17 +195,17 @@ private: const label nCreatedFaces ); - //- add in boundary face + //- Add in boundary face void addPolyBoundaryFace ( const cellFaceIdentifier& identifier, const label nCreatedFaces ); - //- add cellZones based on cellTable Id + //- Add cellZones based on cellTable Id void addCellZones(polyMesh&) const; - //- add faceZones based on monitoring boundary conditions + //- Add faceZones based on monitoring boundary conditions void addFaceZones(polyMesh&) const; //- Make polyhedral boundary from shape boundary @@ -204,7 +221,7 @@ private: void writeInterfaces(const objectRegistry&) const; - // write List<label> in constant/polyMesh + //- Write List<label> in constant/polyMesh void writeMeshLabelList ( const objectRegistry& registry, @@ -219,7 +236,9 @@ private: return const_cast<faceListList&>(cellFaces_); } + protected: + // Protected data //- Pointers to cell shape models @@ -229,19 +248,19 @@ protected: static const cellModel* prismModel; static const cellModel* hexModel; - //- referenced filename + //- Referenced filename fileName geometryFile_; - //- geometry scaling + //- Geometry scaling scalar scaleFactor_; //- Points supporting the mesh pointField points_; - //- lookup original Cell number for a given cell + //- Lookup original Cell number for a given cell labelList origCellId_; - //- identify boundary faces by cells and their faces + //- Identify boundary faces by cells and their faces // for each patch List<List<cellFaceIdentifier> > boundaryIds_; @@ -260,19 +279,17 @@ protected: //- List of each baffle face faceList baffleFaces_; - // cell table id for each cell + //- Cell table id for each cell labelList cellTableId_; - // cell table persistent data saved as a dictionary + //- Cell table persistent data saved as a dictionary cellTable cellTable_; + // Member Functions - //- subclasses are required to supply this information - virtual bool readGeometry - ( - const scalar scaleFactor = 1.0 - ) = 0; + //- Subclasses are required to supply this information + virtual bool readGeometry(const scalar scaleFactor = 1.0) = 0; //- Return mesh points pointField& points() const @@ -280,23 +297,28 @@ protected: return const_cast<pointField&>(points_); } + public: + // Static Members - //- warn about repeated names + //- Warn about repeated names static void warnDuplicates(const word& context, const wordList&); + // Constructors //- Construct from fileName meshReader(const fileName&, const scalar scaleFactor = 1.0); - // Destructor - virtual ~meshReader(); + + //- Destructor + virtual ~meshReader(); + // Member Functions - //- create and return polyMesh + //- Create and return polyMesh virtual autoPtr<polyMesh> mesh(const objectRegistry&); //- Write auxiliary information @@ -310,6 +332,7 @@ public: ) const; }; + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // } // End namespace Foam diff --git a/src/conversion/meshReader/meshReaderAux.C b/src/conversion/meshReader/meshReaderAux.C index 28609259459..dafaf9c9f3b 100644 --- a/src/conversion/meshReader/meshReaderAux.C +++ b/src/conversion/meshReader/meshReaderAux.C @@ -23,17 +23,14 @@ License Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA \*----------------------------------------------------------------------------*/ + #include "meshReader.H" #include "IOMap.H" #include "OFstream.H" -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Static Functions * * * * * * * * * * * * * // -// warn about duplicate names void Foam::meshReader::warnDuplicates ( const word& context, @@ -76,8 +73,6 @@ void Foam::meshReader::warnDuplicates // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // - -// write interface (baffle) mapping void Foam::meshReader::writeInterfaces(const objectRegistry& registry) const { // write constant/polyMesh/interface @@ -103,14 +98,12 @@ void Foam::meshReader::writeInterfaces(const objectRegistry& registry) const ioObj.writeHeader(os); os << interfaces_ - << "// ************************************************************************* //" + << "// *************************************" + << "************************************ //" << endl; - } -// write List<label> in constant/polyMesh -// this is crucial for later conversion back to ccm/starcd void Foam::meshReader::writeMeshLabelList ( const objectRegistry& registry, @@ -151,6 +144,7 @@ void Foam::meshReader::writeMeshLabelList ); } + // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // void Foam::meshReader::writeAux(const objectRegistry& registry) const @@ -179,10 +173,4 @@ void Foam::meshReader::writeAux(const objectRegistry& registry) const } -// * * * * * * * * * * * * * * * Friend Functions * * * * * * * * * * * * * // - -// * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * // - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - // ************************************************************************* // diff --git a/src/conversion/meshReader/starcd/STARCDMeshReader.C b/src/conversion/meshReader/starcd/STARCDMeshReader.C index aaabca6740e..751be41c578 100644 --- a/src/conversion/meshReader/starcd/STARCDMeshReader.C +++ b/src/conversion/meshReader/starcd/STARCDMeshReader.C @@ -34,21 +34,16 @@ License #include "IFstream.H" #include "IOMap.H" -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -// special boundary regions const char* Foam::meshReaders::STARCD::defaultBoundaryName = "Default_Boundary_Region"; const char* Foam::meshReaders::STARCD::defaultSolidBoundaryName = "Default_Boundary_Solid"; -// keep solids bool Foam::meshReaders::STARCD::keepSolids = false; -// face addressing from pro-STAR faces -> foam faces const int Foam::meshReaders::STARCD::starToFoamFaceAddr[4][6] = { { 4, 5, 2, 3, 0, 1 }, // 11 = pro-STAR hex @@ -57,12 +52,9 @@ const int Foam::meshReaders::STARCD::starToFoamFaceAddr[4][6] = { 0, -1, 4, 2, 1, 3 } // 14 = pro-STAR pyramid }; -// * * * * * * * * * * * * * * Static Functions * * * * * * * * * * * * * * // - // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -// read and discard to newline void Foam::meshReaders::STARCD::readToNewline(IFstream& is) { char ch = '\n'; @@ -73,14 +65,8 @@ void Foam::meshReaders::STARCD::readToNewline(IFstream& is) while ((is) && ch != '\n'); } -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -// read header -bool Foam::meshReaders::STARCD::readHeader -( - IFstream& is, - word fileSignature -) +bool Foam::meshReaders::STARCD::readHeader(IFstream& is, word fileSignature) { if (!is.good()) { @@ -108,19 +94,16 @@ bool Foam::meshReaders::STARCD::readHeader return true; } + // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // -// read boundaryRegion names and the cellTable information from -// dictionaries that have been extracted from the .inp file -void Foam::meshReaders::STARCD::readAux -( - const objectRegistry& registry -) +void Foam::meshReaders::STARCD::readAux(const objectRegistry& registry) { boundaryRegion_.readDict(registry); cellTable_.readDict(registry); } + // read in the points from the .vrt file // /*---------------------------------------------------------------------------*\ @@ -219,7 +202,6 @@ void Foam::meshReaders::STARCD::readPoints } -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // read in the cells from the .cel file // @@ -261,10 +243,7 @@ for each cell face. Strictly speaking, we only need the cellModeller for adding boundaries. \*---------------------------------------------------------------------------*/ -void Foam::meshReaders::STARCD::readCells -( - const fileName& inputName -) +void Foam::meshReaders::STARCD::readCells(const fileName& inputName) { const word fileSignature = "PROSTAR_CELL"; label nFluids = 0, nSolids = 0, nBaffles = 0, nShells = 0; @@ -545,7 +524,8 @@ void Foam::meshReaders::STARCD::readCells { Info<< "star cell " << starCellId << " has " << (nFaces - faceI) - << " empty faces - could cause boundary addressing problems" + << " empty faces - could cause boundary " + << "addressing problems" << endl; nFaces = faceI; @@ -633,6 +613,7 @@ void Foam::meshReaders::STARCD::readCells mapToFoamPointId_.clear(); } + // read in the boundaries from the .bnd file // /*---------------------------------------------------------------------------*\ @@ -653,10 +634,7 @@ BAFFLE etc, \*---------------------------------------------------------------------------*/ -void Foam::meshReaders::STARCD::readBoundary -( - const fileName& inputName -) +void Foam::meshReaders::STARCD::readBoundary(const fileName& inputName) { const word fileSignature = "PROSTAR_BOUNDARY"; label nPatches = 0, nFaces = 0, nBafflePatches = 0, maxId = 0; @@ -1059,13 +1037,9 @@ void Foam::meshReaders::STARCD::cullPoints() } - // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -bool Foam::meshReaders::STARCD::readGeometry -( - const scalar scaleFactor -) +bool Foam::meshReaders::STARCD::readGeometry(const scalar scaleFactor) { // Info<< "called meshReaders::STARCD::readGeometry" << endl; @@ -1077,9 +1051,9 @@ bool Foam::meshReaders::STARCD::readGeometry return true; } + // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -// Construct from reading a file Foam::meshReaders::STARCD::STARCD ( const fileName& prefix, @@ -1095,11 +1069,11 @@ Foam::meshReaders::STARCD::STARCD readAux(registry); } + // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // Foam::meshReaders::STARCD::~STARCD() {} -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // ************************************************************************* // diff --git a/src/conversion/meshReader/starcd/STARCDMeshReader.H b/src/conversion/meshReader/starcd/STARCDMeshReader.H index ce887336087..8a82e743ea5 100644 --- a/src/conversion/meshReader/starcd/STARCDMeshReader.H +++ b/src/conversion/meshReader/starcd/STARCDMeshReader.H @@ -67,7 +67,8 @@ class STARCD protected: - // Private Data + // Protected Data + static const char* defaultBoundaryName; static const char* defaultSolidBoundaryName; @@ -83,10 +84,11 @@ protected: //- Cell labels (imported Cell numbering not necessarily contiguous) labelList mapToFoamCellId_; - //- boundary region data + //- Boundary region data boundaryRegion boundaryRegion_; - // Private Member Functions + + // Protected Member Functions //- Disallow default bitwise copy construct STARCD(const STARCD&); @@ -97,27 +99,28 @@ protected: //- Read the mesh from the file(s) virtual bool readGeometry(const scalar scaleFactor = 1.0); - //- read points from file + //- Read points from file void readPoints(const fileName&, const scalar scaleFactor); - //- read cell connectivities from file + //- Read cell connectivities from file virtual void readCells(const fileName&); - //- remove unused points + //- Remove unused points void cullPoints(); - //- read boundary (cell/face) definitions + //- Read boundary (cell/face) definitions void readBoundary(const fileName&); - //- read auxiliary data from constant/{boundaryRegion,cellTable} + //- Read auxiliary data from constant/{boundaryRegion,cellTable} void readAux(const objectRegistry&); - //- read and discard to newline + //- Read and discard to newline static void readToNewline(IFstream&); - //- read header + //- Read header static bool readHeader(IFstream&, word fileSignature); + protected: enum cellType @@ -145,9 +148,12 @@ protected: public: - //- keep solids (default false) + // Static data + + //- Keep solids (default false) static bool keepSolids; + // Constructors //- Construct from case name @@ -158,19 +164,19 @@ public: const scalar scaleFactor = 1.0 ); - // Destructor - virtual ~STARCD(); - - // Member Functions + //- Destructor + virtual ~STARCD(); }; + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // } // End namespace meshReaders - } // End namespace Foam +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + #endif // ************************************************************************* // diff --git a/src/conversion/meshTables/boundaryRegion.C b/src/conversion/meshTables/boundaryRegion.C index 8af5a0e1664..43be5d301fb 100644 --- a/src/conversion/meshTables/boundaryRegion.C +++ b/src/conversion/meshTables/boundaryRegion.C @@ -36,7 +36,6 @@ Foam::boundaryRegion::boundaryRegion() {} -// read constant/boundaryRegion (IOMap<dictionary>) Foam::boundaryRegion::boundaryRegion ( const objectRegistry& registry, @@ -55,6 +54,7 @@ Foam::boundaryRegion::boundaryRegion Foam::boundaryRegion::~boundaryRegion() {} + // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // Foam::label Foam::boundaryRegion::append(const dictionary& dict) @@ -73,8 +73,7 @@ Foam::label Foam::boundaryRegion::append(const dictionary& dict) } -Foam::Map<Foam::word> -Foam::boundaryRegion::names() const +Foam::Map<Foam::word> Foam::boundaryRegion::names() const { Map<word> lookup; @@ -90,8 +89,7 @@ Foam::boundaryRegion::names() const } -Foam::Map<Foam::word> -Foam::boundaryRegion::boundaryTypes() const +Foam::Map<Foam::word> Foam::boundaryRegion::boundaryTypes() const { Map<word> lookup; @@ -139,7 +137,6 @@ Foam::word Foam::boundaryRegion::boundaryType(const word& name) const } -// read constant/boundaryRegion (IOMap<dictionary>) void Foam::boundaryRegion::readDict ( const objectRegistry& registry, @@ -174,7 +171,6 @@ void Foam::boundaryRegion::readDict } -// write constant/boundaryRegion for later reuse void Foam::boundaryRegion::writeDict ( const objectRegistry& registry, @@ -208,12 +204,12 @@ void Foam::boundaryRegion::writeDict // * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * // - void Foam::boundaryRegion::operator=(const boundaryRegion& rhs) { Map<dictionary>::operator=(rhs); } + void Foam::boundaryRegion::operator=(const Map<dictionary>& rhs) { Map<dictionary>::operator=(rhs); @@ -260,9 +256,5 @@ void Foam::boundaryRegion::rename(const dictionary& dict) } } -// * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * // - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // ************************************************************************* // diff --git a/src/conversion/meshTables/boundaryRegion.H b/src/conversion/meshTables/boundaryRegion.H index ba5976d4a5e..643cc17f4da 100644 --- a/src/conversion/meshTables/boundaryRegion.H +++ b/src/conversion/meshTables/boundaryRegion.H @@ -72,15 +72,13 @@ class boundaryRegion : public Map<dictionary> { - // Private data - // Private Member Functions - //- Disallow default bitwise copy construct - boundaryRegion(const boundaryRegion&); + //- Disallow default bitwise copy construct + boundaryRegion(const boundaryRegion&); + public: - // Static Members // Constructors @@ -96,8 +94,8 @@ public: ); - // Destructor - ~boundaryRegion(); + //- Destructor + ~boundaryRegion(); // Member Functions @@ -126,7 +124,6 @@ public: const fileName& instance = "constant" ); - //- Write constant/boundaryRegion for later reuse void writeDict ( @@ -153,13 +150,14 @@ public: // newPatchName originalName; // @endverbatim void rename(const dictionary&); - }; // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // } // End namespace Foam +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + #endif // ************************************************************************* // diff --git a/src/conversion/meshTables/cellTable.C b/src/conversion/meshTables/cellTable.C index 66e39a4cb9f..5b911b8599e 100644 --- a/src/conversion/meshTables/cellTable.C +++ b/src/conversion/meshTables/cellTable.C @@ -37,7 +37,6 @@ const char* const Foam::cellTable::defaultMaterial_ = "fluid"; // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // -//- map from cellTable Id -> zone number (unmapped = -1) Foam::labelList Foam::cellTable::zoneMap() const { label maxId = 0; @@ -78,7 +77,6 @@ Foam::wordList Foam::cellTable::namesList() const } -// add required entries - MaterialType void Foam::cellTable::addDefaults() { forAllIter(Map<dictionary>, *this, iter) @@ -115,14 +113,12 @@ void Foam::cellTable::setEntry // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // - Foam::cellTable::cellTable() : Map<dictionary>() {} -// read constant/cellTable (IOMap<dictionary>) Foam::cellTable::cellTable ( const objectRegistry& registry, @@ -136,13 +132,12 @@ Foam::cellTable::cellTable } -// * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * // - // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // Foam::cellTable::~cellTable() {} + // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // Foam::label Foam::cellTable::append(const dictionary& dict) @@ -161,8 +156,7 @@ Foam::label Foam::cellTable::append(const dictionary& dict) } -Foam::Map<Foam::word> -Foam::cellTable::names() const +Foam::Map<Foam::word> Foam::cellTable::names() const { Map<word> lookup; @@ -211,8 +205,10 @@ Foam::label Foam::cellTable::findIndex(const word& name) const } -Foam::Map<Foam::word> -Foam::cellTable::selectType(const word& materialType) const +Foam::Map<Foam::word> Foam::cellTable::selectType +( + const word& materialType +) const { Map<word> lookup; @@ -236,29 +232,25 @@ Foam::cellTable::selectType(const word& materialType) const } -Foam::Map<Foam::word> -Foam::cellTable::fluids() const +Foam::Map<Foam::word> Foam::cellTable::fluids() const { return selectType("fluid"); } -Foam::Map<Foam::word> -Foam::cellTable::solids() const +Foam::Map<Foam::word> Foam::cellTable::solids() const { return selectType("solid"); } -Foam::Map<Foam::word> -Foam::cellTable::shells() const +Foam::Map<Foam::word> Foam::cellTable::shells() const { return selectType("shell"); } -Foam::Map<Foam::word> -Foam::cellTable::materialTypes() const +Foam::Map<Foam::word> Foam::cellTable::materialTypes() const { Map<word> lookup; @@ -275,7 +267,6 @@ Foam::cellTable::materialTypes() const } -//- assign material Type void Foam::cellTable::setMaterial(const label& id, const word& matlType) { setEntry(id, "MaterialType", matlType); @@ -299,7 +290,6 @@ void Foam::cellTable::setName(const label& id) } -// read constant/cellTable (IOMap<dictionary>) void Foam::cellTable::readDict ( const objectRegistry& registry, @@ -335,7 +325,6 @@ void Foam::cellTable::readDict } -// write constant/cellTable for later reuse void Foam::cellTable::writeDict ( const objectRegistry& registry, @@ -369,19 +358,20 @@ void Foam::cellTable::writeDict // * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * // - void Foam::cellTable::operator=(const cellTable& rhs) { Map<dictionary>::operator=(rhs); addDefaults(); } + void Foam::cellTable::operator=(const Map<dictionary>& rhs) { Map<dictionary>::operator=(rhs); addDefaults(); } + void Foam::cellTable::operator=(const polyMesh& mesh) { Map<dictionary> zoneDict; @@ -430,9 +420,6 @@ void Foam::cellTable::operator=(const polyMesh& mesh) // * * * * * * * * * * * * * * * Friend Functions * * * * * * * * * * * * * // - -// attach cellZones based on the cellTable Id -// - any other values can be extracted later from the cellTable dictionary void Foam::cellTable::addCellZones ( polyMesh& mesh, @@ -580,8 +567,5 @@ void Foam::cellTable::combine(const dictionary& dict, labelList& tableIds) } } -// * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * // - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // ************************************************************************* // diff --git a/src/conversion/meshTables/cellTable.H b/src/conversion/meshTables/cellTable.H index a0e092c7eec..04aac24e96b 100644 --- a/src/conversion/meshTables/cellTable.H +++ b/src/conversion/meshTables/cellTable.H @@ -80,7 +80,9 @@ class cellTable public Map<dictionary> { // Private data - static const char* const defaultMaterial_; + + static const char* const defaultMaterial_; + // Private Member Functions @@ -98,8 +100,8 @@ class cellTable //- Disallow default bitwise copy construct cellTable(const cellTable&); + public: - // Static Members // Constructors @@ -115,8 +117,8 @@ public: ); - // Destructor - ~cellTable(); + //- Destructor + ~cellTable(); // Member Functions @@ -175,6 +177,7 @@ public: const fileName& instance = "constant" ) const; + // Member Operators //- Assignment @@ -195,13 +198,14 @@ public: //- Combine tableIds together // each dictionary entry is a wordList void combine(const dictionary&, labelList& tableIds); - }; // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // } // End namespace Foam +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + #endif // ************************************************************************* // diff --git a/src/conversion/meshWriter/meshWriter.C b/src/conversion/meshWriter/meshWriter.C index ca9eeb01902..fafd62263b1 100644 --- a/src/conversion/meshWriter/meshWriter.C +++ b/src/conversion/meshWriter/meshWriter.C @@ -29,27 +29,34 @@ License // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -// Pointers to cell shape models const Foam::cellModel* Foam::meshWriter::unknownModel = Foam::cellModeller:: lookup ( "unknown" ); + + const Foam::cellModel* Foam::meshWriter::tetModel = Foam::cellModeller:: lookup ( "tet" ); + + const Foam::cellModel* Foam::meshWriter::pyrModel = Foam::cellModeller:: lookup ( "pyr" ); + + const Foam::cellModel* Foam::meshWriter::prismModel = Foam::cellModeller:: lookup ( "prism" ); + + const Foam::cellModel* Foam::meshWriter::hexModel = Foam::cellModeller:: lookup ( @@ -61,15 +68,9 @@ Foam::string Foam::meshWriter::defaultMeshName = "meshExport"; Foam::string Foam::meshWriter::defaultSurfaceName = "surfExport"; -// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // - // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -Foam::meshWriter::meshWriter -( - const polyMesh& mesh, - const scalar scaleFactor -) +Foam::meshWriter::meshWriter(const polyMesh& mesh, const scalar scaleFactor) : mesh_(mesh), scaleFactor_(scaleFactor), @@ -80,27 +81,10 @@ Foam::meshWriter::meshWriter {} -// * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * // - - // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // Foam::meshWriter::~meshWriter() {} -// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // - - -// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * // - - -// * * * * * * * * * * * * * * * Friend Functions * * * * * * * * * * * * * // - - -// * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * // - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - - // ************************************************************************* // diff --git a/src/conversion/meshWriter/meshWriter.H b/src/conversion/meshWriter/meshWriter.H index 866bd0072ff..a3ce8fd32a6 100644 --- a/src/conversion/meshWriter/meshWriter.H +++ b/src/conversion/meshWriter/meshWriter.H @@ -90,8 +90,6 @@ namespace Foam class meshWriter { - // Private data - // Private Member Functions //- Disallow default bitwise copy construct @@ -100,16 +98,18 @@ class meshWriter //- Disallow default bitwise assignment void operator=(const meshWriter&); + protected: + // Protected data - //- mesh reference + //- Mesh reference const polyMesh& mesh_; - //- scaling factor for points (eg, [m] -> [mm]) + //- Scaling factor for points (eg, [m] -> [mm]) scalar scaleFactor_; - //- write bnd file + //- Write bnd file bool writeBoundary_; //- boundaryRegion persistent data saved as a dictionary @@ -118,7 +118,7 @@ protected: //- cellTable persistent data saved as a dictionary cellTable cellTable_; - // cellTable IDs for each cell + //- cellTable IDs for each cell labelList cellTableId_; //- Pointers to cell shape models @@ -128,6 +128,7 @@ protected: static const cellModel* prismModel; static const cellModel* hexModel; + public: // Static data members @@ -138,7 +139,7 @@ public: // Constructors - //- create a writer obejct + //- Ccreate a writer obejct meshWriter ( const polyMesh&, @@ -146,60 +147,46 @@ public: ); - // Selectors - - // Destructor - - virtual ~meshWriter(); + //- Destructor + virtual ~meshWriter(); // Member Functions - // Access - - // Check - // Edit - //- set points scaling - void scaleFactor(const scalar scaling) - { - scaleFactor_ = scaling; - } - - //- suppress writing bnd file - void noBoundary() - { - writeBoundary_ = false; - } - - // Write - - //- write volume mesh - // subclass must to supply this method - virtual bool write - ( - const fileName& timeName = fileName::null - ) const = 0; - - //- write surface mesh with optional triangulation - // subclass could supply this information - virtual bool writeSurface - ( - const fileName& timeName = fileName::null, - const bool& triangulate = false - ) const - { - return false; - } + //- Set points scaling + void scaleFactor(const scalar scaling) + { + scaleFactor_ = scaling; + } - // Member Operators + //- Suppress writing bnd file + void noBoundary() + { + writeBoundary_ = false; + } - // Friend Functions - // Friend Operators + // Write - // IOstream Operators + //- Write volume mesh + // subclass must to supply this method + virtual bool write + ( + const fileName& timeName = fileName::null + ) const = 0; + + //- Write surface mesh with optional triangulation + // subclass could supply this information + virtual bool writeSurface + ( + const fileName& timeName = fileName::null, + const bool& triangulate = false + ) const + { + return false; + } }; @@ -209,10 +196,6 @@ public: // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -// #include "meshWriterI.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - #endif // ************************************************************************* // diff --git a/src/conversion/meshWriter/starcd/STARCDMeshWriter.C b/src/conversion/meshWriter/starcd/STARCDMeshWriter.C index f382f096060..3df2eb62e10 100644 --- a/src/conversion/meshWriter/starcd/STARCDMeshWriter.C +++ b/src/conversion/meshWriter/starcd/STARCDMeshWriter.C @@ -32,11 +32,9 @@ License // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -// special boundary regions const char* Foam::meshWriters::STARCD::defaultBoundaryName = "Default_Boundary_Region"; -// face addressing from foam faces -> pro-STAR faces for primitive shapes const Foam::label Foam::meshWriters::STARCD::foamToStarFaceAddr[4][6] = { { 4, 5, 2, 3, 0, 1 }, // 11 = pro-STAR hex @@ -174,12 +172,7 @@ void Foam::meshWriters::STARCD::getCellTable() } -// Prostar 4+ header format -void Foam::meshWriters::STARCD::writeHeader -( - Ostream& os, - const char* filetype -) +void Foam::meshWriters::STARCD::writeHeader(Ostream& os, const char* filetype) { os << "PROSTAR_" << filetype << nl << 4000 @@ -194,10 +187,7 @@ void Foam::meshWriters::STARCD::writeHeader } -void Foam::meshWriters::STARCD::writePoints -( - const fileName& prefix -) const +void Foam::meshWriters::STARCD::writePoints(const fileName& prefix) const { OFstream os(prefix + ".vrt"); writeHeader(os, "VERTEX"); @@ -227,10 +217,7 @@ void Foam::meshWriters::STARCD::writePoints } -void Foam::meshWriters::STARCD::writeCells -( - const fileName& prefix -) const +void Foam::meshWriters::STARCD::writeCells(const fileName& prefix) const { OFstream os(prefix + ".cel"); writeHeader(os, "CELL"); @@ -372,10 +359,7 @@ void Foam::meshWriters::STARCD::writeCells } -void Foam::meshWriters::STARCD::writeBoundary -( - const fileName& prefix -) const +void Foam::meshWriters::STARCD::writeBoundary(const fileName& prefix) const { OFstream os(prefix + ".bnd"); writeHeader(os, "BOUNDARY"); @@ -495,9 +479,6 @@ Foam::meshWriters::STARCD::STARCD } -// * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * // - - // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // Foam::meshWriters::STARCD::~STARCD() @@ -506,10 +487,7 @@ Foam::meshWriters::STARCD::~STARCD() // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -void Foam::meshWriters::STARCD::rmFiles -( - const fileName& baseName -) const +void Foam::meshWriters::STARCD::rmFiles(const fileName& baseName) const { rm(baseName + ".vrt"); rm(baseName + ".cel"); @@ -518,10 +496,7 @@ void Foam::meshWriters::STARCD::rmFiles } -bool Foam::meshWriters::STARCD::write -( - const fileName& meshName -) const +bool Foam::meshWriters::STARCD::write(const fileName& meshName) const { fileName baseName(meshName); @@ -748,10 +723,4 @@ bool Foam::meshWriters::STARCD::writeSurface } -// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * // - -// * * * * * * * * * * * * * * * Friend Functions * * * * * * * * * * * * * // - -// * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * // - // ************************************************************************* // diff --git a/src/conversion/meshWriter/starcd/STARCDMeshWriter.H b/src/conversion/meshWriter/starcd/STARCDMeshWriter.H index 1bbdf7dd455..48efb8dfee4 100644 --- a/src/conversion/meshWriter/starcd/STARCDMeshWriter.H +++ b/src/conversion/meshWriter/starcd/STARCDMeshWriter.H @@ -64,8 +64,10 @@ class STARCD public meshWriter { // Private Data + static const char* defaultBoundaryName; + // Private Member Functions //- Disallow default bitwise copy construct @@ -74,22 +76,23 @@ class STARCD //- Disallow default bitwise assignment void operator=(const STARCD&); - //- pro-STAR 4+ header format + //- Pro-STAR 4+ header format static void writeHeader(Ostream&, const char* filetype); - //- write points + //- Write points void writePoints(const fileName& baseName) const; - //- write cells + //- Write cells void writeCells(const fileName& baseName) const; - //- write boundary + //- Write boundary void writeBoundary(const fileName& baseName) const; void getCellTable(); label findDefaultBoundary() const; + public: // Static data members @@ -100,68 +103,50 @@ public: // Constructors - //- open a file for writing + //- Open a file for writing STARCD ( const polyMesh&, const scalar scaleFactor = 1.0 ); - // Selectors - // Destructor - - virtual ~STARCD(); + //- Destructor + virtual ~STARCD(); // Member Functions - // Access - - // Check - // Edit - // Write - + //- Remove STAR-CD files for the baseName + void rmFiles(const fileName& baseName) const; - //- Remove STAR-CD files for the baseName - void rmFiles(const fileName& baseName) const; - - //- write volume mesh - virtual bool write - ( - const fileName& meshName = fileName::null - ) const; - //- write surface mesh with optional triangulation - virtual bool writeSurface - ( - const fileName& meshName = fileName::null, - const bool& triangulate = false - ) const; - - - // Member Operators - - // Friend Functions - - // Friend Operators + // Write - // IOstream Operators + //- Write volume mesh + virtual bool write + ( + const fileName& meshName = fileName::null + ) const; + + //- Write surface mesh with optional triangulation + virtual bool writeSurface + ( + const fileName& meshName = fileName::null, + const bool& triangulate = false + ) const; }; // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // } // End namespace meshWriters - } // End namespace Foam // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - #endif // ************************************************************************* // -- GitLab