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);
133 void operator=(
const ZoneMesh<ZoneType, MeshType>&) =
delete;
151 const MeshType&
mesh,
160 const MeshType&
mesh,
169 const MeshType&
mesh,
178 const MeshType&
mesh,
198 label
whichZone(
const label objectIndex)
const;
204 const label objectIndex,
247 const bool useGroups =
true 256 const bool useGroups =
true 271 const bool useGroups =
true 310 const bool useGroups =
true 321 const bool useGroups =
true 386 ZoneType&
operator()(
const word& zoneName,
const bool verbose=
false);
407 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.
FOAM_DEPRECATED_FOR(2022-09, "get(), set() or test() methods") const T *operator()(const label i) const
Deprecated(2022-09) - same as get()
labelList zoneSizes() const
Return a list of zone sizes.
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
The (sorted) patch indices for all matches, optionally matching zone groups.
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...
MeshType mesh_type
The referenced mesh type.
constexpr auto key(const Type &t) noexcept
Helper function to return the enum value.
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...
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.
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.
bool reindex()
Adjust the index of zone entries to be consistent with their position in the list.
const ZoneType * cfindZone(const word &zoneName) const
Find zone by name and return const pointer, nullptr on error.
virtual 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)
void writeEntry(Ostream &os) const
Write as a plain list of entries.