diff --git a/applications/solvers/multiphase/MPPICInterFoam/Allwclean b/applications/solvers/multiphase/MPPICInterFoam/Allwclean index d6607c3db0574ebf6e1ff572e14f54d2ecf59356..12d384e35695e6b298099563f1456891cb553bcc 100755 --- a/applications/solvers/multiphase/MPPICInterFoam/Allwclean +++ b/applications/solvers/multiphase/MPPICInterFoam/Allwclean @@ -1,8 +1,7 @@ #!/bin/sh cd ${0%/*} || exit 1 # run from this directory -set -x wclean libso CompressibleTwoPhaseMixtureTurbulenceModels wclean -# ----------------------------------------------------------------- end-of-file +#------------------------------------------------------------------------------ diff --git a/applications/solvers/multiphase/MPPICInterFoam/Allwmake b/applications/solvers/multiphase/MPPICInterFoam/Allwmake index 110d4b093a7a37ac08945856aca3fb4dcbf52070..36e2f896469fff9123eb2f6b5299c4a782a857ec 100755 --- a/applications/solvers/multiphase/MPPICInterFoam/Allwmake +++ b/applications/solvers/multiphase/MPPICInterFoam/Allwmake @@ -1,8 +1,7 @@ #!/bin/sh cd ${0%/*} || exit 1 # run from this directory -set -x wmake libso CompressibleTwoPhaseMixtureTurbulenceModels wmake -# ----------------------------------------------------------------- end-of-file +#------------------------------------------------------------------------------ diff --git a/applications/solvers/multiphase/interCondensingEvaporatingFoam/Allwmake b/applications/solvers/multiphase/interCondensingEvaporatingFoam/Allwmake index 523c10c33cdc1cc42bce179473211f0da4907648..59af9259fef2b7216a6fe8086c4337b0faf9138e 100755 --- a/applications/solvers/multiphase/interCondensingEvaporatingFoam/Allwmake +++ b/applications/solvers/multiphase/interCondensingEvaporatingFoam/Allwmake @@ -4,7 +4,6 @@ cd ${0%/*} || exit 1 # Run from this directory # Parse arguments for library compilation targetType=libso . $WM_PROJECT_DIR/wmake/scripts/AllwmakeParseArguments -set -x wmake $targetType temperaturePhaseChangeTwoPhaseMixtures wmake diff --git a/applications/utilities/mesh/generation/foamyMesh/Allwmake b/applications/utilities/mesh/generation/foamyMesh/Allwmake index 85f046473cbd3b9ada96efc73eaef278e9aa5be1..bea4106ad3738ae0ede63d3655f726d646ba90a3 100755 --- a/applications/utilities/mesh/generation/foamyMesh/Allwmake +++ b/applications/utilities/mesh/generation/foamyMesh/Allwmake @@ -7,8 +7,6 @@ cd ${0%/*} || exit 1 # Run from this directory if [ -f "$CGAL_ARCH_PATH/include/CGAL/version.h" ] || \ [ "${CGAL_ARCH_PATH##*-}" = system -a -f /usr/include/CGAL/version.h ] then - set -x - wmake $targetType conformalVoronoiMesh wmake $targetType conformalVoronoi2DMesh wmake foamyQuadMesh diff --git a/applications/utilities/mesh/manipulation/renumberMesh/Allwmake b/applications/utilities/mesh/manipulation/renumberMesh/Allwmake index fae482e08b088ce26faa1f02b6e63728adb3afa8..ee135cc373cc65c1ab261367fc5aa474f7e36975 100755 --- a/applications/utilities/mesh/manipulation/renumberMesh/Allwmake +++ b/applications/utilities/mesh/manipulation/renumberMesh/Allwmake @@ -20,7 +20,6 @@ then export LINK_FLAGS="${LINK_FLAGS} -lzoltanRenumber -L${ZOLTAN_ARCH_PATH}/lib -lzoltan" fi -set -x wmake $targetType #------------------------------------------------------------------------------ diff --git a/applications/utilities/surface/surfaceBooleanFeatures/Allwmake b/applications/utilities/surface/surfaceBooleanFeatures/Allwmake index 660a2e59b52039d526cc498cfab408d32a4cc953..260b46ea0bb624037067b0c3d855b67a5cd1963d 100755 --- a/applications/utilities/surface/surfaceBooleanFeatures/Allwmake +++ b/applications/utilities/surface/surfaceBooleanFeatures/Allwmake @@ -1,6 +1,5 @@ #!/bin/sh cd ${0%/*} || exit 1 # Run from this directory -set -x unset COMPILE_FLAGS LINK_FLAGS diff --git a/src/OpenFOAM/db/functionObjects/functionObject/functionObject.H b/src/OpenFOAM/db/functionObjects/functionObject/functionObject.H index 1cf46f877eb192c361bbd8c920e09f95300b991e..9c7d56a340d99c9a9bebecdc29ee1ea7329ff5dc 100644 --- a/src/OpenFOAM/db/functionObjects/functionObject/functionObject.H +++ b/src/OpenFOAM/db/functionObjects/functionObject/functionObject.H @@ -82,7 +82,7 @@ Description runTime | Execute/write every 'Interval' run time period clockTime | Execute/write every 'Interval' clock time period cpuTime | Execute/write every 'Interval' CPU time period - none | Execute/write every time-step + none | Execute/write disabled \endtable The sub-dictionary name \c \<functionObjectName\> is chosen by the user, and diff --git a/src/conversion/ensight/mesh/ensightMeshIO.C b/src/conversion/ensight/mesh/ensightMeshIO.C index 406697d94296f5ea076f3edd14115c08d2891742..f8bc9230c2585331d8abd0a69dfda8ea762ca4a2 100644 --- a/src/conversion/ensight/mesh/ensightMeshIO.C +++ b/src/conversion/ensight/mesh/ensightMeshIO.C @@ -452,24 +452,21 @@ void Foam::ensightMesh::writeCellConnectivity ensightCells::NFACED }; - for (int i=0; i < 5; ++i) + for (label typei=0; typei < ensightCells::nTypes; ++typei) { - const ensightCells::elemType& what = oldOrder[i]; + const ensightCells::elemType& what = oldOrder[typei]; writeCellConnectivity(what, ensCells, pointToGlobal, os); } + + return; } - else - { - const List<ensightCells::elemType> enums = - ensightCells::elemEnum.enums(); - forAllConstIter(List<ensightCells::elemType>, enums, iter) - { - const ensightCells::elemType what = *iter; + for (label typei=0; typei < ensightCells::nTypes; ++typei) + { + const ensightCells::elemType what = ensightCells::elemType(typei); - writeCellConnectivity(what, ensCells, pointToGlobal, os); - } + writeCellConnectivity(what, ensCells, pointToGlobal, os); } } @@ -614,13 +611,11 @@ void Foam::ensightMesh::writeFaceConnectivity const bool raw ) const { - const List<ensightFaces::elemType> enums = ensightFaces::elemEnum.enums(); - if (raw) { - forAllConstIter(List<ensightFaces::elemType>, enums, iter) + for (label typei=0; typei < ensightFaces::nTypes; ++typei) { - const ensightFaces::elemType what = *iter; + const ensightFaces::elemType what = ensightFaces::elemType(typei); writeFaceConnectivity ( @@ -638,9 +633,9 @@ void Foam::ensightMesh::writeFaceConnectivity } else { - forAllConstIter(List<ensightFaces::elemType>, enums, iter) + for (label typei=0; typei < ensightFaces::nTypes; ++typei) { - const ensightFaces::elemType what = *iter; + const ensightFaces::elemType what = ensightFaces::elemType(typei); writeFaceConnectivity ( diff --git a/src/conversion/ensight/output/ensightOutputTemplates.C b/src/conversion/ensight/output/ensightOutputTemplates.C index 4e456fb53850292150093915b8ab350d7a19b5a4..65ce0098af1b3522fc3838c9be254fe080aee437 100644 --- a/src/conversion/ensight/output/ensightOutputTemplates.C +++ b/src/conversion/ensight/output/ensightOutputTemplates.C @@ -101,7 +101,8 @@ bool Foam::ensightOutput::writeFaceField for (label typei=0; typei < ensightFaces::nTypes; ++typei) { - const ensightFaces::elemType what = ensightFaces::elemType(typei); + const ensightFaces::elemType what = + ensightFaces::elemType(typei); writeFieldContent ( @@ -136,7 +137,7 @@ bool Foam::ensightOutput::writeFaceSubField } label start = 0; // start of sublist - for (label typei = 0; typei < ensightFaces::nTypes; ++typei) + for (label typei=0; typei < ensightFaces::nTypes; ++typei) { const ensightFaces::elemType what = ensightFaces::elemType(typei); const label size = ensFaces.faceIds(what).size(); diff --git a/src/conversion/ensight/output/ensightSerialOutputTemplates.C b/src/conversion/ensight/output/ensightSerialOutputTemplates.C index 80ed67b26a0c82aad489106517d0c3b60e6c77ce..ae15572f4c8f50f35287f5c3fd845298bcfb94d1 100644 --- a/src/conversion/ensight/output/ensightSerialOutputTemplates.C +++ b/src/conversion/ensight/output/ensightSerialOutputTemplates.C @@ -84,7 +84,8 @@ bool Foam::ensightSerialOutput::writeField for (label typei=0; typei < ensightFaces::nTypes; ++typei) { - const ensightFaces::elemType what = ensightFaces::elemType(typei); + const ensightFaces::elemType what = + ensightFaces::elemType(typei); writeFieldContent ( diff --git a/src/conversion/ensight/part/ensightPartCells.C b/src/conversion/ensight/part/ensightPartCells.C index cfd5c9482fc84ccde70aced8fcc826e7b63995de..b4fc02ad6a4d6d0fe28669a10f8bf0ac418cf9e4 100644 --- a/src/conversion/ensight/part/ensightPartCells.C +++ b/src/conversion/ensight/part/ensightPartCells.C @@ -263,12 +263,9 @@ void Foam::ensightPartCells::write } // write each element type - const List<ensightCells::elemType> enums = - ensightCells::elemEnum.enums(); - - forAllConstIter(List<ensightCells::elemType>, enums, iter) + for (label typei=0; typei < ensightCells::nTypes; ++typei) { - const ensightCells::elemType what = *iter; + const ensightCells::elemType what = ensightCells::elemType(typei); writeConnectivity ( @@ -308,10 +305,9 @@ void Foam::ensightPartCells::dumpInfo(Ostream& os) const os.writeEntry("name", name()); os.writeEntry("size", size()); - const List<ensightCells::elemType> enums = ensightCells::elemEnum.enums(); - forAllConstIter(List<ensightCells::elemType>, enums, iter) + for (label typei=0; typei < ensightCells::nTypes; ++typei) { - const ensightCells::elemType what = *iter; + const ensightCells::elemType what = ensightCells::elemType(typei); const labelUList& addr = this->cellIds(what); os.writeKeyword(ensightCells::key(what)); diff --git a/src/conversion/ensight/part/ensightPartFaces.C b/src/conversion/ensight/part/ensightPartFaces.C index 576032482650fe119270ca4c84fd4b5932c3f53c..e0ed197639ce366beedbb9ef5397e0b24f0aa15a 100644 --- a/src/conversion/ensight/part/ensightPartFaces.C +++ b/src/conversion/ensight/part/ensightPartFaces.C @@ -226,12 +226,9 @@ void Foam::ensightPartFaces::write } // write part - const List<ensightFaces::elemType> enums = - ensightFaces::elemEnum.enums(); - - forAllConstIter(List<ensightFaces::elemType>, enums, iter) + for (label typei=0; typei < ensightFaces::nTypes; ++typei) { - const ensightFaces::elemType what = *iter; + const ensightFaces::elemType what = ensightFaces::elemType(typei); writeConnectivity ( @@ -273,10 +270,9 @@ void Foam::ensightPartFaces::dumpInfo(Ostream& os) const os.writeEntry("start", start_); os.writeEntry("size", size()); - const List<ensightFaces::elemType> enums = ensightFaces::elemEnum.enums(); - forAllConstIter(List<ensightFaces::elemType>, enums, iter) + for (label typei=0; typei < ensightFaces::nTypes; ++typei) { - const ensightFaces::elemType what = *iter; + const ensightFaces::elemType what = ensightFaces::elemType(typei); const labelUList& addr = this->faceIds(what); os.writeKeyword(ensightFaces::key(what)); diff --git a/src/fileFormats/ensight/part/ensightCells.C b/src/fileFormats/ensight/part/ensightCells.C index 141df44053ec83cd19b22d432a4602f00941d9ce..d08996ad85764bfda0c2616a51c0dbc2e2abc01f 100644 --- a/src/fileFormats/ensight/part/ensightCells.C +++ b/src/fileFormats/ensight/part/ensightCells.C @@ -49,41 +49,25 @@ const Foam::NamedEnum<Foam::ensightCells::elemType, 5> // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // -inline Foam::label Foam::ensightCells::offset -( - const enum elemType what, - const label i -) const -{ - label n = i; - for (label typeI = 0; typeI < label(what); ++typeI) - { - n += sizes_[typeI]; - } - - return n; -} - - -void Foam::ensightCells::resize() +void Foam::ensightCells::resizeAll() { // overall required size label n = 0; - forAll(sizes_, typeI) + forAll(sizes_, typei) { - n += sizes_[typeI]; + n += sizes_[typei]; } address_.setSize(n, Zero); // assign corresponding sub-lists n = 0; - forAll(sizes_, typeI) + forAll(sizes_, typei) { - deleteDemandDrivenData(lists_[typeI]); + deleteDemandDrivenData(lists_[typei]); - lists_[typeI] = new SubList<label>(address_, sizes_[typeI], n); + lists_[typei] = new SubList<label>(address_, sizes_[typei], n); - n += sizes_[typeI]; + n += sizes_[typei]; } } @@ -98,12 +82,12 @@ Foam::ensightCells::ensightCells(const label partIndex) lists_() { // Ensure sub-lists are properly initialized to nullptr - forAll(lists_, typeI) + forAll(lists_, typei) { - lists_[typeI] = nullptr; + lists_[typei] = nullptr; } - resize(); // adjust allocation + resizeAll(); // adjust allocation } @@ -115,9 +99,9 @@ Foam::ensightCells::ensightCells(const ensightCells& obj) lists_() { // Ensure sub-lists are properly initialized to nullptr - forAll(lists_, typeI) + forAll(lists_, typei) { - lists_[typeI] = nullptr; + lists_[typei] = nullptr; } // Total (reduced) sizes @@ -126,7 +110,7 @@ Foam::ensightCells::ensightCells(const ensightCells& obj) // Local sizes this->sizes_ = obj.sizes(); - resize(); // adjust allocation + resizeAll(); // adjust allocation // Restore total (reduced) sizes this->sizes_ = totSizes; @@ -137,9 +121,9 @@ Foam::ensightCells::ensightCells(const ensightCells& obj) Foam::ensightCells::~ensightCells() { - forAll(lists_, typeI) + forAll(lists_, typei) { - deleteDemandDrivenData(lists_[typeI]); + deleteDemandDrivenData(lists_[typei]); } address_.clear(); } @@ -150,21 +134,33 @@ Foam::ensightCells::~ensightCells() Foam::FixedList<Foam::label, 5> Foam::ensightCells::sizes() const { FixedList<label, 5> count; - forAll(lists_, typeI) + forAll(lists_, typei) { - count[typeI] = lists_[typeI]->size(); + count[typei] = lists_[typei]->size(); } return count; } +Foam::label Foam::ensightCells::offset(const enum elemType what) const +{ + label n = 0; + for (label typei = 0; typei < label(what); ++typei) + { + n += lists_[typei]->size(); + } + + return n; +} + + Foam::label Foam::ensightCells::total() const { label n = 0; - forAll(sizes_, typeI) + forAll(sizes_, typei) { - n += sizes_[typeI]; + n += sizes_[typei]; } return n; } @@ -173,25 +169,25 @@ Foam::label Foam::ensightCells::total() const void Foam::ensightCells::clear() { sizes_ = Zero; // reset sizes - resize(); + resizeAll(); } void Foam::ensightCells::reduce() { - forAll(sizes_, typeI) + forAll(sizes_, typei) { - sizes_[typeI] = lists_[typeI]->size(); - Foam::reduce(sizes_[typeI], sumOp<label>()); + sizes_[typei] = lists_[typei]->size(); + Foam::reduce(sizes_[typei], sumOp<label>()); } } void Foam::ensightCells::sort() { - forAll(lists_, typeI) + forAll(lists_, typei) { - Foam::sort(*(lists_[typeI])); + Foam::sort(*(lists_[typei])); } } @@ -217,9 +213,9 @@ void Foam::ensightCells::classify // Can avoid double looping, but only at the expense of allocation sizes_ = Zero; // reset sizes - for (label listI = 0; listI < sz; ++listI) + for (label listi = 0; listi < sz; ++listi) { - const label id = indirect ? addressing[listI] : listI; + const label id = indirect ? addressing[listi] : listi; const cellModel& model = shapes[id].model(); enum elemType what = NFACED; @@ -243,13 +239,13 @@ void Foam::ensightCells::classify sizes_[what]++; } - resize(); // adjust allocation + resizeAll(); // adjust allocation sizes_ = Zero; // reset sizes // Assign cell-id per shape type - for (label listI = 0; listI < sz; ++listI) + for (label listi = 0; listi < sz; ++listi) { - const label id = indirect ? addressing[listI] : listI; + const label id = indirect ? addressing[listi] : listi; const cellModel& model = shapes[id].model(); enum elemType what = NFACED; @@ -276,10 +272,4 @@ void Foam::ensightCells::classify } -Foam::label Foam::ensightCells::offset(const enum elemType what) const -{ - return offset(what, 0); -} - - // ************************************************************************* // diff --git a/src/fileFormats/ensight/part/ensightCells.H b/src/fileFormats/ensight/part/ensightCells.H index a84de2ce9c27ea66951c84932976f079b8e20b42..33bc98a2f4710835ee61e5dba40f3b9107e46f4f 100644 --- a/src/fileFormats/ensight/part/ensightCells.H +++ b/src/fileFormats/ensight/part/ensightCells.H @@ -89,21 +89,19 @@ private: //- Linear list of ids, sub-sectioned per element type via SubLists labelList address_; - //- List of sizes for each element type + //- List of global sizes for each element type. + // Used temporarily for local sizes when building the element lists. FixedList<label, 5> sizes_; - //- List of ids for each element type + //- List of ids for each element type. // Managed via pointers, since a SubList cannot be relocated/resized. FixedList<SubList<label>*, 5> lists_; // Private Member Functions - //- Low-level offset routine - inline label offset(const enum elemType what, const label i) const; - - //- Use current sizes to redimension the element lists - void resize(); + //- Use temporarily stored sizes to redimension the element lists + void resizeAll(); //- Disallow default bitwise assignment void operator=(const ensightCells&) = delete; @@ -126,7 +124,7 @@ public: // Member Functions - // Access + // Access //- The index in a list. inline label index() const; @@ -145,13 +143,15 @@ public: // This value is only meaningful after a reduce operation. label total() const; - //- The processor local sizes per element type. - FixedList<label, 5> sizes() const; - //- The global numbers per element type. // This value is only meaningful after a reduce operation. inline const FixedList<label, 5>& totals() const; + //- The processor local sizes per element type. + FixedList<label, 5> sizes() const; + + //- Processor local starting offset of element type. + label offset(const enum elemType what) const; //- Return the (local) cell ids of the specified element type inline const labelUList& cellIds(const enum elemType) const; @@ -159,9 +159,6 @@ public: //- Return the cell ids of all elements inline const labelUList& cellIds() const; - //- Starting offset of element type. - label offset(const enum elemType what) const; - // Edit diff --git a/src/fileFormats/ensight/part/ensightFaces.C b/src/fileFormats/ensight/part/ensightFaces.C index e8085b1fcbd3c45aa81dea0ae5a14680cfe69bae..65117d3cd60d56a36de7ed381f49d654778f50cc 100644 --- a/src/fileFormats/ensight/part/ensightFaces.C +++ b/src/fileFormats/ensight/part/ensightFaces.C @@ -74,52 +74,36 @@ inline void Foam::ensightFaces::add { const enum elemType what = whatType(f); - label n = sizes_[what]++; - lists_[what]->operator[](n) = id; + // linear addressing: + const label index = offset(what) + sizes_[what]++; + address_[index] = id; if (flipMap_.size()) { - flipMap_[offset(what, n)] = flip; + flipMap_[index] = flip; } } -// only used in this file-scope -inline Foam::label Foam::ensightFaces::offset -( - const enum elemType what, - const label i -) const -{ - label n = i; - for (label typeI = 0; typeI < label(what); ++typeI) - { - n += sizes_[typeI]; - } - - return n; -} - - -void Foam::ensightFaces::resize() +void Foam::ensightFaces::resizeAll() { // overall required size label n = 0; - forAll(sizes_, typeI) + forAll(sizes_, typei) { - n += sizes_[typeI]; + n += sizes_[typei]; } address_.setSize(n, Zero); // assign corresponding sub-lists n = 0; - forAll(sizes_, typeI) + forAll(sizes_, typei) { - deleteDemandDrivenData(lists_[typeI]); + deleteDemandDrivenData(lists_[typei]); - lists_[typeI] = new SubList<label>(address_, sizes_[typeI], n); + lists_[typei] = new SubList<label>(address_, sizes_[typei], n); - n += sizes_[typeI]; + n += sizes_[typei]; } // normally assume no flipMap @@ -138,12 +122,12 @@ Foam::ensightFaces::ensightFaces(label partIndex) lists_() { // Ensure sub-lists are properly initialized to nullptr - forAll(lists_, typeI) + forAll(lists_, typei) { - lists_[typeI] = nullptr; + lists_[typei] = nullptr; } - resize(); // adjust allocation + resizeAll(); // adjust allocation } @@ -156,9 +140,9 @@ Foam::ensightFaces::ensightFaces(const ensightFaces& obj) lists_() { // Ensure sub-lists are properly initialized to nullptr - forAll(lists_, typeI) + forAll(lists_, typei) { - lists_[typeI] = nullptr; + lists_[typei] = nullptr; } // Total (reduced) sizes @@ -167,7 +151,7 @@ Foam::ensightFaces::ensightFaces(const ensightFaces& obj) // Local sizes this->sizes_ = obj.sizes(); - resize(); // adjust allocation + resizeAll(); // adjust allocation // Restore total (reduced) sizes this->sizes_ = totSizes; @@ -178,9 +162,9 @@ Foam::ensightFaces::ensightFaces(const ensightFaces& obj) Foam::ensightFaces::~ensightFaces() { - forAll(lists_, typeI) + forAll(lists_, typei) { - deleteDemandDrivenData(lists_[typeI]); + deleteDemandDrivenData(lists_[typei]); } address_.clear(); flipMap_.clear(); @@ -192,21 +176,33 @@ Foam::ensightFaces::~ensightFaces() Foam::FixedList<Foam::label, 3> Foam::ensightFaces::sizes() const { FixedList<label, 3> count; - forAll(lists_, typeI) + forAll(lists_, typei) { - count[typeI] = lists_[typeI]->size(); + count[typei] = lists_[typei]->size(); } return count; } +Foam::label Foam::ensightFaces::offset(const enum elemType what) const +{ + label n = 0; + for (label typei = 0; typei < label(what); ++typei) + { + n += lists_[typei]->size(); + } + + return n; +} + + Foam::label Foam::ensightFaces::total() const { label n = 0; - forAll(sizes_, typeI) + forAll(sizes_, typei) { - n += sizes_[typeI]; + n += sizes_[typei]; } return n; } @@ -215,16 +211,16 @@ Foam::label Foam::ensightFaces::total() const void Foam::ensightFaces::clear() { sizes_ = Zero; // reset sizes - resize(); + resizeAll(); } void Foam::ensightFaces::reduce() { - forAll(sizes_, typeI) + forAll(sizes_, typei) { - sizes_[typeI] = lists_[typeI]->size(); - Foam::reduce(sizes_[typeI], sumOp<label>()); + sizes_[typei] = lists_[typei]->size(); + Foam::reduce(sizes_[typei], sumOp<label>()); } } @@ -238,9 +234,9 @@ void Foam::ensightFaces::sort() labelList order; label start = 0; - forAll(lists_, typeI) + forAll(lists_, typei) { - SubList<label>& idLst = *(lists_[typeI]); + SubList<label>& idLst = *(lists_[typei]); const label sz = idLst.size(); if (sz) @@ -258,9 +254,9 @@ void Foam::ensightFaces::sort() else { // no flip-maps, simpler to sort - forAll(lists_, typeI) + forAll(lists_, typei) { - Foam::sort(*(lists_[typeI])); + Foam::sort(*(lists_[typei])); } flipMap_.clear(); // for safety } @@ -275,19 +271,19 @@ void Foam::ensightFaces::classify(const faceList& faces) // Can avoid double looping, but only at the expense of allocation sizes_ = Zero; // reset sizes - for (label listI = 0; listI < sz; ++listI) + for (label listi = 0; listi < sz; ++listi) { - const enum elemType what = whatType(faces[listI]); + const enum elemType what = whatType(faces[listi]); sizes_[what]++; } - resize(); // adjust allocation + resizeAll(); // adjust allocation sizes_ = Zero; // reset sizes // Assign face-id per shape type - for (label listI = 0; listI < sz; ++listI) + for (label listi = 0; listi < sz; ++listi) { - add(faces[listI], listI); + add(faces[listi], listi); } } @@ -310,9 +306,9 @@ void Foam::ensightFaces::classify // Can avoid double looping, but only at the expense of allocation sizes_ = Zero; // reset sizes - for (label listI = 0; listI < sz; ++listI) + for (label listi = 0; listi < sz; ++listi) { - const label faceId = addressing[listI]; + const label faceId = addressing[listi]; if (!exclude[faceId]) { @@ -321,7 +317,7 @@ void Foam::ensightFaces::classify } } - resize(); // adjust allocation + resizeAll(); // adjust allocation sizes_ = Zero; // reset sizes if (useFlip) @@ -331,10 +327,10 @@ void Foam::ensightFaces::classify } // Assign face-id per shape type - for (label listI = 0; listI < sz; ++listI) + for (label listi = 0; listi < sz; ++listi) { - const label faceId = addressing[listI]; - const bool flip = useFlip && flipMap[listI]; + const label faceId = addressing[listi]; + const bool flip = useFlip && flipMap[listi]; if (!exclude[faceId]) { @@ -343,11 +339,4 @@ void Foam::ensightFaces::classify } } - -Foam::label Foam::ensightFaces::offset(const enum elemType what) const -{ - return offset(what, 0); -} - - // ************************************************************************* // diff --git a/src/fileFormats/ensight/part/ensightFaces.H b/src/fileFormats/ensight/part/ensightFaces.H index ddce1410d818f55fe4c4893d156155252d935f6d..844a03e9b357f874cb297c0f893958d69bac5c5d 100644 --- a/src/fileFormats/ensight/part/ensightFaces.H +++ b/src/fileFormats/ensight/part/ensightFaces.H @@ -89,7 +89,8 @@ private: //- Linear list of face-flips boolList flipMap_; - //- List of global sizes for each element type + //- List of global sizes for each element type. + // Used temporarily for local sizes when building the element lists. FixedList<label, 3> sizes_; //- SubLists of ids for each element type. @@ -102,14 +103,11 @@ private: //- Simple classifier inline static elemType whatType(const face&); - //- Low-level addition routine + //- Low-level internal addition routine inline void add(const face&, const label id, const bool flip = false); - //- Low-level offset routine - inline label offset(const enum elemType what, const label i) const; - - //- Use current sizes to redimension the element lists - void resize(); + //- Use temporarily stored sizes to redimension the element lists + void resizeAll(); //- Disallow default bitwise assignment void operator=(const ensightFaces&) = delete; @@ -132,76 +130,73 @@ public: // Member Functions - // Access - - //- The index in a list. - inline label index() const; - - //- The index in a list, non-const access. - inline label& index(); - - //- The processor local size of all elements. - inline label size() const; + // Access - //- The global number of the specified element type. - // This value is only meaningful after a reduce operation. - inline label total(const enum elemType) const; + //- The index in a list. + inline label index() const; - //- The global number of all element types. - // This value is only meaningful after a reduce operation. - label total() const; + //- The index in a list, non-const access. + inline label& index(); + //- The processor local size of all elements. + inline label size() const; - //- The processor local sizes per element type. - FixedList<label, 3> sizes() const; + //- The global number of the specified element type. + // This value is only meaningful after a reduce operation. + inline label total(const enum elemType) const; - //- The global numbers per element type. - // This value is only meaningful after a reduce operation. - const FixedList<label, 3>& totals() const; + //- The global number of all element types. + // This value is only meaningful after a reduce operation. + label total() const; + //- The global numbers per element type. + // This value is only meaningful after a reduce operation. + inline const FixedList<label, 3>& totals() const; - //- Return the (local) face ids of the specified element type - inline const labelUList& faceIds(const enum elemType) const; + //- The processor local sizes per element type. + FixedList<label, 3> sizes() const; - //- Return the face ids of all elements - inline const labelUList& faceIds() const; + //- Processor local starting offset of element type. + label offset(const enum elemType what) const; - //- Return the flip-map of all elements - inline const boolList& flipMap() const; + //- Return the (local) face ids of the specified element type + inline const labelUList& faceIds(const enum elemType) const; + //- Return the processor local face ids of all elements + inline const labelUList& faceIds() const; - //- Starting offset of element type. - label offset(const enum elemType what) const; + //- Return the processor local flip-map of all elements + inline const boolList& flipMap() const; - // Edit + // Edit - //- Classify the face types, set element list. - void classify(const faceList& faces); + //- Classify the face types, set element list. + void classify(const faceList& faces); - //- Classify the face types, set element list. - // The indirect addressing can be used when classifying groups of - // face (eg, from a faceZone etc) with an optional flipMap. - // The optional exclude marker can be used to skip faces on particular - // boundary types or regions. - void classify - ( - const faceList& faces, - const labelUList& addressing, - const boolList& flipMap = boolList(), - const PackedBoolList& exclude = PackedBoolList() - ); + //- Classify the face types, set element list. + // The indirect addressing can be used when classifying groups of + // face (eg, from a faceZone etc) with an optional flipMap. + // The optional exclude marker can be used to skip faces on particular + // boundary types or regions. + void classify + ( + const faceList& faces, + const labelUList& addressing, + const boolList& flipMap = boolList(), + const PackedBoolList& exclude = PackedBoolList() + ); - //- Set addressable sizes to zero, free up addressing memory. - void clear(); + //- Set addressable sizes to zero, free up addressing memory. + void clear(); - //- Sum element counts across all processes. - void reduce(); + //- Sum element counts across all processes. + void reduce(); - //- Sort element lists numerically. - void sort(); + //- Sort element lists numerically. + void sort(); // Member operators diff --git a/src/functionObjects/field/fieldValues/surfaceFieldValue/surfaceFieldValue.C b/src/functionObjects/field/fieldValues/surfaceFieldValue/surfaceFieldValue.C index 446a6440447d213eb9f1234ab6dc54421beeb611..baa86b3157bfb865a6dbd3548f50e139653d219d 100644 --- a/src/functionObjects/field/fieldValues/surfaceFieldValue/surfaceFieldValue.C +++ b/src/functionObjects/field/fieldValues/surfaceFieldValue/surfaceFieldValue.C @@ -64,7 +64,7 @@ template<> const char* Foam::NamedEnum < Foam::functionObjects::fieldValues::surfaceFieldValue::operationType, - 15 + 16 >::names[] = { "none", @@ -77,6 +77,7 @@ const char* Foam::NamedEnum "areaAverage", "weightedAreaAverage", "areaIntegrate", + "weightedAreaIntegrate", "min", "max", "CoV", @@ -93,7 +94,7 @@ const Foam::NamedEnum const Foam::NamedEnum < Foam::functionObjects::fieldValues::surfaceFieldValue::operationType, - 15 + 16 > Foam::functionObjects::fieldValues::surfaceFieldValue::operationTypeNames_; diff --git a/src/functionObjects/field/fieldValues/surfaceFieldValue/surfaceFieldValue.H b/src/functionObjects/field/fieldValues/surfaceFieldValue/surfaceFieldValue.H index b34a9b6544f21aafa7522fc473ef76fe824b340b..8f39f204c4a3c41a02f9eacd1819bb671b45d833 100644 --- a/src/functionObjects/field/fieldValues/surfaceFieldValue/surfaceFieldValue.H +++ b/src/functionObjects/field/fieldValues/surfaceFieldValue/surfaceFieldValue.H @@ -109,14 +109,15 @@ Usage sumDirectionBalance | sum of balance of values in given direction average | ensemble average weightedAverage | weighted average - areaAverage | area weighted average + areaAverage | area-weighted average weightedAreaAverage | weighted area average areaIntegrate | area integral + weightedAreaIntegrate | weighted area integral min | minimum max | maximum CoV | coefficient of variation: standard deviation/mean - areaNormalAverage| area weighted average in face normal direction - areaNormalIntegrate | area weighted integral in face normal directon + areaNormalAverage| area-weighted average in face normal direction + areaNormalIntegrate | area-weighted integral in face normal directon \endplaintable Note @@ -210,6 +211,7 @@ public: opAreaAverage, //!< Area average opWeightedAreaAverage, //!< Weighted area average opAreaIntegrate, //!< Area integral + opWeightedAreaIntegrate, //!< Weighted area integral opMin, //!< Minimum opMax, //!< Maximum opCoV, //!< Coefficient of variation @@ -218,7 +220,7 @@ public: }; //- Operation type names - static const NamedEnum<operationType, 15> operationTypeNames_; + static const NamedEnum<operationType, 16> operationTypeNames_; private: diff --git a/src/functionObjects/field/fieldValues/surfaceFieldValue/surfaceFieldValueTemplates.C b/src/functionObjects/field/fieldValues/surfaceFieldValue/surfaceFieldValueTemplates.C index 5272714d95781c3a10710c061248aafafd0b44bc..5c76bc055bd525d8b892d567be5aed94bd697b4e 100644 --- a/src/functionObjects/field/fieldValues/surfaceFieldValue/surfaceFieldValueTemplates.C +++ b/src/functionObjects/field/fieldValues/surfaceFieldValue/surfaceFieldValueTemplates.C @@ -176,10 +176,9 @@ processSameTypeValues } case opWeightedAverage: { - label wSize = returnReduce(weightField.size(), sumOp<label>()); - - if (wSize > 0) + if (returnReduce(weightField.size(), sumOp<label>())) { + // has weights result = gSum(weightField*values)/(gSum(weightField) + ROOTVSMALL); } @@ -192,31 +191,40 @@ processSameTypeValues } case opAreaAverage: { - const scalarField magSf(mag(Sf)); + const scalarField factor(mag(Sf)); - result = gSum(magSf*values)/gSum(magSf); + result = gSum(factor*values)/gSum(factor); break; } case opWeightedAreaAverage: { - const scalarField magSf(mag(Sf)); - label wSize = returnReduce(weightField.size(), sumOp<label>()); - - if (wSize > 0) - { - result = gSum(weightField*magSf*values)/gSum(magSf*weightField); - } - else - { - result = gSum(magSf*values)/gSum(magSf); - } + const scalarField factor + ( + returnReduce(weightField.size(), sumOp<label>()) // has weights + ? weightField*mag(Sf) + : mag(Sf) + ); + + result = gSum(factor*values)/gSum(factor); break; } case opAreaIntegrate: { - const scalarField magSf(mag(Sf)); + const scalarField factor(mag(Sf)); - result = gSum(magSf*values); + result = gSum(factor*values); + break; + } + case opWeightedAreaIntegrate: + { + const scalarField factor + ( + returnReduce(weightField.size(), sumOp<label>()) // has weights + ? weightField*mag(Sf) + : mag(Sf) + ); + + result = gSum(factor*values); break; } case opMin: diff --git a/src/renumber/Allwmake b/src/renumber/Allwmake index 66d9bfd5366c8f66e74b55adda50298aafeaf50e..b76410a6a785aa8e7cda37ea66440f6c21100325 100755 --- a/src/renumber/Allwmake +++ b/src/renumber/Allwmake @@ -16,8 +16,6 @@ targetType=libso # echo #fi -set -x - wmake $targetType renumberMethods if [ -f "$BOOST_ARCH_PATH/include/boost/version.hpp" ] || \ diff --git a/src/sampling/sampledSurface/sampledSurfaces/sampledSurfaces.C b/src/sampling/sampledSurface/sampledSurfaces/sampledSurfaces.C index f15c61b36315f0d3bd89dcdb14334c7bbc6d7e70..39568568524f490ea0922ba49771d3358b106d4d 100644 --- a/src/sampling/sampledSurface/sampledSurfaces/sampledSurfaces.C +++ b/src/sampling/sampledSurface/sampledSurfaces/sampledSurfaces.C @@ -31,6 +31,7 @@ License #include "volPointInterpolation.H" #include "PatchTools.H" #include "mapPolyMesh.H" +#include "sampledTriSurfaceMesh.H" #include "addToRunTimeSelectionTable.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // @@ -84,6 +85,37 @@ void Foam::sampledSurfaces::writeGeometry() const } +void Foam::sampledSurfaces::writeOriginalIds() +{ + const word fieldName = "Ids"; + const fileName outputDir = outputPath_/time_.timeName(); + + forAll(*this, surfI) + { + const sampledSurface& s = operator[](surfI); + + if (isA<sampledTriSurfaceMesh>(s)) + { + const sampledTriSurfaceMesh& surf = + dynamicCast<const sampledTriSurfaceMesh&>(s); + + if (surf.keepIds()) + { + const labelList& idLst = surf.originalIds(); + + Field<scalar> ids(idLst.size()); + forAll(idLst, i) + { + ids[i] = idLst[i]; + } + + writeSurface(ids, surfI, fieldName, outputDir); + } + } + } +} + + // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // Foam::sampledSurfaces::sampledSurfaces diff --git a/src/sampling/sampledSurface/sampledSurfaces/sampledSurfaces.H b/src/sampling/sampledSurface/sampledSurfaces/sampledSurfaces.H index 1d9c9e730b91a668999fa9b5292804f22c0d2128..8d610dbb5921504452b1c3076d480a98073a1fd6 100644 --- a/src/sampling/sampledSurface/sampledSurfaces/sampledSurfaces.H +++ b/src/sampling/sampledSurface/sampledSurfaces/sampledSurfaces.H @@ -116,6 +116,9 @@ class sampledSurfaces //- Write geometry only void writeGeometry() const; + //- Write scalar field with original ids + void writeOriginalIds(); + //- Write sampled fieldName on surface and on outputDir path template<class Type> void writeSurface diff --git a/src/sampling/sampledSurface/sampledSurfaces/sampledSurfacesGrouping.C b/src/sampling/sampledSurface/sampledSurfaces/sampledSurfacesGrouping.C index 4e25d84af06d86b2f616e092d5afd9451760c021..143837a4eb3294936e916089e57103e155b95bd8 100644 --- a/src/sampling/sampledSurface/sampledSurfaces/sampledSurfacesGrouping.C +++ b/src/sampling/sampledSurface/sampledSurfaces/sampledSurfacesGrouping.C @@ -60,7 +60,6 @@ Foam::label Foam::sampledSurfaces::classifyFields() { // Check currently available fields wordList allFields = obr_.sortedNames(); - labelList indices = findStrings(fieldSelection_, allFields); forAll(fieldSelection_, i) { diff --git a/src/sampling/sampledSurface/sampledSurfaces/sampledSurfacesTemplates.C b/src/sampling/sampledSurface/sampledSurfaces/sampledSurfacesTemplates.C index ba39848aad2bd0d809c3e56b2d0a0e615f43b679..0dd8c248efdff0e0c493171f84d401da54d5e406 100644 --- a/src/sampling/sampledSurface/sampledSurfaces/sampledSurfacesTemplates.C +++ b/src/sampling/sampledSurface/sampledSurfaces/sampledSurfacesTemplates.C @@ -49,9 +49,7 @@ void Foam::sampledSurfaces::writeSurface gatheredValues[Pstream::myProcNo()] = values; Pstream::gatherList(gatheredValues); - fileName sampleFile; - if (Pstream::master()) { // Combine values into single field @@ -181,24 +179,21 @@ void Foam::sampledSurfaces::sampleAndWrite template<class GeoField> void Foam::sampledSurfaces::sampleAndWrite(const IOobjectList& objects) { - wordList names; + wordList fieldNames; if (loadFromFiles_) { - IOobjectList fieldObjects(objects.lookupClass(GeoField::typeName)); - names = fieldObjects.names(); + fieldNames = objects.sortedNames(GeoField::typeName, fieldSelection_); } else { - names = mesh_.thisDb().names<GeoField>(); - } + fieldNames = mesh_.thisDb().sortedNames<GeoField>(fieldSelection_); - labelList nameIDs(findStrings(fieldSelection_, names)); - - wordHashSet fieldNames(wordList(names, nameIDs)); + writeOriginalIds(); + } - forAllConstIter(wordHashSet, fieldNames, iter) + forAll(fieldNames, fieldi) { - const word& fieldName = iter.key(); + const word& fieldName = fieldNames[fieldi]; if ((Pstream::master()) && verbose_) { diff --git a/src/sampling/sampledSurface/sampledTriSurfaceMesh/sampledTriSurfaceMesh.C b/src/sampling/sampledSurface/sampledTriSurfaceMesh/sampledTriSurfaceMesh.C index c1c08006d4542c0dc3caf1f5e41d78bb9d23f851..38fdc7c748f8d86602db4f299e1cb7c80fb1cc28 100644 --- a/src/sampling/sampledSurface/sampledTriSurfaceMesh/sampledTriSurfaceMesh.C +++ b/src/sampling/sampledSurface/sampledTriSurfaceMesh/sampledTriSurfaceMesh.C @@ -296,6 +296,11 @@ bool Foam::sampledTriSurfaceMesh::update(const meshSearch& meshSearcher) } + if (keepIds_) + { + originalIds_ = faceMap; + } + // Subset cellOrFaceLabels cellOrFaceLabels = UIndirectList<label>(cellOrFaceLabels, faceMap)(); @@ -545,6 +550,8 @@ Foam::sampledTriSurfaceMesh::sampledTriSurfaceMesh ), sampleSource_(sampleSource), needsUpdate_(true), + keepIds_(false), + originalIds_(), sampleElements_(0), samplePoints_(0) {} @@ -573,6 +580,8 @@ Foam::sampledTriSurfaceMesh::sampledTriSurfaceMesh ), sampleSource_(samplingSourceNames_[dict.lookup("source")]), needsUpdate_(true), + keepIds_(dict.lookupOrDefault<Switch>("keepIds", false)), + originalIds_(), sampleElements_(0), samplePoints_(0) {} @@ -594,7 +603,7 @@ Foam::sampledTriSurfaceMesh::sampledTriSurfaceMesh name, mesh.time().constant(), // instance "triSurface", // local - mesh, // registry + mesh, // registry IOobject::NO_READ, IOobject::NO_WRITE, false @@ -603,6 +612,8 @@ Foam::sampledTriSurfaceMesh::sampledTriSurfaceMesh ), sampleSource_(samplingSourceNames_[sampleSourceName]), needsUpdate_(true), + keepIds_(false), + originalIds_(), sampleElements_(0), samplePoints_(0) {} @@ -633,6 +644,7 @@ bool Foam::sampledTriSurfaceMesh::expire() sampledSurface::clearGeom(); MeshStorage::clear(); + originalIds_.clear(); boundaryTreePtr_.clear(); sampleElements_.clear(); samplePoints_.clear(); diff --git a/src/sampling/sampledSurface/sampledTriSurfaceMesh/sampledTriSurfaceMesh.H b/src/sampling/sampledSurface/sampledTriSurfaceMesh/sampledTriSurfaceMesh.H index 7403bfc65e24a4888b7b1fb18282646e3d1d4b3d..6cd96a4770c0c49e8c19a7a871016fd3c6792e47 100644 --- a/src/sampling/sampledSurface/sampledTriSurfaceMesh/sampledTriSurfaceMesh.H +++ b/src/sampling/sampledSurface/sampledTriSurfaceMesh/sampledTriSurfaceMesh.H @@ -117,6 +117,13 @@ private: //- Track if the surface needs an update mutable bool needsUpdate_; + //- Retain element ids/order of original surface + bool keepIds_; + + //- List of element ids/order of the original surface, + // when keepIds is active. + labelList originalIds_; + //- Search tree for all non-coupled boundary faces mutable autoPtr<indexedOctree<treeDataFace>> boundaryTreePtr_; @@ -240,6 +247,19 @@ public: return MeshStorage::Cf(); } + //- If element ids/order of the original surface are kept + bool keepIds() const + { + return keepIds_; + } + + //- List of element ids/order of the original surface, + // when keepIds is active. + const labelList& originalIds() const + { + return originalIds_; + } + //- Sample field on surface virtual tmp<scalarField> sample diff --git a/tutorials/basic/potentialFoam/pitzDaily/Allrun b/tutorials/basic/potentialFoam/pitzDaily/Allrun index 2c9adcb14b53b9a3e33da88eb6d239d2422edda9..b4667497e463182f3b51997d62610e2ab32993a1 100755 --- a/tutorials/basic/potentialFoam/pitzDaily/Allrun +++ b/tutorials/basic/potentialFoam/pitzDaily/Allrun @@ -7,6 +7,6 @@ cd ${0%/*} || exit 1 # Run from this directory restore0Dir runApplication blockMesh runApplication $(getApplication) -writePhi -writep -runApplication streamFunction +runApplication postProcess -func streamFunction #------------------------------------------------------------------------------ diff --git a/tutorials/combustion/XiDyMFoam/annularCombustorTurbine/constant/dynamicMeshDict b/tutorials/combustion/XiDyMFoam/annularCombustorTurbine/constant/dynamicMeshDict index ea9757bb617222237add2a82f8f4d7e915202b64..5d93972d0be6372e6fb27a9649b8d46b6a3ae682 100644 --- a/tutorials/combustion/XiDyMFoam/annularCombustorTurbine/constant/dynamicMeshDict +++ b/tutorials/combustion/XiDyMFoam/annularCombustorTurbine/constant/dynamicMeshDict @@ -15,11 +15,11 @@ FoamFile } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -dynamicFvMesh solidBodyMotionFvMesh; +dynamicFvMesh dynamicMotionSolverFvMesh; -motionSolverLibs ( "libfvMotionSolvers.so" ); +solver solidBody; -solidBodyMotionFvMeshCoeffs +solidBodyCoeffs { cellZone rotating; diff --git a/tutorials/compressible/rhoPimpleFoam/RAS/TJunction/0/T b/tutorials/compressible/rhoPimpleFoam/RAS/TJunction/0/T index 1caf3dd1cc728c1c57e5bc452f021cfd8fb3d4d7..1a28e71f552bf3ceaf9f02540b1cba242086be3c 100644 --- a/tutorials/compressible/rhoPimpleFoam/RAS/TJunction/0/T +++ b/tutorials/compressible/rhoPimpleFoam/RAS/TJunction/0/T @@ -24,7 +24,7 @@ boundaryField inlet { type outletMappedUniformInletHeatAddition; - outletPatchName outlet1; + outletPatch outlet1; Q 5; // Heat addition in W TMin 300; TMax 500; diff --git a/tutorials/incompressible/pimpleDyMFoam/oscillatingInletPeriodicAMI2D/constant/dynamicMeshDict b/tutorials/incompressible/pimpleDyMFoam/oscillatingInletPeriodicAMI2D/constant/dynamicMeshDict index 8e7f72b360e6f8ff304094a71408adac8cdbc86c..371ee2c7bfd4787beca44aa646ee835e000b24e5 100644 --- a/tutorials/incompressible/pimpleDyMFoam/oscillatingInletPeriodicAMI2D/constant/dynamicMeshDict +++ b/tutorials/incompressible/pimpleDyMFoam/oscillatingInletPeriodicAMI2D/constant/dynamicMeshDict @@ -15,15 +15,15 @@ FoamFile } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -dynamicFvMesh solidBodyMotionFvMesh; +dynamicFvMesh dynamicMotionSolverFvMesh; -motionSolverLibs ( "libfvMotionSolvers.so" ); +solver solidBody; -solidBodyMotionFvMeshCoeffs +solidBodyCoeffs { cellZone inletChannel; - solidBodyMotionFunction oscillatingLinearMotion; + solidBodyMotionFunction oscillatingLinearMotion; oscillatingLinearMotionCoeffs {