38#ifndef Foam_ZoneMesh_H
39#define Foam_ZoneMesh_H
55template<
class ZoneType,
class MeshType>
class ZoneMesh;
57template<
class ZoneType,
class MeshType>
65template<
class ZoneType,
class MeshType>
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();
109 bool readIOcontents(
const bool allowOptionalRead);
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);
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects.
A HashTable similar to std::unordered_map.
Defines the attributes of an object for which implicit objectRegistry management is supported,...
static word groupName(StringType base, const word &group)
Create dot-delimited name.group string.
A HashTable to objects of type <T> with a label key.
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
A list of pointers to objects of type <T>, with allocation/deallocation management of the pointers....
constexpr PtrList() noexcept
label size() const noexcept
The number of entries in the list.
bool checkDefinition(const bool report=false) const
Check zone definition. Return true if in error.
label findZoneID(const word &zoneName) const
Find zone index by name, return -1 if not found.
wordList sortedNames(const wordRes &matcher) const
Sorted list of zone names satisfying the input matchers.
void operator=(const ZoneMesh< ZoneType, MeshType > &)=delete
No copy assignment.
ZoneType & operator[](const word &zoneName)
Return reference to an existing zone by name.
friend Ostream & operator(Ostream &os, const ZoneMesh< ZoneType, MeshType > &zones)
wordList sortedNames() const
Sorted list of the zone names.
wordList names(const wordRe &matcher) const
A list of zone names satisfying the input matcher.
void setGroup(const word &groupName, const labelUList &zoneIDs)
Set/add group with zones.
labelList indices(const wordRes &allow, const wordRes &deny, const bool useGroups=true) const
The (sorted) patch indices: logic as per Foam::wordRes::filter, optionally matching zone groups.
wordList types() const
Return a list of zone types.
virtual bool writeData(Ostream &os) const
The writeData member function required by regIOobject.
bool hasZoneMap() const noexcept
The zoneMap has been allocated.
ZoneType * findZone(const word &zoneName)
Find zone by name and return pointer, nullptr on error.
const ZoneType * cfindZone(const word &zoneName) const
Find zone by name and return const pointer, nullptr on error.
bool reindex()
Adjust the index of zone entries to be consistent with their position in the list.
void clearPrimitives()
Clear primitive addressing.
const faMesh & mesh() const noexcept
void updateMetaData()
Update internal meta-data (eg, prior to writing).
ZoneMesh(const IOobject &io, const MeshType &mesh, Foam::zero)
Construct empty with IOobject properties and a mesh reference. Does not read.
ZoneMesh(const IOobject &io, const MeshType &mesh)
Read construct from IOobject and mesh reference Any reading (mandatory, optional) based on IOobject p...
void writeEntry(const word &keyword, Ostream &os) const
Write as a primitive entry with given name. If the keyword is empty, revert to a plain list.
labelList indices(const wordRes &matcher, const bool useGroups=true) const
The (sorted) patch indices for all matches, optionally matching zone groups.
labelList findIndices(const wordRes &key) const
ZoneMesh(const IOobject &io, const MeshType &mesh, const PtrList< ZoneType > &list)
Read construct (mandatory, optional) based on IOobject properties or use the fallback PtrList (with c...
ZoneMesh(const IOobject &io, const MeshType &mesh, const label size)
Construct with specified size if not read. Any reading (mandatory, optional) based on IOobject proper...
labelList zoneSizes() const
Return a list of zone sizes.
label findIndex(const wordRes &matcher) 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.
static int disallowGenericZones
wordList names(const wordRes &matcher) const
A list of zone names satisfying the input matchers.
label whichZones(const label objectIndex, DynamicList< label > &zones) const
Given a global object index, return (in argument) its zones.
void clearAddressing()
Clear addressing.
bitSet selection(const labelUList &zoneIds) const
Return all elements (cells, faces, points) contained in the listed zones.
void writeEntry(Ostream &os) const
Write as a plain list of entries.
const ZoneType & operator[](const word &zoneName) const
Return const reference to zone by name.
ZoneMesh(const ZoneMesh &)=delete
No copy construct.
void movePoints(const pointField &pts)
Correct zone mesh after moving points.
void clear()
Clear the zones.
wordList groupNames() const
A list of the zone group names (if any).
const HashTable< labelList > & groupZoneIDs() const
The zone indices per zone group.
ZoneMesh(const IOobject &io, const MeshType &mesh, PtrList< entry > &&entries)
Read construct (mandatory, optional) based on IOobject properties or use the fallback PtrList (with c...
label whichZone(const label objectIndex) const
Given a global object index, return the zone it is in.
wordList names() const
A list of the zone names.
bool checkParallelSync(const bool report=false) const
Check whether all procs have all zones and in same order.
bitSet selection(const wordRe &matcher, const bool useGroups=true) const
Return all elements (cells, faces, points) that match the zone specification as a bitSet.
wordList sortedNames(const wordRe &matcher) const
Sorted list of zone names satisfying the input matcher.
bitSet selection(const wordRes &matcher, const bool useGroups=true) const
Return all elements (cells, faces, points) that match the zone specification as a bitSet.
labelList indices(const wordRe &matcher, const bool useGroups=true) const
The (sorted) patch indices for all matches, optionally matching zone groups.
~ZoneMesh()=default
Destructor.
ZoneType & operator()(const word &zoneName, const bool verbose=false)
Find an existing zone by name or create a new empty one if required.
label findIndex(const wordRe &key) const
Zone index for the first match, return -1 if not found.
A bitSet stores bits (elements with only two states) in packed internal format and supports a variety...
regIOobject(const IOobject &io, const bool isTimeObject=false)
Construct from IOobject. The optional flag adds special handling if the object is the top-level regIO...
A wordRe is a Foam::word, but can contain a regular expression for matching words or strings.
A List of wordRe with additional matching capabilities.
A class for handling words, derived from Foam::string.
A class representing the concept of 0 (zero) that can be used to avoid manipulating objects known to ...
OBJstream os(runTime.globalPath()/outputName)
const labelIOList & zoneIDs
List< word > wordList
List of word.
List< label > labelList
A List of labels.
Ostream & operator<<(Ostream &, const boundaryPatch &p)
Write boundaryPatch as dictionary entries (without surrounding braces).
vectorField pointField
pointField is a vectorField.
UList< label > labelUList
A UList of labels.
#define FOAM_DEPRECATED_FOR(since, replacement)