diff --git a/etc/caseDicts/postProcessing/README b/etc/caseDicts/postProcessing/README index 2759598c0..eb82ed277 100644 --- a/etc/caseDicts/postProcessing/README +++ b/etc/caseDicts/postProcessing/README @@ -49,4 +49,4 @@ Current tools - scalarTransport for plugin scalar transport calculations - visualization post-processing VTK files for cutting planes, streamlines,... -- faceSource configuration for some of the tools above +- surfaceRegion configuration for some of the tools above diff --git a/etc/caseDicts/postProcessing/flowRate/volFlowRateSurface.cfg b/etc/caseDicts/postProcessing/flowRate/volFlowRateSurface.cfg index f0c76cb49..1a0f98722 100644 --- a/etc/caseDicts/postProcessing/flowRate/volFlowRateSurface.cfg +++ b/etc/caseDicts/postProcessing/flowRate/volFlowRateSurface.cfg @@ -6,7 +6,7 @@ | \\/ M anipulation | | \*---------------------------------------------------------------------------*/ -#includeEtc "caseDicts/postProcessing/flowRate/surfaceSource.cfg" +#includeEtc "caseDicts/postProcessing/flowRate/sursurfaceRegion.cfg" fields (U); operation areaNormalIntegrate; diff --git a/etc/caseDicts/postProcessing/minMax/cellMinMax.cfg b/etc/caseDicts/postProcessing/minMax/cellMinMax.cfg index 3b0d0aa24..383fe224d 100644 --- a/etc/caseDicts/postProcessing/minMax/cellMinMax.cfg +++ b/etc/caseDicts/postProcessing/minMax/cellMinMax.cfg @@ -6,7 +6,7 @@ | \\/ M anipulation | | \*---------------------------------------------------------------------------*/ -type cellSource; +type volRegion; libs ("libfieldFunctionObjects.so"); writeControl timeStep; @@ -15,7 +15,7 @@ writeInterval 1; writeFields false; log false; -source all; +regionType all; operation max; // ************************************************************************* // diff --git a/etc/caseDicts/postProcessing/minMax/faceMinMax.cfg b/etc/caseDicts/postProcessing/minMax/faceMinMax.cfg index 2acdf0a30..56305b4dd 100644 --- a/etc/caseDicts/postProcessing/minMax/faceMinMax.cfg +++ b/etc/caseDicts/postProcessing/minMax/faceMinMax.cfg @@ -6,7 +6,7 @@ | \\/ M anipulation | | \*---------------------------------------------------------------------------*/ -type faceSource; +type surfaceRegion; libs ("libfieldFunctionObjects.so"); writeControl timeStep; @@ -15,7 +15,7 @@ writeInterval 1; writeFields false; log false; -source all; +regionType all; operation max; // ************************************************************************* // diff --git a/etc/caseDicts/postProcessing/pressure/pressureDifference.cfg b/etc/caseDicts/postProcessing/pressure/pressureDifference.cfg index 9636eac4d..7b8f3588c 100644 --- a/etc/caseDicts/postProcessing/pressure/pressureDifference.cfg +++ b/etc/caseDicts/postProcessing/pressure/pressureDifference.cfg @@ -17,13 +17,13 @@ log false; source1 { - #includeEtc "caseDicts/postProcessing/faceSource/faceSource.cfg" + #includeEtc "caseDicts/postProcessing/surfaceRegion/surfaceRegion.cfg" operation areaAverage; fields (p); } source2 { - #includeEtc "caseDicts/postProcessing/faceSource/faceSource.cfg" + #includeEtc "caseDicts/postProcessing/surfaceRegion/surfaceRegion.cfg" operation areaAverage; fields (p); } diff --git a/etc/caseDicts/postProcessing/pressure/pressureDifferencePatch.cfg b/etc/caseDicts/postProcessing/pressure/pressureDifferencePatch.cfg index 01a239236..4775eb803 100644 --- a/etc/caseDicts/postProcessing/pressure/pressureDifferencePatch.cfg +++ b/etc/caseDicts/postProcessing/pressure/pressureDifferencePatch.cfg @@ -10,13 +10,13 @@ source1 { - source patch; - sourceName $patch1; + regionType patch; + name $patch1; } source2 { - source patch; - sourceName $patch2; + regionType patch; + name $patch2; } // ************************************************************************* // diff --git a/etc/caseDicts/postProcessing/pressure/pressureDifferenceSurface.cfg b/etc/caseDicts/postProcessing/pressure/pressureDifferenceSurface.cfg index c1df7cff5..e42e167d0 100644 --- a/etc/caseDicts/postProcessing/pressure/pressureDifferenceSurface.cfg +++ b/etc/caseDicts/postProcessing/pressure/pressureDifferenceSurface.cfg @@ -10,12 +10,12 @@ source1 { - source sampledSurface; + regionType sampledSurface; sampledSurfaceDict { type sampledTriSurfaceMesh; - source cells; + regionType cells; interpolate true; surface $triSurface1; } diff --git a/etc/caseDicts/postProcessing/faceSource/faceZoneSource.cfg b/etc/caseDicts/postProcessing/surfaceRegion/faceZone.cfg similarity index 87% rename from etc/caseDicts/postProcessing/faceSource/faceZoneSource.cfg rename to etc/caseDicts/postProcessing/surfaceRegion/faceZone.cfg index b63c882f0..5f5e55366 100644 --- a/etc/caseDicts/postProcessing/faceSource/faceZoneSource.cfg +++ b/etc/caseDicts/postProcessing/surfaceRegion/faceZone.cfg @@ -6,8 +6,8 @@ | \\/ M anipulation | | \*---------------------------------------------------------------------------*/ -#includeEtc "caseDicts/postProcessing/faceSource/faceSource.cfg" +#includeEtc "caseDicts/postProcessing/surfaceRegion/surfaceRegion.cfg" -source faceZone; +regionType faceZone; // ************************************************************************* // diff --git a/etc/caseDicts/postProcessing/faceSource/patchSource.cfg b/etc/caseDicts/postProcessing/surfaceRegion/patch.cfg similarity index 85% rename from etc/caseDicts/postProcessing/faceSource/patchSource.cfg rename to etc/caseDicts/postProcessing/surfaceRegion/patch.cfg index d5bd7fd1a..ad4d31f77 100644 --- a/etc/caseDicts/postProcessing/faceSource/patchSource.cfg +++ b/etc/caseDicts/postProcessing/surfaceRegion/patch.cfg @@ -6,9 +6,9 @@ | \\/ M anipulation | | \*---------------------------------------------------------------------------*/ -#includeEtc "caseDicts/postProcessing/faceSource/faceSource.cfg" +#includeEtc "caseDicts/postProcessing/surfaceRegion/surfaceRegion.cfg" -source patch; -sourceName $patch; +regionType patch; +name $patch; // ************************************************************************* // diff --git a/etc/caseDicts/postProcessing/faceSource/patchAverage b/etc/caseDicts/postProcessing/surfaceRegion/patchAverage similarity index 91% rename from etc/caseDicts/postProcessing/faceSource/patchAverage rename to etc/caseDicts/postProcessing/surfaceRegion/patchAverage index bb573da7c..8f042fa96 100644 --- a/etc/caseDicts/postProcessing/faceSource/patchAverage +++ b/etc/caseDicts/postProcessing/surfaceRegion/patchAverage @@ -16,7 +16,7 @@ patchAverage fields (); operation average; - #includeEtc "caseDicts/postProcessing/faceSource/patchSource.cfg" + #includeEtc "caseDicts/postProcessing/surfaceRegion/patch.cfg" log true; } diff --git a/etc/caseDicts/postProcessing/faceSource/patchIntegrate b/etc/caseDicts/postProcessing/surfaceRegion/patchIntegrate similarity index 91% rename from etc/caseDicts/postProcessing/faceSource/patchIntegrate rename to etc/caseDicts/postProcessing/surfaceRegion/patchIntegrate index 6e4dcea05..1c86de232 100644 --- a/etc/caseDicts/postProcessing/faceSource/patchIntegrate +++ b/etc/caseDicts/postProcessing/surfaceRegion/patchIntegrate @@ -16,7 +16,7 @@ patchIntegrate fields (); operation areaIntegrate; - #includeEtc "caseDicts/postProcessing/faceSource/patchSource.cfg" + #includeEtc "caseDicts/postProcessing/surfaceRegion/patch.cfg" log true; } diff --git a/etc/caseDicts/postProcessing/faceSource/faceSource.cfg b/etc/caseDicts/postProcessing/surfaceRegion/surfaceRegion.cfg similarity index 96% rename from etc/caseDicts/postProcessing/faceSource/faceSource.cfg rename to etc/caseDicts/postProcessing/surfaceRegion/surfaceRegion.cfg index 3ee20ae0a..32814fa20 100644 --- a/etc/caseDicts/postProcessing/faceSource/faceSource.cfg +++ b/etc/caseDicts/postProcessing/surfaceRegion/surfaceRegion.cfg @@ -6,7 +6,7 @@ | \\/ M anipulation | | \*---------------------------------------------------------------------------*/ -type faceSource; +type surfaceRegion; libs ("libfieldFunctionObjects.so"); writeControl timeStep; diff --git a/etc/caseDicts/postProcessing/faceSource/surfaceSource.cfg b/etc/caseDicts/postProcessing/surfaceRegion/triSurfaceRegion.cfg similarity index 88% rename from etc/caseDicts/postProcessing/faceSource/surfaceSource.cfg rename to etc/caseDicts/postProcessing/surfaceRegion/triSurfaceRegion.cfg index 4bcbde878..3c608ed1a 100644 --- a/etc/caseDicts/postProcessing/faceSource/surfaceSource.cfg +++ b/etc/caseDicts/postProcessing/surfaceRegion/triSurfaceRegion.cfg @@ -6,9 +6,9 @@ | \\/ M anipulation | | \*---------------------------------------------------------------------------*/ -#includeEtc "caseDicts/postProcessing/faceSource/faceSource.cfg" +#includeEtc "caseDicts/postProcessing/surfaceRegion/surfaceRegion.cfg" -source sampledSurface; +regionType sampledSurface; sampledSurfaceDict { diff --git a/src/functionObjects/field/Make/files b/src/functionObjects/field/Make/files index 3b447f031..c0c5827b3 100644 --- a/src/functionObjects/field/Make/files +++ b/src/functionObjects/field/Make/files @@ -8,8 +8,8 @@ fieldMinMax/fieldMinMax.C fieldValues/fieldValue/fieldValue.C fieldValues/fieldValue/fieldValueNew.C fieldValues/fieldValueDelta/fieldValueDelta.C -fieldValues/cellSource/cellSource.C -fieldValues/faceSource/faceSource.C +fieldValues/volRegion/volRegion.C +fieldValues/surfaceRegion/surfaceRegion.C nearWallFields/nearWallFields.C nearWallFields/findCellParticle.C diff --git a/src/functionObjects/field/fieldValues/controlDict b/src/functionObjects/field/fieldValues/controlDict index 7b2581c19..f21f2d325 100644 --- a/src/functionObjects/field/fieldValues/controlDict +++ b/src/functionObjects/field/fieldValues/controlDict @@ -48,7 +48,7 @@ functions { faceObj1 { - type faceSource; + type surfaceRegion; libs ("libfieldFunctionObjects.so"); enabled true; @@ -64,7 +64,7 @@ functions source patch; // if patch or faceZone: name of patch or faceZone - sourceName movingWall; + name movingWall; //// if sampledSurface: dictionary with a sampledSurface //// Note: will not sample surface fields. @@ -90,14 +90,14 @@ functions faceObj2 { - type faceSource; + type surfaceRegion; libs ("libfieldFunctionObjects.so"); enabled true; writeControl writeTime; log true; writeFields true; source faceZone; - sourceName f0; + name f0; operation sum; fields @@ -108,14 +108,14 @@ functions cellObj1 { - type cellSource; + type volRegion; libs ("libfieldFunctionObjects.so"); enabled true; writeControl writeTime; log true; writeFields true; source cellZone; - sourceName c0; + name c0; operation volAverage; fields diff --git a/src/functionObjects/field/fieldValues/fieldValue/fieldValue.C b/src/functionObjects/field/fieldValues/fieldValue/fieldValue.C index 9bb22503c..4127cb80a 100644 --- a/src/functionObjects/field/fieldValues/fieldValue/fieldValue.C +++ b/src/functionObjects/field/fieldValues/fieldValue/fieldValue.C @@ -51,7 +51,7 @@ Foam::functionObjects::fieldValue::fieldValue : writeFiles(name, runTime, dict, name), dict_(dict), - sourceName_(word::null), + name_(word::null), resultDict_(fileName("name"), dictionary::null) { read(dict); @@ -69,7 +69,7 @@ Foam::functionObjects::fieldValue::fieldValue : writeFiles(name, obr, dict, name), dict_(dict), - sourceName_(word::null), + name_(word::null), resultDict_(fileName("name"), dictionary::null) { read(dict); diff --git a/src/functionObjects/field/fieldValues/fieldValue/fieldValue.H b/src/functionObjects/field/fieldValues/fieldValue/fieldValue.H index 3ec92b858..40d17636e 100644 --- a/src/functionObjects/field/fieldValues/fieldValue/fieldValue.H +++ b/src/functionObjects/field/fieldValues/fieldValue/fieldValue.H @@ -70,7 +70,7 @@ protected: dictionary dict_; //- Name of source object - word sourceName_; + word name_; //- List of field names to operate on wordList fields_; @@ -154,7 +154,7 @@ public: inline const dictionary& dict() const; //- Return the source name - inline const word& sourceName() const; + inline const word& name() const; //- Return the list of field names inline const wordList& fields() const; diff --git a/src/functionObjects/field/fieldValues/fieldValue/fieldValueI.H b/src/functionObjects/field/fieldValues/fieldValue/fieldValueI.H index 3375af1b4..7d0e402a6 100644 --- a/src/functionObjects/field/fieldValues/fieldValue/fieldValueI.H +++ b/src/functionObjects/field/fieldValues/fieldValue/fieldValueI.H @@ -34,9 +34,9 @@ inline const Foam::dictionary& Foam::functionObjects::fieldValue::dict() const } -inline const Foam::word& Foam::functionObjects::fieldValue::sourceName() const +inline const Foam::word& Foam::functionObjects::fieldValue::name() const { - return sourceName_; + return name_; } diff --git a/src/functionObjects/field/fieldValues/faceSource/faceSource.C b/src/functionObjects/field/fieldValues/surfaceRegion/surfaceRegion.C similarity index 85% rename from src/functionObjects/field/fieldValues/faceSource/faceSource.C rename to src/functionObjects/field/fieldValues/surfaceRegion/surfaceRegion.C index fcc3aff3e..d4bef0c7a 100644 --- a/src/functionObjects/field/fieldValues/faceSource/faceSource.C +++ b/src/functionObjects/field/fieldValues/surfaceRegion/surfaceRegion.C @@ -23,7 +23,7 @@ License \*---------------------------------------------------------------------------*/ -#include "faceSource.H" +#include "surfaceRegion.H" #include "fvMesh.H" #include "cyclicPolyPatch.H" #include "emptyPolyPatch.H" @@ -42,9 +42,9 @@ namespace functionObjects { namespace fieldValues { - defineTypeNameAndDebug(faceSource, 0); - addToRunTimeSelectionTable(fieldValue, faceSource, dictionary); - addToRunTimeSelectionTable(functionObject, faceSource, dictionary); + defineTypeNameAndDebug(surfaceRegion, 0); + addToRunTimeSelectionTable(fieldValue, surfaceRegion, dictionary); + addToRunTimeSelectionTable(functionObject, surfaceRegion, dictionary); } } } @@ -52,7 +52,7 @@ namespace fieldValues template<> const char* Foam::NamedEnum < - Foam::functionObjects::fieldValues::faceSource::sourceType, + Foam::functionObjects::fieldValues::surfaceRegion::regionTypes, 3 >::names[] = { @@ -64,7 +64,7 @@ const char* Foam::NamedEnum template<> const char* Foam::NamedEnum < - Foam::functionObjects::fieldValues::faceSource::operationType, + Foam::functionObjects::fieldValues::surfaceRegion::operationType, 15 >::names[] = { @@ -87,29 +87,29 @@ const char* Foam::NamedEnum const Foam::NamedEnum < - Foam::functionObjects::fieldValues::faceSource::sourceType, + Foam::functionObjects::fieldValues::surfaceRegion::regionTypes, 3 -> Foam::functionObjects::fieldValues::faceSource::sourceTypeNames_; +> Foam::functionObjects::fieldValues::surfaceRegion::regionTypeNames_; const Foam::NamedEnum < - Foam::functionObjects::fieldValues::faceSource::operationType, + Foam::functionObjects::fieldValues::surfaceRegion::operationType, 15 -> Foam::functionObjects::fieldValues::faceSource::operationTypeNames_; +> Foam::functionObjects::fieldValues::surfaceRegion::operationTypeNames_; // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // -void Foam::functionObjects::fieldValues::faceSource::setFaceZoneFaces() +void Foam::functionObjects::fieldValues::surfaceRegion::setFaceZoneFaces() { - label zoneId = mesh().faceZones().findZoneID(sourceName_); + label zoneId = mesh().faceZones().findZoneID(name_); if (zoneId < 0) { FatalErrorInFunction << type() << " " << name() << ": " - << sourceTypeNames_[source_] << "(" << sourceName_ << "):" << nl - << " Unknown face zone name: " << sourceName_ + << regionTypeNames_[regionType_] << "(" << name_ << "):" << nl + << " Unknown face zone name: " << name_ << ". Valid face zones are: " << mesh().faceZones().names() << nl << exit(FatalError); } @@ -185,16 +185,16 @@ void Foam::functionObjects::fieldValues::faceSource::setFaceZoneFaces() } -void Foam::functionObjects::fieldValues::faceSource::setPatchFaces() +void Foam::functionObjects::fieldValues::surfaceRegion::setPatchFaces() { - const label patchid = mesh().boundaryMesh().findPatchID(sourceName_); + const label patchid = mesh().boundaryMesh().findPatchID(name_); if (patchid < 0) { FatalErrorInFunction << type() << " " << name() << ": " - << sourceTypeNames_[source_] << "(" << sourceName_ << "):" << nl - << " Unknown patch name: " << sourceName_ + << regionTypeNames_[regionType_] << "(" << name_ << "):" << nl + << " Unknown patch name: " << name_ << ". Valid patch names are: " << mesh().boundaryMesh().names() << nl << exit(FatalError); @@ -222,7 +222,7 @@ void Foam::functionObjects::fieldValues::faceSource::setPatchFaces() } -void Foam::functionObjects::fieldValues::faceSource::sampledSurfaceFaces +void Foam::functionObjects::fieldValues::surfaceRegion::sampledSurfaceFaces ( const dictionary& dict ) @@ -238,7 +238,7 @@ void Foam::functionObjects::fieldValues::faceSource::sampledSurfaceFaces } -void Foam::functionObjects::fieldValues::faceSource::combineMeshGeometry +void Foam::functionObjects::fieldValues::surfaceRegion::combineMeshGeometry ( faceList& faces, pointField& points @@ -359,7 +359,7 @@ void Foam::functionObjects::fieldValues::faceSource::combineMeshGeometry } -void Foam::functionObjects::fieldValues::faceSource::combineSurfaceGeometry +void Foam::functionObjects::fieldValues::surfaceRegion::combineSurfaceGeometry ( faceList& faces, pointField& points @@ -398,7 +398,8 @@ void Foam::functionObjects::fieldValues::faceSource::combineSurfaceGeometry } -Foam::scalar Foam::functionObjects::fieldValues::faceSource::totalArea() const +Foam::scalar +Foam::functionObjects::fieldValues::surfaceRegion::totalArea() const { scalar totalArea; @@ -417,14 +418,14 @@ Foam::scalar Foam::functionObjects::fieldValues::faceSource::totalArea() const // * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // -void Foam::functionObjects::fieldValues::faceSource::initialise +void Foam::functionObjects::fieldValues::surfaceRegion::initialise ( const dictionary& dict ) { - dict.lookup("sourceName") >> sourceName_; + dict.lookup("name") >> name_; - switch (source_) + switch (regionType_) { case stFaceZone: { @@ -445,9 +446,9 @@ void Foam::functionObjects::fieldValues::faceSource::initialise { FatalErrorInFunction << type() << " " << name() << ": " - << sourceTypeNames_[source_] << "(" << sourceName_ << "):" - << nl << " Unknown source type. Valid source types are:" - << sourceTypeNames_.sortedToc() << nl << exit(FatalError); + << regionTypeNames_[regionType_] << "(" << name_ << "):" + << nl << " Unknown region type. Valid region types are:" + << regionTypeNames_.sortedToc() << nl << exit(FatalError); } } @@ -455,8 +456,8 @@ void Foam::functionObjects::fieldValues::faceSource::initialise { FatalErrorInFunction << type() << " " << name() << ": " - << sourceTypeNames_[source_] << "(" << sourceName_ << "):" << nl - << " Source has no faces" << exit(FatalError); + << regionTypeNames_[regionType_] << "(" << name_ << "):" << nl + << " Region has no faces" << exit(FatalError); } if (surfacePtr_.valid()) @@ -476,7 +477,7 @@ void Foam::functionObjects::fieldValues::faceSource::initialise { Info<< " weight field = " << weightFieldName_ << nl; - if (source_ == stSampledSurface) + if (regionType_ == stSampledSurface) { FatalIOErrorInFunction(dict) << "Cannot use weightField for a sampledSurface" @@ -532,13 +533,13 @@ void Foam::functionObjects::fieldValues::faceSource::initialise } -void Foam::functionObjects::fieldValues::faceSource::writeFileHeader +void Foam::functionObjects::fieldValues::surfaceRegion::writeFileHeader ( const label i ) { - writeCommented(file(), "Source : "); - file() << sourceTypeNames_[source_] << " " << sourceName_ << endl; + writeCommented(file(), "Region type : "); + file() << regionTypeNames_[regionType_] << " " << name_ << endl; writeCommented(file(), "Faces : "); file() << nFaces_ << endl; writeCommented(file(), "Area : "); @@ -562,7 +563,7 @@ void Foam::functionObjects::fieldValues::faceSource::writeFileHeader template<> -Foam::scalar Foam::functionObjects::fieldValues::faceSource::processValues +Foam::scalar Foam::functionObjects::fieldValues::surfaceRegion::processValues ( const Field& values, const vectorField& Sf, @@ -593,7 +594,7 @@ Foam::scalar Foam::functionObjects::fieldValues::faceSource::processValues template<> -Foam::vector Foam::functionObjects::fieldValues::faceSource::processValues +Foam::vector Foam::functionObjects::fieldValues::surfaceRegion::processValues ( const Field& values, const vectorField& Sf, @@ -639,7 +640,7 @@ Foam::vector Foam::functionObjects::fieldValues::faceSource::processValues // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -Foam::functionObjects::fieldValues::faceSource::faceSource +Foam::functionObjects::fieldValues::surfaceRegion::surfaceRegion ( const word& name, const Time& runTime, @@ -648,7 +649,7 @@ Foam::functionObjects::fieldValues::faceSource::faceSource : fieldValue(name, runTime, dict, typeName), surfaceWriterPtr_(NULL), - source_(sourceTypeNames_.read(dict.lookup("source"))), + regionType_(regionTypeNames_.read(dict.lookup("regionType"))), operation_(operationTypeNames_.read(dict.lookup("operation"))), weightFieldName_("none"), orientWeightField_(false), @@ -669,7 +670,7 @@ Foam::functionObjects::fieldValues::faceSource::faceSource read(dict); } -Foam::functionObjects::fieldValues::faceSource::faceSource +Foam::functionObjects::fieldValues::surfaceRegion::surfaceRegion ( const word& name, const objectRegistry& obr, @@ -678,7 +679,7 @@ Foam::functionObjects::fieldValues::faceSource::faceSource : fieldValue(name, obr, dict, typeName), surfaceWriterPtr_(NULL), - source_(sourceTypeNames_.read(dict.lookup("source"))), + regionType_(regionTypeNames_.read(dict.lookup("regionType"))), operation_(operationTypeNames_.read(dict.lookup("operation"))), weightFieldName_("none"), orientWeightField_(false), @@ -702,13 +703,13 @@ Foam::functionObjects::fieldValues::faceSource::faceSource // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // -Foam::functionObjects::fieldValues::faceSource::~faceSource() +Foam::functionObjects::fieldValues::surfaceRegion::~surfaceRegion() {} // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -bool Foam::functionObjects::fieldValues::faceSource::read +bool Foam::functionObjects::fieldValues::surfaceRegion::read ( const dictionary& dict ) @@ -720,7 +721,7 @@ bool Foam::functionObjects::fieldValues::faceSource::read } -bool Foam::functionObjects::fieldValues::faceSource::write +bool Foam::functionObjects::fieldValues::surfaceRegion::write ( const bool postProcess ) diff --git a/src/functionObjects/field/fieldValues/faceSource/faceSource.H b/src/functionObjects/field/fieldValues/surfaceRegion/surfaceRegion.H similarity index 87% rename from src/functionObjects/field/fieldValues/faceSource/faceSource.H rename to src/functionObjects/field/fieldValues/surfaceRegion/surfaceRegion.H index 6a8884ce1..f89ab0619 100644 --- a/src/functionObjects/field/fieldValues/faceSource/faceSource.H +++ b/src/functionObjects/field/fieldValues/surfaceRegion/surfaceRegion.H @@ -22,13 +22,13 @@ License along with OpenFOAM. If not, see . Class - Foam::functionObjects::fieldValues::faceSource + Foam::functionObjects::fieldValues::surfaceRegion Group grpFieldFunctionObjects Description - This function object provides a 'face source' variant of the fieldValues + This function object provides a 'face regionType' variant of the fieldValues function object. Given a list of user-specified fields and a selection of mesh (or general surface) faces, a number of operations can be performed, such as sums, averages and integrations. @@ -39,16 +39,16 @@ Description Example of function object specification: \verbatim - faceSource1 + surfaceRegion1 { - type faceSource; + type surfaceRegion; libs ("libfieldFunctionObjects.so"); ... log yes; writeFields true; surfaceFormat none; - source faceZone; - sourceName f0; + regionType faceZone; + name f0; operation sum; weightField alpha1; fields @@ -63,13 +63,13 @@ Description \heading Function object usage \table Property | Description | Required | Default value - type | type name: faceSource | yes | + type | type name: surfaceRegion | yes | log | write data to standard output | no | no writeFields | write the output values | yes | - writeArea | Write the area of the faceSource | no | + writeArea | Write the area of the surfaceRegion | no | surfaceFormat | output value format | no | - source | face source: see below | yes | - sourceName | name of face source if required | no | + regionType | face regionType: see below | yes | + name | name of face regionType if required | no | operation | operation to perform | yes | weightField | name of field to apply weighting | no | orientedWeightField | name of oriented field to apply weighting | no | @@ -79,10 +79,10 @@ Description \endtable \linebreak - Where \c source is defined by + Where \c regionType is defined by \plaintable - faceZone | requires a 'sourceName' entry to specify the faceZone - patch | requires a 'sourceName' entry to specify the patch + faceZone | requires a 'name' entry to specify the faceZone + patch | requires a 'name' entry to specify the patch sampledSurface | requires a 'sampledSurfaceDict' sub-dictionary \endplaintable @@ -130,13 +130,13 @@ SeeAlso Foam::functionObject SourceFiles - faceSource.C - faceSourceTemplates.C + surfaceRegion.C + surfaceRegionTemplates.C \*---------------------------------------------------------------------------*/ -#ifndef functionObjects_faceSource_H -#define functionObjects_faceSource_H +#ifndef functionObjects_surfaceRegion_H +#define functionObjects_surfaceRegion_H #include "fieldValue.H" #include "NamedEnum.H" @@ -155,10 +155,10 @@ namespace fieldValues { /*---------------------------------------------------------------------------*\ - Class faceSource Declaration + Class surfaceRegion Declaration \*---------------------------------------------------------------------------*/ -class faceSource +class surfaceRegion : public fieldValue { @@ -167,16 +167,16 @@ public: // Public data types - //- Source type enumeration - enum sourceType + //- region type enumeration + enum regionTypes { stFaceZone, stPatch, stSampledSurface }; - //- Source type names - static const NamedEnum sourceTypeNames_; + //- region type names + static const NamedEnum regionTypeNames_; //- Operation type enumeration @@ -230,7 +230,7 @@ private: pointField& points ) const; - //- Calculate and return total area of the faceSource: sum(magSf) + //- Calculate and return total area of the surfaceRegion: sum(magSf) scalar totalArea() const; @@ -241,8 +241,8 @@ protected: //- Surface writer autoPtr surfaceWriterPtr_; - //- Source type - sourceType source_; + //- region type + regionTypes regionType_; //- Operation to apply to values operationType operation_; @@ -259,10 +259,10 @@ protected: //- Scale factor - optional scalar scaleFactor_; - //- Total area of the faceSource + //- Total area of the surfaceRegion scalar totalArea_; - //- Optionally write the area of the faceSource + //- Optionally write the area of the surfaceRegion bool writeArea_; //- Global number of faces @@ -333,13 +333,13 @@ protected: public: //- Run-time type information - TypeName("faceSource"); + TypeName("surfaceRegion"); // Constructors //- Construct from name, Time and dictionary - faceSource + surfaceRegion ( const word& name, const Time& runTime, @@ -347,7 +347,7 @@ public: ); //- Construct from name, objectRegistry and dictionary - faceSource + surfaceRegion ( const word& name, const objectRegistry& obr, @@ -356,13 +356,13 @@ public: //- Destructor - virtual ~faceSource(); + virtual ~surfaceRegion(); // Public Member Functions - //- Return the source type - inline const sourceType& source() const; + //- Return the region type + inline const regionTypes& regionType() const; //- Return the local list of face IDs inline const labelList& faceId() const; @@ -408,7 +408,7 @@ public: //- Specialisation for scalar template<> -scalar faceSource::processValues +scalar surfaceRegion::processValues ( const Field& values, const vectorField& Sf, @@ -418,7 +418,7 @@ scalar faceSource::processValues //- Specialisation for vector template<> -vector faceSource::processValues +vector surfaceRegion::processValues ( const Field& values, const vectorField& Sf, @@ -434,12 +434,12 @@ vector faceSource::processValues // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -#include "faceSourceI.H" +#include "surfaceRegionI.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // #ifdef NoRepository - #include "faceSourceTemplates.C" + #include "surfaceRegionTemplates.C" #endif // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/functionObjects/field/fieldValues/faceSource/faceSourceI.H b/src/functionObjects/field/fieldValues/surfaceRegion/surfaceRegionI.H similarity index 79% rename from src/functionObjects/field/fieldValues/faceSource/faceSourceI.H rename to src/functionObjects/field/fieldValues/surfaceRegion/surfaceRegionI.H index 8808c1a5b..f9e12d657 100644 --- a/src/functionObjects/field/fieldValues/faceSource/faceSourceI.H +++ b/src/functionObjects/field/fieldValues/surfaceRegion/surfaceRegionI.H @@ -23,33 +23,33 @@ License \*---------------------------------------------------------------------------*/ -#include "faceSource.H" +#include "surfaceRegion.H" // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -inline const Foam::functionObjects::fieldValues::faceSource::sourceType& -Foam::functionObjects::fieldValues::faceSource::source() const +inline const Foam::functionObjects::fieldValues::surfaceRegion::regionTypes& +Foam::functionObjects::fieldValues::surfaceRegion::regionType() const { - return source_; + return regionType_; } inline const Foam::labelList& -Foam::functionObjects::fieldValues::faceSource::faceId() const +Foam::functionObjects::fieldValues::surfaceRegion::faceId() const { return faceId_; } inline const Foam::labelList& -Foam::functionObjects::fieldValues::faceSource::facePatch() const +Foam::functionObjects::fieldValues::surfaceRegion::facePatch() const { return facePatchId_; } inline const Foam::labelList& -Foam::functionObjects::fieldValues::faceSource::faceSign() const +Foam::functionObjects::fieldValues::surfaceRegion::faceSign() const { return faceSign_; } diff --git a/src/functionObjects/field/fieldValues/faceSource/faceSourceTemplates.C b/src/functionObjects/field/fieldValues/surfaceRegion/surfaceRegionTemplates.C similarity index 92% rename from src/functionObjects/field/fieldValues/faceSource/faceSourceTemplates.C rename to src/functionObjects/field/fieldValues/surfaceRegion/surfaceRegionTemplates.C index 2eee47306..478443c8a 100644 --- a/src/functionObjects/field/fieldValues/faceSource/faceSourceTemplates.C +++ b/src/functionObjects/field/fieldValues/surfaceRegion/surfaceRegionTemplates.C @@ -23,7 +23,7 @@ License \*---------------------------------------------------------------------------*/ -#include "faceSource.H" +#include "surfaceRegion.H" #include "surfaceFields.H" #include "volFields.H" #include "sampledSurface.H" @@ -33,7 +33,7 @@ License // * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // template -bool Foam::functionObjects::fieldValues::faceSource::validField +bool Foam::functionObjects::fieldValues::surfaceRegion::validField ( const word& fieldName ) const @@ -41,7 +41,7 @@ bool Foam::functionObjects::fieldValues::faceSource::validField typedef GeometricField sf; typedef GeometricField vf; - if (source_ != stSampledSurface && obr_.foundObject(fieldName)) + if (regionType_ != stSampledSurface && obr_.foundObject(fieldName)) { return true; } @@ -56,7 +56,7 @@ bool Foam::functionObjects::fieldValues::faceSource::validField template Foam::tmp> -Foam::functionObjects::fieldValues::faceSource::getFieldValues +Foam::functionObjects::fieldValues::surfaceRegion::getFieldValues ( const word& fieldName, const bool mustGet, @@ -66,7 +66,7 @@ Foam::functionObjects::fieldValues::faceSource::getFieldValues typedef GeometricField sf; typedef GeometricField vf; - if (source_ != stSampledSurface && obr_.foundObject(fieldName)) + if (regionType_ != stSampledSurface && obr_.foundObject(fieldName)) { return filterField(obr_.lookupObject(fieldName), applyOrientation); } @@ -125,7 +125,7 @@ Foam::functionObjects::fieldValues::faceSource::getFieldValues template -Type Foam::functionObjects::fieldValues::faceSource::processSameTypeValues +Type Foam::functionObjects::fieldValues::surfaceRegion::processSameTypeValues ( const Field& values, const vectorField& Sf, @@ -254,7 +254,7 @@ Type Foam::functionObjects::fieldValues::faceSource::processSameTypeValues template -Type Foam::functionObjects::fieldValues::faceSource::processValues +Type Foam::functionObjects::fieldValues::surfaceRegion::processValues ( const Field& values, const vectorField& Sf, @@ -269,7 +269,7 @@ Type Foam::functionObjects::fieldValues::faceSource::processValues // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // template -bool Foam::functionObjects::fieldValues::faceSource::writeValues +bool Foam::functionObjects::fieldValues::surfaceRegion::writeValues ( const word& fieldName, const scalarField& weightField, @@ -321,7 +321,7 @@ bool Foam::functionObjects::fieldValues::faceSource::writeValues surfaceWriterPtr_->write ( outputDir, - word(sourceTypeNames_[source_]) + "_" + sourceName_, + word(regionTypeNames_[regionType_]) + "_" + name_, points, faces, fieldName, @@ -345,7 +345,7 @@ bool Foam::functionObjects::fieldValues::faceSource::writeValues file()<< tab << result; Log << " " << operationTypeNames_[operation_] - << "(" << sourceName_ << ") of " << fieldName + << "(" << name_ << ") of " << fieldName << " = " << result << endl; } } @@ -356,7 +356,7 @@ bool Foam::functionObjects::fieldValues::faceSource::writeValues template Foam::tmp> -Foam::functionObjects::fieldValues::faceSource::filterField +Foam::functionObjects::fieldValues::surfaceRegion::filterField ( const GeometricField& field, const bool applyOrientation @@ -377,7 +377,7 @@ Foam::functionObjects::fieldValues::faceSource::filterField { FatalErrorInFunction << type() << " " << name() << ": " - << sourceTypeNames_[source_] << "(" << sourceName_ << "):" + << regionTypeNames_[regionType_] << "(" << name_ << "):" << nl << " Unable to process internal faces for volume field " << field.name() << nl << abort(FatalError); @@ -398,7 +398,7 @@ Foam::functionObjects::fieldValues::faceSource::filterField template Foam::tmp> -Foam::functionObjects::fieldValues::faceSource::filterField +Foam::functionObjects::fieldValues::surfaceRegion::filterField ( const GeometricField& field, const bool applyOrientation diff --git a/src/functionObjects/field/fieldValues/cellSource/cellSource.C b/src/functionObjects/field/fieldValues/volRegion/volRegion.C similarity index 75% rename from src/functionObjects/field/fieldValues/cellSource/cellSource.C rename to src/functionObjects/field/fieldValues/volRegion/volRegion.C index f6e1d15f9..0035e013b 100644 --- a/src/functionObjects/field/fieldValues/cellSource/cellSource.C +++ b/src/functionObjects/field/fieldValues/volRegion/volRegion.C @@ -23,7 +23,7 @@ License \*---------------------------------------------------------------------------*/ -#include "cellSource.H" +#include "volRegion.H" #include "fvMesh.H" #include "volFields.H" #include "addToRunTimeSelectionTable.H" @@ -36,9 +36,9 @@ namespace functionObjects { namespace fieldValues { - defineTypeNameAndDebug(cellSource, 0); - addToRunTimeSelectionTable(fieldValue, cellSource, dictionary); - addToRunTimeSelectionTable(functionObject, cellSource, dictionary); + defineTypeNameAndDebug(volRegion, 0); + addToRunTimeSelectionTable(fieldValue, volRegion, dictionary); + addToRunTimeSelectionTable(functionObject, volRegion, dictionary); } } } @@ -47,7 +47,7 @@ template<> const char* Foam::NamedEnum < - Foam::functionObjects::fieldValues::cellSource::sourceType, + Foam::functionObjects::fieldValues::volRegion::regionTypes, 2 >::names[] = {"cellZone", "all"}; @@ -55,7 +55,7 @@ template<> const char* Foam::NamedEnum < - Foam::functionObjects::fieldValues::cellSource::operationType, + Foam::functionObjects::fieldValues::volRegion::operationType, 11 >::names[] = { @@ -74,33 +74,33 @@ Foam::NamedEnum const Foam::NamedEnum < - Foam::functionObjects::fieldValues::cellSource::sourceType, + Foam::functionObjects::fieldValues::volRegion::regionTypes, 2 -> Foam::functionObjects::fieldValues::cellSource::sourceTypeNames_; +> Foam::functionObjects::fieldValues::volRegion::regionTypeNames_; const Foam::NamedEnum < - Foam::functionObjects::fieldValues::cellSource::operationType, + Foam::functionObjects::fieldValues::volRegion::operationType, 11 -> Foam::functionObjects::fieldValues::cellSource::operationTypeNames_; +> Foam::functionObjects::fieldValues::volRegion::operationTypeNames_; // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // -void Foam::functionObjects::fieldValues::cellSource::setCellZoneCells() +void Foam::functionObjects::fieldValues::volRegion::setCellZoneCells() { - switch (source_) + switch (regionType_) { case stCellZone: { - dict().lookup("sourceName") >> sourceName_; + dict().lookup("name") >> name_; - label zoneId = mesh().cellZones().findZoneID(sourceName_); + label zoneId = mesh().cellZones().findZoneID(name_); if (zoneId < 0) { FatalErrorInFunction - << "Unknown cell zone name: " << sourceName_ + << "Unknown cell zone name: " << name_ << ". Valid cell zones are: " << mesh().cellZones().names() << nl << exit(FatalError); } @@ -120,19 +120,19 @@ void Foam::functionObjects::fieldValues::cellSource::setCellZoneCells() default: { FatalErrorInFunction - << "Unknown source type. Valid source types are:" - << sourceTypeNames_ << nl << exit(FatalError); + << "Unknown region type. Valid region types are:" + << regionTypeNames_ << nl << exit(FatalError); } } if (debug) { - Pout<< "Selected source size = " << cellId_.size() << endl; + Pout<< "Selected region size = " << cellId_.size() << endl; } } -Foam::scalar Foam::functionObjects::fieldValues::cellSource::volume() const +Foam::scalar Foam::functionObjects::fieldValues::volRegion::volume() const { return gSum(filterField(mesh().V())); } @@ -140,7 +140,7 @@ Foam::scalar Foam::functionObjects::fieldValues::cellSource::volume() const // * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // -void Foam::functionObjects::fieldValues::cellSource::initialise +void Foam::functionObjects::fieldValues::volRegion::initialise ( const dictionary& dict ) @@ -151,14 +151,14 @@ void Foam::functionObjects::fieldValues::cellSource::initialise { FatalErrorInFunction << type() << " " << name() << ": " - << sourceTypeNames_[source_] << "(" << sourceName_ << "):" << nl - << " Source has no cells" << exit(FatalError); + << regionTypeNames_[regionType_] << "(" << name_ << "):" << nl + << " Region has no cells" << exit(FatalError); } volume_ = volume(); Info<< type() << " " << name() << ":" - << sourceTypeNames_[source_] << "(" << sourceName_ << "):" << nl + << regionTypeNames_[regionType_] << "(" << name_ << "):" << nl << " total cells = " << nCells_ << nl << " total volume = " << volume_ << nl << endl; @@ -172,13 +172,13 @@ void Foam::functionObjects::fieldValues::cellSource::initialise } -void Foam::functionObjects::fieldValues::cellSource::writeFileHeader +void Foam::functionObjects::fieldValues::volRegion::writeFileHeader ( const label i ) { - writeCommented(file(), "Source : "); - file() << sourceTypeNames_[source_] << " " << sourceName_ << endl; + writeCommented(file(), "Region type : "); + file() << regionTypeNames_[regionType_] << " " << name_ << endl; writeCommented(file(), "Cells : "); file() << nCells_ << endl; writeCommented(file(), "Volume : "); @@ -203,7 +203,7 @@ void Foam::functionObjects::fieldValues::cellSource::writeFileHeader // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -Foam::functionObjects::fieldValues::cellSource::cellSource +Foam::functionObjects::fieldValues::volRegion::volRegion ( const word& name, const Time& runTime, @@ -211,7 +211,7 @@ Foam::functionObjects::fieldValues::cellSource::cellSource ) : fieldValue(name, runTime, dict, typeName), - source_(sourceTypeNames_.read(dict.lookup("source"))), + regionType_(regionTypeNames_.read(dict.lookup("regionType"))), operation_(operationTypeNames_.read(dict.lookup("operation"))), nCells_(0), cellId_(), @@ -228,7 +228,7 @@ Foam::functionObjects::fieldValues::cellSource::cellSource } -Foam::functionObjects::fieldValues::cellSource::cellSource +Foam::functionObjects::fieldValues::volRegion::volRegion ( const word& name, const objectRegistry& obr, @@ -236,7 +236,7 @@ Foam::functionObjects::fieldValues::cellSource::cellSource ) : fieldValue(name, obr, dict, typeName), - source_(sourceTypeNames_.read(dict.lookup("source"))), + regionType_(regionTypeNames_.read(dict.lookup("regionType"))), operation_(operationTypeNames_.read(dict.lookup("operation"))), nCells_(0), cellId_(), @@ -255,13 +255,13 @@ Foam::functionObjects::fieldValues::cellSource::cellSource // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // -Foam::functionObjects::fieldValues::cellSource::~cellSource() +Foam::functionObjects::fieldValues::volRegion::~volRegion() {} // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -bool Foam::functionObjects::fieldValues::cellSource::read +bool Foam::functionObjects::fieldValues::volRegion::read ( const dictionary& dict ) @@ -275,7 +275,7 @@ bool Foam::functionObjects::fieldValues::cellSource::read } -bool Foam::functionObjects::fieldValues::cellSource::write +bool Foam::functionObjects::fieldValues::volRegion::write ( const bool postProcess ) diff --git a/src/functionObjects/field/fieldValues/cellSource/cellSource.H b/src/functionObjects/field/fieldValues/volRegion/volRegion.H similarity index 83% rename from src/functionObjects/field/fieldValues/cellSource/cellSource.H rename to src/functionObjects/field/fieldValues/volRegion/volRegion.H index 79c52a1c5..8d488bfb5 100644 --- a/src/functionObjects/field/fieldValues/cellSource/cellSource.H +++ b/src/functionObjects/field/fieldValues/volRegion/volRegion.H @@ -22,13 +22,13 @@ License along with OpenFOAM. If not, see . Class - Foam::functionObjects::fieldValues::cellSource + Foam::functionObjects::fieldValues::volRegion Group grpFieldFunctionObjects Description - This function object provides a 'cell source' variant of the fieldValues + This function object provides a 'cell region' variant of the fieldValues function object. Given a list of user-specified fields and a selection of mesh cells, a number of operations can be performed, such as sums, averages and integrations. @@ -36,15 +36,15 @@ Description Example of function object specification: \verbatim - cellSource1 + volRegion1 { - type cellSource; + type volRegion; libs ("libfieldFunctionObjects.so"); ... log true; writeFields true; - source cellZone; - sourceName c0; + regionType cellZone; + name c0; operation volAverage; weightField alpha1; fields @@ -58,21 +58,21 @@ Description \heading Function object usage \table Property | Description | Required | Default value - type | Type name: cellSource | yes | + type | Type name: volRegion | yes | log | Write data to standard output | no | no writeFields | Write the raw output values | yes | - writeVolume | Write the volume of the cellSource | no | - source | cell source: see below | yes | - sourceName | name of cell source if required | no | + writeVolume | Write the volume of the volRegion | no | + regionType | cell regionType: see below | yes | + name | name of cell regionType if required | no | operation | operation to perform | yes | weightField | name of field to apply weighting | no | fields | list of fields to operate on | yes | \endtable \linebreak - Where \c source is defined by + Where \c regionType is defined by \plaintable - cellZone | requires a 'sourceName' entry to specify the cellZone + cellZone | requires a 'name' entry to specify the cellZone all | all cells \endplaintable @@ -97,12 +97,12 @@ SeeAlso Foam::functionObject SourceFiles - cellSource.C + volRegion.C \*---------------------------------------------------------------------------*/ -#ifndef functionObjects_cellSource_H -#define functionObjects_cellSource_H +#ifndef functionObjects_volRegion_H +#define functionObjects_volRegion_H #include "fieldValue.H" #include "NamedEnum.H" @@ -117,10 +117,10 @@ namespace fieldValues { /*---------------------------------------------------------------------------*\ - Class cellSource Declaration + Class volRegion Declaration \*---------------------------------------------------------------------------*/ -class cellSource +class volRegion : public fieldValue { @@ -129,15 +129,15 @@ public: // Public data types - //- Source type enumeration - enum sourceType + //- region type enumeration + enum regionTypes { stCellZone, stAll }; - //- Source type names - static const NamedEnum sourceTypeNames_; + //- region type names + static const NamedEnum regionTypeNames_; //- Operation type enumeration @@ -170,7 +170,7 @@ private: //- Set cells to evaluate based on a patch void setPatchCells(); - //- Calculate and return volume of the cellSource: sum(V) + //- Calculate and return volume of the volRegion: sum(V) scalar volume() const; @@ -178,8 +178,8 @@ protected: // Protected data - //- Source type - sourceType source_; + //- region type + regionTypes regionType_; //- Operation to apply to values operationType operation_; @@ -193,10 +193,10 @@ protected: //- Weight field name - only used for opWeightedAverage mode word weightFieldName_; - //- Volume of the cellSource + //- Volume of the volRegion scalar volume_; - //- Optionally write the volume of the cellSource + //- Optionally write the volume of the volRegion bool writeVolume_; @@ -233,13 +233,13 @@ protected: public: //- Run-time type information - TypeName("cellSource"); + TypeName("volRegion"); // Constructors //- Construct from name, Time and dictionary - cellSource + volRegion ( const word& name, const Time& runTime, @@ -247,7 +247,7 @@ public: ); //- Construct from name, objectRegistry and dictionary - cellSource + volRegion ( const word& name, const objectRegistry& obr, @@ -256,13 +256,13 @@ public: //- Destructor - virtual ~cellSource(); + virtual ~volRegion(); // Public Member Functions - //- Return the source type - inline const sourceType& source() const; + //- Return the region type + inline const regionTypes& regionType() const; //- Return the local list of cell IDs inline const labelList& cellId() const; @@ -291,12 +291,12 @@ public: // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -#include "cellSourceI.H" +#include "volRegionI.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // #ifdef NoRepository - #include "cellSourceTemplates.C" + #include "volRegionTemplates.C" #endif // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/functionObjects/field/fieldValues/cellSource/cellSourceI.H b/src/functionObjects/field/fieldValues/volRegion/volRegionI.H similarity index 84% rename from src/functionObjects/field/fieldValues/cellSource/cellSourceI.H rename to src/functionObjects/field/fieldValues/volRegion/volRegionI.H index c0a6bee40..cf5750e3e 100644 --- a/src/functionObjects/field/fieldValues/cellSource/cellSourceI.H +++ b/src/functionObjects/field/fieldValues/volRegion/volRegionI.H @@ -23,19 +23,19 @@ License \*---------------------------------------------------------------------------*/ -#include "cellSource.H" +#include "volRegion.H" // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -inline const Foam::functionObjects::fieldValues::cellSource::sourceType& -Foam::functionObjects::fieldValues::cellSource::source() const +inline const Foam::functionObjects::fieldValues::volRegion::regionTypes& +Foam::functionObjects::fieldValues::volRegion::regionType() const { - return source_; + return regionType_; } inline const Foam::labelList& -Foam::functionObjects::fieldValues::cellSource::cellId() const +Foam::functionObjects::fieldValues::volRegion::cellId() const { return cellId_; } diff --git a/src/functionObjects/field/fieldValues/cellSource/cellSourceTemplates.C b/src/functionObjects/field/fieldValues/volRegion/volRegionTemplates.C similarity index 91% rename from src/functionObjects/field/fieldValues/cellSource/cellSourceTemplates.C rename to src/functionObjects/field/fieldValues/volRegion/volRegionTemplates.C index c525504c8..12fb69de8 100644 --- a/src/functionObjects/field/fieldValues/cellSource/cellSourceTemplates.C +++ b/src/functionObjects/field/fieldValues/volRegion/volRegionTemplates.C @@ -23,13 +23,13 @@ License \*---------------------------------------------------------------------------*/ -#include "cellSource.H" +#include "volRegion.H" #include "volFields.H" // * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // template -bool Foam::functionObjects::fieldValues::cellSource::validField +bool Foam::functionObjects::fieldValues::volRegion::validField ( const word& fieldName ) const @@ -47,7 +47,7 @@ bool Foam::functionObjects::fieldValues::cellSource::validField template Foam::tmp> -Foam::functionObjects::fieldValues::cellSource::setFieldValues +Foam::functionObjects::fieldValues::volRegion::setFieldValues ( const word& fieldName, const bool mustGet @@ -72,7 +72,7 @@ Foam::functionObjects::fieldValues::cellSource::setFieldValues template -Type Foam::functionObjects::fieldValues::cellSource::processValues +Type Foam::functionObjects::fieldValues::volRegion::processValues ( const Field& values, const scalarField& V, @@ -155,7 +155,7 @@ Type Foam::functionObjects::fieldValues::cellSource::processValues // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // template -bool Foam::functionObjects::fieldValues::cellSource::writeValues +bool Foam::functionObjects::fieldValues::volRegion::writeValues ( const word& fieldName ) @@ -191,8 +191,8 @@ bool Foam::functionObjects::fieldValues::cellSource::writeValues ( IOobject ( - fieldName + "_" + sourceTypeNames_[source_] + "-" - + sourceName_, + fieldName + "_" + regionTypeNames_[regionType_] + "-" + + name_, obr_.time().timeName(), obr_, IOobject::NO_READ, @@ -206,7 +206,7 @@ bool Foam::functionObjects::fieldValues::cellSource::writeValues file()<< tab << result; Log << " " << operationTypeNames_[operation_] - << "(" << sourceName_ << ") of " << fieldName + << "(" << name_ << ") of " << fieldName << " = " << result << endl; } } @@ -217,7 +217,7 @@ bool Foam::functionObjects::fieldValues::cellSource::writeValues template Foam::tmp> -Foam::functionObjects::fieldValues::cellSource::filterField +Foam::functionObjects::fieldValues::volRegion::filterField ( const Field& field ) const diff --git a/src/functionObjects/field/readFields/postProcessingDict b/src/functionObjects/field/readFields/postProcessingDict index 3d385ccc8..e319b614f 100644 --- a/src/functionObjects/field/readFields/postProcessingDict +++ b/src/functionObjects/field/readFields/postProcessingDict @@ -32,7 +32,7 @@ functions faceObj2 { - type faceSource; + type surfaceRegion; libs ("libfieldFunctionObjects.so"); enabled true; writeControl timeStep; @@ -40,7 +40,7 @@ functions log true; writeFields true; source faceZone; - sourceName f0; + name f0; operation areaAverage; fields diff --git a/src/meshTools/sets/surfaceRegions/boundaryToFace/boundaryToFace.C b/src/meshTools/sets/surfaceRegions/boundaryToFace/boundaryToFace.C new file mode 100644 index 000000000..7ae3ab1a6 --- /dev/null +++ b/src/meshTools/sets/surfaceRegions/boundaryToFace/boundaryToFace.C @@ -0,0 +1,125 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +\*---------------------------------------------------------------------------*/ + +#include "boundaryToFace.H" +#include "polyMesh.H" + +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ + +defineTypeNameAndDebug(boundaryToFace, 0); + +addToRunTimeSelectionTable(topoSetSource, boundaryToFace, word); + +addToRunTimeSelectionTable(topoSetSource, boundaryToFace, istream); + +} + + +Foam::topoSetSource::addToUsageTable Foam::boundaryToFace::usage_ +( + boundaryToFace::typeName, + "\n Usage: boundaryToFace\n\n" + " Select all boundary faces\n\n" +); + + +// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // + +void Foam::boundaryToFace::combine(topoSet& set, const bool add) const +{ + for + ( + label facei = mesh().nInternalFaces(); + facei < mesh().nFaces(); + facei++ + ) + { + addOrDelete(set, facei, add); + } +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +// Construct from components +Foam::boundaryToFace::boundaryToFace(const polyMesh& mesh) +: + topoSetSource(mesh) +{} + + +// Construct from dictionary +Foam::boundaryToFace::boundaryToFace(const polyMesh& mesh, const dictionary&) +: + topoSetSource(mesh) +{} + + +// Construct from Istream +Foam::boundaryToFace::boundaryToFace +( + const polyMesh& mesh, + Istream& is +) +: + topoSetSource(mesh) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::boundaryToFace::~boundaryToFace() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +void Foam::boundaryToFace::applyToSet +( + const topoSetSource::setAction action, + topoSet& set +) const +{ + if ((action == topoSetSource::NEW) || (action == topoSetSource::ADD)) + { + Info<< " Adding all boundary faces ..." << endl; + + combine(set, true); + } + else if (action == topoSetSource::DELETE) + { + Info<< " Removing all boundary faces ..." << endl; + + combine(set, false); + } +} + + +// ************************************************************************* // diff --git a/src/meshTools/sets/surfaceRegions/boundaryToFace/boundaryToFace.H b/src/meshTools/sets/surfaceRegions/boundaryToFace/boundaryToFace.H new file mode 100644 index 000000000..5875ea290 --- /dev/null +++ b/src/meshTools/sets/surfaceRegions/boundaryToFace/boundaryToFace.H @@ -0,0 +1,117 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +Class + Foam::boundaryToFace + +Description + A topoSetSource to select all external (boundary) faces. + +SourceFiles + boundaryToFace.C + +\*---------------------------------------------------------------------------*/ + +#ifndef boundaryToFace_H +#define boundaryToFace_H + +#include "topoSetSource.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class boundaryToFace Declaration +\*---------------------------------------------------------------------------*/ + +class boundaryToFace +: + public topoSetSource +{ + // Private data + + //- Add usage string + static addToUsageTable usage_; + + + // Private Member Functions + + void combine(topoSet& set, const bool add) const; + + +public: + + //- Runtime type information + TypeName("boundaryToFace"); + + // Constructors + + //- Construct from components + boundaryToFace(const polyMesh&); + + //- Construct from dictionary + boundaryToFace + ( + const polyMesh& mesh, + const dictionary& dict + ); + + //- Construct from Istream + boundaryToFace + ( + const polyMesh& mesh, + Istream& + ); + + + //- Destructor + virtual ~boundaryToFace(); + + + // Member Functions + + virtual sourceType setType() const + { + return FACESETSOURCE; + } + + virtual void applyToSet + ( + const topoSetSource::setAction action, + topoSet& + ) const; + +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/meshTools/sets/surfaceRegions/boxToFace/boxToFace.C b/src/meshTools/sets/surfaceRegions/boxToFace/boxToFace.C new file mode 100644 index 000000000..5ad4d8e5e --- /dev/null +++ b/src/meshTools/sets/surfaceRegions/boxToFace/boxToFace.C @@ -0,0 +1,145 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +\*---------------------------------------------------------------------------*/ + +#include "boxToFace.H" +#include "polyMesh.H" + +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ + +defineTypeNameAndDebug(boxToFace, 0); + +addToRunTimeSelectionTable(topoSetSource, boxToFace, word); + +addToRunTimeSelectionTable(topoSetSource, boxToFace, istream); + +} + + +Foam::topoSetSource::addToUsageTable Foam::boxToFace::usage_ +( + boxToFace::typeName, + "\n Usage: boxToFace ((minx miny minz) (maxx maxy maxz))\n\n" + " Select all face with faceCentre within bounding box\n\n" +); + + +// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // + +void Foam::boxToFace::combine(topoSet& set, const bool add) const +{ + const pointField& ctrs = mesh_.faceCentres(); + + forAll(ctrs, facei) + { + forAll(bbs_, i) + { + if (bbs_[i].contains(ctrs[facei])) + { + addOrDelete(set, facei, add); + break; + } + } + } +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +// Construct from components +Foam::boxToFace::boxToFace +( + const polyMesh& mesh, + const treeBoundBoxList& bbs +) +: + topoSetSource(mesh), + bbs_(bbs) +{} + + +// Construct from dictionary +Foam::boxToFace::boxToFace +( + const polyMesh& mesh, + const dictionary& dict +) +: + topoSetSource(mesh), + bbs_ + ( + dict.found("box") + ? treeBoundBoxList(1, treeBoundBox(dict.lookup("box"))) + : dict.lookup("boxes") + ) +{} + + +// Construct from Istream +Foam::boxToFace::boxToFace +( + const polyMesh& mesh, + Istream& is +) +: + topoSetSource(mesh), + bbs_(1, treeBoundBox(checkIs(is))) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::boxToFace::~boxToFace() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +void Foam::boxToFace::applyToSet +( + const topoSetSource::setAction action, + topoSet& set +) const +{ + if ((action == topoSetSource::NEW) || (action == topoSetSource::ADD)) + { + Info<< " Adding faces with centre within boxes " << bbs_ << endl; + + combine(set, true); + } + else if (action == topoSetSource::DELETE) + { + Info<< " Removing faces with centre within boxes " << bbs_ << endl; + + combine(set, false); + } +} + + +// ************************************************************************* // diff --git a/src/meshTools/sets/surfaceRegions/boxToFace/boxToFace.H b/src/meshTools/sets/surfaceRegions/boxToFace/boxToFace.H new file mode 100644 index 000000000..f3b4d4707 --- /dev/null +++ b/src/meshTools/sets/surfaceRegions/boxToFace/boxToFace.H @@ -0,0 +1,126 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +Class + Foam::boxToFace + +Description + A topoSetSource to select faces based on face centres inside box. + +SourceFiles + boxToFace.C + +\*---------------------------------------------------------------------------*/ + +#ifndef boxToFace_H +#define boxToFace_H + +#include "topoSetSource.H" +#include "treeBoundBoxList.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class boxToFace Declaration +\*---------------------------------------------------------------------------*/ + +class boxToFace +: + public topoSetSource +{ + + // Private data + + //- Add usage string + static addToUsageTable usage_; + + //- Bounding box. + treeBoundBoxList bbs_; + + + // Private Member Functions + + void combine(topoSet& set, const bool add) const; + + +public: + + //- Runtime type information + TypeName("boxToFace"); + + // Constructors + + //- Construct from components + boxToFace + ( + const polyMesh& mesh, + const treeBoundBoxList& bbs + ); + + //- Construct from dictionary + boxToFace + ( + const polyMesh& mesh, + const dictionary& dict + ); + + //- Construct from Istream + boxToFace + ( + const polyMesh& mesh, + Istream& + ); + + + //- Destructor + virtual ~boxToFace(); + + + // Member Functions + + virtual sourceType setType() const + { + return FACESETSOURCE; + } + + virtual void applyToSet + ( + const topoSetSource::setAction action, + topoSet& + ) const; + +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/meshTools/sets/surfaceRegions/cellToFace/cellToFace.C b/src/meshTools/sets/surfaceRegions/cellToFace/cellToFace.C new file mode 100644 index 000000000..64e04fe75 --- /dev/null +++ b/src/meshTools/sets/surfaceRegions/cellToFace/cellToFace.C @@ -0,0 +1,228 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +\*---------------------------------------------------------------------------*/ + +#include "cellToFace.H" +#include "polyMesh.H" +#include "cellSet.H" +#include "Time.H" +#include "syncTools.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ + defineTypeNameAndDebug(cellToFace, 0); + addToRunTimeSelectionTable(topoSetSource, cellToFace, word); + addToRunTimeSelectionTable(topoSetSource, cellToFace, istream); + + template<> + const char* Foam::NamedEnum + < + Foam::cellToFace::cellAction, + 2 + >::names[] = + { + "all", + "both" + }; +} + + +Foam::topoSetSource::addToUsageTable Foam::cellToFace::usage_ +( + cellToFace::typeName, + "\n Usage: cellToFace all|both\n\n" + " Select -all : all faces of cells in the cellSet\n" + " -both: faces where both neighbours are in the cellSet\n\n" +); + +const Foam::NamedEnum + Foam::cellToFace::cellActionNames_; + + +// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // + +void Foam::cellToFace::combine(topoSet& set, const bool add) const +{ + // Load the set + if (!exists(mesh_.time().path()/topoSet::localPath(mesh_, setName_))) + { + SeriousError<< "Cannot load set " + << setName_ << endl; + } + + cellSet loadedSet(mesh_, setName_); + + if (option_ == ALL) + { + // Add all faces from cell + forAllConstIter(cellSet, loadedSet, iter) + { + const label celli = iter.key(); + const labelList& cFaces = mesh_.cells()[celli]; + + forAll(cFaces, cFacei) + { + addOrDelete(set, cFaces[cFacei], add); + } + } + } + else if (option_ == BOTH) + { + // Add all faces whose both neighbours are in set. + + const label nInt = mesh_.nInternalFaces(); + const labelList& own = mesh_.faceOwner(); + const labelList& nei = mesh_.faceNeighbour(); + const polyBoundaryMesh& patches = mesh_.boundaryMesh(); + + + // Check all internal faces + for (label facei = 0; facei < nInt; facei++) + { + if (loadedSet.found(own[facei]) && loadedSet.found(nei[facei])) + { + addOrDelete(set, facei, add); + } + } + + + // Get coupled cell status + boolList neiInSet(mesh_.nFaces()-nInt, false); + + forAll(patches, patchi) + { + const polyPatch& pp = patches[patchi]; + + if (pp.coupled()) + { + label facei = pp.start(); + forAll(pp, i) + { + neiInSet[facei-nInt] = loadedSet.found(own[facei]); + facei++; + } + } + } + syncTools::swapBoundaryFaceList(mesh_, neiInSet); + + + // Check all boundary faces + forAll(patches, patchi) + { + const polyPatch& pp = patches[patchi]; + + if (pp.coupled()) + { + label facei = pp.start(); + forAll(pp, i) + { + if (loadedSet.found(own[facei]) && neiInSet[facei-nInt]) + { + addOrDelete(set, facei, add); + } + facei++; + } + } + } + } +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +// Construct from componenta +Foam::cellToFace::cellToFace +( + const polyMesh& mesh, + const word& setName, + const cellAction option +) +: + topoSetSource(mesh), + setName_(setName), + option_(option) +{} + + +// Construct from dictionary +Foam::cellToFace::cellToFace +( + const polyMesh& mesh, + const dictionary& dict +) +: + topoSetSource(mesh), + setName_(dict.lookup("set")), + option_(cellActionNames_.read(dict.lookup("option"))) +{} + + +// Construct from Istream +Foam::cellToFace::cellToFace +( + const polyMesh& mesh, + Istream& is +) +: + topoSetSource(mesh), + setName_(checkIs(is)), + option_(cellActionNames_.read(checkIs(is))) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::cellToFace::~cellToFace() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +void Foam::cellToFace::applyToSet +( + const topoSetSource::setAction action, + topoSet& set +) const +{ + if ((action == topoSetSource::NEW) || (action == topoSetSource::ADD)) + { + Info<< " Adding faces according to cellSet " << setName_ + << " ..." << endl; + + combine(set, true); + } + else if (action == topoSetSource::DELETE) + { + Info<< " Removing faces according to cellSet " << setName_ + << " ..." << endl; + + combine(set, false); + } +} + + +// ************************************************************************* // diff --git a/src/meshTools/sets/surfaceRegions/cellToFace/cellToFace.H b/src/meshTools/sets/surfaceRegions/cellToFace/cellToFace.H new file mode 100644 index 000000000..d49917a63 --- /dev/null +++ b/src/meshTools/sets/surfaceRegions/cellToFace/cellToFace.H @@ -0,0 +1,145 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +Class + Foam::cellToFace + +Description + A topoSetSource to select a faceSet from cells. + + Either all faces of cell or some other criterion. + See implementation. + Note: when picking up coupled faces uses cells on neighbouring processors. + +SourceFiles + cellToFace.C + +\*---------------------------------------------------------------------------*/ + +#ifndef cellToFace_H +#define cellToFace_H + +#include "topoSetSource.H" +#include "NamedEnum.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class cellToFace Declaration +\*---------------------------------------------------------------------------*/ + +class cellToFace +: + public topoSetSource +{ +public: + //- Enumeration defining the valid options + enum cellAction + { + ALL, + BOTH + }; + + +private: + + //- Add usage string + static addToUsageTable usage_; + + static const NamedEnum cellActionNames_; + + //- Name of set to use + word setName_; + + //- Option + cellAction option_; + + + // Private Member Functions + + //- Depending on face to cell option add to or delete from cellSet. + void combine(topoSet& set, const bool add) const; + + +public: + + //- Runtime type information + TypeName("cellToFace"); + + // Constructors + + //- Construct from components + cellToFace + ( + const polyMesh& mesh, + const word& setName, + const cellAction option + ); + + //- Construct from dictionary + cellToFace + ( + const polyMesh& mesh, + const dictionary& dict + ); + + //- Construct from Istream + cellToFace + ( + const polyMesh& mesh, + Istream& + ); + + + //- Destructor + virtual ~cellToFace(); + + + // Member Functions + + virtual sourceType setType() const + { + return FACESETSOURCE; + } + + virtual void applyToSet + ( + const topoSetSource::setAction action, + topoSet& + ) const; + +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/meshTools/sets/surfaceRegions/faceToFace/faceToFace.C b/src/meshTools/sets/surfaceRegions/faceToFace/faceToFace.C new file mode 100644 index 000000000..1e05fdefd --- /dev/null +++ b/src/meshTools/sets/surfaceRegions/faceToFace/faceToFace.C @@ -0,0 +1,129 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +\*---------------------------------------------------------------------------*/ + +#include "faceToFace.H" +#include "polyMesh.H" +#include "faceSet.H" + +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ + +defineTypeNameAndDebug(faceToFace, 0); + +addToRunTimeSelectionTable(topoSetSource, faceToFace, word); + +addToRunTimeSelectionTable(topoSetSource, faceToFace, istream); + +} + + +Foam::topoSetSource::addToUsageTable Foam::faceToFace::usage_ +( + faceToFace::typeName, + "\n Usage: faceToFace \n\n" + " Select all faces in the faceSet\n\n" +); + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +// Construct from components +Foam::faceToFace::faceToFace +( + const polyMesh& mesh, + const word& setName +) +: + topoSetSource(mesh), + setName_(setName) +{} + + +// Construct from dictionary +Foam::faceToFace::faceToFace +( + const polyMesh& mesh, + const dictionary& dict +) +: + topoSetSource(mesh), + setName_(dict.lookup("set")) +{} + + +// Construct from Istream +Foam::faceToFace::faceToFace +( + const polyMesh& mesh, + Istream& is +) +: + topoSetSource(mesh), + setName_(checkIs(is)) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::faceToFace::~faceToFace() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +void Foam::faceToFace::applyToSet +( + const topoSetSource::setAction action, + topoSet& set +) const +{ + if ((action == topoSetSource::NEW) || (action == topoSetSource::ADD)) + { + Info<< " Adding all faces from faceSet " << setName_ << " ..." + << endl; + + // Load the set + faceSet loadedSet(mesh_, setName_); + + set.addSet(loadedSet); + } + else if (action == topoSetSource::DELETE) + { + Info<< " Removing all faces from faceSet " << setName_ << " ..." + << endl; + + // Load the set + faceSet loadedSet(mesh_, setName_); + + set.deleteSet(loadedSet); + } +} + + +// ************************************************************************* // diff --git a/src/meshTools/sets/surfaceRegions/faceToFace/faceToFace.H b/src/meshTools/sets/surfaceRegions/faceToFace/faceToFace.H new file mode 100644 index 000000000..45de3e301 --- /dev/null +++ b/src/meshTools/sets/surfaceRegions/faceToFace/faceToFace.H @@ -0,0 +1,118 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +Class + Foam::faceToFace + +Description + A topoSetSource to select faces based on usage in another faceSet. + +SourceFiles + faceToFace.C + +\*---------------------------------------------------------------------------*/ + +#ifndef faceToFace_H +#define faceToFace_H + +#include "topoSetSource.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class faceToFace Declaration +\*---------------------------------------------------------------------------*/ + +class faceToFace +: + public topoSetSource +{ + // Private data + + //- Add usage string + static addToUsageTable usage_; + + //- Name of set to use + word setName_; + +public: + + //- Runtime type information + TypeName("faceToFace"); + + // Constructors + + //- Construct from components + faceToFace + ( + const polyMesh& mesh, + const word& setName + ); + + //- Construct from dictionary + faceToFace + ( + const polyMesh& mesh, + const dictionary& dict + ); + + //- Construct from Istream + faceToFace + ( + const polyMesh& mesh, + Istream& + ); + + + //- Destructor + virtual ~faceToFace(); + + + // Member Functions + + virtual sourceType setType() const + { + return FACESETSOURCE; + } + + virtual void applyToSet + ( + const topoSetSource::setAction action, + topoSet& + ) const; + +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/meshTools/sets/surfaceRegions/labelToFace/labelToFace.C b/src/meshTools/sets/surfaceRegions/labelToFace/labelToFace.C new file mode 100644 index 000000000..ca61be907 --- /dev/null +++ b/src/meshTools/sets/surfaceRegions/labelToFace/labelToFace.C @@ -0,0 +1,131 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +\*---------------------------------------------------------------------------*/ + +#include "labelToFace.H" +#include "polyMesh.H" + +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ + +defineTypeNameAndDebug(labelToFace, 0); + +addToRunTimeSelectionTable(topoSetSource, labelToFace, word); + +addToRunTimeSelectionTable(topoSetSource, labelToFace, istream); + +} + + +Foam::topoSetSource::addToUsageTable Foam::labelToFace::usage_ +( + labelToFace::typeName, + "\n Usage: labelToFace (i0 i1 .. in)\n\n" + " Select faces by label\n\n" +); + + +// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // + +void Foam::labelToFace::combine(topoSet& set, const bool add) const +{ + forAll(labels_, labelI) + { + addOrDelete(set, labels_[labelI], add); + } +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +// Construct from components +Foam::labelToFace::labelToFace +( + const polyMesh& mesh, + const labelList& labels +) +: + topoSetSource(mesh), + labels_(labels) +{} + + +// Construct from dictionary +Foam::labelToFace::labelToFace +( + const polyMesh& mesh, + const dictionary& dict +) +: + topoSetSource(mesh), + labels_(dict.lookup("value")) +{} + + +// Construct from Istream +Foam::labelToFace::labelToFace +( + const polyMesh& mesh, + Istream& is +) +: + topoSetSource(mesh), + labels_(checkIs(is)) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::labelToFace::~labelToFace() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +void Foam::labelToFace::applyToSet +( + const topoSetSource::setAction action, + topoSet& set +) const +{ + if ((action == topoSetSource::NEW) || (action == topoSetSource::ADD)) + { + Info<< " Adding faces mentioned in dictionary" << " ..." << endl; + + combine(set, true); + } + else if (action == topoSetSource::DELETE) + { + Info<< " Removing faces mentioned dictionary" << " ..." << endl; + + combine(set, false); + } +} + + +// ************************************************************************* // diff --git a/src/meshTools/sets/surfaceRegions/labelToFace/labelToFace.H b/src/meshTools/sets/surfaceRegions/labelToFace/labelToFace.H new file mode 100644 index 000000000..e66ef132f --- /dev/null +++ b/src/meshTools/sets/surfaceRegions/labelToFace/labelToFace.H @@ -0,0 +1,125 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +Class + Foam::labelToFace + +Description + A topoSetSource to select faces given explicitly provided face labels. + +SourceFiles + labelToFace.C + +\*---------------------------------------------------------------------------*/ + +#ifndef labelToFace_H +#define labelToFace_H + +#include "topoSetSource.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class labelToFace Declaration +\*---------------------------------------------------------------------------*/ + +class labelToFace +: + public topoSetSource +{ + + // Private data + + //- Add usage string + static addToUsageTable usage_; + + //- Cell labels read from dictionary + labelList labels_; + + + // Private Member Functions + + void combine(topoSet& set, const bool add) const; + + +public: + + //- Runtime type information + TypeName("labelToFace"); + + // Constructors + + //- Construct from components + labelToFace + ( + const polyMesh& mesh, + const labelList& labels + ); + + //- Construct from dictionary + labelToFace + ( + const polyMesh& mesh, + const dictionary& dict + ); + + //- Construct from Istream + labelToFace + ( + const polyMesh& mesh, + Istream& + ); + + + //- Destructor + virtual ~labelToFace(); + + + // Member Functions + + virtual sourceType setType() const + { + return FACESETSOURCE; + } + + virtual void applyToSet + ( + const topoSetSource::setAction action, + topoSet& + ) const; + +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/meshTools/sets/surfaceRegions/normalToFace/normalToFace.C b/src/meshTools/sets/surfaceRegions/normalToFace/normalToFace.C new file mode 100644 index 000000000..eb289aa68 --- /dev/null +++ b/src/meshTools/sets/surfaceRegions/normalToFace/normalToFace.C @@ -0,0 +1,171 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +\*---------------------------------------------------------------------------*/ + +#include "normalToFace.H" +#include "polyMesh.H" +#include "faceSet.H" + +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ + +defineTypeNameAndDebug(normalToFace, 0); + +addToRunTimeSelectionTable(topoSetSource, normalToFace, word); + +addToRunTimeSelectionTable(topoSetSource, normalToFace, istream); + +} + + +Foam::topoSetSource::addToUsageTable Foam::normalToFace::usage_ +( + normalToFace::typeName, + "\n Usage: normalToFace (nx ny nz) \n\n" + " Select faces with normal aligned to unit vector (nx ny nz)\n" + " to within tol\n" +); + + +// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // + +void Foam::normalToFace::setNormal() +{ + normal_ /= mag(normal_) + VSMALL; + + Info<< " normalToFace : Normalized vector to " << normal_ << endl; + + if (tol_ < -1 || tol_ > 1) + { + FatalErrorInFunction + << "tolerance not within range -1..1 : " << tol_ + << exit(FatalError); + } +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +// Construct from components +Foam::normalToFace::normalToFace +( + const polyMesh& mesh, + const vector& normal, + const scalar tol +) +: + topoSetSource(mesh), + normal_(normal), + tol_(tol) +{ + setNormal(); +} + + +// Construct from dictionary +Foam::normalToFace::normalToFace(const polyMesh& mesh, const dictionary& dict) +: + topoSetSource(mesh), + normal_(dict.lookup("normal")), + tol_(readScalar(dict.lookup("cos"))) +{ + setNormal(); +} + + +// Construct from Istream +Foam::normalToFace::normalToFace(const polyMesh& mesh, Istream& is) +: + topoSetSource(mesh), + normal_(checkIs(is)), + tol_(readScalar(checkIs(is))) +{ + setNormal(); +} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::normalToFace::~normalToFace() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +void Foam::normalToFace::applyToSet +( + const topoSetSource::setAction action, + topoSet& set +) const +{ + if ((action == topoSetSource::NEW) || (action == topoSetSource::ADD)) + { + Info<< " Adding faces according to normal being aligned with " + << normal_ << " (to within " << tol_ << ") ..." << endl; + + forAll(mesh_.faceAreas(), facei) + { + vector n = mesh_.faceAreas()[facei]; + n /= mag(n) + VSMALL; + + if (mag(1 - (n & normal_)) < tol_) + { + set.insert(facei); + } + } + } + else if (action == topoSetSource::DELETE) + { + Info<< " Removing faces according to normal being aligned with " + << normal_ << " (to within " << tol_ << ") ..." << endl; + + + DynamicList