faBoundaryMesh.C
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2016-2017 Wikki Ltd
9  Copyright (C) 2018-2022 OpenCFD Ltd.
10 -------------------------------------------------------------------------------
11 License
12  This file is part of OpenFOAM.
13 
14  OpenFOAM is free software: you can redistribute it and/or modify it
15  under the terms of the GNU General Public License as published by
16  the Free Software Foundation, either version 3 of the License, or
17  (at your option) any later version.
18 
19  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22  for more details.
23 
24  You should have received a copy of the GNU General Public License
25  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26 
27 \*---------------------------------------------------------------------------*/
28 
29 #include "faBoundaryMesh.H"
30 #include "faMesh.H"
31 #include "globalIndex.H"
32 #include "primitiveMesh.H"
33 #include "processorFaPatch.H"
34 #include "PtrListOps.H"
35 
36 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
37 
38 namespace Foam
39 {
40  defineTypeNameAndDebug(faBoundaryMesh, 0);
41 }
42 
43 
44 // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
45 
46 bool Foam::faBoundaryMesh::hasGroupIDs() const
47 {
48  if (groupIDsPtr_)
49  {
50  // Use existing cache
51  return !groupIDsPtr_->empty();
52  }
53 
54  const faPatchList& patches = *this;
55 
56  for (const faPatch& p : patches)
57  {
58  if (!p.inGroups().empty())
59  {
60  return true;
61  }
62  }
63 
64  return false;
65 }
66 
67 
68 void Foam::faBoundaryMesh::calcGroupIDs() const
69 {
70  if (groupIDsPtr_)
71  {
72  return; // Or FatalError
73  }
74 
75  groupIDsPtr_.reset(new HashTable<labelList>(16));
76  auto& groupLookup = *groupIDsPtr_;
77 
78  const faPatchList& patches = *this;
79 
80  forAll(patches, patchi)
81  {
82  const wordList& groups = patches[patchi].inGroups();
83 
84  for (const word& groupName : groups)
85  {
86  groupLookup(groupName).append(patchi);
87  }
88  }
89 
90  // Remove groups that clash with patch names
91  forAll(patches, patchi)
92  {
93  if (groupLookup.erase(patches[patchi].name()))
94  {
96  << "Removed group '" << patches[patchi].name()
97  << "' which clashes with patch " << patchi
98  << " of the same name."
99  << endl;
100  }
101  }
102 }
103 
104 
105 bool Foam::faBoundaryMesh::readContents(const bool allowReadIfPresent)
106 {
107  if
108  (
109  isReadRequired()
110  || (allowReadIfPresent && isReadOptional() && headerOk())
111  )
112  {
113  // Warn for MUST_READ_IF_MODIFIED
114  warnNoRereading<faBoundaryMesh>();
115 
116  faPatchList& patches = *this;
117 
118  // Read faPatch list
119  Istream& is = readStream(typeName);
120 
121  // Read patches as entries
122  PtrList<entry> patchEntries(is);
123  patches.resize(patchEntries.size());
124 
125  // Transcribe
126  forAll(patches, patchi)
127  {
128  patches.set
129  (
130  patchi,
132  (
133  patchEntries[patchi].keyword(),
134  patchEntries[patchi].dict(),
135  patchi,
136  *this
137  )
138  );
139  }
140 
141  is.check(FUNCTION_NAME);
142  close();
143  return true;
144  }
145 
146  return false;
147 }
148 
149 
150 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
151 
152 Foam::faBoundaryMesh::faBoundaryMesh
153 (
154  const IOobject& io,
155  const faMesh& mesh
156 )
157 :
158  faPatchList(),
159  regIOobject(io),
160  mesh_(mesh)
161 {
162  readContents(false); // READ_IF_PRESENT allowed: False
163 }
164 
165 
166 Foam::faBoundaryMesh::faBoundaryMesh
167 (
168  const IOobject& io,
169  const faMesh& pm,
170  const label size
171 )
172 :
173  faPatchList(size),
175  mesh_(pm)
176 {}
177 
178 
179 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
180 
182 {
183  // processorFaPatch geometry triggers calculation of pointNormals.
184  // This uses parallel comms and hence will not be trigggered
185  // on processors that do not have a processorFaPatch so instead
186  // force construction.
187  (void)mesh_.pointAreaNormals();
188 
190 
191  if
192  (
193  pBufs.commsType() == Pstream::commsTypes::blocking
194  || pBufs.commsType() == Pstream::commsTypes::nonBlocking
195  )
196  {
197  forAll(*this, patchi)
198  {
199  operator[](patchi).initGeometry(pBufs);
200  }
201 
202  pBufs.finishedSends();
203 
204  forAll(*this, patchi)
205  {
206  operator[](patchi).calcGeometry(pBufs);
207  }
208  }
209  else if (pBufs.commsType() == Pstream::commsTypes::scheduled)
210  {
211  const lduSchedule& patchSchedule = mesh().globalData().patchSchedule();
212 
213  // Dummy.
214  pBufs.finishedSends();
215 
216  for (const auto& patchEval : patchSchedule)
217  {
218  const label patchi = patchEval.patch;
219 
220  if (patchEval.init)
221  {
222  operator[](patchi).initGeometry(pBufs);
223  }
224  else
225  {
226  operator[](patchi).calcGeometry(pBufs);
227  }
228  }
229  }
230 }
231 
232 
235 {
236  const faPatchList& patches = *this;
237 
238  UPtrList<const labelUList> list(patches.size());
239 
240  forAll(list, patchi)
241  {
242  list.set(patchi, &patches[patchi].edgeLabels());
243  }
244 
245  return list;
246 }
247 
248 
251 {
252  const faPatchList& patches = *this;
253 
254  UPtrList<const labelUList> list(patches.size());
255 
256  forAll(list, patchi)
257  {
258  list.set(patchi, &patches[patchi].edgeFaces());
259  }
260 
261  return list;
262 }
263 
264 
266 {
267  const faPatchList& patches = *this;
268 
270 
271  forAll(list, patchi)
272  {
273  const lduInterface* lduPtr = isA<lduInterface>(patches[patchi]);
274 
275  if (lduPtr)
276  {
277  list.set(patchi, lduPtr);
278  }
279  }
280 
281  return list;
282 }
283 
284 
285 Foam::label Foam::faBoundaryMesh::nNonProcessor() const
286 {
287  const faPatchList& patches = *this;
288 
289  label nonProc = 0;
290 
291  for (const faPatch& p : patches)
292  {
293  if (isA<processorFaPatch>(p))
294  {
295  break;
296  }
297 
298  ++nonProc;
299  }
300 
301  return nonProc;
302 }
303 
304 
307 {
308  if (!groupIDsPtr_)
309  {
310  calcGroupIDs();
311  }
312 
313  return *groupIDsPtr_;
314 }
315 
316 
318 (
319  const word& groupName,
320  const labelUList& patchIDs
321 )
322 {
323  groupIDsPtr_.clear();
324 
325  faPatchList& patches = *this;
326 
327  boolList donePatch(patches.size(), false);
328 
329  // Add to specified patches
330  for (const label patchi : patchIDs)
331  {
332  patches[patchi].inGroups().appendUniq(groupName);
333  donePatch[patchi] = true;
334  }
335 
336  // Remove from other patches
337  forAll(patches, patchi)
338  {
339  if (!donePatch[patchi])
340  {
341  wordList& groups = patches[patchi].inGroups();
342 
343  if (groups.found(groupName))
344  {
345  label newi = 0;
346  forAll(groups, i)
347  {
348  if (groups[i] != groupName)
349  {
350  groups[newi++] = groups[i];
351  }
352  }
353  groups.resize(newi);
354  }
355  }
356  }
357 }
358 
361 {
362  return PtrListOps::get<word>(*this, nameOp<faPatch>());
363 }
364 
367 {
368  return PtrListOps::get<word>(*this, typeOp<faPatch>());
369 }
370 
371 
373 {
374  // Manually: faPatch does not have independent start() information
375 
376  const faPatchList& patches = *this;
377 
378  labelList list(patches.size());
379 
380  label beg = mesh_.nInternalEdges();
381  forAll(patches, patchi)
382  {
383  const label len = patches[patchi].nEdges();
384  list[patchi] = beg;
385  beg += len;
386  }
387  return list;
388 }
389 
390 
392 {
393  return
394  PtrListOps::get<label>
395  (
396  *this,
397  [](const faPatch& p) { return p.nEdges(); } // avoid virtual
398  );
399 }
400 
401 
403 {
404  const faPatchList& patches = *this;
405 
406  List<labelRange> list(patches.size());
407 
408  label beg = mesh_.nInternalEdges();
409  forAll(patches, patchi)
410  {
411  const label len = patches[patchi].nEdges();
412  list[patchi].reset(beg, len);
413  beg += len;
414  }
415  return list;
416 }
417 
420 {
421  return this->groupPatchIDs().sortedToc();
422 }
423 
425 Foam::label Foam::faBoundaryMesh::start() const
426 {
427  return mesh_.nInternalEdges();
428 }
429 
431 Foam::label Foam::faBoundaryMesh::nEdges() const
432 {
433  return mesh_.nBoundaryEdges();
434 }
435 
436 
438 {
439  return labelRange(mesh_.nInternalEdges(), mesh_.nBoundaryEdges());
440 }
441 
442 
444 (
445  const wordRe& matcher,
446  const bool useGroups
447 ) const
448 {
449  if (matcher.empty())
450  {
451  return labelList();
452  }
453 
454  // Only check groups if requested and they exist
455  const bool checkGroups = (useGroups && this->hasGroupIDs());
456 
457  labelHashSet ids;
458 
459  if (matcher.isPattern())
460  {
461  if (checkGroups)
462  {
463  const auto& groupLookup = groupPatchIDs();
464  forAllConstIters(groupLookup, iter)
465  {
466  if (matcher.match(iter.key()))
467  {
468  // Hash ids associated with the group
469  ids.insert(iter.val());
470  }
471  }
472  }
473 
474  if (ids.empty())
475  {
476  return PtrListOps::findMatching(*this, matcher);
477  }
478  else
479  {
480  ids.insert(PtrListOps::findMatching(*this, matcher));
481  }
482  }
483  else
484  {
485  // Literal string.
486  // Special version of above for reduced memory footprint
487 
488  const label patchId = PtrListOps::firstMatching(*this, matcher);
489 
490  if (patchId >= 0)
491  {
492  return labelList(one{}, patchId);
493  }
494  else if (checkGroups)
495  {
496  const auto iter = groupPatchIDs().cfind(matcher);
497 
498  if (iter.found())
499  {
500  // Hash ids associated with the group
501  ids.insert(iter.val());
502  }
503  }
504  }
505 
506  return ids.sortedToc();
507 }
508 
509 
511 (
512  const wordRes& matcher,
513  const bool useGroups
514 ) const
515 {
516  if (matcher.empty())
517  {
518  return labelList();
519  }
520  else if (matcher.size() == 1)
521  {
522  return this->indices(matcher.first(), useGroups);
523  }
524 
525  labelHashSet ids;
526 
527  // Only check groups if requested and they exist
528  if (useGroups && this->hasGroupIDs())
529  {
530  ids.resize(2*this->size());
531 
532  const auto& groupLookup = groupPatchIDs();
533  forAllConstIters(groupLookup, iter)
534  {
535  if (matcher.match(iter.key()))
536  {
537  // Hash ids associated with the group
538  ids.insert(iter.val());
539  }
540  }
541  }
542 
543  if (ids.empty())
544  {
545  return PtrListOps::findMatching(*this, matcher);
546  }
547  else
548  {
549  ids.insert(PtrListOps::findMatching(*this, matcher));
550  }
551 
552  return ids.sortedToc();
553 }
554 
555 
556 Foam::label Foam::faBoundaryMesh::findIndex(const wordRe& key) const
557 {
558  if (key.empty())
559  {
560  return -1;
561  }
562  return PtrListOps::firstMatching(*this, key);
563 }
564 
565 
567 (
568  const word& patchName,
569  bool allowNotFound
570 ) const
571 {
572  if (patchName.empty())
573  {
574  return -1;
575  }
576 
577  const label patchId = PtrListOps::firstMatching(*this, patchName);
578 
579  if (patchId >= 0)
580  {
581  return patchId;
582  }
583 
584  if (!allowNotFound)
585  {
587  << "Patch '" << patchName << "' not found. "
588  << "Available patch names: " << names() << endl
589  << exit(FatalError);
590  }
591 
592  // Patch not found
593  if (debug)
594  {
595  Pout<< "label faBoundaryMesh::findPatchID(const word&) const"
596  << "Patch named " << patchName << " not found. "
597  << "Available patch names: " << names() << endl;
598  }
599 
600  // Not found, return -1
601  return -1;
602 }
603 
604 
605 Foam::label Foam::faBoundaryMesh::whichPatch(const label edgeIndex) const
606 {
607  if (edgeIndex < mesh().nInternalEdges())
608  {
609  // Internal edge
610  return -1;
611  }
612  else if (edgeIndex >= mesh().nEdges())
613  {
614  // Bounds error: abort
616  << "Edge " << edgeIndex
617  << " out of bounds. Number of geometric edges " << mesh().nEdges()
618  << abort(FatalError);
619 
620  return -1;
621  }
622 
623  // Find patch that the edgeIndex belongs to.
624 
625  forAll(*this, patchi)
626  {
627  label start = mesh_.patchStarts()[patchi];
628  label size = operator[](patchi).faPatch::size();
629 
630  if (edgeIndex >= start && edgeIndex < start + size)
631  {
632  return patchi;
633  }
634  }
635 
636  // If not in any of above, it's trouble!
638  << "Error in patch search algorithm"
639  << abort(FatalError);
640 
641  return -1;
642 }
643 
644 
645 bool Foam::faBoundaryMesh::checkParallelSync(const bool report) const
646 {
647  if (!Pstream::parRun())
648  {
649  return false;
650  }
651 
652  const faBoundaryMesh& bm = *this;
653 
654  bool hasError = false;
655 
656  // Collect non-proc patches and check proc patches are last.
657  wordList localNames(bm.size());
658  wordList localTypes(bm.size());
659 
660  label nonProci = 0;
661 
662  forAll(bm, patchi)
663  {
664  if (!isA<processorFaPatch>(bm[patchi]))
665  {
666  if (nonProci != patchi)
667  {
668  // A processor patch in between normal patches!
669  hasError = true;
670 
671  if (debug || report)
672  {
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;
678  }
679  }
680  else
681  {
682  localNames[nonProci] = bm[patchi].name();
683  localTypes[nonProci] = bm[patchi].type();
684  ++nonProci;
685  }
686  }
687  }
688  localNames.resize(nonProci);
689  localTypes.resize(nonProci);
690 
691  // Check and report error(s) on master
692  // - don't need indexing on master itself
693 
694  const globalIndex procAddr(globalIndex::gatherNonLocal{}, nonProci);
695 
696  const wordList allNames(procAddr.gather(localNames));
697  const wordList allTypes(procAddr.gather(localTypes));
698 
699  // Automatically restricted to master
700  for (const int proci : procAddr.subProcs())
701  {
702  const auto procNames(allNames.slice(procAddr.range(proci)));
703  const auto procTypes(allTypes.slice(procAddr.range(proci)));
704 
705  if (procNames != localNames || procTypes != localTypes)
706  {
707  hasError = true;
708 
709  if (debug || report)
710  {
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
717  << endl;
718  }
719  }
720  }
721 
722  // Reduce (not broadcast) to respect local out-of-order errors (first loop)
723  return returnReduceOr(hasError);
724 }
725 
726 
727 bool Foam::faBoundaryMesh::checkDefinition(const bool report) const
728 {
729  label nextPatchStart = mesh().nInternalEdges();
730  const faBoundaryMesh& bm = *this;
731 
732  bool hasError = false;
733 
734  forAll(bm, patchi)
735  {
736  if (bm[patchi].start() != nextPatchStart && !hasError)
737  {
738  hasError = true;
739 
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()
746  << "." << endl
747  << "Possibly consecutive patches have this same problem."
748  << " Suppressing future warnings." << endl;
749  }
750 
751  // Warn about duplicate boundary patches?
752 
753  nextPatchStart += bm[patchi].faPatch::size();
754  }
755 
756  if (hasError)
757  {
759  << "This mesh is not valid: boundary definition is in error."
760  << endl;
761  }
762  else
763  {
764  if (debug || report)
765  {
766  Info << "Boundary definition OK." << endl;
767  }
768  }
769 
770  return hasError;
771 }
772 
773 
775 {
776  // processorFaPatch geometry triggers calculation of pointNormals.
777  // This uses parallel comms and hence will not be trigggered
778  // on processors that do not have a processorFaPatch so instead
779  // force construction.
780  (void)mesh_.pointAreaNormals();
781 
782  PstreamBuffers pBufs(Pstream::defaultCommsType);
783 
784  if
785  (
786  pBufs.commsType() == Pstream::commsTypes::blocking
787  || pBufs.commsType() == Pstream::commsTypes::nonBlocking
788  )
789  {
790  forAll(*this, patchi)
791  {
792  operator[](patchi).initMovePoints(pBufs, p);
793  }
794 
795  pBufs.finishedSends();
796 
797  forAll(*this, patchi)
798  {
799  operator[](patchi).movePoints(pBufs, p);
800  }
801  }
802  else if (pBufs.commsType() == Pstream::commsTypes::scheduled)
803  {
804  const lduSchedule& patchSchedule = mesh().globalData().patchSchedule();
805 
806  // Dummy.
807  pBufs.finishedSends();
808 
809  for (const auto& schedEval : patchSchedule)
810  {
811  const label patchi = schedEval.patch;
812 
813  if (schedEval.init)
814  {
815  operator[](patchi).initMovePoints(pBufs, p);
816  }
817  else
818  {
819  operator[](patchi).movePoints(pBufs, p);
820  }
821  }
822  }
823 }
824 
825 
827 {
828  PstreamBuffers pBufs(Pstream::defaultCommsType);
829 
830  if
831  (
832  pBufs.commsType() == Pstream::commsTypes::blocking
833  || pBufs.commsType() == Pstream::commsTypes::nonBlocking
834  )
835  {
836  forAll(*this, patchi)
837  {
838  operator[](patchi).initUpdateMesh(pBufs);
839  }
840 
841  pBufs.finishedSends();
842 
843  forAll(*this, patchi)
844  {
845  operator[](patchi).updateMesh(pBufs);
846  }
847  }
848  else if (pBufs.commsType() == Pstream::commsTypes::scheduled)
849  {
850  const lduSchedule& patchSchedule = mesh().globalData().patchSchedule();
851 
852  // Dummy.
853  pBufs.finishedSends();
854 
855  for (const auto& schedEval : patchSchedule)
856  {
857  const label patchi = schedEval.patch;
858 
859  if (schedEval.init)
860  {
861  operator[](patchi).initUpdateMesh(pBufs);
862  }
863  else
864  {
865  operator[](patchi).updateMesh(pBufs);
866  }
867  }
868  }
869 }
870 
871 
872 bool Foam::faBoundaryMesh::writeData(Ostream& os) const
873 {
874  const faPatchList& patches = *this;
875 
876  os << patches.size() << nl << token::BEGIN_LIST << incrIndent << nl;
877 
878  for (const faPatch& p : patches)
879  {
880  os.beginBlock(p.name());
881  os << p;
882  os.endBlock();
883  }
884 
888  return os.good();
889 }
890 
891 
893 (
894  IOstreamOption streamOpt,
895  const bool valid
896 ) const
897 {
898  // Allow/disallow compression?
899  // 1. keep readable
900  // 2. save some space
901  // ??? streamOpt.compression(IOstreamOption::UNCOMPRESSED);
902  return regIOobject::writeObject(streamOpt, valid);
903 }
904 
905 
906 // * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
907 
908 Foam::Ostream& Foam::operator<<(Ostream& os, const faBoundaryMesh& bm)
909 {
910  bm.writeData(os);
911  return os;
912 }
913 
914 
915 // ************************************************************************* //
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.
Definition: faPatch.H:59
Finite area mesh (used for 2-D non-Euclidian finite area method) defined using a patch of faces on a ...
Definition: faMesh.H:88
label patchId(-1)
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) ...
Definition: OSstream.H:128
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.
Definition: faPatchNew.C:28
dictionary dict
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 &#39;name()&#39; 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.
Definition: IOstream.C:33
bool writeData(Ostream &os) const
The writeData member function required by regIOobject.
errorManipArg< error, int > exit(error &err, const int errNo=1)
Definition: errorManip.H:125
error FatalError
Error stream (stdout output on all processes), with additional &#39;FOAM FATAL ERROR&#39; header text and sta...
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition: error.H:578
virtual bool check(const char *operation) const
Check IOstream status for given operation.
Definition: IOstream.C:45
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.
Definition: IOobjectI.H:150
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.
Definition: labelRange.H:51
constexpr char nl
The newline &#39;\n&#39; character (0x0a)
Definition: Ostream.H:49
Type type(bool followLink=true, bool checkGzip=false) const
Return the directory entry type: UNDEFINED, FILE, DIRECTORY (or SYMLINK).
Definition: fileName.C:353
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:487
void updateMesh()
Correct faBoundaryMesh after topology update.
static bool & parRun() noexcept
Test if this a parallel run.
Definition: UPstream.H:639
Begin list [isseparator].
Definition: token.H:158
List< lduScheduleEntry > lduSchedule
A List of lduSchedule entries.
Definition: lduSchedule.H:46
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.
Definition: UList.H:80
labelRange range() const
Return start/size range of local processor data.
Definition: globalIndexI.H:250
void resize(const label sz)
Resize the hash table for efficiency.
Definition: HashTable.C:594
Extract name (as a word) from an object, typically using its name() method.
Definition: word.H:340
#define SeriousErrorInFunction
Report an error message using Foam::SeriousError.
#define forAll(list, i)
Loop across all elements in list.
Definition: stdFoam.H:413
HashSet< label, Hash< label > > labelHashSet
A HashSet of labels, uses label hasher.
Definition: HashSet.H:85
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.
Definition: pointFieldFwd.H:38
void movePoints(const pointField &)
Correct faBoundaryMesh after moving points.
IOobject io("surfaceFilmProperties", mesh.time().constant(), mesh, IOobject::READ_IF_PRESENT, IOobject::NO_WRITE, false)
dynamicFvMesh & mesh
"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.
Definition: UPtrListI.H:99
virtual Ostream & endBlock()
Write end block group.
Definition: Ostream.C:98
UPtrList< const lduInterface > lduInterfacePtrsList
Store lists of lduInterface as a UPtrList.
const globalMeshData & globalData() const
Return parallel info.
Definition: polyMesh.C:1293
End list [isseparator].
Definition: token.H:159
A HashTable similar to std::unordered_map.
Definition: HashTable.H:102
A list of pointers to objects of type <T>, without allocation/deallocation management of the pointers...
Definition: HashTable.H:100
errorManip< error > abort(error &err)
Definition: errorManip.H:139
const T * set(const label i) const
Return const pointer to element (can be nullptr), or nullptr for out-of-range access (ie...
Definition: PtrList.H:163
label nEdges() const
Number of mesh edges.
A wordRe is a Foam::word, but can contain a regular expression for matching words or strings...
Definition: wordRe.H:78
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...
Definition: Ostream.H:55
int debug
Static debugging option.
wordList types() const
Return a list of patch types.
OBJstream os(runTime.globalPath()/outputName)
#define FUNCTION_NAME
defineTypeNameAndDebug(combustionModel, 0)
Finite area patch class. Used for 2-D non-Euclidian finite area method.
Definition: faPatch.H:72
Ostream & decrIndent(Ostream &os)
Decrement the indent level.
Definition: Ostream.H:467
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)
Definition: globalIndexI.H:171
void resize(const label newLen)
Adjust size of PtrList.
Definition: PtrList.C:95
Ostream & operator<<(Ostream &, const boundaryPatch &p)
Write boundaryPatch as dictionary entries (without surrounding braces)
Definition: boundaryPatch.C:76
List< word > wordList
A List of words.
Definition: fileName.H:58
void append(autoPtr< T > &ptr)
Move append an element to the end of the list.
Definition: PtrList.H:304
static commsTypes defaultCommsType
Default commsType.
Definition: UPstream.H:337
#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
Definition: foamGltfBase.H:103
A list of pointers to objects of type <T>, with allocation/deallocation management of the pointers...
Definition: List.H:55
label nNonProcessor() const
The number of patches before the first processor patch.
bool good() const noexcept
True if next operation might succeed.
Definition: IOstream.H:274
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...
Definition: regIOobject.H:69
"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.
Definition: Ostream.C:80
bool match(const std::string &text, bool literal=false) const
Smart match as regular expression or as a string.
Definition: wordReI.H:193
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.
Definition: List.H:62
virtual bool writeObject(IOstreamOption streamOpt, const bool valid) const
Write using stream options.
volScalarField & p
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.
Definition: Ostream.H:458
Defines the attributes of an object for which implicit objectRegistry management is supported...
Definition: IOobject.H:166
labelList patchStarts() const
Return a list of patch start indices.
List< bool > boolList
A List of bools.
Definition: List.H:60
bool isPattern() const noexcept
The wordRe is a pattern, not a literal string.
Definition: wordReI.H:104
prefixOSstream Pout
OSstream wrapped stdout (std::cout) with parallel prefix.
Extract type (as a word) from an object, typically using its type() method.
Definition: word.H:361
Namespace for OpenFOAM.
forAllConstIters(mixture.phases(), phase)
Definition: pEqn.H:28
label firstMatching(const UPtrList< T > &list, const UnaryMatchPredicate &matcher)
Find first list item with &#39;name()&#39; that matches, -1 on failure.
#define InfoInFunction
Report an information message using Foam::Info.