mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: extend topoSetSource::sourceType to support bitmasks
- improves usability in other contexts ENH: expose topoSet::findIOobject as public
This commit is contained in:
committed by
Andrew Heather
parent
492705b0cf
commit
2e57f329f2
@ -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;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@ -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;
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -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;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@ -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;
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -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;
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -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;
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -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;
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -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;
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -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;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@ -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;
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -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<string>* 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];
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -309,6 +309,8 @@ void Foam::topoSet::writeDebug
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //
|
||||
|
||||
Foam::IOobject Foam::topoSet::findIOobject
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
|
||||
@ -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
|
||||
|
||||
Reference in New Issue
Block a user