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-2023 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 
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 
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 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
180 
182 {
184  groupIDsPtr_.reset(nullptr);
185 }
186 
187 
188 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
189 
191 {
192  // processor initGeometry send/recv the following:
193  // - edgeCentres() : faMesh::edgeCentres()
194  // - edgeLengths() : faMesh::Le()
195  // - edgeFaceCentres() : faMesh::areaCentres()
196  //
197  // faMesh::Le() has its own point-to-point communication (OK) but
198  // triggers either/or edgeAreaNormals(), pointAreaNormals()
199  // with their own communication that can block.
200 
201  // This uses parallel comms and hence will not be trigggered
202  // on processors that do not have a processorFaPatch so instead
203  // force construction.
204 
205  (void)mesh_.edgeAreaNormals();
206  (void)mesh_.pointAreaNormals();
207 
208  (void)mesh_.areaCentres();
209  (void)mesh_.faceAreaNormals();
210 
211 
213 
214  if
215  (
216  pBufs.commsType() == Pstream::commsTypes::blocking
217  || pBufs.commsType() == Pstream::commsTypes::nonBlocking
218  )
219  {
220  forAll(*this, patchi)
221  {
222  operator[](patchi).initGeometry(pBufs);
223  }
224 
225  pBufs.finishedSends();
226 
227  forAll(*this, patchi)
228  {
229  operator[](patchi).calcGeometry(pBufs);
230  }
231  }
232  else if (pBufs.commsType() == Pstream::commsTypes::scheduled)
233  {
234  const lduSchedule& patchSchedule = mesh().globalData().patchSchedule();
235 
236  // Dummy.
237  pBufs.finishedSends();
238 
239  for (const auto& patchEval : patchSchedule)
240  {
241  const label patchi = patchEval.patch;
242 
243  if (patchEval.init)
244  {
245  operator[](patchi).initGeometry(pBufs);
246  }
247  else
248  {
249  operator[](patchi).calcGeometry(pBufs);
250  }
251  }
252  }
253 }
254 
255 
258 {
259  const faPatchList& patches = *this;
260 
261  UPtrList<const labelUList> list(patches.size());
262 
263  forAll(list, patchi)
264  {
265  list.set(patchi, &patches[patchi].edgeLabels());
266  }
267 
268  return list;
269 }
270 
271 
274 {
275  const faPatchList& patches = *this;
276 
277  UPtrList<const labelUList> list(patches.size());
278 
279  forAll(list, patchi)
280  {
281  list.set(patchi, &patches[patchi].edgeFaces());
282  }
283 
284  return list;
285 }
286 
287 
289 {
290  const faPatchList& patches = *this;
291 
293 
294  forAll(list, patchi)
295  {
296  const lduInterface* lduPtr = isA<lduInterface>(patches[patchi]);
297 
298  if (lduPtr)
299  {
300  list.set(patchi, lduPtr);
301  }
302  }
303 
304  return list;
305 }
306 
307 
308 Foam::label Foam::faBoundaryMesh::nNonProcessor() const
309 {
310  const faPatchList& patches = *this;
311 
312  label count = 0;
313 
314  for (const faPatch& p : patches)
315  {
316  if (isA<processorFaPatch>(p))
317  {
318  break;
319  }
320 
321  ++count;
322  }
323 
324  return count;
325 }
326 
327 
328 Foam::label Foam::faBoundaryMesh::nProcessorPatches() const
329 {
330  const faPatchList& patches = *this;
331 
332  label count = 0;
333 
334  for (const faPatch& p : patches)
335  {
336  if (isA<processorFaPatch>(p))
337  {
338  ++count;
339  }
340  }
341 
342  return count;
343 }
344 
345 
348 {
349  if (!groupIDsPtr_)
350  {
351  calcGroupIDs();
352  }
353 
354  return *groupIDsPtr_;
355 }
356 
357 
359 (
360  const word& groupName,
361  const labelUList& patchIDs
362 )
363 {
364  groupIDsPtr_.clear();
365 
366  faPatchList& patches = *this;
367 
368  boolList donePatch(patches.size(), false);
369 
370  // Add to specified patches
371  for (const label patchi : patchIDs)
372  {
373  patches[patchi].inGroups().appendUniq(groupName);
374  donePatch[patchi] = true;
375  }
376 
377  // Remove from other patches
378  forAll(patches, patchi)
379  {
380  if (!donePatch[patchi])
381  {
382  wordList& groups = patches[patchi].inGroups();
383 
384  if (groups.found(groupName))
385  {
386  label newi = 0;
387  forAll(groups, i)
388  {
389  if (groups[i] != groupName)
390  {
391  groups[newi++] = groups[i];
392  }
393  }
394  groups.resize(newi);
395  }
396  }
397  }
398 }
399 
402 {
403  return PtrListOps::get<word>(*this, nameOp<faPatch>());
404 }
405 
408 {
409  return PtrListOps::get<word>(*this, typeOp<faPatch>());
410 }
411 
412 
414 {
415  // Manually: faPatch does not have independent start() information
416 
417  const faPatchList& patches = *this;
418 
419  labelList list(patches.size());
420 
421  label beg = mesh_.nInternalEdges();
422  forAll(patches, patchi)
423  {
424  const label len = patches[patchi].nEdges();
425  list[patchi] = beg;
426  beg += len;
427  }
428  return list;
429 }
430 
431 
433 {
434  return
435  PtrListOps::get<label>
436  (
437  *this,
438  [](const faPatch& p) { return p.nEdges(); } // avoid virtual
439  );
440 }
441 
442 
444 {
445  const faPatchList& patches = *this;
446 
447  List<labelRange> list(patches.size());
448 
449  label beg = mesh_.nInternalEdges();
450  forAll(patches, patchi)
451  {
452  const label len = patches[patchi].nEdges();
453  list[patchi].reset(beg, len);
454  beg += len;
455  }
456  return list;
457 }
458 
461 {
462  return this->groupPatchIDs().sortedToc();
463 }
464 
466 Foam::label Foam::faBoundaryMesh::start() const
467 {
468  return mesh_.nInternalEdges();
469 }
470 
472 Foam::label Foam::faBoundaryMesh::nEdges() const
473 {
474  return mesh_.nBoundaryEdges();
475 }
476 
477 
479 {
480  return labelRange(mesh_.nInternalEdges(), mesh_.nBoundaryEdges());
481 }
482 
483 
485 (
486  const wordRe& matcher,
487  const bool useGroups
488 ) const
489 {
490  if (matcher.empty())
491  {
492  return labelList();
493  }
494 
495  // Only check groups if requested and they exist
496  const bool checkGroups = (useGroups && this->hasGroupIDs());
497 
498  labelHashSet ids;
499 
500  if (matcher.isPattern())
501  {
502  if (checkGroups)
503  {
504  const auto& groupLookup = groupPatchIDs();
505  forAllConstIters(groupLookup, iter)
506  {
507  if (matcher.match(iter.key()))
508  {
509  // Hash ids associated with the group
510  ids.insert(iter.val());
511  }
512  }
513  }
514 
515  if (ids.empty())
516  {
517  return PtrListOps::findMatching(*this, matcher);
518  }
519  else
520  {
521  ids.insert(PtrListOps::findMatching(*this, matcher));
522  }
523  }
524  else
525  {
526  // Literal string.
527  // Special version of above for reduced memory footprint
528 
529  const label patchId = PtrListOps::firstMatching(*this, matcher);
530 
531  if (patchId >= 0)
532  {
533  return labelList(one{}, patchId);
534  }
535  else if (checkGroups)
536  {
537  const auto iter = groupPatchIDs().cfind(matcher);
538 
539  if (iter.good())
540  {
541  // Hash ids associated with the group
542  ids.insert(iter.val());
543  }
544  }
545  }
546 
547  return ids.sortedToc();
548 }
549 
550 
552 (
553  const wordRes& matcher,
554  const bool useGroups
555 ) const
556 {
557  if (matcher.empty())
558  {
559  return labelList();
560  }
561  else if (matcher.size() == 1)
562  {
563  return this->indices(matcher.first(), useGroups);
564  }
565 
566  labelHashSet ids;
567 
568  // Only check groups if requested and they exist
569  if (useGroups && this->hasGroupIDs())
570  {
571  ids.resize(2*this->size());
572 
573  const auto& groupLookup = groupPatchIDs();
574  forAllConstIters(groupLookup, iter)
575  {
576  if (matcher.match(iter.key()))
577  {
578  // Hash ids associated with the group
579  ids.insert(iter.val());
580  }
581  }
582  }
583 
584  if (ids.empty())
585  {
586  return PtrListOps::findMatching(*this, matcher);
587  }
588  else
589  {
590  ids.insert(PtrListOps::findMatching(*this, matcher));
591  }
592 
593  return ids.sortedToc();
594 }
595 
596 
597 Foam::label Foam::faBoundaryMesh::findIndex(const wordRe& key) const
598 {
599  if (key.empty())
600  {
601  return -1;
602  }
603  return PtrListOps::firstMatching(*this, key);
604 }
605 
606 
608 (
609  const word& patchName,
610  bool allowNotFound
611 ) const
612 {
613  if (patchName.empty())
614  {
615  return -1;
616  }
617 
618  const label patchId = PtrListOps::firstMatching(*this, patchName);
619 
620  if (patchId >= 0)
621  {
622  return patchId;
623  }
624 
625  if (!allowNotFound)
626  {
628  << "Patch '" << patchName << "' not found. "
629  << "Available patch names: " << names() << endl
630  << exit(FatalError);
631  }
632 
633  // Patch not found
634  if (debug)
635  {
636  Pout<< "label faBoundaryMesh::findPatchID(const word&) const"
637  << "Patch named " << patchName << " not found. "
638  << "Available patch names: " << names() << endl;
639  }
640 
641  // Not found, return -1
642  return -1;
643 }
644 
645 
646 Foam::label Foam::faBoundaryMesh::whichPatch(const label edgeIndex) const
647 {
648  if (edgeIndex < mesh().nInternalEdges())
649  {
650  // Internal edge
651  return -1;
652  }
653  else if (edgeIndex >= mesh().nEdges())
654  {
655  // Bounds error: abort
657  << "Edge " << edgeIndex
658  << " out of bounds. Number of geometric edges " << mesh().nEdges()
659  << abort(FatalError);
660 
661  return -1;
662  }
663 
664  // Find patch that the edgeIndex belongs to.
665 
666  forAll(*this, patchi)
667  {
668  label start = mesh_.patchStarts()[patchi];
669  label size = operator[](patchi).faPatch::size();
670 
671  if (edgeIndex >= start && edgeIndex < start + size)
672  {
673  return patchi;
674  }
675  }
676 
677  // If not in any of above, it's trouble!
679  << "Error in patch search algorithm"
680  << abort(FatalError);
681 
682  return -1;
683 }
684 
685 
686 bool Foam::faBoundaryMesh::checkParallelSync(const bool report) const
687 {
688  if (!Pstream::parRun())
689  {
690  return false;
691  }
692 
693  const faBoundaryMesh& bm = *this;
694 
695  bool hasError = false;
696 
697  // Collect non-proc patches and check proc patches are last.
698  wordList localNames(bm.size());
699  wordList localTypes(bm.size());
700 
701  label nonProci = 0;
702 
703  forAll(bm, patchi)
704  {
705  if (!isA<processorFaPatch>(bm[patchi]))
706  {
707  if (nonProci != patchi)
708  {
709  // A processor patch in between normal patches!
710  hasError = true;
711 
712  if (debug || report)
713  {
714  Pout<< " ***Problem with boundary patch " << patchi
715  << " name:" << bm[patchi].name()
716  << " type:" << bm[patchi].type()
717  << " - seems to be preceeded by processor patches."
718  << " This is usually a problem." << endl;
719  }
720  }
721  else
722  {
723  localNames[nonProci] = bm[patchi].name();
724  localTypes[nonProci] = bm[patchi].type();
725  ++nonProci;
726  }
727  }
728  }
729  localNames.resize(nonProci);
730  localTypes.resize(nonProci);
731 
732  // Check and report error(s) on master
733  // - don't need indexing on master itself
734 
735  const globalIndex procAddr(globalIndex::gatherNonLocal{}, nonProci);
736 
737  const wordList allNames(procAddr.gather(localNames));
738  const wordList allTypes(procAddr.gather(localTypes));
739 
740  // Automatically restricted to master
741  for (const int proci : procAddr.subProcs())
742  {
743  const auto procNames(allNames.slice(procAddr.range(proci)));
744  const auto procTypes(allTypes.slice(procAddr.range(proci)));
745 
746  if (procNames != localNames || procTypes != localTypes)
747  {
748  hasError = true;
749 
750  if (debug || report)
751  {
752  Info<< " ***Inconsistent patches across processors, "
753  "processor0 has patch names:" << localNames
754  << " patch types:" << localTypes
755  << " processor" << proci
756  << " has patch names:" << procNames
757  << " patch types:" << procTypes
758  << endl;
759  }
760  }
761  }
762 
763  // Reduce (not broadcast) to respect local out-of-order errors (first loop)
764  return returnReduceOr(hasError);
765 }
766 
767 
768 bool Foam::faBoundaryMesh::checkDefinition(const bool report) const
769 {
770  label nextPatchStart = mesh().nInternalEdges();
771  const faBoundaryMesh& bm = *this;
772 
773  bool hasError = false;
774 
775  forAll(bm, patchi)
776  {
777  if (bm[patchi].start() != nextPatchStart && !hasError)
778  {
779  hasError = true;
780 
782  << " ****Problem with boundary patch " << patchi
783  << " named " << bm[patchi].name()
784  << " of type " << bm[patchi].type()
785  << ". The patch should start on face no " << nextPatchStart
786  << " and the patch specifies " << bm[patchi].start()
787  << "." << endl
788  << "Possibly consecutive patches have this same problem."
789  << " Suppressing future warnings." << endl;
790  }
791 
792  // Warn about duplicate boundary patches?
793 
794  nextPatchStart += bm[patchi].faPatch::size();
795  }
796 
797  if (hasError)
798  {
800  << "This mesh is not valid: boundary definition is in error."
801  << endl;
802  }
803  else
804  {
805  if (debug || report)
806  {
807  Info << "Boundary definition OK." << endl;
808  }
809  }
810 
811  return hasError;
812 }
813 
814 
816 {
817  // See comments in calcGeometry()
818 
819  (void)mesh_.edgeAreaNormals();
820  (void)mesh_.pointAreaNormals();
821 
822  (void)mesh_.areaCentres();
823  (void)mesh_.faceAreaNormals();
824 
825 
826  PstreamBuffers pBufs(Pstream::defaultCommsType);
827 
828  if
829  (
830  pBufs.commsType() == Pstream::commsTypes::blocking
831  || pBufs.commsType() == Pstream::commsTypes::nonBlocking
832  )
833  {
834  forAll(*this, patchi)
835  {
836  operator[](patchi).initMovePoints(pBufs, p);
837  }
838 
839  pBufs.finishedSends();
840 
841  forAll(*this, patchi)
842  {
843  operator[](patchi).movePoints(pBufs, p);
844  }
845  }
846  else if (pBufs.commsType() == Pstream::commsTypes::scheduled)
847  {
848  const lduSchedule& patchSchedule = mesh().globalData().patchSchedule();
849 
850  // Dummy.
851  pBufs.finishedSends();
852 
853  for (const auto& schedEval : patchSchedule)
854  {
855  const label patchi = schedEval.patch;
856 
857  if (schedEval.init)
858  {
859  operator[](patchi).initMovePoints(pBufs, p);
860  }
861  else
862  {
863  operator[](patchi).movePoints(pBufs, p);
864  }
865  }
866  }
867 }
868 
869 
871 {
872  PstreamBuffers pBufs(Pstream::defaultCommsType);
873 
874  if
875  (
876  pBufs.commsType() == Pstream::commsTypes::blocking
877  || pBufs.commsType() == Pstream::commsTypes::nonBlocking
878  )
879  {
880  forAll(*this, patchi)
881  {
882  operator[](patchi).initUpdateMesh(pBufs);
883  }
884 
885  pBufs.finishedSends();
886 
887  forAll(*this, patchi)
888  {
889  operator[](patchi).updateMesh(pBufs);
890  }
891  }
892  else if (pBufs.commsType() == Pstream::commsTypes::scheduled)
893  {
894  const lduSchedule& patchSchedule = mesh().globalData().patchSchedule();
895 
896  // Dummy.
897  pBufs.finishedSends();
898 
899  for (const auto& schedEval : patchSchedule)
900  {
901  const label patchi = schedEval.patch;
902 
903  if (schedEval.init)
904  {
905  operator[](patchi).initUpdateMesh(pBufs);
906  }
907  else
908  {
909  operator[](patchi).updateMesh(pBufs);
910  }
911  }
912  }
913 }
914 
915 
916 bool Foam::faBoundaryMesh::writeData(Ostream& os) const
917 {
918  const faPatchList& patches = *this;
919 
920  os << patches.size() << nl << token::BEGIN_LIST << incrIndent << nl;
921 
922  for (const faPatch& p : patches)
923  {
924  os.beginBlock(p.name());
925  os << p;
926  os.endBlock();
927  }
928 
932  return os.good();
933 }
934 
935 
937 (
938  IOstreamOption streamOpt,
939  const bool writeOnProc
940 ) const
941 {
942  // Allow/disallow compression?
943  // 1. keep readable
944  // 2. save some space
945  // ??? streamOpt.compression(IOstreamOption::UNCOMPRESSED);
946  return regIOobject::writeObject(streamOpt, writeOnProc);
947 }
948 
949 
950 // * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
951 
952 Foam::Ostream& Foam::operator<<(Ostream& os, const faBoundaryMesh& bm)
953 {
954  bm.writeData(os);
955  return os;
956 }
957 
958 
959 // ************************************************************************* //
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.
const labelList patchIDs(pbm.patchSet(polyPatchNames, false, true).sortedToc())
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.
void clear()
Clear the patch list and all demand-driven data.
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:162
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:1004
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.
virtual bool writeObject(IOstreamOption streamOpt, const bool writeOnProc) const
Write using stream options.
virtual bool writeObject(IOstreamOption streamOpt, const bool writeOnProc) const
Write using stream options.
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:78
labelRange range() const
Return start/size range of local processor data.
Definition: globalIndexI.H:249
void resize(const label sz)
Resize the hash table for efficiency.
Definition: HashTable.C:632
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:414
HashSet< label, Hash< label > > labelHashSet
A HashSet of labels, uses label hasher.
Definition: HashSet.H:85
unsigned int count(const UList< bool > &bools, const bool val=true)
Count number of &#39;true&#39; entries.
Definition: BitOps.H:73
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.
dynamicFvMesh & mesh
"scheduled" : (MPI_Send, MPI_Recv)
wordList names() const
Return a list of patch names.
label size() const noexcept
The number of entries in the list.
Definition: UPtrListI.H:113
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:1300
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:159
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
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
faBoundaryMesh(const faBoundaryMesh &)=delete
No copy construct.
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:170
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
List of word.
Definition: fileName.H:58
void append(autoPtr< T > &ptr)
Move append an element to the end of the list.
Definition: PtrList.H:323
static commsTypes defaultCommsType
Default commsType.
Definition: UPstream.H:387
#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:281
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:65
void clear()
Clear the PtrList. Delete allocated entries and set size to zero.
Definition: PtrListI.H:81
"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
volScalarField & p
IOobject io("surfaceFilmProperties", mesh.time().constant(), mesh, IOobject::READ_IF_PRESENT, IOobject::NO_WRITE, IOobject::NO_REGISTER)
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:171
labelList patchStarts() const
Return a list of patch start indices.
List< bool > boolList
A List of bools.
Definition: List.H:60
label nProcessorPatches() const
The number of processorFaPatch patches.
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.