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&)" 202 operator[](
patchi).clearGeom();
210 nbrEdgesPtr_.clear();
212 patchFaceIDPtr_.clear();
213 groupPatchIDsPtr_.clear();
219 operator[](
patchi).clearAddressing();
227 void Foam::polyBoundaryMesh::calcGeometry()
239 operator[](
patchi).initCalcGeometry(pBufs);
246 operator[](
patchi).calcGeometry(pBufs);
256 forAll(patchSchedule, patchEvali)
258 const label patchi = patchSchedule[patchEvali].patch;
260 if (patchSchedule[patchEvali].init)
262 operator[](patchi).initCalcGeometry(pBufs);
266 operator[](patchi).calcGeometry(pBufs);
279 <<
"Neighbour edge addressing not correct across parallel" 280 <<
" boundaries." <<
endl;
283 if (!nbrEdgesPtr_.valid())
289 label nEdgePairs = 0;
320 edgei < edges.
size();
325 const edge&
e = edges[edgei];
333 if (fnd == pointsToEdge.
end())
355 nbrEdges[edgeInfo[0]][edgeInfo[1]]
366 if (pointsToEdge.
size())
369 <<
"Not all boundary edges of patches match up." <<
nl 370 <<
"Is the outside of your mesh multiply connected?" 382 const labelPair& edgeInfo = nbrEdgesp[i];
384 if (edgeInfo[0] == -1 || edgeInfo[1] == -1)
390 <<
"Not all boundary edges of patches match up." <<
nl 391 <<
"Edge " << edgeI <<
" on patch " << pp.
name()
393 << pp.
localPoints()[e[1]] <<
" is not matched to an" 394 <<
" edge on any other patch." <<
nl 395 <<
"Is the outside of your mesh multiply connected?" 402 return nbrEdgesPtr_();
408 if (!patchIDPtr_.valid())
415 - mesh_.nInternalFaces()
424 label bFacei = bm[
patchi].start() - mesh_.nInternalFaces();
427 patchID[bFacei++] =
patchi;
431 return patchIDPtr_();
437 if (!patchFaceIDPtr_.valid())
439 patchFaceIDPtr_.reset
444 - mesh_.nInternalFaces()
447 labelList& patchFaceID = patchFaceIDPtr_();
453 label bFacei = bm[
patchi].start() - mesh_.nInternalFaces();
456 patchFaceID[bFacei++] = i;
460 return patchFaceIDPtr_();
467 if (!groupPatchIDsPtr_.valid())
487 if (iter != groupPatchIDs.
end())
504 <<
"Removing patchGroup '" << bm[
patchi].
name()
505 <<
"' which clashes with patch " <<
patchi 506 <<
" of the same name." 512 return groupPatchIDsPtr_();
518 const word& groupName,
522 groupPatchIDsPtr_.clear();
555 if (groups[i] != groupName)
557 groups[newI++] = groups[i];
615 const bool usePatchGroups
626 if (usePatchGroups && groupPatchIDs().size())
630 const wordList allGroupNames = groupPatchIDs().toc();
634 const word& grpName = allGroupNames[groupIDs[i]];
635 const labelList& patchIDs = groupPatchIDs()[grpName];
638 if (indexSet.
insert(patchIDs[j]))
640 indices.
append(patchIDs[j]);
654 if (key ==
operator[](i).
name())
661 if (usePatchGroups && groupPatchIDs().size())
664 groupPatchIDs().find(key);
666 if (iter != groupPatchIDs().end())
673 if (indexSet.
insert(patchIDs[j]))
675 indices.
append(patchIDs[j]);
683 return move(indices);
696 if (!indices.
empty())
705 if (key ==
operator[](i).
name())
733 Pout<<
"label polyBoundaryMesh::findPatchID(const word&) const" 734 <<
"Patch named " << patchName <<
" not found. " 735 <<
"List of available patch names: " << names() <<
endl;
749 if (faceIndex <
mesh().nInternalFaces())
753 else if (faceIndex >=
mesh().nFaces())
756 <<
"given label " << faceIndex
757 <<
" greater than the number of geometric faces " <<
mesh().
nFaces()
768 faceIndex >= bp.
start()
769 && faceIndex < bp.
start() + bp.size()
778 <<
"Cannot find face " << faceIndex <<
" in any of the patches " 780 <<
"It seems your patches are not consistent with the mesh :" 782 <<
" total number of faces:" <<
mesh().
nFaces()
792 const bool warnNotFound,
793 const bool usePatchGroups
796 const wordList allPatchNames(this->names());
801 const wordRe& patchName = patchNames[i];
812 if (patchIDs.
empty())
816 const wordList allGroupNames = groupPatchIDs().toc();
823 const word&
name = allGroupNames[groupIDs[i]];
826 forAll(extraPatchIDs, extraI)
828 ids.
insert(extraPatchIDs[extraI]);
832 if (groupIDs.
empty() && warnNotFound)
835 <<
"Cannot find any patch or group names matching " 840 else if (warnNotFound)
843 <<
"Cannot find any patch names matching " << patchName
870 groupPatchIDs.
begin();
871 iter != groupPatchIDs.
end();
882 label nMatch = nonGroupPatches.
erase(groupPatchSet);
884 if (nMatch == groupPatchSet.
size())
886 matchedGroups.
append(iter.key());
888 else if (nMatch != 0)
891 nonGroupPatches.
transfer(oldNonGroupPatches);
909 bool hasError =
false;
919 if (!isA<processorPolyPatch>(bm[
patchi]))
921 if (nonProci != patchi)
928 Pout<<
" ***Problem with boundary patch " << patchi
930 <<
" of type " << bm[
patchi].type()
931 <<
". The patch seems to be preceded by processor" 932 <<
" patches. This is can give problems." 939 types[nonProci] = bm[
patchi].type();
945 types.setSize(nonProci);
959 for (
label proci = 1; proci < allNames.
size(); ++proci)
963 (allNames[proci] != allNames[0])
964 || (allTypes[proci] != allTypes[0])
971 Info<<
" ***Inconsistent patches across processors, " 972 "processor 0 has patch names:" << allNames[0]
973 <<
" patch types:" << allTypes[0]
974 <<
" processor " << proci <<
" has patch names:" 976 <<
" patch types:" << allTypes[proci]
991 bool hasError =
false;
997 if (bm[
patchi].start() != nextPatchStart && !hasError)
1001 Info<<
" ****Problem with boundary patch " <<
patchi 1003 <<
" of type " << bm[
patchi].type()
1004 <<
". The patch should start on face no " << nextPatchStart
1005 <<
" and the patch specifies " << bm[
patchi].start()
1007 <<
"Possibly consecutive patches have this same problem." 1008 <<
" Suppressing future warnings." <<
endl;
1015 Info<<
" ****Duplicate boundary patch " <<
patchi 1017 <<
" of type " << bm[
patchi].type()
1019 <<
"Suppressing future warnings." <<
endl;
1027 if (debug || report)
1031 Pout<<
" ***Boundary definition is in error." <<
endl;
1035 Info<<
" Boundary definition OK." <<
endl;
1055 operator[](
patchi).initMovePoints(pBufs, p);
1062 operator[](
patchi).movePoints(pBufs, p);
1072 forAll(patchSchedule, patchEvali)
1074 const label patchi = patchSchedule[patchEvali].patch;
1076 if (patchSchedule[patchEvali].init)
1078 operator[](patchi).initMovePoints(pBufs, p);
1082 operator[](patchi).movePoints(pBufs, p);
1091 nbrEdgesPtr_.clear();
1092 patchIDPtr_.clear();
1093 patchFaceIDPtr_.clear();
1094 groupPatchIDsPtr_.clear();
1106 operator[](
patchi).initTopoChange(pBufs);
1113 operator[](
patchi).topoChange(pBufs);
1123 forAll(patchSchedule, patchEvali)
1125 const label patchi = patchSchedule[patchEvali].patch;
1127 if (patchSchedule[patchEvali].init)
1129 operator[](patchi).initTopoChange(pBufs);
1133 operator[](patchi).topoChange(pBufs);
1143 const bool validBoundary
1151 patches[
patchi].rename(newNames);
1165 const bool validBoundary
1205 os.
check(
"polyBoundaryMesh::writeData(Ostream& os) const");
1227 const word& patchName
1235 <<
"Patch named " << patchName <<
" not found." <<
nl 1236 <<
"Available patch names: " << names() <<
endl 1240 return operator[](patchi);
1246 const word& patchName
1254 <<
"Patch named " << patchName <<
" not found." <<
nl 1255 <<
"Available patch names: " << names() <<
endl 1259 return operator[](patchi);
const fvPatchList & patches
PtrList< polyPatch > polyPatchList
container classes for polyPatch
void reorder(const labelUList &oldToNew)
Reorders elements. Ordering does not have to be done in.
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.
bool empty() const
Return true if the UList is empty (ie, size() is zero)
bool writeData(Ostream &) const
writeData member function required by regIOobject
const word & name() const
Return name.
const word & name() const
Return name.
Ostream & indent(Ostream &os)
Indent stream.
bool set(const label) const
Is element set.
void finishedSends(const bool block=true)
Mark all sends as having been done. This will start receives.
An STL-conforming const_iterator.
static iteratorEnd end()
iteratorEnd set to beyond the end of any HashTable
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
virtual bool check(const char *operation) const
Check IOstream status for given operation.
label nInternalFaces() const
bool writeObject(IOstream::streamFormat fmt, IOstream::versionNumber ver, IOstream::compressionType cmp, const bool write=true) const
Write using given format, version and form uncompression.
void renamePatches(const wordUList &newNames, const bool validBoundary)
Rename the patches. If validBoundary is set this calls topoChange()
bool inGroup(const word &) const
Test if in group.
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.
static int myProcNo(const label communicator=0)
Number of this process (starting from masterNo() = 0)
const lduSchedule & patchSchedule() const
Order in which the patches should be initialised/evaluated.
Ostream & endl(Ostream &os)
Add newline and flush stream.
const labelList & patchID() const
Per boundary face label the patch index.
static bool master(const label communicator=0)
Am I the master process.
void reorderPatches(const labelUList &newToOld, const bool validBoundary)
Reorders the patches. Ordering does not have to be done in.
label findPatchID(const word &patchName) const
Find patch index given a name.
label nInternalEdges() const
Number of internal edges.
void clearGeom()
Clear geometry at this level and at patches.
const wordList & inGroups() const
Return the optional groups patch belongs to.
Operations on lists of strings.
void transfer(HashTable< T, Key, Hash > &)
Transfer the contents of the argument table into this table.
const Field< PointType > & localPoints() const
Return pointField of points in patch.
wordList types() const
Return a list of patch types.
labelList findIndices(const ListType &, typename ListType::const_reference, const label start=0)
Find all occurrences of given element. Linear search.
bool insert(const Key &key)
Insert a new entry.
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.
bool good() const
Return true if next operation might succeed.
label size() const
Return number of elements in table.
const labelList & meshPoints() const
Return labelList of mesh points in patch. They are constructed.
bool erase(const iterator &)
Erase a hashedEntry specified by given iterator.
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.
void matchGroups(const labelUList &patchIDs, wordList &groups, labelHashSet &nonGroupPatches) const
Match the patches to groups. Returns all the (fully matched) groups.
void topoChange()
Correct polyBoundaryMesh after topology update.
An ordered pair of two objects of type <T> with first() and second() elements.
~polyBoundaryMesh()
Destructor.
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects...
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.
static bool isPattern(const string &)
Test string for regular expression meta characters.
bool checkDefinition(const bool report=false) const
Check boundary definition. Return true if in error.
wordList names() const
Return a list of patch names.
void append(const T &)
Append an element at the end of the list.
void setCapacity(const label)
Alter the size of the underlying storage.
wordList patchNames(nPatches)
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.
Pair< label > labelPair
Label pair.
const globalMeshData & globalData() const
Return parallel info.
const edgeList & edges() const
Return list of edges, address into LOCAL point list.
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.
An STL-conforming hash table.
errorManip< error > abort(error &err)
const List< labelPairList > & nbrEdges() const
Per patch the edges on the neighbouring patch. Is for every external.
A wordRe is a word, but can also have a regular expression for matching words.
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.
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...
bool checkParallelSync(const bool report=false) const
Check whether all procs have all patches and in same order. Return.
label nEdges() const
Return number of edges in patch.
defineTypeNameAndDebug(combustionModel, 0)
Ostream & decrIndent(Ostream &os)
Decrement the indent level.
Buffers for inter-processor communications streams (UOPstream, UIPstream).
const labelList & patchFaceID() const
Per boundary face label the patch face index.
void reduce(const List< UPstream::commsStruct > &comms, T &Value, const BinaryOp &bop, const int tag, const label comm)
word name(const complex &)
Return a string representation of a complex.
label size() const
Return the number of elements in the UPtrList.
edge meshEdge(const PrimitivePatch< FaceList, PointField > &p, const label edgei)
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.
#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.
prefixOSstream Pout(cout, "Pout")
label start() const
Return start label of this patch in the polyMesh face list.
Ostream & operator<<(Ostream &, const ensightPart &)
regIOobject is an abstract class derived from IOobject to handle automatic object registration with t...
virtual bool writeObject(IOstream::streamFormat, IOstream::versionNumber, IOstream::compressionType, const bool write) const
Write using given format, version and compression.
label findIndex(const wordRe &) const
Return patch index for the first match, return -1 if not found.
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.
void shuffle(const labelUList &newToOld)
Reorders elements. Ordering does not have to be done in.
const doubleScalar e
Elementary charge.
Mesh consisting of general polyhedral cells.
A patch is a list of labels that address the faces in the global face list.
Ostream & incrIndent(Ostream &os)
Increment the indent level.
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 whichPatch(const label faceIndex) const
Return patch index for a given face label.
void transfer(List< T > &)
Transfer the contents of the argument List into this list.
labelList findIndices(const wordRe &, const bool usePatchGroups=true) const
Return patch indices for all matches. Optionally matches patchGroups.
void setGroup(const word &groupName, const labelList &patchIDs)
Set/add group with patches.
const HashTable< labelList, word > & groupPatchIDs() const
Per patch group the patch indices.