ZoneMesh< ZoneType, MeshType > Class Template Reference

A list of mesh zones. More...

Inheritance diagram for ZoneMesh< ZoneType, MeshType >:
[legend]

Public Member Functions

 ZoneMesh (const IOobject &io, const MeshType &mesh)
 Read constructor given IOobject and a MeshType reference. More...
 
 ZoneMesh (const IOobject &io, const MeshType &mesh, const label size)
 Construct given size. More...
 
 ZoneMesh (const IOobject &io, const MeshType &mesh, const PtrList< ZoneType > &pzm)
 Construct given a PtrList. More...
 
 ~ZoneMesh ()
 Destructor. More...
 
const MeshType & mesh () const noexcept
 Return the mesh reference. More...
 
const Map< label > & zoneMap () const
 Map of zones containing zone index for all zoned elements. More...
 
label whichZone (const label objectIndex) const
 Given a global object index, return the zone it is in. More...
 
wordList types () const
 Return a list of zone types. More...
 
wordList names () const
 A list of the zone names. More...
 
wordList names (const wordRe &matcher) const
 A list of zone names satisfying the input matcher. More...
 
wordList names (const wordRes &matcher) const
 A list of zone names satisfying the input matchers. More...
 
wordList sortedNames () const
 Sorted list of the zone names. More...
 
wordList sortedNames (const wordRe &matcher) const
 Sorted list of zone names satisfying the input matcher. More...
 
wordList sortedNames (const wordRes &matcher) const
 Sorted list of zone names satisfying the input matchers. More...
 
labelList indices (const wordRe &matcher, const bool useGroups=true) const
 Return (sorted) zone indices for all matches. More...
 
labelList indices (const wordRes &matcher, const bool useGroups=true) const
 Return (sorted) zone indices for all matches. More...
 
label findIndex (const wordRe &key) const
 Zone index for the first match, return -1 if not found. More...
 
label findIndex (const wordRes &matcher) const
 Zone index for the first match, return -1 if not found. More...
 
label findZoneID (const word &zoneName) const
 Find zone index by name, return -1 if not found. More...
 
const ZoneType * cfindZone (const word &zoneName) const
 Find zone by name and return const pointer, nullptr on error. More...
 
ZoneType * findZone (const word &zoneName)
 Find zone by name and return pointer, nullptr on error. More...
 
bitSet selection (const labelUList &zoneIds) const
 
bitSet selection (const wordRe &matcher, const bool useGroups=true) const
 
bitSet selection (const wordRes &matcher, const bool useGroups=true) const
 
const HashTable< labelList > & groupZoneIDs () const
 The zone indices per zone group. More...
 
void setGroup (const word &groupName, const labelUList &zoneIDs)
 Set/add group with zones. More...
 
bool checkDefinition (const bool report=false) const
 Check zone definition. Return true if in error. More...
 
bool checkParallelSync (const bool report=false) const
 Check whether all procs have all zones and in same order. More...
 
void movePoints (const pointField &pts)
 Correct zone mesh after moving points. More...
 
void clearAddressing ()
 Clear addressing. More...
 
void clear ()
 Clear the zones. More...
 
bool hasFaceAreas () const
 
const ZoneType & operator[] (const word &zoneName) const
 Return const reference to zone by name. More...
 
ZoneType & operator[] (const word &zoneName)
 Return reference to an existing zone by name. More...
 
ZoneType & operator() (const word &zoneName, const bool verbose=false)
 
void updateMetaData ()
 Update internal meta-data (eg, prior to writing) More...
 
bool writeData (Ostream &os) const
 The writeData member function required by regIOobject. More...
 
labelList findIndices (const wordRes &key) const
 Identical to the indices() method (AUG-2018) More...
 

Static Public Attributes

static int disallowGenericZones
 Debug switch to disallow the use of generic zones. More...
 

Friends

Ostreamoperator (Ostream &os, const ZoneMesh< ZoneType, MeshType > &zones)
 

Detailed Description

template<class ZoneType, class MeshType>
class Foam::ZoneMesh< ZoneType, MeshType >

A list of mesh zones.

Source files

Definition at line 44 of file cellZoneMeshFwd.H.

Constructor & Destructor Documentation

◆ ZoneMesh() [1/3]

ZoneMesh ( const IOobject io,
const MeshType &  mesh 
)

Read constructor given IOobject and a MeshType reference.

Definition at line 207 of file ZoneMesh.C.

◆ ZoneMesh() [2/3]

ZoneMesh ( const IOobject io,
const MeshType &  mesh,
const label  size 
)

Construct given size.

Definition at line 222 of file ZoneMesh.C.

◆ ZoneMesh() [3/3]

ZoneMesh ( const IOobject io,
const MeshType &  mesh,
const PtrList< ZoneType > &  pzm 
)

Construct given a PtrList.

Definition at line 239 of file ZoneMesh.C.

◆ ~ZoneMesh()

~ZoneMesh ( )

Destructor.

Definition at line 266 of file ZoneMesh.C.

Member Function Documentation

◆ mesh()

const MeshType& mesh ( ) const
inlinenoexcept

Return the mesh reference.

Definition at line 142 of file ZoneMesh.H.

◆ zoneMap()

const Foam::Map< Foam::label > & zoneMap ( ) const

Map of zones containing zone index for all zoned elements.

Return -1 if the object is not in the zone

Definition at line 276 of file ZoneMesh.C.

◆ whichZone()

Foam::label whichZone ( const label  objectIndex) const

Given a global object index, return the zone it is in.

If object does not belong to any zones, return -1

Definition at line 289 of file ZoneMesh.C.

Referenced by cyclicAMIPolyPatch::addAMIFaces(), meshRefinement::mergeBaffles(), polyMeshAdder::mergePoints(), removeCells::setRefinement(), perfectInterface::setRefinement(), and edgeCollapser::setRefinement().

Here is the caller graph for this function:

◆ types()

Foam::wordList types ( ) const

Return a list of zone types.

Definition at line 298 of file ZoneMesh.C.

◆ names() [1/3]

◆ names() [2/3]

Foam::wordList names ( const wordRe matcher) const

A list of zone names satisfying the input matcher.

Definition at line 313 of file ZoneMesh.C.

◆ names() [3/3]

Foam::wordList names ( const wordRes matcher) const

A list of zone names satisfying the input matchers.

Definition at line 323 of file ZoneMesh.C.

◆ sortedNames() [1/3]

Foam::wordList sortedNames ( ) const

Sorted list of the zone names.

Definition at line 333 of file ZoneMesh.C.

◆ sortedNames() [2/3]

Foam::wordList sortedNames ( const wordRe matcher) const

Sorted list of zone names satisfying the input matcher.

Definition at line 344 of file ZoneMesh.C.

◆ sortedNames() [3/3]

Foam::wordList sortedNames ( const wordRes matcher) const

Sorted list of zone names satisfying the input matchers.

Definition at line 357 of file ZoneMesh.C.

◆ indices() [1/2]

Foam::labelList indices ( const wordRe matcher,
const bool  useGroups = true 
) const

Return (sorted) zone indices for all matches.

Optionally matches zone groups. A no-op (returns empty list) for an empty matcher

Definition at line 371 of file ZoneMesh.C.

Referenced by ZoneMesh< cellZone, polyMesh >::findIndices(), multiphaseMangrovesTurbulenceModel::read(), and sampledFaceZone::zoneIDs().

Here is the caller graph for this function:

◆ indices() [2/2]

Foam::labelList indices ( const wordRes matcher,
const bool  useGroups = true 
) const

Return (sorted) zone indices for all matches.

Optionally matches zone groups. A no-op (returns empty list) for an empty matcher

Definition at line 444 of file ZoneMesh.C.

◆ findIndex() [1/2]

Foam::label findIndex ( const wordRe key) const

Zone index for the first match, return -1 if not found.

A no-op (returns -1) for an empty key

Definition at line 491 of file ZoneMesh.C.

Referenced by sampledCuttingPlane::sampledCuttingPlane(), sampledInterface::sampledInterface(), sampledIsoSurface::sampledIsoSurface(), and sampledPlane::sampledPlane().

Here is the caller graph for this function:

◆ findIndex() [2/2]

Foam::label findIndex ( const wordRes matcher) const

Zone index for the first match, return -1 if not found.

A no-op (returns -1) for an empty matcher

Definition at line 505 of file ZoneMesh.C.

◆ findZoneID()

◆ cfindZone()

const ZoneType * cfindZone ( const word zoneName) const

Find zone by name and return const pointer, nullptr on error.

A no-op (returns nullptr) for an empty zoneName

Definition at line 553 of file ZoneMesh.C.

◆ findZone()

ZoneType * findZone ( const word zoneName)

Find zone by name and return pointer, nullptr on error.

A no-op (returns nullptr) for an empty zoneName

Definition at line 589 of file ZoneMesh.C.

◆ selection() [1/3]

Foam::bitSet selection ( const labelUList zoneIds) const

Return all elements (cells, faces, points) contained in the listed zones.

The bitSet is empty (zero-size) if there are no elements matched anywhere.

Definition at line 599 of file ZoneMesh.C.

◆ selection() [2/3]

Foam::bitSet selection ( const wordRe matcher,
const bool  useGroups = true 
) const

Return all elements (cells, faces, points) that match the zone specification as a bitSet.

The bitSet is empty (zero-size) if there are no elements matched anywhere. Optionally matches zoneGroups. A no-op (returns empty bitSet) for an empty matcher

Definition at line 629 of file ZoneMesh.C.

◆ selection() [3/3]

Foam::bitSet selection ( const wordRes matcher,
const bool  useGroups = true 
) const

Return all elements (cells, faces, points) that match the zone specification as a bitSet.

The bitSet is empty (zero-size) if there are no elements matched anywhere. A no-op (returns empty bitSet) for an empty matcher

Definition at line 641 of file ZoneMesh.C.

◆ groupZoneIDs()

const Foam::HashTable< Foam::labelList > & groupZoneIDs ( ) const

The zone indices per zone group.

Definition at line 653 of file ZoneMesh.C.

◆ setGroup()

void setGroup ( const word groupName,
const labelUList zoneIDs 
)

Set/add group with zones.

Definition at line 666 of file ZoneMesh.C.

◆ checkDefinition()

bool checkDefinition ( const bool  report = false) const

Check zone definition. Return true if in error.

Definition at line 733 of file ZoneMesh.C.

◆ checkParallelSync()

bool checkParallelSync ( const bool  report = false) const

Check whether all procs have all zones and in same order.

Returns
True if any errors.

Definition at line 752 of file ZoneMesh.C.

◆ movePoints()

void movePoints ( const pointField pts)

Correct zone mesh after moving points.

Definition at line 828 of file ZoneMesh.C.

◆ clearAddressing()

void clearAddressing ( )

Clear addressing.

Definition at line 709 of file ZoneMesh.C.

Referenced by interRegionExplicitPorositySource::initialise(), polyMesh::updateMesh(), cellZoneSet::writeObject(), pointZoneSet::writeObject(), and faceZoneSet::writeObject().

Here is the caller graph for this function:

◆ clear()

void clear ( )

Clear the zones.

Definition at line 724 of file ZoneMesh.C.

Referenced by cellTable::addCellZones(), blockMesh::mesh(), and fvMeshTools::newMesh().

Here is the caller graph for this function:

◆ hasFaceAreas()

bool hasFaceAreas ( ) const
inline

Definition at line 270 of file ZoneMesh.H.

◆ operator[]() [1/2]

const ZoneType & operator[] ( const word zoneName) const

Return const reference to zone by name.

Fatal if the zone does not exist.

Definition at line 867 of file ZoneMesh.C.

◆ operator[]() [2/2]

ZoneType & operator[] ( const word zoneName)

Return reference to an existing zone by name.

Fatal if the zone does not exist.

Definition at line 887 of file ZoneMesh.C.

◆ operator()()

ZoneType & operator() ( const word zoneName,
const bool  verbose = false 
)

Find an existing zone by name or create a new empty one if required.

To determine if the zone already existed or was newly created, it will be necessary to add additional logic in the caller. For example,

const label nOrig = zones.size();
ZoneType& zn = zones("zoneName");
if (nOrig == zones.size()) { existing... } else { new... }
Parameters
zoneNamethe name of the zone
verbosereport if an existing zone was selected or a new zone was created.
Returns
non-const reference to the existing or new zone

Definition at line 907 of file ZoneMesh.C.

◆ updateMetaData()

void updateMetaData ( )

Update internal meta-data (eg, prior to writing)

Definition at line 840 of file ZoneMesh.C.

◆ writeData()

bool writeData ( Ostream os) const

The writeData member function required by regIOobject.

Definition at line 856 of file ZoneMesh.C.

◆ findIndices()

labelList findIndices ( const wordRes key) const
inline

Identical to the indices() method (AUG-2018)

Definition at line 328 of file ZoneMesh.H.

Friends And Related Function Documentation

◆ operator

Ostream& operator ( Ostream os,
const ZoneMesh< ZoneType, MeshType > &  zones 
)
friend

Member Data Documentation

◆ disallowGenericZones

int disallowGenericZones
static

Debug switch to disallow the use of generic zones.

Definition at line 106 of file ZoneMesh.H.


The documentation for this class was generated from the following files: