46 Foam::polyBoundaryMesh::polyBoundaryMesh
65 <<
"Specified IOobject::MUST_READ_IF_MODIFIED but class" 66 <<
" does not support automatic rereading." 74 Istream& is = readStream(typeName);
86 patchEntries[
patchi].keyword(),
97 "polyBoundaryMesh::polyBoundaryMesh" 98 "(const IOobject&, const polyMesh&)" 106 Foam::polyBoundaryMesh::polyBoundaryMesh
119 Foam::polyBoundaryMesh::polyBoundaryMesh
141 <<
"Specified IOobject::MUST_READ_IF_MODIFIED but class" 142 <<
" does not support automatic rereading." 149 Istream& is = readStream(typeName);
161 patchEntries[
patchi].keyword(),
172 "polyBoundaryMesh::polyBoundaryMesh" 173 "(const IOobject&, const polyMesh&, const polyPatchList&)" 200 operator[](
patchi).clearGeom();
207 neighbourEdgesPtr_.clear();
209 groupPatchIDsPtr_.clear();
213 operator[](
patchi).clearAddressing();
220 void Foam::polyBoundaryMesh::calcGeometry()
232 operator[](
patchi).initGeometry(pBufs);
239 operator[](
patchi).calcGeometry(pBufs);
249 forAll(patchSchedule, patchEvali)
251 const label patchi = patchSchedule[patchEvali].patch;
253 if (patchSchedule[patchEvali].init)
255 operator[](patchi).initGeometry(pBufs);
259 operator[](patchi).calcGeometry(pBufs);
272 <<
"Neighbour edge addressing not correct across parallel" 273 <<
" boundaries." <<
endl;
276 if (!neighbourEdgesPtr_.valid())
282 label nEdgePairs = 0;
313 edgei < edges.
size();
318 const edge&
e = edges[edgei];
324 pointsToEdge.
find(meshEdge);
326 if (fnd == pointsToEdge.
end())
348 neighbourEdges[edgeInfo[0]][edgeInfo[1]]
354 pointsToEdge.
erase(meshEdge);
359 if (pointsToEdge.
size())
362 <<
"Not all boundary edges of patches match up." <<
nl 363 <<
"Is the outside of your mesh multiply connected?" 377 if (edgeInfo[0] == -1 || edgeInfo[1] == -1)
383 <<
"Not all boundary edges of patches match up." <<
nl 384 <<
"Edge " << edgeI <<
" on patch " << pp.
name()
386 << pp.
localPoints()[e[1]] <<
" is not matched to an" 387 <<
" edge on any other patch." <<
nl 388 <<
"Is the outside of your mesh multiply connected?" 395 return neighbourEdgesPtr_();
401 if (!patchIDPtr_.valid())
408 - mesh_.nInternalFaces()
417 label bFacei = bm[
patchi].start() - mesh_.nInternalFaces();
420 patchID[bFacei++] =
patchi;
424 return patchIDPtr_();
431 if (!groupPatchIDsPtr_.valid())
446 if (findPatchID(name) != -1)
450 <<
" specifies a group " << name
451 <<
" which is also a patch name." 452 <<
" This might give problems later on." <<
endl;
461 if (iter != groupPatchIDs.
end())
472 return groupPatchIDsPtr_();
478 const word& groupName,
482 groupPatchIDsPtr_.clear();
515 if (groups[i] != groupName)
517 groups[newI++] = groups[i];
575 const bool usePatchGroups
586 if (usePatchGroups && groupPatchIDs().size())
590 const wordList allGroupNames = groupPatchIDs().toc();
594 const word& grpName = allGroupNames[groupIDs[i]];
595 const labelList& patchIDs = groupPatchIDs()[grpName];
598 if (indexSet.
insert(patchIDs[j]))
600 indices.
append(patchIDs[j]);
614 if (key ==
operator[](i).
name())
621 if (usePatchGroups && groupPatchIDs().size())
624 groupPatchIDs().find(key);
626 if (iter != groupPatchIDs().end())
633 if (indexSet.
insert(patchIDs[j]))
635 indices.
append(patchIDs[j]);
656 if (!indices.
empty())
665 if (key ==
operator[](i).
name())
693 Pout<<
"label polyBoundaryMesh::findPatchID(const word&) const" 694 <<
"Patch named " << patchName <<
" not found. " 695 <<
"List of available patch names: " << names() <<
endl;
709 if (faceIndex <
mesh().nInternalFaces())
713 else if (faceIndex >=
mesh().nFaces())
716 <<
"given label " << faceIndex
717 <<
" greater than the number of geometric faces " <<
mesh().
nFaces()
728 faceIndex >= bp.
start()
729 && faceIndex < bp.
start() + bp.size()
738 <<
"Cannot find face " << faceIndex <<
" in any of the patches " 740 <<
"It seems your patches are not consistent with the mesh :" 742 <<
" total number of faces:" <<
mesh().
nFaces()
752 const bool warnNotFound,
753 const bool usePatchGroups
756 const wordList allPatchNames(this->names());
761 const wordRe& patchName = patchNames[i];
772 if (patchIDs.
empty())
776 const wordList allGroupNames = groupPatchIDs().toc();
783 const word&
name = allGroupNames[groupIDs[i]];
786 forAll(extraPatchIDs, extraI)
788 ids.
insert(extraPatchIDs[extraI]);
792 if (groupIDs.
empty() && warnNotFound)
795 <<
"Cannot find any patch or group names matching " 800 else if (warnNotFound)
803 <<
"Cannot find any patch names matching " << patchName
830 groupPatchIDs.
begin();
831 iter != groupPatchIDs.
end();
842 label nMatch = nonGroupPatches.
erase(groupPatchSet);
844 if (nMatch == groupPatchSet.
size())
846 matchedGroups.
append(iter.key());
848 else if (nMatch != 0)
851 nonGroupPatches.
transfer(oldNonGroupPatches);
869 bool hasError =
false;
879 if (!isA<processorPolyPatch>(bm[
patchi]))
881 if (nonProci != patchi)
888 Pout<<
" ***Problem with boundary patch " << patchi
890 <<
" of type " << bm[
patchi].type()
891 <<
". The patch seems to be preceeded by processor" 892 <<
" patches. This is can give problems." 899 types[nonProci] = bm[
patchi].type();
905 types.setSize(nonProci);
919 for (
label proci = 1; proci < allNames.
size(); ++proci)
923 (allNames[proci] != allNames[0])
924 || (allTypes[proci] != allTypes[0])
931 Info<<
" ***Inconsistent patches across processors, " 932 "processor 0 has patch names:" << allNames[0]
933 <<
" patch types:" << allTypes[0]
934 <<
" processor " << proci <<
" has patch names:" 936 <<
" patch types:" << allTypes[proci]
951 bool hasError =
false;
957 if (bm[
patchi].start() != nextPatchStart && !hasError)
961 Info<<
" ****Problem with boundary patch " <<
patchi 963 <<
" of type " << bm[
patchi].type()
964 <<
". The patch should start on face no " << nextPatchStart
965 <<
" and the patch specifies " << bm[
patchi].start()
967 <<
"Possibly consecutive patches have this same problem." 968 <<
" Suppressing future warnings." <<
endl;
975 Info<<
" ****Duplicate boundary patch " <<
patchi 977 <<
" of type " << bm[
patchi].type()
979 <<
"Suppressing future warnings." <<
endl;
991 Pout<<
" ***Boundary definition is in error." <<
endl;
995 Info<<
" Boundary definition OK." <<
endl;
1015 operator[](
patchi).initMovePoints(pBufs, p);
1022 operator[](
patchi).movePoints(pBufs, p);
1032 forAll(patchSchedule, patchEvali)
1034 const label patchi = patchSchedule[patchEvali].patch;
1036 if (patchSchedule[patchEvali].init)
1038 operator[](patchi).initMovePoints(pBufs, p);
1042 operator[](patchi).movePoints(pBufs, p);
1051 neighbourEdgesPtr_.clear();
1052 patchIDPtr_.clear();
1053 groupPatchIDsPtr_.clear();
1065 operator[](
patchi).initUpdateMesh(pBufs);
1072 operator[](
patchi).updateMesh(pBufs);
1082 forAll(patchSchedule, patchEvali)
1084 const label patchi = patchSchedule[patchEvali].patch;
1086 if (patchSchedule[patchEvali].init)
1088 operator[](patchi).initUpdateMesh(pBufs);
1092 operator[](patchi).updateMesh(pBufs);
1102 const bool validBoundary
1140 os.
check(
"polyBoundaryMesh::writeData(Ostream& os) const");
1160 const word& patchName
1168 <<
"Patch named " << patchName <<
" not found." <<
nl 1169 <<
"Available patch names: " << names() <<
endl 1173 return operator[](patchi);
1179 const word& patchName
1187 <<
"Patch named " << patchName <<
" not found." <<
nl 1188 <<
"Available patch names: " << names() <<
endl 1192 return operator[](patchi);
void matchGroups(const labelUList &patchIDs, wordList &groups, labelHashSet &nonGroupPatches) const
Match the patches to groups. Returns all the (fully matched) groups.
PtrList< polyPatch > polyPatchList
container classes for polyPatch
const labelList & patchID() const
Per boundary face label the patch index.
A class for handling keywords in dictionaries.
static void scatterList(const List< commsStruct > &comms, List< T > &Values, const int tag, const label comm)
Scatter data. Reverse of gatherList.
#define forAll(list, i)
Loop across all elements in list.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Ostream & indent(Ostream &os)
Indent stream.
void finishedSends(const bool block=true)
Mark all sends as having been done. This will start receives.
An STL-conforming const_iterator.
bool checkParallelSync(const bool report=false) const
Check whether all procs have all patches and in same order. Return.
wordList names() const
Return a list of patch names.
static iteratorEnd end()
iteratorEnd set to beyond the end of any HashTable
const double e
Elementary charge.
const labelList & meshPoints() const
Return labelList of mesh points in patch. They are constructed.
bool checkDefinition(const bool report=false) const
Check boundary definition. Return true if in error.
void reorder(const labelUList &)
Reorders elements. Ordering does not have to be done in.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
bool empty() const
Return true if the UList is empty (ie, size() is zero)
An Istream is an abstract base class for all input systems (streams, files, token lists etc)...
void size(const label)
Override size to be inconsistent with allocated storage.
virtual bool check(const char *operation) const
Check IOstream status for given operation.
static int myProcNo(const label communicator=0)
Number of this process (starting from masterNo() = 0)
bool good() const
Return true if next operation might succeed.
Ostream & endl(Ostream &os)
Add newline and flush stream.
static bool master(const label communicator=0)
Am I the master process.
void clearGeom()
Clear geometry at this level and at patches.
label size() const
Return number of elements in table.
Operations on lists of strings.
void transfer(HashTable< T, Key, Hash > &)
Transfer the contents of the argument table into this table.
labelList findIndices(const ListType &, typename ListType::const_reference, const label start=0)
Find all occurences of given element. Linear search.
bool insert(const Key &key)
Insert a new entry.
const lduSchedule & patchSchedule() const
Order in which the patches should be initialised/evaluated.
bool erase(const iterator &)
Erase a hashedEntry specified by given iterator.
bool inGroup(const word &) const
Test if in group.
bool findStrings(const wordReListMatcher &matcher, const std::string &str)
Return true if string matches one of the regular expressions.
friend Ostream & operator(Ostream &, const UPtrList< T > &)
Write UPtrList to Ostream.
bool insert(const Key &, const T &newElmt)
Insert a new hashedEntry.
iterator find(const Key &)
Find and return an iterator set at the hashedEntry.
HashSet< label, Hash< label > > labelHashSet
A HashSet with label keys.
An STL-conforming iterator.
An ordered pair of two objects of type <T> with first() and second() elements.
~polyBoundaryMesh()
Destructor.
label start() const
Return start label of this patch in the polyMesh face list.
void movePoints(const pointField &)
Correct polyBoundaryMesh after moving points.
An edge is a list of two point labels. The functionality it provides supports the discretisation on a...
A class for handling words, derived from string.
void append(const T &)
Append an element at the end of the list.
label findIndex(const keyType &) const
Return patch index for the first match, return -1 if not found.
void setCapacity(const label)
Alter the size of the underlying storage.
wordList patchNames(nPatches)
const edgeList & edges() const
Return list of edges, address into LOCAL point list.
bool set(const label) const
Is element set.
streamFormat
Enumeration for the format of data in the stream.
DynamicList< T, SizeInc, SizeMult, SizeDiv > & append(const T &)
Append an element at the end of the list.
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.
Pair< label > labelPair
Label pair.
List< label > labelList
A List of labels.
wordList physicalTypes() const
Return a list of physical types.
iterator begin()
Iterator set to the beginning of the HashTable.
const word & name() const
Return name.
An STL-conforming hash table.
const List< labelPairList > & neighbourEdges() const
Per patch the edges on the neighbouring patch. Is for every external.
errorManip< error > abort(error &err)
A wordRe is a word, but can also have a regular expression for matching words.
virtual bool writeObject(IOstream::streamFormat, IOstream::versionNumber, IOstream::compressionType) const
Write using given format, version and compression.
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
void setSize(const label)
Reset size of PtrList. If extending the PtrList, new entries are.
labelList findIndices(const keyType &, const bool usePatchGroups=true) const
Return patch indices for all matches. Optionally matches patchGroups.
const globalMeshData & globalData() const
Return parallel info.
compressionType
Enumeration for the format of data in the stream.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
prefixOSstream Pout(cout,"Pout")
void updateMesh()
Correct polyBoundaryMesh after topology update.
defineTypeNameAndDebug(combustionModel, 0)
Ostream & decrIndent(Ostream &os)
Decrement the indent level.
Buffers for inter-processor communications streams (UOPstream, UIPstream).
void reduce(const List< UPstream::commsStruct > &comms, T &Value, const BinaryOp &bop, const int tag, const label comm)
const HashTable< labelList, word > & groupPatchIDs() const
Per patch group the patch indices.
word name(const complex &)
Return a string representation of a complex.
bool writeObject(IOstream::streamFormat fmt, IOstream::versionNumber ver, IOstream::compressionType cmp) const
Write using given format, version and form uncompression.
label nEdges() const
Return number of edges in patch.
static commsTypes defaultCommsType
Default commsType.
void setSize(const label)
Reset size of List.
static bool & parRun()
Is this a parallel run?
static label nProcs(const label communicator=0)
Number of processes in parallel run.
wordList types() const
Return a list of patch types.
#define WarningInFunction
Report a warning using Foam::Warning.
A templated 1D list of pointers to objects of type <T>, where the size of the array is known and used...
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 nInternalEdges() const
Number of internal edges.
Ostream & operator<<(Ostream &, const ensightPart &)
bool writeData(Ostream &) const
writeData member function required by regIOobject
regIOobject is an abstract class derived from IOobject to handle automatic object registration with t...
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.
Mesh consisting of general polyhedral cells.
const wordList & inGroups() const
Return the optional groups patch belongs to.
A patch is a list of labels that address the faces in the global face list.
Ostream & incrIndent(Ostream &os)
Increment the indent level.
label findPatchID(const word &patchName) const
Find patch index given a name.
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
static void gatherList(const List< commsStruct > &comms, List< T > &Values, const int tag, const label comm)
Gather data but keep individual values separate.
label nInternalFaces() const
void transfer(List< T > &)
Transfer the contents of the argument List into this list.
void reorder(const labelUList &, const bool validBoundary)
Reorders patches. Ordering does not have to be done in.
const Field< PointType > & localPoints() const
Return pointField of points in patch.
void setGroup(const word &groupName, const labelList &patchIDs)
Set/add group with patches.
const word & name() const
Return name.
bool isPattern() const
Should be treated as a match rather than a literal string.
label size() const
Return the number of elements in the UPtrList.