38 #ifndef Foam_ZoneMesh_H 39 #define Foam_ZoneMesh_H 55 template<
class ZoneType,
class MeshType>
class ZoneMesh;
57 template<
class ZoneType,
class MeshType>
58 Ostream& operator<<(Ostream& os, const ZoneMesh<ZoneType, MeshType>& zones);
65 template<
class ZoneType,
class MeshType>
68 public PtrList<ZoneType>,
74 const MeshType& mesh_;
77 mutable std::unique_ptr<Map<label>> zoneMapPtr_;
81 mutable std::unique_ptr<labelListList> additionalMapPtr_;
84 mutable std::unique_ptr<HashTable<labelList>> groupIDsPtr_;
90 label totalSize()
const;
93 void calcZoneMap()
const;
96 bool hasGroupIDs()
const;
99 void calcGroupIDs()
const;
102 void clearLocalAddressing();
105 void populate(PtrList<entry>&& entries);
109 bool readIOcontents(
const bool allowOptionalRead);
130 void operator=(
const ZoneMesh<ZoneType, MeshType>&) =
delete;
148 const MeshType&
mesh,
157 const MeshType&
mesh,
166 const MeshType&
mesh,
175 const MeshType&
mesh,
195 label
whichZone(
const label objectIndex)
const;
201 const label objectIndex,
236 const bool useGroups =
true 245 const bool useGroups =
true 257 const bool useGroups =
true 296 const bool useGroups =
true 307 const bool useGroups =
true 372 ZoneType&
operator()(
const word& zoneName,
const bool verbose=
false);
386 friend Ostream& operator<< <ZoneType, MeshType>
bool checkParallelSync(const bool report=false) const
Check whether all procs have all zones and in same order.
const labelIOList & zoneIDs
wordList types() const
Return a list of zone types.
void clearAddressing()
Clear addressing.
ZoneType * findZone(const word &zoneName)
Find zone by name and return pointer, nullptr on error.
void clear()
Clear the zones.
label findIndex(const wordRe &key) const
Zone index for the first match, return -1 if not found.
const Map< label > & zoneMap() const
Map of zones containing zone index for all zoned elements.
List< bool > select(const label n, const labelUList &locations)
Construct a selection list of bools (all false) with the given pre-size, subsequently add specified l...
FOAM_DEPRECATED_FOR(2022-09, "get(), set() or test() methods") const T *operator()(const label i) const
Deprecated(2022-09) - same as get()
const MeshType & mesh() const noexcept
Return the mesh reference.
void movePoints(const pointField &pts)
Correct zone mesh after moving points.
static word groupName(StringType base, const word &group)
Create dot-delimited name.group string.
labelList findIndices(const wordRes &key) const
Identical to the indices() method (AUG-2018)
labelList indices(const wordRe &matcher, const bool useGroups=true) const
Return (sorted) zone indices for all matches.
label findZoneID(const word &zoneName) const
Find zone index by name, return -1 if not found.
A class for handling words, derived from Foam::string.
void setGroup(const word &groupName, const labelUList &zoneIDs)
Set/add group with zones.
label size() const noexcept
The number of entries in the list.
~ZoneMesh()=default
Destructor.
A List of wordRe with additional matching capabilities.
void clearPrimitives()
Clear primitive addressing.
A HashTable similar to std::unordered_map.
A wordRe is a Foam::word, but can contain a regular expression for matching words or strings...
An Ostream is an abstract base class for all output systems (streams, files, token lists...
OBJstream os(runTime.globalPath()/outputName)
const ZoneType & operator[](const word &zoneName) const
Return const reference to zone by name.
label whichZone(const label objectIndex) const
Given a global object index, return the zone it is in.
ZoneMesh(const ZoneMesh &)=delete
No copy construct.
A bitSet stores bits (elements with only two states) in packed internal format and supports a variety...
auto key(const Type &t) -> typename std::enable_if< std::is_enum< Type >::value, typename std::underlying_type< Type >::type >::type
wordList groupNames() const
A list of the zone group names (if any)
bool checkDefinition(const bool report=false) const
Check zone definition. Return true if in error.
wordList names() const
A list of the zone names.
bitSet selection(const labelUList &zoneIds) const
Return all elements (cells, faces, points) contained in the listed zones.
A class representing the concept of 0 (zero) that can be used to avoid manipulating objects known to ...
ZoneType zone_type
The zone type. Same as PtrList<ZoneType>::value_type.
bool hasZoneMap() const noexcept
The zoneMap has been allocated.
wordList sortedNames() const
Sorted list of the zone names.
ZoneType & operator()(const word &zoneName, const bool verbose=false)
Find an existing zone by name or create a new empty one if required.
IOobject io("surfaceFilmProperties", mesh.time().constant(), mesh, IOobject::READ_IF_PRESENT, IOobject::NO_WRITE, IOobject::NO_REGISTER)
label whichZones(const label objectIndex, DynamicList< label > &zones) const
Given a global object index, return (in argument) its zones.
void operator=(const ZoneMesh< ZoneType, MeshType > &)=delete
No copy assignment.
Defines the attributes of an object for which implicit objectRegistry management is supported...
static int disallowGenericZones
Debug switch to disallow the use of generic zones.
const ZoneType * cfindZone(const word &zoneName) const
Find zone by name and return const pointer, nullptr on error.
bool writeData(Ostream &os) const
The writeData member function required by regIOobject.
const HashTable< labelList > & groupZoneIDs() const
The zone indices per zone group.
void updateMetaData()
Update internal meta-data (eg, prior to writing)