diff --git a/src/meshTools/sets/cellSources/topoSetCellSource/topoSetCellSource.H b/src/meshTools/sets/cellSources/topoSetCellSource/topoSetCellSource.H index b617542a63..2b2276d8f9 100644 --- a/src/meshTools/sets/cellSources/topoSetCellSource/topoSetCellSource.H +++ b/src/meshTools/sets/cellSources/topoSetCellSource/topoSetCellSource.H @@ -5,7 +5,7 @@ \\ / A nd | www.openfoam.com \\/ M anipulation | ------------------------------------------------------------------------------- - Copyright (C) 2018 OpenCFD Ltd. + Copyright (C) 2018-2019 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -124,9 +124,10 @@ public: // Member Functions + //- The source category is a cellSet virtual topoSetSource::sourceType setType() const { - return CELLSETSOURCE; + return CELLSET_SOURCE; } }; diff --git a/src/meshTools/sets/cellZoneSources/setToCellZone/setToCellZone.H b/src/meshTools/sets/cellZoneSources/setToCellZone/setToCellZone.H index c482c8f64e..6104b10888 100644 --- a/src/meshTools/sets/cellZoneSources/setToCellZone/setToCellZone.H +++ b/src/meshTools/sets/cellZoneSources/setToCellZone/setToCellZone.H @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011 OpenFOAM Foundation - Copyright (C) 2018 OpenCFD Ltd. + Copyright (C) 2018-2019 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -32,8 +32,8 @@ Description \heading Dictionary parameters \table - Property | Description | Required | Default - set | The cell set name | yes | + Property | Description | Required | Default + set | The cell set name | yes | \endtable SourceFiles @@ -90,9 +90,10 @@ public: // Member Functions - virtual sourceType setType() const + //- The source category is a cellZone + virtual topoSetSource::sourceType setType() const { - return CELLZONESOURCE; + return CELLZONE_SOURCE; } virtual void applyToSet @@ -100,7 +101,6 @@ public: const topoSetSource::setAction action, topoSet& set ) const; - }; diff --git a/src/meshTools/sets/faceSources/topoSetFaceSource/topoSetFaceSource.H b/src/meshTools/sets/faceSources/topoSetFaceSource/topoSetFaceSource.H index fed00cb39f..ff7021ba96 100644 --- a/src/meshTools/sets/faceSources/topoSetFaceSource/topoSetFaceSource.H +++ b/src/meshTools/sets/faceSources/topoSetFaceSource/topoSetFaceSource.H @@ -5,7 +5,7 @@ \\ / A nd | www.openfoam.com \\/ M anipulation | ------------------------------------------------------------------------------- - Copyright (C) 2018 OpenCFD Ltd. + Copyright (C) 2018-2019 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -124,9 +124,10 @@ public: // Member Functions + //- The source category is a faceSet virtual topoSetSource::sourceType setType() const { - return FACESETSOURCE; + return FACESET_SOURCE; } }; diff --git a/src/meshTools/sets/faceZoneSources/faceZoneToFaceZone/faceZoneToFaceZone.H b/src/meshTools/sets/faceZoneSources/faceZoneToFaceZone/faceZoneToFaceZone.H index 4801c6ba5e..bac4cf627b 100644 --- a/src/meshTools/sets/faceZoneSources/faceZoneToFaceZone/faceZoneToFaceZone.H +++ b/src/meshTools/sets/faceZoneSources/faceZoneToFaceZone/faceZoneToFaceZone.H @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011 OpenFOAM Foundation - Copyright (C) 2018 OpenCFD Ltd. + Copyright (C) 2018-2019 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -94,9 +94,10 @@ public: // Member Functions - virtual sourceType setType() const + //- The source category is a faceZone + virtual topoSetSource::sourceType setType() const { - return FACEZONESOURCE; + return FACEZONE_SOURCE; } virtual void applyToSet @@ -104,7 +105,6 @@ public: const topoSetSource::setAction action, topoSet& set ) const; - }; diff --git a/src/meshTools/sets/faceZoneSources/searchableSurfaceToFaceZone/searchableSurfaceToFaceZone.H b/src/meshTools/sets/faceZoneSources/searchableSurfaceToFaceZone/searchableSurfaceToFaceZone.H index 8669a6e3f9..5db0d4ef05 100644 --- a/src/meshTools/sets/faceZoneSources/searchableSurfaceToFaceZone/searchableSurfaceToFaceZone.H +++ b/src/meshTools/sets/faceZoneSources/searchableSurfaceToFaceZone/searchableSurfaceToFaceZone.H @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2012 OpenFOAM Foundation - Copyright (C) 2018 OpenCFD Ltd. + Copyright (C) 2018-2019 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -116,9 +116,10 @@ public: // Member Functions + //- The source category is a faceZone virtual topoSetSource::sourceType setType() const { - return FACEZONESOURCE; + return FACEZONE_SOURCE; } virtual void applyToSet @@ -126,7 +127,6 @@ public: const topoSetSource::setAction action, topoSet& set ) const; - }; diff --git a/src/meshTools/sets/faceZoneSources/setAndNormalToFaceZone/setAndNormalToFaceZone.H b/src/meshTools/sets/faceZoneSources/setAndNormalToFaceZone/setAndNormalToFaceZone.H index 160615e9e4..de59e08ff1 100644 --- a/src/meshTools/sets/faceZoneSources/setAndNormalToFaceZone/setAndNormalToFaceZone.H +++ b/src/meshTools/sets/faceZoneSources/setAndNormalToFaceZone/setAndNormalToFaceZone.H @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2013 OpenFOAM Foundation - Copyright (C) 2018 OpenCFD Ltd. + Copyright (C) 2018-2019 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -101,9 +101,10 @@ public: // Member Functions - virtual sourceType setType() const + //- The source category is a faceZone + virtual topoSetSource::sourceType setType() const { - return FACEZONESOURCE; + return FACEZONE_SOURCE; } virtual void applyToSet @@ -111,7 +112,6 @@ public: const topoSetSource::setAction action, topoSet& set ) const; - }; diff --git a/src/meshTools/sets/faceZoneSources/setToFaceZone/setToFaceZone.H b/src/meshTools/sets/faceZoneSources/setToFaceZone/setToFaceZone.H index d1309fe2e7..f0151f3735 100644 --- a/src/meshTools/sets/faceZoneSources/setToFaceZone/setToFaceZone.H +++ b/src/meshTools/sets/faceZoneSources/setToFaceZone/setToFaceZone.H @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011 OpenFOAM Foundation - Copyright (C) 2018 OpenCFD Ltd. + Copyright (C) 2018-2019 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -100,9 +100,10 @@ public: // Member Functions - virtual sourceType setType() const + //- The source category is a faceZone + virtual topoSetSource::sourceType setType() const { - return FACEZONESOURCE; + return FACEZONE_SOURCE; } virtual void applyToSet @@ -110,7 +111,6 @@ public: const topoSetSource::setAction action, topoSet& set ) const; - }; diff --git a/src/meshTools/sets/faceZoneSources/setsToFaceZone/setsToFaceZone.H b/src/meshTools/sets/faceZoneSources/setsToFaceZone/setsToFaceZone.H index d1635d3684..0cb09e7f1f 100644 --- a/src/meshTools/sets/faceZoneSources/setsToFaceZone/setsToFaceZone.H +++ b/src/meshTools/sets/faceZoneSources/setsToFaceZone/setsToFaceZone.H @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2013 OpenFOAM Foundation - Copyright (C) 2018 OpenCFD Ltd. + Copyright (C) 2018-2019 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -104,17 +104,17 @@ public: // Member Functions - virtual sourceType setType() const + //- The source category is a pointSet + virtual topoSetSource::sourceType setType() const { - return FACEZONESOURCE; + return FACEZONE_SOURCE; } virtual void applyToSet ( const topoSetSource::setAction action, - topoSet& + topoSet& set ) const; - }; diff --git a/src/meshTools/sets/pointSources/topoSetPointSource/topoSetPointSource.H b/src/meshTools/sets/pointSources/topoSetPointSource/topoSetPointSource.H index 937693e44b..2d938c9a01 100644 --- a/src/meshTools/sets/pointSources/topoSetPointSource/topoSetPointSource.H +++ b/src/meshTools/sets/pointSources/topoSetPointSource/topoSetPointSource.H @@ -5,7 +5,7 @@ \\ / A nd | www.openfoam.com \\/ M anipulation | ------------------------------------------------------------------------------- - Copyright (C) 2018 OpenCFD Ltd. + Copyright (C) 2018-2019 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -124,9 +124,10 @@ public: // Member Functions + //- The source category is a pointSet virtual topoSetSource::sourceType setType() const { - return POINTSETSOURCE; + return POINTSET_SOURCE; } }; diff --git a/src/meshTools/sets/pointZoneSources/setToPointZone/setToPointZone.H b/src/meshTools/sets/pointZoneSources/setToPointZone/setToPointZone.H index e658dffd12..0f6d1ef329 100644 --- a/src/meshTools/sets/pointZoneSources/setToPointZone/setToPointZone.H +++ b/src/meshTools/sets/pointZoneSources/setToPointZone/setToPointZone.H @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011 OpenFOAM Foundation - Copyright (C) 2018 OpenCFD Ltd. + Copyright (C) 2018-2019 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -94,9 +94,10 @@ public: // Member Functions - virtual sourceType setType() const + //- The source category is a pointZone + virtual topoSetSource::sourceType setType() const { - return POINTZONESOURCE; + return POINTZONE_SOURCE; } virtual void applyToSet @@ -104,7 +105,6 @@ public: const topoSetSource::setAction action, topoSet& set ) const; - }; diff --git a/src/meshTools/sets/topoSetSource/topoSetSource.H b/src/meshTools/sets/topoSetSource/topoSetSource.H index 6a09ec501c..a48121871f 100644 --- a/src/meshTools/sets/topoSetSource/topoSetSource.H +++ b/src/meshTools/sets/topoSetSource/topoSetSource.H @@ -61,25 +61,39 @@ class bitSet; class topoSet; /*---------------------------------------------------------------------------*\ - Class topoSetSource Declaration + Class topoSetSource Declaration \*---------------------------------------------------------------------------*/ class topoSetSource { public: - // Public data types + // Public Data Types //- Enumeration defining the types of sources enum sourceType { - CELLSETSOURCE = 0x1, //!< Cells - FACESETSOURCE = 0x2, //!< Faces - POINTSETSOURCE = 0x4, //!< Points + UNKNOWN_SOURCE = 0, //!< Placeholder + SET_SOURCE = 0x10, //!< Source based on topoSet + ZONE_SOURCE = 0x20, //!< Source based on mesh zone + CELL_TYPE = 0x1, //!< Geometric type is "cell" + FACE_TYPE = 0x2, //!< Geometric type is "face" + POINT_TYPE = 0x4, //!< Geometric type is "point" - CELLZONESOURCE = 0x11, //!< Cells as zone - FACEZONESOURCE = 0x12, //!< Faces as zone - POINTZONESOURCE = 0x14, //!< Points as zone + CELLSET_SOURCE = (CELL_TYPE | SET_SOURCE), //!< Cells as set + FACESET_SOURCE = (FACE_TYPE | SET_SOURCE), //!< Faces as set + POINTSET_SOURCE = (POINT_TYPE | SET_SOURCE), //!< Points as set + + CELLZONE_SOURCE = (CELL_TYPE | ZONE_SOURCE), //!< Cells as zone + FACEZONE_SOURCE = (FACE_TYPE | ZONE_SOURCE), //!< Faces as zone + POINTZONE_SOURCE = (POINT_TYPE | ZONE_SOURCE), //!< Points as zone + + CELLSETSOURCE = CELLSET_SOURCE, // Compat (2019-11) + FACESETSOURCE = FACESET_SOURCE, // Compat (2019-11) + POINTSETSOURCE = POINTSET_SOURCE, // Compat (2019-11) + CELLZONESOURCE = CELLZONE_SOURCE, // Compat (2019-11) + FACEZONESOURCE = FACEZONE_SOURCE, // Compat (2019-11) + POINTZONESOURCE = POINTZONE_SOURCE, // Compat (2019-11) }; //- Enumeration defining the valid actions @@ -102,6 +116,8 @@ public: protected: + static const string illegalSource_; + //- A table of usage strings static HashTable* usageTablePtr_; @@ -165,13 +181,6 @@ protected: ) const; -private: - - static const string illegalSource_; - - - // Private Member Functions - //- No copy construct topoSetSource(const topoSetSource&) = delete; @@ -187,16 +196,39 @@ public: // Static Functions - //- Deprecated(2018-07) convert string to action - // \deprecated(2018-07) - use actionNames[] directly - static setAction toAction(const word& actionName) - { - return actionNames[actionName]; - } - //- Check state of stream. static Istream& checkIs(Istream& is); + //- True if a "set" source + static inline bool isSetSource(const sourceType t) + { + return (t & SET_SOURCE); + } + + //- True if a "zone" source + static inline bool isZoneSource(const sourceType t) + { + return (t & ZONE_SOURCE); + } + + //- True if "cell" geometric type + static inline bool isCell(const sourceType t) + { + return (t & CELL_TYPE); + } + + //- True if "face" geometric type + static inline bool isFace(const sourceType t) + { + return (t & FACE_TYPE); + } + + //- True if "point" geometric type + static inline bool isPoint(const sourceType t) + { + return (t & POINT_TYPE); + } + // Declare run-time constructor selection table @@ -319,16 +351,25 @@ public: // Member Functions - //- The type of set being used by the source + //- The source category (set/zone, cell/face/point) virtual sourceType setType() const = 0; //- Apply specified action to the topoSet virtual void applyToSet ( - const setAction action, + const topoSetSource::setAction action, topoSet& set - ) const = 0; + ) const = 0; + + // Housekeeping + + //- Deprecated(2018-07) convert string to action + // \deprecated(2018-07) - use actionNames[] directly + static setAction toAction(const word& actionName) + { + return actionNames[actionName]; + } }; diff --git a/src/meshTools/sets/topoSets/topoSet.C b/src/meshTools/sets/topoSets/topoSet.C index dcb61cb870..9584631a23 100644 --- a/src/meshTools/sets/topoSets/topoSet.C +++ b/src/meshTools/sets/topoSets/topoSet.C @@ -309,6 +309,8 @@ void Foam::topoSet::writeDebug } +// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * // + Foam::IOobject Foam::topoSet::findIOobject ( const polyMesh& mesh, diff --git a/src/meshTools/sets/topoSets/topoSet.H b/src/meshTools/sets/topoSets/topoSet.H index 80908eac16..975320c942 100644 --- a/src/meshTools/sets/topoSets/topoSet.H +++ b/src/meshTools/sets/topoSets/topoSet.H @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation - Copyright (C) 2016-2018 OpenCFD Ltd. + Copyright (C) 2016-2019 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -54,7 +54,7 @@ SourceFiles namespace Foam { -// Forward declarations +// Forward Declarations class mapPolyMesh; class polyMesh; class primitiveMesh; @@ -108,26 +108,6 @@ protected: const label maxLen ) const; - - //- Helper for constructor - return IOobject in the polyMesh/sets - static IOobject findIOobject - ( - const polyMesh& mesh, - const word& name, - readOption r, - writeOption w - ); - - //- Helper for constructor - return IOobject in the polyMesh/sets - static IOobject findIOobject - ( - const Time& runTime, - const word& name, - readOption r, - writeOption w - ); - - //- No copy construct topoSet(const topoSet&) = delete; @@ -140,11 +120,29 @@ public: // Static + //- Debug switch to disallow the use of generic sets + static int disallowGenericSets; + //- Name of file set will use. static fileName localPath(const polyMesh& mesh, const word& name); - //- Debug switch to disallow the use of generic sets - static int disallowGenericSets; + //- Find IOobject in the polyMesh/sets (used as constructor helper) + static IOobject findIOobject + ( + const polyMesh& mesh, + const word& name, + readOption r=MUST_READ, + writeOption w=NO_WRITE + ); + + //- Find IOobject in the polyMesh/sets (used as constructor helper) + static IOobject findIOobject + ( + const Time& runTime, + const word& name, + readOption r=MUST_READ, + writeOption w=NO_WRITE + ); // Declare run-time constructor selection table