diff --git a/src/faOptions/corrections/limitVelocity/limitVelocity.H b/src/faOptions/corrections/limitVelocity/limitVelocity.H index e5da8a400a..c4abb1c8d5 100644 --- a/src/faOptions/corrections/limitVelocity/limitVelocity.H +++ b/src/faOptions/corrections/limitVelocity/limitVelocity.H @@ -65,8 +65,8 @@ SourceFiles \*---------------------------------------------------------------------------*/ -#ifndef limitVelocity_H -#define limitVelocity_H +#ifndef Foam_fa_limitVelocity_H +#define Foam_fa_limitVelocity_H #include "faceSetOption.H" @@ -83,7 +83,7 @@ namespace fa class limitVelocity : - public faceSetOption + public fa::faceSetOption { protected: @@ -96,17 +96,6 @@ protected: scalar max_; -private: - - // Private Member Functions - - //- No copy construct - limitVelocity(const limitVelocity&) = delete; - - //- No copy assignment - void operator=(const limitVelocity&) = delete; - - public: //- Runtime type information @@ -124,6 +113,12 @@ public: const fvPatch& patch ); + //- No copy construct + limitVelocity(const limitVelocity&) = delete; + + //- No copy assignment + void operator=(const limitVelocity&) = delete; + //- Destructor virtual ~limitVelocity() = default; diff --git a/src/faOptions/faOption/faOptions.C b/src/faOptions/faOption/faOptions.C index a97e165597..7c2401be57 100644 --- a/src/faOptions/faOption/faOptions.C +++ b/src/faOptions/faOption/faOptions.C @@ -103,26 +103,19 @@ Foam::fa::options& Foam::fa::options::New(const fvPatch& p) { const fvMesh& mesh = p.boundaryMesh().mesh(); - if (mesh.thisDb().foundObject(typeName)) - { - return const_cast - ( - mesh.lookupObject(typeName) - ); - } - else - { - if (debug) - { - InfoInFunction - << "Constructing " << typeName - << " for region " << mesh.name() << endl; - } + options* ptr = mesh.thisDb().getObjectPtr(typeName); - options* objectPtr = new options(p); - regIOobject::store(objectPtr); - return *objectPtr; + if (!ptr) + { + DebugInFunction + << "Constructing " << typeName + << " for region " << mesh.name() << endl; + + ptr = new options(p); + regIOobject::store(ptr); } + + return *ptr; } @@ -133,10 +126,8 @@ bool Foam::fa::options::read() optionList::read(*this); return true; } - else - { - return false; - } + + return false; } diff --git a/src/faOptions/faOption/faOptions.H b/src/faOptions/faOption/faOptions.H index a80969885c..165c340164 100644 --- a/src/faOptions/faOption/faOptions.H +++ b/src/faOptions/faOption/faOptions.H @@ -86,8 +86,7 @@ public: //- Destructor - virtual ~options() - {} + virtual ~options() = default; // Member Functions diff --git a/src/faOptions/faceSetOption/faceSetOption.C b/src/faOptions/faceSetOption/faceSetOption.C index aa33a78507..c28d589ed5 100644 --- a/src/faOptions/faceSetOption/faceSetOption.C +++ b/src/faOptions/faceSetOption/faceSetOption.C @@ -26,6 +26,7 @@ License \*---------------------------------------------------------------------------*/ #include "faceSetOption.H" +#include "faceSet.H" #include "areaFields.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // @@ -46,7 +47,10 @@ const Foam::Enum Foam::fa::faceSetOption::selectionModeTypeNames_ ({ { selectionModeType::smAll, "all" }, - { selectionModeType::smVolFaceZone, "volFaceZone" } + { selectionModeType::smFaceSet, "faceSet" }, + { selectionModeType::smFaceZone, "faceZone" }, + { selectionModeType::smPatch, "patch" }, + { selectionModeType::smFaceZone, "volFaceZone" } // Compat? }); @@ -54,15 +58,44 @@ Foam::fa::faceSetOption::selectionModeTypeNames_ void Foam::fa::faceSetOption::setSelection(const dictionary& dict) { + selectionNames_.clear(); + switch (selectionMode_) { case smAll: { break; } - case smVolFaceZone: + case smFaceSet: { - dict.readEntry("faceZone", zoneName_); + selectionNames_.resize(1); + dict.readEntry("faceSet", selectionNames_.first()); + break; + } + case smFaceZone: + { + if + ( + !dict.readIfPresent("faceZones", selectionNames_) + || selectionNames_.empty() + ) + { + selectionNames_.resize(1); + dict.readEntry("faceZone", selectionNames_.first()); + } + break; + } + case smPatch: + { + if + ( + !dict.readIfPresent("patches", selectionNames_) + || selectionNames_.empty() + ) + { + selectionNames_.resize(1); + dict.readEntry("patch", selectionNames_.first()); + } break; } default: @@ -82,21 +115,22 @@ void Foam::fa::faceSetOption::setArea() { // Set area information - scalar sumArea = 0.0; + scalar sumArea = 0; for (const label facei : faces_) { sumArea += regionMesh().S()[facei]; } reduce(sumArea, sumOp()); - const scalar AOld = A_; + const scalar old(A_); A_ = sumArea; - // Convert both areas to representation using current writeprecision - word AOldName(Time::timeName(AOld, IOstream::defaultPrecision())); - word AName(Time::timeName(A_, IOstream::defaultPrecision())); - - if (AName != AOldName) + // Compare area values, stringified using current write precision + if + ( + Time::timeName(old, IOstream::defaultPrecision()) + != Time::timeName(A_, IOstream::defaultPrecision()) + ) { Info<< indent << "- selected " << returnReduce(faces_.size(), sumOp