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
 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 keyType &key) const
 Return zone indices for all matches. More...
 
labelList indices (const wordRes &matcher) const
 Return zone indices for all matches. More...
 
label findIndex (const keyType &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 keyType &key) const
 
bitSet selection (const wordRes &matcher) const
 
void clearAddressing ()
 Clear addressing. More...
 
void clear ()
 Clear the 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...
 
bool writeData (Ostream &os) const
 writeData member function required by regIOobject More...
 
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)
 
labelList findIndices (const keyType &key) const
 Identical to the indices() method (AUG-2018) More...
 
template<class UnaryMatchPredicate >
Foam::wordList namesImpl (const PtrList< ZoneType > &list, const UnaryMatchPredicate &matcher, const bool doSort)
 
template<class UnaryMatchPredicate >
Foam::labelList indicesImpl (const PtrList< ZoneType > &list, const UnaryMatchPredicate &matcher)
 
template<class UnaryMatchPredicate >
Foam::label findIndexImpl (const PtrList< ZoneType > &list, const UnaryMatchPredicate &matcher)
 

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 230 of file ZoneMesh.C.

◆ ZoneMesh() [2/3]

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

Construct given size.

Definition at line 246 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 264 of file ZoneMesh.C.

◆ ~ZoneMesh()

~ZoneMesh ( )

Destructor.

Definition at line 292 of file ZoneMesh.C.

Member Function Documentation

◆ mesh()

const MeshType& mesh ( ) const
inline

Return the mesh reference.

Definition at line 159 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 302 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 315 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 324 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 357 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 367 of file ZoneMesh.C.

◆ sortedNames() [1/3]

Foam::wordList sortedNames ( ) const

Sorted list of the zone names.

Definition at line 377 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 388 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 398 of file ZoneMesh.C.

◆ indices() [1/2]

Foam::labelList indices ( const keyType key) const

Return zone indices for all matches.

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

Definition at line 409 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

Return zone indices for all matches.

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

Definition at line 434 of file ZoneMesh.C.

◆ findIndex() [1/2]

Foam::label findIndex ( const keyType 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 449 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 474 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 518 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 554 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 564 of file ZoneMesh.C.

◆ selection() [2/3]

Foam::bitSet selection ( const keyType key) 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 key

Definition at line 594 of file ZoneMesh.C.

◆ selection() [3/3]

Foam::bitSet selection ( const wordRes matcher) 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 605 of file ZoneMesh.C.

◆ clearAddressing()

void clearAddressing ( )

Clear addressing.

Definition at line 615 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 629 of file ZoneMesh.C.

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

Here is the caller graph for this function:

◆ checkDefinition()

bool checkDefinition ( const bool  report = false) const

Check zone definition. Return true if in error.

Definition at line 638 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 657 of file ZoneMesh.C.

◆ movePoints()

void movePoints ( const pointField pts)

Correct zone mesh after moving points.

Definition at line 733 of file ZoneMesh.C.

◆ writeData()

bool writeData ( Ostream os) const

writeData member function required by regIOobject

Definition at line 745 of file ZoneMesh.C.

◆ 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 756 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 776 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 796 of file ZoneMesh.C.

◆ findIndices()

labelList findIndices ( const keyType key) const
inline

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

Definition at line 310 of file ZoneMesh.H.

◆ namesImpl()

Foam::wordList namesImpl ( const PtrList< ZoneType > &  list,
const UnaryMatchPredicate &  matcher,
const bool  doSort 
)

Definition at line 145 of file ZoneMesh.C.

◆ indicesImpl()

Foam::labelList indicesImpl ( const PtrList< ZoneType > &  list,
const UnaryMatchPredicate &  matcher 
)

Definition at line 180 of file ZoneMesh.C.

◆ findIndexImpl()

Foam::label findIndexImpl ( const PtrList< ZoneType > &  list,
const UnaryMatchPredicate &  matcher 
)

Definition at line 207 of file ZoneMesh.C.

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 123 of file ZoneMesh.H.


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