46 Foam::polyBoundaryMesh::polyBoundaryMesh
66 "polyBoundaryMesh::polyBoundaryMesh\n" 71 ) <<
"Specified IOobject::MUST_READ_IF_MODIFIED but class" 72 <<
" does not support automatic rereading." 80 Istream& is = readStream(typeName);
92 patchEntries[patchI].keyword(),
93 patchEntries[patchI].
dict(),
103 "polyBoundaryMesh::polyBoundaryMesh" 104 "(const IOobject&, const polyMesh&)" 112 Foam::polyBoundaryMesh::polyBoundaryMesh
125 Foam::polyBoundaryMesh::polyBoundaryMesh
148 "polyBoundaryMesh::polyBoundaryMesh\n" 150 " const IOobject&,\n" 152 " const polyPatchList&\n" 154 ) <<
"Specified IOobject::MUST_READ_IF_MODIFIED but class" 155 <<
" does not support automatic rereading." 162 Istream& is = readStream(typeName);
174 patchEntries[patchI].keyword(),
175 patchEntries[patchI].
dict(),
185 "polyBoundaryMesh::polyBoundaryMesh" 186 "(const IOobject&, const polyMesh&, const polyPatchList&)" 197 patches.
set(patchI, ppl[patchI].clone(*this).ptr());
213 operator[](patchI).clearGeom();
220 neighbourEdgesPtr_.clear();
222 groupPatchIDsPtr_.clear();
226 operator[](patchI).clearAddressing();
233 void Foam::polyBoundaryMesh::calcGeometry()
245 operator[](patchI).initGeometry(pBufs);
252 operator[](patchI).calcGeometry(pBufs);
262 forAll(patchSchedule, patchEvali)
264 const label patchI = patchSchedule[patchEvali].patch;
266 if (patchSchedule[patchEvali].init)
268 operator[](patchI).initGeometry(pBufs);
272 operator[](patchI).calcGeometry(pBufs);
284 WarningIn(
"polyBoundaryMesh::neighbourEdges() const")
285 <<
"Neighbour edge addressing not correct across parallel" 286 <<
" boundaries." <<
endl;
289 if (!neighbourEdgesPtr_.valid())
295 label nEdgePairs = 0;
298 const polyPatch& pp = operator[](patchI);
302 forAll(neighbourEdges[patchI], i)
304 labelPair& edgeInfo = neighbourEdges[patchI][i];
319 const polyPatch& pp = operator[](patchI);
326 edgei < edges.
size();
331 const edge&
e = edges[edgei];
337 pointsToEdge.
find(meshEdge);
339 if (fnd == pointsToEdge.
end())
361 neighbourEdges[edgeInfo[0]][edgeInfo[1]]
367 pointsToEdge.
erase(meshEdge);
372 if (pointsToEdge.
size())
374 FatalErrorIn(
"polyBoundaryMesh::neighbourEdges() const")
375 <<
"Not all boundary edges of patches match up." <<
nl 376 <<
"Is the outside of your mesh multiply connected?" 382 const polyPatch& pp = operator[](patchI);
390 if (edgeInfo[0] == -1 || edgeInfo[1] == -1)
395 FatalErrorIn(
"polyBoundaryMesh::neighbourEdges() const")
396 <<
"Not all boundary edges of patches match up." <<
nl 397 <<
"Edge " << edgeI <<
" on patch " << pp.
name()
399 << pp.
localPoints()[e[1]] <<
" is not matched to an" 400 <<
" edge on any other patch." <<
nl 401 <<
"Is the outside of your mesh multiply connected?" 408 return neighbourEdgesPtr_();
414 if (!patchIDPtr_.valid())
421 - mesh_.nInternalFaces()
430 label bFaceI = bm[patchI].start() - mesh_.nInternalFaces();
433 patchID[bFaceI++] = patchI;
437 return patchIDPtr_();
444 if (!groupPatchIDsPtr_.valid())
453 const wordList& groups = bm[patchI].inGroups();
459 if (findPatchID(name) != -1)
461 WarningIn(
"polyBoundaryMesh::groupPatchIDs() const")
462 <<
"Patch " << bm[patchI].
name()
463 <<
" specifies a group " << name
464 <<
" which is also a patch name." 465 <<
" This might give problems later on." <<
endl;
474 if (iter != groupPatchIDs.
end())
476 iter().append(patchI);
485 return groupPatchIDsPtr_();
491 const word& groupName,
495 groupPatchIDsPtr_.clear();
504 label patchI = patchIDs[i];
511 donePatch[patchI] =
true;
517 if (!donePatch[patchI])
528 if (groups[i] != groupName)
530 groups[newI++] = groups[i];
548 t[patchI] = patches[patchI].name();
563 t[patchI] = patches[patchI].type();
578 t[patchI] = patches[patchI].physicalType();
588 const bool usePatchGroups
599 if (usePatchGroups && groupPatchIDs().size())
603 const wordList allGroupNames = groupPatchIDs().toc();
607 const word& grpName = allGroupNames[groupIDs[i]];
608 const labelList& patchIDs = groupPatchIDs()[grpName];
611 if (indexSet.
insert(patchIDs[j]))
613 indices.
append(patchIDs[j]);
627 if (key ==
operator[](i).
name())
634 if (usePatchGroups && groupPatchIDs().size())
637 groupPatchIDs().find(key);
639 if (iter != groupPatchIDs().end())
646 if (indexSet.
insert(patchIDs[j]))
648 indices.
append(patchIDs[j]);
669 if (!indices.
empty())
678 if (key ==
operator[](i).
name())
697 if (patches[patchI].
name() == patchName)
706 Pout<<
"label polyBoundaryMesh::findPatchID(const word&) const" 707 <<
"Patch named " << patchName <<
" not found. " 708 <<
"List of available patch names: " << names() <<
endl;
722 if (faceIndex <
mesh().nInternalFaces())
726 else if (faceIndex >=
mesh().nFaces())
730 "polyBoundaryMesh::whichPatch(const label faceIndex) const" 731 ) <<
"given label " << faceIndex
732 <<
" greater than the number of geometric faces " <<
mesh().
nFaces()
739 const polyPatch& bp = operator[](patchI);
743 faceIndex >= bp.
start()
744 && faceIndex < bp.
start() + bp.size()
754 "label polyBoundaryMesh::whichPatch(const label faceIndex) const" 755 ) <<
"Cannot find face " << faceIndex <<
" in any of the patches " 757 <<
"It seems your patches are not consistent with the mesh :" 759 <<
" total number of faces:" <<
mesh().
nFaces()
769 const bool warnNotFound,
770 const bool usePatchGroups
773 const wordList allPatchNames(this->names());
778 const wordRe& patchName = patchNames[i];
789 if (patchIDs.
empty())
793 const wordList allGroupNames = groupPatchIDs().toc();
800 const word&
name = allGroupNames[groupIDs[i]];
803 forAll(extraPatchIDs, extraI)
805 ids.
insert(extraPatchIDs[extraI]);
809 if (groupIDs.
empty() && warnNotFound)
813 "polyBoundaryMesh::patchSet" 814 "(const wordReList&, const bool, const bool) const" 815 ) <<
"Cannot find any patch or group names matching " 820 else if (warnNotFound)
824 "polyBoundaryMesh::patchSet" 825 "(const wordReList&, const bool, const bool) const" 826 ) <<
"Cannot find any patch names matching " << patchName
853 groupPatchIDs.
begin();
854 iter != groupPatchIDs.
end();
865 label nMatch = nonGroupPatches.
erase(groupPatchSet);
867 if (nMatch == groupPatchSet.
size())
869 matchedGroups.
append(iter.key());
871 else if (nMatch != 0)
874 nonGroupPatches.
transfer(oldNonGroupPatches);
892 bool hasError =
false;
902 if (!isA<processorPolyPatch>(bm[patchI]))
904 if (nonProcI != patchI)
911 Pout<<
" ***Problem with boundary patch " << patchI
912 <<
" named " << bm[patchI].
name()
913 <<
" of type " << bm[patchI].type()
914 <<
". The patch seems to be preceeded by processor" 915 <<
" patches. This is can give problems." 921 names[nonProcI] = bm[patchI].
name();
922 types[nonProcI] = bm[patchI].type();
928 types.setSize(nonProcI);
942 for (
label procI = 1; procI < allNames.
size(); ++procI)
946 (allNames[procI] != allNames[0])
947 || (allTypes[procI] != allTypes[0])
954 Info<<
" ***Inconsistent patches across processors, " 955 "processor 0 has patch names:" << allNames[0]
956 <<
" patch types:" << allTypes[0]
957 <<
" processor " << procI <<
" has patch names:" 959 <<
" patch types:" << allTypes[procI]
974 bool hasError =
false;
980 if (bm[patchI].start() != nextPatchStart && !hasError)
984 Info<<
" ****Problem with boundary patch " << patchI
985 <<
" named " << bm[patchI].
name()
986 <<
" of type " << bm[patchI].type()
987 <<
". The patch should start on face no " << nextPatchStart
988 <<
" and the patch specifies " << bm[patchI].start()
990 <<
"Possibly consecutive patches have this same problem." 991 <<
" Suppressing future warnings." <<
endl;
994 if (!patchNames.
insert(bm[patchI].
name()) && !hasError)
998 Info<<
" ****Duplicate boundary patch " << patchI
999 <<
" named " << bm[patchI].
name()
1000 <<
" of type " << bm[patchI].type()
1002 <<
"Suppressing future warnings." <<
endl;
1005 nextPatchStart += bm[patchI].
size();
1010 if (debug || report)
1014 Pout<<
" ***Boundary definition is in error." <<
endl;
1018 Info<<
" Boundary definition OK." <<
endl;
1038 operator[](patchI).initMovePoints(pBufs, p);
1045 operator[](patchI).movePoints(pBufs, p);
1055 forAll(patchSchedule, patchEvali)
1057 const label patchI = patchSchedule[patchEvali].patch;
1059 if (patchSchedule[patchEvali].init)
1061 operator[](patchI).initMovePoints(pBufs, p);
1065 operator[](patchI).movePoints(pBufs, p);
1074 neighbourEdgesPtr_.clear();
1075 patchIDPtr_.clear();
1076 groupPatchIDsPtr_.clear();
1088 operator[](patchI).initUpdateMesh(pBufs);
1095 operator[](patchI).updateMesh(pBufs);
1105 forAll(patchSchedule, patchEvali)
1107 const label patchI = patchSchedule[patchEvali].patch;
1109 if (patchSchedule[patchEvali].init)
1111 operator[](patchI).initUpdateMesh(pBufs);
1115 operator[](patchI).updateMesh(pBufs);
1125 const bool validBoundary
1136 patches[patchI].index() = patchI;
1154 os <<
indent << patches[patchI].name() << nl
1163 os.
check(
"polyBoundaryMesh::writeData(Ostream& os) const");
1183 const word& patchName
1186 const label patchI = findPatchID(patchName);
1192 "polyBoundaryMesh::operator[](const word&) const" 1193 ) <<
"Patch named " << patchName <<
" not found." <<
nl 1194 <<
"Available patch names: " << names() <<
endl 1198 return operator[](patchI);
1204 const word& patchName
1207 const label patchI = findPatchID(patchName);
1213 "polyBoundaryMesh::operator[](const word&)" 1214 ) <<
"Patch named " << patchName <<
" not found." <<
nl 1215 <<
"Available patch names: " << names() <<
endl 1219 return operator[](patchI);
void reduce(const List< UPstream::commsStruct > &comms, T &Value, const BinaryOp &bop, const int tag, const label comm)
static bool & parRun()
Is this a parallel run?
void setSize(const label)
Reset size of PtrList. If extending the PtrList, new entries are.
Buffers for inter-processor communications streams (UOPstream, UIPstream).
void setCapacity(const label)
Alter the size of the underlying storage.
~polyBoundaryMesh()
Destructor.
label size() const
Return the number of elements in the PtrList.
bool set(const label) const
Is element set.
An ordered pair of two objects of type <T> with first() and second() elements.
const word & name() const
Return name.
A templated 1D list of pointers to objects of type <T>, where the size of the array is known and used...
bool erase(const iterator &)
Erase a hashedEntry specified by given iterator.
void transfer(List< T > &)
Transfer the contents of the argument List into this list.
wordList patchNames(nPatches)
An STL-conforming const_iterator.
word name(const complex &)
Return a string representation of a complex.
static void gatherList(const List< commsStruct > &comms, List< T > &Values, const int tag, const label comm)
Gather data but keep individual values separate.
virtual bool writeObject(IOstream::streamFormat, IOstream::versionNumber, IOstream::compressionType) const
Write using given format, version and compression.
bool empty() const
Return true if the UList is empty (ie, size() is zero).
bool insert(const Key &, const T &newElmt)
Insert a new hashedEntry.
An STL-conforming iterator.
Ostream & indent(Ostream &os)
Indent stream.
An STL-conforming hash table.
bool checkParallelSync(const bool report=false) const
Check whether all procs have all patches and in same order. Return.
An Istream is an abstract base class for all input systems (streams, files, token lists etc)...
A class for handling words, derived from string.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
void size(const label)
Override size to be inconsistent with allocated storage.
wordList physicalTypes() const
Return a list of physical types.
DynamicList< T, SizeInc, SizeMult, SizeDiv > & append(const T &)
Append an element at the end of the list.
bool isPattern() const
Should be treated as a match rather than a literal string.
void updateMesh()
Correct polyBoundaryMesh after topology update.
const List< labelPairList > & neighbourEdges() const
Per patch the edges on the neighbouring patch. Is for every external.
An STL-conforming iterator.
static void scatterList(const List< commsStruct > &comms, List< T > &Values, const int tag, const label comm)
Scatter data. Reverse of gatherList.
bool checkDefinition(const bool report=false) const
Check boundary definition. Return true if in error.
friend Ostream & operator(Ostream &, const PtrList< T > &)
Ostream & operator<<(Ostream &, const edgeMesh &)
An edge is a list of two point labels. The functionality it provides supports the discretisation on a...
A class for handling keywords in dictionaries.
const HashTable< labelList, word > & groupPatchIDs() const
Per patch group the patch indices.
A patch is a list of labels that address the faces in the global face list.
virtual bool check(const char *operation) const
Check IOstream status for given operation.
wordList names() const
Return a list of patch names.
PtrList< polyPatch > polyPatchList
container classes for polyPatch
Ostream & incrIndent(Ostream &os)
Increment the indent level.
const Field< PointType > & localPoints() const
Return pointField of points in patch.
static label nProcs(const label communicator=0)
Number of processes in parallel run.
const double e
Elementary charge.
void setSize(const label)
Reset size of List.
wordList types() const
Return a list of patch types.
Ostream & endl(Ostream &os)
Add newline and flush stream.
void setGroup(const word &groupName, const labelList &patchIDs)
Set/add group with patches.
Ostream & decrIndent(Ostream &os)
Decrement the indent level.
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
#define WarningIn(functionName)
Report a warning using Foam::Warning.
streamFormat
Enumeration for the format of data in the stream.
bool findStrings(const wordReListMatcher &matcher, const std::string &str)
Return true if string matches one of the regular expressions.
const labelList & meshPoints() const
Return labelList of mesh points in patch. They are constructed.
const edgeList & edges() const
Return list of edges, address into LOCAL point list.
bool good() const
Return true if next operation might succeed.
bool writeObject(IOstream::streamFormat fmt, IOstream::versionNumber ver, IOstream::compressionType cmp) const
Write using given format, version and form uncompression.
void clearAddressing()
Clear addressing at this level and at patches.
label whichPatch(const label faceIndex) const
Return patch index for a given face label.
label findIndex(const keyType &) const
Return patch index for the first match, return -1 if not found.
label size() const
Return number of elements in table.
errorManip< error > abort(error &err)
const word & name() const
Return name.
static int myProcNo(const label communicator=0)
Number of this process (starting from masterNo() = 0)
void matchGroups(const labelUList &patchIDs, wordList &groups, labelHashSet &nonGroupPatches) const
Match the patches to groups. Returns all the (fully matched) groups.
static autoPtr< polyPatch > New(const word &patchType, const word &name, const label size, const label start, const label index, const polyBoundaryMesh &bm)
Return a pointer to a new patch created on freestore from.
#define FatalErrorIn(functionName)
Report an error message using Foam::FatalError.
HashSet< label, Hash< label > > labelHashSet
A HashSet with label keys.
labelHashSet patchSet(const UList< wordRe > &patchNames, const bool warnNotFound=true, const bool usePatchGroups=true) const
Return the set of patch IDs corresponding to the given names.
compressionType
Enumeration for the format of data in the stream.
label start() const
Return start label of this patch in the polyMesh face list.
label nInternalFaces() const
const labelList & patchID() const
Per boundary face label the patch index.
void movePoints(const pointField &)
Correct polyBoundaryMesh after moving points.
Mesh consisting of general polyhedral cells.
label nInternalEdges() const
Number of internal edges.
regIOobject is an abstract class derived from IOobject to handle automatic object registration with t...
labelList findIndices(const keyType &, const bool usePatchGroups=true) const
Return patch indices for all matches. Optionally matches patchGroups.
List< label > labelList
A List of labels.
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
Pair< label > labelPair
Label pair.
Operations on lists of strings.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
void transfer(HashTable< T, Key, Hash > &)
Transfer the contents of the argument table into this table.
static bool master(const label communicator=0)
Am I the master process.
static iteratorEnd end()
iteratorEnd set to beyond the end of any HashTable
void append(const T &)
Append an element at the end of the list.
bool inGroup(const word &) const
Test if in group.
void clearGeom()
Clear geometry at this level and at patches.
void reorder(const labelUList &)
Reorders elements. Ordering does not have to be done in.
iterator begin()
Iterator set to the beginning of the HashTable.
iterator find(const Key &)
Find and return an iterator set at the hashedEntry.
static commsTypes defaultCommsType
Default commsType.
const lduSchedule & patchSchedule() const
Order in which the patches should be initialised/evaluated.
void finishedSends(const bool block=true)
Mark all sends as having been done. This will start receives.
void reorder(const labelUList &, const bool validBoundary)
Reorders patches. Ordering does not have to be done in.
label nEdges() const
Return number of edges in patch.
A wordRe is a word, but can also have a regular expression for matching words.
label findPatchID(const word &patchName) const
Find patch index given a name.
bool writeData(Ostream &) const
writeData member function required by regIOobject
labelList findIndices(const ListType &, typename ListType::const_reference, const label start=0)
Find all occurences of given element. Linear search.
const globalMeshData & globalData() const
Return parallel info.
defineTypeNameAndDebug(combustionModel, 0)
prefixOSstream Pout(cout,"Pout")
const wordList & inGroups() const
Return the optional groups patch belongs to.
bool insert(const Key &key)
Insert a new entry.