46bool Foam::faBoundaryMesh::hasGroupIDs()
const
51 return !groupIDsPtr_->empty();
68void Foam::faBoundaryMesh::calcGroupIDs()
const
75 groupIDsPtr_.reset(
new HashTable<labelList>(16));
76 auto& groupLookup = *groupIDsPtr_;
84 for (
const word& groupName : groups)
86 groupLookup(groupName).
append(patchi);
97 <<
"' which clashes with patch " << patchi
98 <<
" of the same name."
105bool Foam::faBoundaryMesh::readContents(
const bool allowReadIfPresent)
119 warnNoRereading<faBoundaryMesh>();
124 Istream& is = readStream(typeName);
127 PtrList<entry> patchEntries(is);
138 patchEntries[patchi].keyword(),
139 patchEntries[patchi].
dict(),
192 (void)mesh_.pointAreaNormals();
204 operator[](patchi).initGeometry(pBufs);
211 operator[](patchi).calcGeometry(pBufs);
221 for (
const auto& patchEval : patchSchedule)
223 const label patchi = patchEval.patch;
227 operator[](patchi).initGeometry(pBufs);
231 operator[](patchi).calcGeometry(pBufs);
247 list.
set(patchi, &
patches[patchi].edgeLabels());
263 list.
set(patchi, &
patches[patchi].edgeFaces());
282 list.
set(patchi, lduPtr);
298 if (isA<processorFaPatch>(
p))
318 return *groupIDsPtr_;
324 const word& groupName,
328 groupIDsPtr_.clear();
335 for (
const label patchi : patchIDs)
337 patches[patchi].inGroups().appendUniq(groupName);
338 donePatch[patchi] =
true;
344 if (!donePatch[patchi])
348 if (groups.
found(groupName))
353 if (groups[i] != groupName)
355 groups[newi++] = groups[i];
385 label beg = mesh_.nInternalEdges();
388 const label len =
patches[patchi].nEdges();
399 PtrListOps::get<label>
402 [](
const faPatch&
p) {
return p.nEdges(); }
413 label beg = mesh_.nInternalEdges();
416 const label len =
patches[patchi].nEdges();
417 list[patchi].reset(beg, len);
426 return mesh_.nInternalEdges();
432 return mesh_.nBoundaryEdges();
438 return labelRange(mesh_.nInternalEdges(), mesh_.nBoundaryEdges());
454 const bool checkGroups = (useGroups && this->hasGroupIDs());
462 const auto& groupLookup = groupPatchIDs();
465 if (matcher.
match(iter.key()))
493 else if (checkGroups)
495 const auto iter = groupPatchIDs().cfind(matcher);
519 else if (matcher.
size() == 1)
521 return this->indices(matcher.
first(), useGroups);
527 if (useGroups && this->hasGroupIDs())
529 ids.
resize(2*this->size());
531 const auto& groupLookup = groupPatchIDs();
534 if (matcher.
match(iter.key()))
567 const word& patchName,
571 if (patchName.empty())
586 <<
"Patch '" << patchName <<
"' not found. "
587 <<
"Available patch names: " << names() <<
endl
594 Pout<<
"label faBoundaryMesh::findPatchID(const word&) const"
595 <<
"Patch named " << patchName <<
" not found. "
596 <<
"Available patch names: " << names() <<
endl;
610 if (edgeIndex <
mesh().nInternalEdges())
617 <<
"Edge " << edgeIndex
618 <<
" out of bounds. Number of geometric edges " <<
mesh().
nEdges()
624 label start = mesh_.patchStarts()[patchi];
625 label size = operator[](patchi).faPatch::size();
630 && edgeIndex < start + size
639 <<
"error in patch search algorithm"
655 bool hasError =
false;
665 if (!isA<processorFaPatch>(bm[patchi]))
667 if (nonProci != patchi)
674 Pout<<
" ***Problem with boundary patch " << patchi
675 <<
" name:" << bm[patchi].
name()
676 <<
" type:" << bm[patchi].type()
677 <<
" - seems to be preceeded by processor patches."
678 <<
" This is usually a problem." <<
endl;
683 localNames[nonProci] = bm[patchi].
name();
684 localTypes[nonProci] = bm[patchi].type();
689 localNames.
resize(nonProci);
690 localTypes.
resize(nonProci);
710 if (procNames != localNames || procTypes != localTypes)
716 Info<<
" ***Inconsistent patches across processors, "
717 "processor0 has patch names:" << localNames
718 <<
" patch types:" << localTypes
719 <<
" processor" << proci
720 <<
" has patch names:" << procNames
721 <<
" patch types:" << procTypes
739 bool hasError =
false;
743 if (bm[patchi].start() != nextPatchStart && !hasError)
748 <<
" ****Problem with boundary patch " << patchi
749 <<
" named " << bm[patchi].
name()
750 <<
" of type " << bm[patchi].type()
751 <<
". The patch should start on face no " << nextPatchStart
752 <<
" and the patch specifies " << bm[patchi].
start()
754 <<
"Possibly consecutive patches have this same problem."
755 <<
" Suppressing future warnings." <<
endl;
760 nextPatchStart += bm[patchi].faPatch::size();
766 <<
"This mesh is not valid: boundary definition is in error."
773 Info <<
"Boundary definition OK." <<
endl;
787 (void)mesh_.pointAreaNormals();
799 operator[](patchi).initMovePoints(pBufs,
p);
806 operator[](patchi).movePoints(pBufs,
p);
816 for (
const auto& schedEval : patchSchedule)
818 const label patchi = schedEval.patch;
822 operator[](patchi).initMovePoints(pBufs,
p);
826 operator[](patchi).movePoints(pBufs,
p);
845 operator[](patchi).initUpdateMesh(pBufs);
852 operator[](patchi).updateMesh(pBufs);
862 for (
const auto& schedEval : patchSchedule)
864 const label patchi = schedEval.patch;
868 operator[](patchi).initUpdateMesh(pBufs);
872 operator[](patchi).updateMesh(pBufs);
Functions to operate on Pointer Lists.
globalIndex procAddr(aMesh.nFaces())
bool insert(const Key &key)
Insert a new entry, not overwriting existing entries.
A HashTable similar to std::unordered_map.
List< Key > sortedToc() const
The table of contents (the keys) in sorted order.
bool empty() const noexcept
True if the hash table is empty.
void resize(const label sz)
Resize the hash table for efficiency.
Defines the attributes of an object for which implicit objectRegistry management is supported,...
const word & name() const noexcept
Return the object name.
The IOstreamOption is a simple container for options an IOstream can normally have.
virtual bool check(const char *operation) const
Check IOstream status for given operation.
bool good() const noexcept
True if next operation might succeed.
void resize(const label len)
Adjust allocated size of list.
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
virtual Ostream & endBlock()
Write end block group.
virtual Ostream & beginBlock(const keyType &kw)
Write begin block group with the given name.
Buffers for inter-processor communications streams (UOPstream, UIPstream).
UPstream::commsTypes commsType() const noexcept
The communications type of the stream.
void finishedSends(const bool wait=true)
Mark sends as done.
A list of pointers to objects of type <T>, with allocation/deallocation management of the pointers....
const T * set(const label i) const
void append(T *ptr)
Append an element to the end of the list.
void resize(const label newLen)
Adjust size of PtrList.
const labelUList & indices() const noexcept
Return the list of sorted indices (updated every sort).
static autoPtr< Time > New()
Construct (dummy) Time - no functionObjects or libraries.
T & first()
Return the first element of the list.
bool found(const T &val, label pos=0) const
True if the value if found in the list.
bool empty() const noexcept
True if the UList is empty (ie, size() is zero)
SubList< T > slice(const label pos, label len=-1)
Return SubList slice (non-const access) - no range checking.
void size(const label n)
Older name for setAddressableSize.
@ nonBlocking
"nonBlocking"
static commsTypes defaultCommsType
Default commsType.
static bool & parRun() noexcept
Test if this a parallel run.
A list of pointers to objects of type <T>, without allocation/deallocation management of the pointers...
const T * set(const label i) const
label size() const noexcept
The number of elements in the list.
Finite area boundary mesh.
UPtrList< const labelUList > edgeFaces() const
Return a list of edgeFaces for each patch.
bool checkDefinition(const bool report=false) const
Check boundary definition.
label nNonProcessor() const
The number of patches before the first processor patch.
void calcGeometry()
Calculate the geometry for the patches.
const HashTable< labelList > & groupPatchIDs() const
The patch indices per patch group.
labelList patchStarts() const
Return a list of patch start indices.
lduInterfacePtrsList interfaces() const
labelRange range() const
The edge range for all boundary edges.
wordList types() const
Return a list of patch types.
label findPatchID(const word &patchName, const bool allowNotFound=true) const
Find patch index given a name, return -1 if not found.
bool writeData(Ostream &os) const
The writeData member function required by regIOobject.
void setGroup(const word &groupName, const labelUList &patchIDs)
Set/add group with patches.
virtual bool writeObject(IOstreamOption streamOpt, const bool valid) const
Write using stream options.
List< labelRange > patchRanges() const
Return a list of patch ranges.
label whichPatch(const label edgeIndex) const
Return patch index for a given edge label.
labelList patchSizes() const
Return a list of patch sizes (number of edges in each patch)
wordList names() const
Return a list of patch names.
bool checkParallelSync(const bool report=false) const
Check whether all procs have all patches and in same order.
void updateMesh()
Correct faBoundaryMesh after topology update.
UPtrList< const labelUList > edgeLabels() const
Return a list of edgeLabels for each patch.
label nEdges() const
The number of boundary edges for the underlying mesh.
label findIndex(const wordRe &key) const
Return patch index for the first match, return -1 if not found.
label start() const
The start label of the edges in the faMesh edges list.
Finite area mesh (used for 2-D non-Euclidian finite area method) defined using a patch of faces on a ...
Finite area patch class. Used for 2-D non-Euclidian finite area method.
Calculates a unique integer (label so might not have enough room - 2G max) for processor + local inde...
labelRange range() const
Return start/size range of local processor data.
static void gather(const labelUList &offsets, const label comm, const ProcIDsContainer &procIDs, const UList< Type > &fld, List< Type > &allFld, const int tag=UPstream::msgType(), const UPstream::commsTypes=UPstream::commsTypes::nonBlocking)
Collect data in processor order on master (== procIDs[0]).
labelRange subProcs() const noexcept
Range of process indices for addressed sub-offsets (processes)
const lduSchedule & patchSchedule() const noexcept
A range or interval of labels defined by a start and a size.
An abstract base class for implicitly-coupled interfaces e.g. processor and cyclic patches.
void movePoints()
Update for new mesh geometry.
A class representing the concept of 1 (one) that can be used to avoid manipulating objects known to b...
const globalMeshData & globalData() const
Return parallel info.
label nInternalEdges() const
Internal edges using 0,1 or 2 boundary points.
label nEdges() const
Number of mesh edges.
regIOobject is an abstract class derived from IOobject to handle automatic object registration with t...
virtual bool writeObject(IOstreamOption streamOpt, const bool valid) const
Write using stream options.
splitCell * master() const
@ BEGIN_LIST
Begin list [isseparator].
@ END_LIST
End list [isseparator].
A wordRe is a Foam::word, but can contain a regular expression for matching words or strings.
bool isPattern() const noexcept
The wordRe is a pattern, not a literal string.
bool match(const std::string &text, bool literal=false) const
Smart match as regular expression or as a string.
A List of wordRe with additional matching capabilities.
bool match(const std::string &text, bool literal=false) const
Smart match as literal or regex, stopping on the first match.
A class for handling words, derived from Foam::string.
#define defineTypeNameAndDebug(Type, DebugSwitch)
Define the typeName and debug information.
const polyBoundaryMesh & patches
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
OBJstream os(runTime.globalPath()/outputName)
const labelList nEdges(UPstream::listGatherValues< label >(aMesh.nEdges()))
IOobject io("surfaceFilmProperties", mesh.time().constant(), mesh, IOobject::READ_IF_PRESENT, IOobject::NO_WRITE, false)
#define WarningInFunction
Report a warning using Foam::Warning.
#define InfoInFunction
Report an information message using Foam::Info.
#define SeriousErrorInFunction
Report an error message using Foam::SeriousError.
labelList findMatching(const UPtrList< T > &list, const UnaryMatchPredicate &matcher)
Extract list indices for all items with 'name()' that matches.
label firstMatching(const UPtrList< T > &list, const UnaryMatchPredicate &matcher)
Find first list item with 'name()' that matches, -1 on failure.
List< word > wordList
A List of words.
List< label > labelList
A List of labels.
messageStream Info
Information stream (stdout output on master, null elsewhere)
Ostream & operator<<(Ostream &, const boundaryPatch &p)
Write boundaryPatch as dictionary entries (without surrounding braces)
Ostream & incrIndent(Ostream &os)
Increment the indent level.
Ostream & endl(Ostream &os)
Add newline and flush stream.
void reduce(const List< UPstream::commsStruct > &comms, T &value, const BinaryOp &bop, const int tag, const label comm)
errorManip< error > abort(error &err)
prefixOSstream Pout
OSstream wrapped stdout (std::cout) with parallel prefix.
PtrList< faPatch > faPatchList
Store lists of faPatch as a PtrList.
errorManipArg< error, int > exit(error &err, const int errNo=1)
Ostream & decrIndent(Ostream &os)
Decrement the indent level.
constexpr char nl
The newline '\n' character (0x0a)
#define forAll(list, i)
Loop across all elements in list.
#define forAllConstIters(container, iter)
Iterate across all elements of the container object with const access.
Extract name (as a word) from an object, typically using its name() method.
Extract type (as a word) from an object, typically using its type() method.