46 bool Foam::faBoundaryMesh::hasGroupIDs()
const 51 return !groupIDsPtr_->empty();
58 if (!
p.inGroups().empty())
68 void 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." 105 bool Foam::faBoundaryMesh::readContents(
const bool allowReadIfPresent)
110 || (allowReadIfPresent && isReadOptional() && headerOk())
114 warnNoRereading<faBoundaryMesh>();
119 Istream& is = readStream(typeName);
122 PtrList<entry> patchEntries(is);
133 patchEntries[patchi].keyword(),
134 patchEntries[patchi].
dict(),
152 Foam::faBoundaryMesh::faBoundaryMesh
166 Foam::faBoundaryMesh::faBoundaryMesh
187 (void)mesh_.pointAreaNormals();
199 operator[](patchi).initGeometry(pBufs);
202 pBufs.finishedSends();
206 operator[](patchi).calcGeometry(pBufs);
214 pBufs.finishedSends();
216 for (
const auto& patchEval : patchSchedule)
218 const label patchi = patchEval.patch;
222 operator[](patchi).initGeometry(pBufs);
226 operator[](patchi).calcGeometry(pBufs);
242 list.set(patchi, &
patches[patchi].edgeLabels());
258 list.set(patchi, &
patches[patchi].edgeFaces());
273 const lduInterface* lduPtr = isA<lduInterface>(
patches[patchi]);
277 list.set(patchi, lduPtr);
293 if (isA<processorFaPatch>(
p))
313 return *groupIDsPtr_;
319 const word& groupName,
323 groupIDsPtr_.clear();
330 for (
const label patchi : patchIDs)
332 patches[patchi].inGroups().appendUniq(groupName);
333 donePatch[patchi] =
true;
339 if (!donePatch[patchi])
343 if (groups.found(groupName))
348 if (groups[i] != groupName)
350 groups[newi++] = groups[i];
380 label beg = mesh_.nInternalEdges();
383 const label len =
patches[patchi].nEdges();
394 PtrListOps::get<label>
397 [](
const faPatch&
p) {
return p.nEdges(); }
408 label beg = mesh_.nInternalEdges();
411 const label len =
patches[patchi].nEdges();
412 list[patchi].reset(beg, len);
421 return this->groupPatchIDs().sortedToc();
427 return mesh_.nInternalEdges();
433 return mesh_.nBoundaryEdges();
439 return labelRange(mesh_.nInternalEdges(), mesh_.nBoundaryEdges());
455 const bool checkGroups = (useGroups && this->hasGroupIDs());
463 const auto& groupLookup = groupPatchIDs();
466 if (matcher.
match(iter.key()))
469 ids.insert(iter.val());
494 else if (checkGroups)
496 const auto iter = groupPatchIDs().cfind(matcher);
501 ids.insert(iter.val());
506 return ids.sortedToc();
512 const wordRes& matcher,
520 else if (matcher.size() == 1)
522 return this->indices(matcher.first(), useGroups);
528 if (useGroups && this->hasGroupIDs())
530 ids.
resize(2*this->size());
532 const auto& groupLookup = groupPatchIDs();
535 if (matcher.match(iter.key()))
538 ids.insert(iter.val());
552 return ids.sortedToc();
568 const word& patchName,
572 if (patchName.empty())
587 <<
"Patch '" << patchName <<
"' not found. " 588 <<
"Available patch names: " <<
names() <<
endl 595 Pout<<
"label faBoundaryMesh::findPatchID(const word&) const" 596 <<
"Patch named " << patchName <<
" not found. " 597 <<
"Available patch names: " <<
names() <<
endl;
607 if (edgeIndex <
mesh().nInternalEdges())
612 else if (edgeIndex >=
mesh().nEdges())
616 <<
"Edge " << edgeIndex
617 <<
" out of bounds. Number of geometric edges " <<
mesh().
nEdges()
627 label start = mesh_.patchStarts()[patchi];
628 label size = operator[](patchi).faPatch::size();
630 if (edgeIndex >= start && edgeIndex < start + size)
638 <<
"Error in patch search algorithm" 652 const faBoundaryMesh& bm = *
this;
654 bool hasError =
false;
664 if (!isA<processorFaPatch>(bm[patchi]))
666 if (nonProci != patchi)
673 Pout<<
" ***Problem with boundary patch " << patchi
674 <<
" name:" << bm[patchi].
name()
675 <<
" type:" << bm[patchi].
type()
676 <<
" - seems to be preceeded by processor patches." 677 <<
" This is usually a problem." <<
endl;
682 localNames[nonProci] = bm[patchi].
name();
683 localTypes[nonProci] = bm[patchi].
type();
688 localNames.resize(nonProci);
689 localTypes.resize(nonProci);
694 const globalIndex
procAddr(globalIndex::gatherNonLocal{}, nonProci);
705 if (procNames != localNames || procTypes != localTypes)
711 Info<<
" ***Inconsistent patches across processors, " 712 "processor0 has patch names:" << localNames
713 <<
" patch types:" << localTypes
714 <<
" processor" << proci
715 <<
" has patch names:" << procNames
716 <<
" patch types:" << procTypes
730 const faBoundaryMesh& bm = *
this;
732 bool hasError =
false;
736 if (bm[patchi].start() != nextPatchStart && !hasError)
741 <<
" ****Problem with boundary patch " << patchi
742 <<
" named " << bm[patchi].name()
743 <<
" of type " << bm[patchi].type()
744 <<
". The patch should start on face no " << nextPatchStart
745 <<
" and the patch specifies " << bm[patchi].start()
747 <<
"Possibly consecutive patches have this same problem." 748 <<
" Suppressing future warnings." <<
endl;
753 nextPatchStart += bm[patchi].faPatch::size();
759 <<
"This mesh is not valid: boundary definition is in error." 766 Info <<
"Boundary definition OK." <<
endl;
780 (void)mesh_.pointAreaNormals();
792 operator[](patchi).initMovePoints(pBufs,
p);
795 pBufs.finishedSends();
799 operator[](patchi).movePoints(pBufs,
p);
807 pBufs.finishedSends();
809 for (
const auto& schedEval : patchSchedule)
811 const label patchi = schedEval.patch;
815 operator[](patchi).initMovePoints(pBufs,
p);
819 operator[](patchi).movePoints(pBufs,
p);
838 operator[](patchi).initUpdateMesh(pBufs);
841 pBufs.finishedSends();
845 operator[](patchi).updateMesh(pBufs);
853 pBufs.finishedSends();
855 for (
const auto& schedEval : patchSchedule)
857 const label patchi = schedEval.patch;
861 operator[](patchi).initUpdateMesh(pBufs);
865 operator[](patchi).updateMesh(pBufs);
wordList groupNames() const
A list of the group names (if any)
label whichPatch(const label edgeIndex) const
Return patch index for a given edge label.
PtrList< faPatch > faPatchList
Store lists of faPatch as a PtrList.
Finite area mesh (used for 2-D non-Euclidian finite area method) defined using a patch of faces on a ...
List< labelRange > patchRanges() const
Return a list of patch ranges.
virtual const fileName & name() const
Get the name of the output serial stream. (eg, the name of the Fstream file name) ...
static autoPtr< faPatch > New(const word &name, const dictionary &dict, const label index, const faBoundaryMesh &bm)
Return pointer to a new patch created on freestore from dictionary.
labelList indices(const wordRe &matcher, const bool useGroups=true) const
Return (sorted) patch indices for all matches.
labelList findMatching(const UPtrList< T > &list, const UnaryMatchPredicate &matcher)
Extract list indices for all items with 'name()' that matches.
"blocking" : (MPI_Bsend, MPI_Recv)
bool checkDefinition(const bool report=false) const
Check boundary definition.
List< word > names(const UPtrList< T > &list, const UnaryMatchPredicate &matcher)
List of names generated by calling name() for each list item and filtered for matches.
virtual const fileName & name() const
The name of the stream.
bool writeData(Ostream &os) const
The writeData member function required by regIOobject.
errorManipArg< error, int > exit(error &err, const int errNo=1)
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
virtual bool check(const char *operation) const
Check IOstream status for given operation.
lduInterfacePtrsList interfaces() const
Return a list of pointers for each patch with only those pointing to interfaces being set...
void calcGeometry()
Calculate the geometry for the patches.
const word & name() const noexcept
Return the object name.
labelList patchSizes() const
Return a list of patch sizes (number of edges in each patch)
UPtrList< const labelUList > edgeFaces() const
Return a list of edgeFaces for each patch.
A range or interval of labels defined by a start and a size.
constexpr char nl
The newline '\n' character (0x0a)
Type type(bool followLink=true, bool checkGzip=false) const
Return the directory entry type: UNDEFINED, FILE, DIRECTORY (or SYMLINK).
Ostream & endl(Ostream &os)
Add newline and flush stream.
void updateMesh()
Correct faBoundaryMesh after topology update.
static bool & parRun() noexcept
Test if this a parallel run.
Begin list [isseparator].
List< lduScheduleEntry > lduSchedule
A List of lduSchedule entries.
Functions to operate on Pointer Lists.
A simple container for options an IOstream can normally have.
const HashTable< labelList > & groupPatchIDs() const
The patch indices per patch group.
label findIndex(const wordRe &key) const
Return patch index for the first match, return -1 if not found.
UList< label > labelUList
A UList of labels.
labelRange range() const
Return start/size range of local processor data.
void resize(const label sz)
Resize the hash table for efficiency.
Extract name (as a word) from an object, typically using its name() method.
#define SeriousErrorInFunction
Report an error message using Foam::SeriousError.
#define forAll(list, i)
Loop across all elements in list.
HashSet< label, Hash< label > > labelHashSet
A HashSet of labels, uses label hasher.
label findPatchID(const word &patchName, const bool allowNotFound=true) const
Find patch index given a name, return -1 if not found.
vectorField pointField
pointField is a vectorField.
void movePoints(const pointField &)
Correct faBoundaryMesh after moving points.
IOobject io("surfaceFilmProperties", mesh.time().constant(), mesh, IOobject::READ_IF_PRESENT, IOobject::NO_WRITE, false)
"scheduled" : (MPI_Send, MPI_Recv)
wordList names() const
Return a list of patch names.
label size() const noexcept
The number of elements in the list.
virtual Ostream & endBlock()
Write end block group.
UPtrList< const lduInterface > lduInterfacePtrsList
Store lists of lduInterface as a UPtrList.
const globalMeshData & globalData() const
Return parallel info.
A HashTable similar to std::unordered_map.
A list of pointers to objects of type <T>, without allocation/deallocation management of the pointers...
errorManip< error > abort(error &err)
const T * set(const label i) const
Return const pointer to element (can be nullptr), or nullptr for out-of-range access (ie...
label nEdges() const
Number of mesh edges.
A wordRe is a Foam::word, but can contain a regular expression for matching words or strings...
virtual bool writeObject(IOstreamOption streamOpt, const bool valid) const
Write using stream options.
label nInternalEdges() const
Internal edges using 0,1 or 2 boundary points.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
int debug
Static debugging option.
wordList types() const
Return a list of patch types.
OBJstream os(runTime.globalPath()/outputName)
defineTypeNameAndDebug(combustionModel, 0)
Finite area patch class. Used for 2-D non-Euclidian finite area method.
Ostream & decrIndent(Ostream &os)
Decrement the indent level.
Buffers for inter-processor communications streams (UOPstream, UIPstream).
label start() const
The start label of the edges in the faMesh edges list.
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.
labelRange subProcs() const noexcept
Range of process indices for addressed sub-offsets (processes)
void resize(const label newLen)
Adjust size of PtrList.
Ostream & operator<<(Ostream &, const boundaryPatch &p)
Write boundaryPatch as dictionary entries (without surrounding braces)
List< word > wordList
A List of words.
void append(autoPtr< T > &ptr)
Move append an element to the end of the list.
static commsTypes defaultCommsType
Default commsType.
#define WarningInFunction
Report a warning using Foam::Warning.
globalIndex procAddr(aMesh.nFaces())
auto key(const Type &t) -> typename std::enable_if< std::is_enum< Type >::value, typename std::underlying_type< Type >::type >::type
A list of pointers to objects of type <T>, with allocation/deallocation management of the pointers...
label nNonProcessor() const
The number of patches before the first processor patch.
bool good() const noexcept
True if next operation might succeed.
const lduSchedule & patchSchedule() const noexcept
Order in which the patches should be initialised/evaluated corresponding to the schedule.
const polyBoundaryMesh & patches
void setGroup(const word &groupName, const labelUList &patchIDs)
Set/add group with patches.
bool checkParallelSync(const bool report=false) const
Check whether all procs have all patches and in same order.
regIOobject is an abstract class derived from IOobject to handle automatic object registration with t...
"nonBlocking" : (MPI_Isend, MPI_Irecv)
messageStream Info
Information stream (stdout output on master, null elsewhere)
virtual Ostream & beginBlock(const keyType &kw)
Write begin block group with the given name.
bool match(const std::string &text, bool literal=false) const
Smart match as regular expression or as a string.
labelRange range() const
The edge range for all boundary edges.
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]).
List< label > labelList
A List of labels.
virtual bool writeObject(IOstreamOption streamOpt, const bool valid) const
Write using stream options.
bool returnReduceOr(const bool value, const label comm=UPstream::worldComm)
Perform logical (or) MPI Allreduce on a copy. Uses UPstream::reduceOr.
Ostream & incrIndent(Ostream &os)
Increment the indent level.
Defines the attributes of an object for which implicit objectRegistry management is supported...
labelList patchStarts() const
Return a list of patch start indices.
List< bool > boolList
A List of bools.
bool isPattern() const noexcept
The wordRe is a pattern, not a literal string.
prefixOSstream Pout
OSstream wrapped stdout (std::cout) with parallel prefix.
Extract type (as a word) from an object, typically using its type() method.
forAllConstIters(mixture.phases(), phase)
label firstMatching(const UPtrList< T > &list, const UnaryMatchPredicate &matcher)
Find first list item with 'name()' that matches, -1 on failure.
#define InfoInFunction
Report an information message using Foam::Info.