ZoneMesh.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) 2011-2016 OpenFOAM Foundation
9  Copyright (C) 2016-2021 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 "ZoneMesh.H"
30 #include "entry.H"
31 #include "DynamicList.H"
32 #include "Pstream.H"
33 #include "PtrListOps.H"
34 
35 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
36 
37 namespace Foam
38 {
39  template<class ZoneType, class MeshType>
41  (
42  debug::debugSwitch("disallowGenericZones", 0)
43  );
44 }
45 
46 
47 // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
48 
49 template<class ZoneType, class MeshType>
51 {
52  if (zoneMapPtr_)
53  {
55  << "zone map already calculated"
56  << abort(FatalError);
57  }
58  else
59  {
60  // Count number of objects in all zones
61  label nObjects = 0;
62 
63  const PtrList<ZoneType>& zones = *this;
64 
65  for (const ZoneType& zn : zones)
66  {
67  nObjects += zn.size();
68  }
69 
70  zoneMapPtr_.reset(new Map<label>(2*nObjects));
71  auto& zm = *zoneMapPtr_;
72 
73  // Fill in objects of all zones into the map.
74  // The key is the global object index, value is the zone index
75 
76  label zonei = 0;
77 
78  for (const ZoneType& zn : zones)
79  {
80  const labelList& labels = zn;
81 
82  for (const label idx : labels)
83  {
84  zm.insert(idx, zonei);
85  }
86 
87  ++zonei;
88  }
89  }
90 }
91 
92 
93 template<class ZoneType, class MeshType>
95 {
96  if (groupIDsPtr_)
97  {
98  // Use existing cache
99  return !groupIDsPtr_->empty();
100  }
101 
102  const PtrList<ZoneType>& zones = *this;
103 
104  for (const ZoneType& zn : zones)
105  {
106  if (!zn.inGroups().empty())
107  {
108  return true;
109  }
110  }
111 
112  return false;
113 }
114 
115 
116 template<class ZoneType, class MeshType>
118 {
119  if (groupIDsPtr_)
120  {
121  return; // Or FatalError
122  }
123 
124  groupIDsPtr_.reset(new HashTable<labelList>(16));
125  auto& groupLookup = *groupIDsPtr_;
126 
127  const PtrList<ZoneType>& zones = *this;
128 
129  forAll(zones, zonei)
130  {
131  const wordList& groups = zones[zonei].inGroups();
132 
133  for (const word& groupName : groups)
134  {
135  groupLookup(groupName).append(zonei);
136  }
137  }
138 
139  // Remove groups that clash with zone names
140  forAll(zones, zonei)
141  {
142  if (groupLookup.erase(zones[zonei].name()))
143  {
145  << "Removed group '" << zones[zonei].name()
146  << "' which clashes with zone " << zonei
147  << " of the same name."
148  << endl;
149  }
150  }
151 }
152 
153 
154 template<class ZoneType, class MeshType>
156 {
157  if
158  (
159  readOpt() == IOobject::MUST_READ
160  || readOpt() == IOobject::MUST_READ_IF_MODIFIED
161  || (readOpt() == IOobject::READ_IF_PRESENT && headerOk())
162  )
163  {
164  // Warn for MUST_READ_IF_MODIFIED
165  warnNoRereading<ZoneMesh<ZoneType, MeshType>>();
166 
167  PtrList<ZoneType>& zones = *this;
168 
169  // Read zones
170  Istream& is = readStream(typeName);
171 
172  PtrList<entry> patchEntries(is);
173  zones.resize(patchEntries.size());
174 
175  forAll(zones, zonei)
176  {
177  zones.set
178  (
179  zonei,
181  (
182  patchEntries[zonei].keyword(),
183  patchEntries[zonei].dict(),
184  zonei,
185  *this
186  )
187  );
188  }
189 
190  // Check state of IOstream
191  is.check(FUNCTION_NAME);
192 
193  close();
194 
195  return true;
196  }
197 
198  // Nothing read
199  return false;
200 }
201 
202 
203 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
204 
205 template<class ZoneType, class MeshType>
207 (
208  const IOobject& io,
209  const MeshType& mesh
210 )
211 :
213  regIOobject(io),
214  mesh_(mesh)
215 {
216  read();
217 }
218 
219 
220 template<class ZoneType, class MeshType>
222 (
223  const IOobject& io,
224  const MeshType& mesh,
225  const label size
226 )
227 :
228  PtrList<ZoneType>(size),
229  regIOobject(io),
230  mesh_(mesh)
231 {
232  // Optionally read contents, otherwise keep size
233  read();
234 }
235 
236 
237 template<class ZoneType, class MeshType>
239 (
240  const IOobject& io,
241  const MeshType& mesh,
242  const PtrList<ZoneType>& pzm
243 )
244 :
246  regIOobject(io),
247  mesh_(mesh)
248 {
249  if (!read())
250  {
251  // Nothing read. Use supplied zones
252  PtrList<ZoneType>& zones = *this;
253  zones.resize(pzm.size());
254 
255  forAll(zones, zonei)
256  {
257  zones.set(zonei, pzm[zonei].clone(*this).ptr());
258  }
259  }
260 }
261 
262 
263 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
264 
265 template<class ZoneType, class MeshType>
267 {
268  clearAddressing();
269 }
270 
271 
272 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
273 
274 template<class ZoneType, class MeshType>
277 {
278  if (!zoneMapPtr_)
279  {
280  calcZoneMap();
281  }
282 
283  return *zoneMapPtr_;
284 }
285 
286 
287 template<class ZoneType, class MeshType>
289 (
290  const label objectIndex
291 ) const
292 {
293  return zoneMap().lookup(objectIndex, -1);
294 }
295 
296 
297 template<class ZoneType, class MeshType>
299 {
300  return PtrListOps::get<word>(*this, typeOp<ZoneType>());
301 }
302 
303 
304 template<class ZoneType, class MeshType>
306 {
307  return PtrListOps::get<word>(*this, nameOp<ZoneType>());
308 }
309 
310 
311 template<class ZoneType, class MeshType>
313 (
314  const wordRe& matcher
315 ) const
316 {
317  return PtrListOps::names(*this, matcher);
318 }
319 
320 
321 template<class ZoneType, class MeshType>
323 (
324  const wordRes& matcher
325 )
326 const
327 {
328  return PtrListOps::names(*this, matcher);
329 }
330 
331 
332 template<class ZoneType, class MeshType>
334 {
335  wordList sorted(this->names());
336  Foam::sort(sorted);
337 
338  return sorted;
339 }
340 
341 
342 template<class ZoneType, class MeshType>
344 (
345  const wordRe& matcher
346 ) const
347 {
348  wordList sorted(this->names(matcher));
349  Foam::sort(sorted);
350 
351  return sorted;
352 }
353 
354 
355 template<class ZoneType, class MeshType>
357 (
358  const wordRes& matcher
359 )
360 const
361 {
362  wordList sorted(this->names(matcher));
363  Foam::sort(sorted);
364 
365  return sorted;
366 }
367 
368 
369 template<class ZoneType, class MeshType>
371 (
372  const wordRe& matcher,
373  const bool useGroups
374 ) const
375 {
376  if (matcher.empty())
377  {
378  return labelList();
379  }
380 
381  // Only check groups if requested and they exist
382  const bool checkGroups = (useGroups && this->hasGroupIDs());
383 
384  labelHashSet ids;
385 
386  if (checkGroups)
387  {
388  ids.resize(2*this->size());
389  }
390 
391  if (matcher.isPattern())
392  {
393  if (checkGroups)
394  {
395  const auto& groupLookup = groupZoneIDs();
396  forAllConstIters(groupLookup, iter)
397  {
398  if (matcher.match(iter.key()))
399  {
400  // Hash ids associated with the group
401  ids.insert(iter.val());
402  }
403  }
404  }
405 
406  if (ids.empty())
407  {
408  return PtrListOps::findMatching(*this, matcher);
409  }
410  else
411  {
412  ids.insert(PtrListOps::findMatching(*this, matcher));
413  }
414  }
415  else
416  {
417  // Literal string.
418  // Special version of above for reduced memory footprint
419 
420  const label zoneId = PtrListOps::firstMatching(*this, matcher);
421 
422  if (zoneId >= 0)
423  {
424  return labelList(one{}, zoneId);
425  }
426  else if (checkGroups)
427  {
428  const auto iter = groupZoneIDs().cfind(matcher);
429 
430  if (iter.found())
431  {
432  // Hash ids associated with the group
433  ids.insert(iter.val());
434  }
435  }
436  }
437 
438  return ids.sortedToc();
439 }
440 
441 
442 template<class ZoneType, class MeshType>
444 (
445  const wordRes& matcher,
446  const bool useGroups
447 ) const
448 {
449  if (matcher.empty())
450  {
451  return labelList();
452  }
453  else if (matcher.size() == 1)
454  {
455  return this->indices(matcher.first(), useGroups);
456  }
457 
458  labelHashSet ids;
459 
460  // Only check groups if requested and they exist
461  if (useGroups && this->hasGroupIDs())
462  {
463  ids.resize(2*this->size());
464 
465  const auto& groupLookup = groupZoneIDs();
466  forAllConstIters(groupLookup, iter)
467  {
468  if (matcher.match(iter.key()))
469  {
470  // Hash the ids associated with the group
471  ids.insert(iter.val());
472  }
473  }
474  }
475 
476  if (ids.empty())
477  {
478  return PtrListOps::findMatching(*this, matcher);
479  }
480  else
481  {
482  ids.insert(PtrListOps::findMatching(*this, matcher));
483  }
484 
485  return ids.sortedToc();
486 }
487 
488 
489 template<class ZoneType, class MeshType>
491 (
492  const wordRe& key
493 ) const
494 {
495  if (key.empty())
496  {
497  return -1;
498  }
499  return PtrListOps::firstMatching(*this, key);
500 }
501 
502 
503 template<class ZoneType, class MeshType>
505 (
506  const wordRes& matcher
507 ) const
508 {
509  if (matcher.empty())
510  {
511  return -1;
512  }
513  return PtrListOps::firstMatching(*this, matcher);
514 }
515 
516 
517 template<class ZoneType, class MeshType>
519 (
520  const word& zoneName
521 ) const
522 {
523  if (zoneName.empty())
524  {
525  return -1;
526  }
527 
528  label zoneId = PtrListOps::firstMatching(*this, zoneName);
529 
530  if (zoneId < 0)
531  {
533  << "Zone named " << zoneName << " not found. "
534  << "List of available zone names: " << names() << endl;
535 
536  // Used for -dry-run, for example
537  if (disallowGenericZones != 0)
538  {
539  auto& zm = const_cast<ZoneMesh<ZoneType, MeshType>&>(*this);
540  zoneId = zm.size();
541 
542  Info<< "Creating dummy zone " << zoneName << endl;
543  zm.append(new ZoneType(zoneName, zoneId, zm));
544  }
545  }
546 
547  return zoneId;
548 }
549 
550 
551 template<class ZoneType, class MeshType>
553 (
554  const word& zoneName
555 ) const
556 {
557  if (zoneName.empty())
558  {
559  return nullptr;
560  }
561 
562  const PtrList<ZoneType>& zones = *this;
563 
564  for (auto iter = zones.begin(); iter != zones.end(); ++iter)
565  {
566  const ZoneType* ptr = iter.get();
567 
568  if (ptr && zoneName == ptr->name())
569  {
570  return ptr;
571  }
572  }
573 
574  // Used for -dry-run, for example
575  if (disallowGenericZones != 0)
576  {
577  auto& zm = const_cast<ZoneMesh<ZoneType, MeshType>&>(*this);
578 
579  Info<< "Creating dummy zone " << zoneName << endl;
580  zm.append(new ZoneType(zoneName, zm.size(), zm));
581  }
582 
583  return nullptr;
584 }
585 
586 
587 template<class ZoneType, class MeshType>
589 (
590  const word& zoneName
591 )
592 {
593  return const_cast<ZoneType*>(this->cfindZone(zoneName));
594 }
595 
596 
597 template<class ZoneType, class MeshType>
599 (
600  const labelUList& zoneIds
601 ) const
602 {
603  bitSet bitset;
604 
605  for (const label zonei : zoneIds)
606  {
607  #ifdef FULLDEBUG
608  if (zonei < 0 || zonei >= this->size())
609  {
611  << ZoneType::typeName << " "
612  << zonei << " out of range [0," << this->size() << ")"
613  << abort(FatalError);
614  }
615  #endif
616 
617  bitset.set
618  (
619  static_cast<const labelList&>(this->operator[](zonei))
620  );
621  }
622 
623  return bitset;
624 }
625 
626 
627 template<class ZoneType, class MeshType>
629 (
630  const wordRe& matcher,
631  const bool useGroups
632 ) const
633 {
634  // matcher.empty() is handled by indices()
635  return this->selection(this->indices(matcher, useGroups));
636 }
637 
638 
639 template<class ZoneType, class MeshType>
641 (
642  const wordRes& matcher,
643  const bool useGroups
644 ) const
645 {
646  // matcher.empty() is handled by indices()
647  return this->selection(this->indices(matcher, useGroups));
648 }
649 
650 
651 template<class ZoneType, class MeshType>
654 {
655  if (!groupIDsPtr_)
656  {
657  calcGroupIDs();
658  }
659 
660  return *groupIDsPtr_;
661 }
662 
663 
664 template<class ZoneType, class MeshType>
666 (
667  const word& groupName,
668  const labelUList& zoneIDs
669 )
670 {
671  groupIDsPtr_.clear();
672 
673  PtrList<ZoneType>& zones = *this;
674 
675  boolList doneZone(zones.size(), false);
676 
677  // Add to specified zones
678  for (const label zonei : zoneIDs)
679  {
680  zones[zonei].inGroups().appendUniq(groupName);
681  doneZone[zonei] = true;
682  }
683 
684  // Remove from other zones
685  forAll(zones, zonei)
686  {
687  if (!doneZone[zonei])
688  {
689  wordList& groups = zones[zonei].inGroups();
690 
691  if (groups.found(groupName))
692  {
693  label newi = 0;
694  forAll(groups, i)
695  {
696  if (groups[i] != groupName)
697  {
698  groups[newi++] = groups[i];
699  }
700  }
701  groups.resize(newi);
702  }
703  }
704  }
705 }
706 
707 
708 template<class ZoneType, class MeshType>
710 {
711  zoneMapPtr_.clear();
712  groupIDsPtr_.clear();
713 
714  PtrList<ZoneType>& zones = *this;
715 
716  for (ZoneType& zn : zones)
717  {
718  zn.clearAddressing();
719  }
720 }
721 
722 
723 template<class ZoneType, class MeshType>
725 {
726  clearAddressing();
728 }
729 
730 
731 template<class ZoneType, class MeshType>
733 (
734  const bool report
735 ) const
736 {
737  bool hasError = false;
738 
739  const PtrList<ZoneType>& zones = *this;
740 
741  for (const ZoneType& zn : zones)
742  {
743  hasError |= zn.checkDefinition(report);
744  }
745 
746  return hasError;
747 }
748 
749 
750 template<class ZoneType, class MeshType>
752 (
753  const bool report
754 ) const
755 {
756  if (!Pstream::parRun())
757  {
758  return false;
759  }
760 
761  const PtrList<ZoneType>& zones = *this;
762 
763  bool hasError = false;
764 
765  // Collect all names
766  List<wordList> allNames(Pstream::nProcs());
767  allNames[Pstream::myProcNo()] = this->names();
768  Pstream::gatherList(allNames);
769  Pstream::scatterList(allNames);
770 
771  List<wordList> allTypes(Pstream::nProcs());
772  allTypes[Pstream::myProcNo()] = this->types();
773  Pstream::gatherList(allTypes);
774  Pstream::scatterList(allTypes);
775 
776  // Have every processor check but only master print error.
777 
778  for (label proci = 1; proci < allNames.size(); ++proci)
779  {
780  if
781  (
782  (allNames[proci] != allNames[0])
783  || (allTypes[proci] != allTypes[0])
784  )
785  {
786  hasError = true;
787 
788  if (debug || (report && Pstream::master()))
789  {
790  Info<< " ***Inconsistent zones across processors, "
791  "processor 0 has zone names:" << allNames[0]
792  << " zone types:" << allTypes[0]
793  << " processor " << proci << " has zone names:"
794  << allNames[proci]
795  << " zone types:" << allTypes[proci]
796  << endl;
797  }
798  }
799  }
800 
801  // Check contents
802  if (!hasError)
803  {
804  for (const ZoneType& zn : zones)
805  {
806  if (zn.checkParallelSync(false))
807  {
808  hasError = true;
809 
810  if (debug || (report && Pstream::master()))
811  {
812  Info<< " ***Zone " << zn.name()
813  << " of type " << zn.type()
814  << " is not correctly synchronised"
815  << " across coupled boundaries."
816  << " (coupled faces are either not both"
817  << " present in set or have same flipmap)" << endl;
818  }
819  }
820  }
821  }
822 
823  return hasError;
824 }
825 
826 
827 template<class ZoneType, class MeshType>
829 {
830  PtrList<ZoneType>& zones = *this;
831 
832  for (ZoneType& zn : zones)
833  {
834  zn.movePoints(pts);
835  }
836 }
837 
838 
839 template<class ZoneType, class MeshType>
841 {
842  wordList zoneNames(this->names());
843  if (zoneNames.empty())
844  {
845  this->removeMetaData();
846  }
847  else
848  {
849  dictionary& meta = this->getMetaData();
850  meta.set("names", zoneNames);
851  }
852 }
853 
854 
855 template<class ZoneType, class MeshType>
857 {
858  os << *this;
859  return os.good();
860 }
861 
862 
863 // * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * * //
864 
865 template<class ZoneType, class MeshType>
867 (
868  const word& zoneName
869 ) const
870 {
871  const label zonei = findZoneID(zoneName);
872 
873  if (zonei < 0)
874  {
876  << "Zone named " << zoneName << " not found." << nl
877  << "Available zone names: " << names() << endl
878  << abort(FatalError);
879  }
880 
881  return operator[](zonei);
882 }
883 
884 
885 template<class ZoneType, class MeshType>
887 (
888  const word& zoneName
889 )
890 {
891  const label zonei = findZoneID(zoneName);
892 
893  if (zonei < 0)
894  {
896  << "Zone named " << zoneName << " not found." << nl
897  << "Available zone names: " << names() << endl
898  << abort(FatalError);
899  }
900 
901  return operator[](zonei);
902 }
903 
904 
905 template<class ZoneType, class MeshType>
907 (
908  const word& zoneName,
909  const bool verbose
910 )
911 {
912  ZoneType* ptr = findZone(zoneName);
913 
914  const bool existing = bool(ptr);
915 
916  if (!ptr)
917  {
918  ptr = new ZoneType(zoneName, this->size(), *this);
919  this->append(ptr);
920  }
921 
922  if (verbose)
923  {
924  Info<< ZoneType::typeName << ' ' << zoneName
925  << " (" << (existing ? "existing" : "new")
926  << " at index " << ptr->index() << ')'
927  << endl;
928  }
929 
930  return *ptr;
931 }
932 
933 
934 // * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
935 
936 template<class ZoneType, class MeshType>
937 Foam::Ostream& Foam::operator<<
938 (
939  Ostream& os,
940  const ZoneMesh<ZoneType, MeshType>& zones
941 )
942 {
943  const label sz = zones.size();
944 
945  if (sz)
946  {
947  os << sz << nl << token::BEGIN_LIST;
948 
949  for (label i=0; i < sz; ++i)
950  {
951  zones[i].writeDict(os);
952  }
953 
954  os << token::END_LIST;
955  }
956  else
957  {
958  os << sz << token::BEGIN_LIST << token::END_LIST;
959  }
960 
961  return os;
962 }
963 
964 
965 // ************************************************************************* //
Foam::ZoneMesh::zoneMap
const Map< label > & zoneMap() const
Map of zones containing zone index for all zoned elements.
Definition: ZoneMesh.C:276
Foam::expressions::patchExpr::debug
int debug
Static debugging option.
Foam::ZoneMesh::checkDefinition
bool checkDefinition(const bool report=false) const
Check zone definition. Return true if in error.
Definition: ZoneMesh.C:733
Foam::labelList
List< label > labelList
A List of labels.
Definition: List.H:67
Foam::ZoneMesh::clear
void clear()
Clear the zones.
Definition: ZoneMesh.C:724
Foam::IOobject
Defines the attributes of an object for which implicit objectRegistry management is supported,...
Definition: IOobject.H:169
Foam::wordRe::isPattern
bool isPattern() const noexcept
The wordRe is treated as a pattern, not as literal string.
Definition: wordReI.H:107
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:65
ZoneMesh.H
Foam::ZoneMesh::writeData
bool writeData(Ostream &os) const
The writeData member function required by regIOobject.
Definition: ZoneMesh.C:856
Foam::ZoneMesh::findIndex
label findIndex(const wordRe &key) const
Zone index for the first match, return -1 if not found.
Definition: ZoneMesh.C:491
Foam::ZoneMesh::cfindZone
const ZoneType * cfindZone(const word &zoneName) const
Find zone by name and return const pointer, nullptr on error.
Definition: ZoneMesh.C:553
Foam::bitSet
A bitSet stores bits (elements with only two states) in packed internal format and supports a variety...
Definition: bitSet.H:63
Foam::List::resize
void resize(const label len)
Adjust allocated size of list.
Definition: ListI.H:139
Foam::ZoneMesh::groupZoneIDs
const HashTable< labelList > & groupZoneIDs() const
The zone indices per zone group.
Definition: ZoneMesh.C:653
Foam::debug::debugSwitch
int debugSwitch(const char *name, const int deflt=0)
Lookup debug switch or add default value.
Definition: debug.C:225
Foam::glTF::key
auto key(const Type &t) -> typename std::enable_if< std::is_enum< Type >::value, typename std::underlying_type< Type >::type >::type
Definition: foamGltfBase.H:108
Foam::PtrListOps::findMatching
labelList findMatching(const UPtrList< T > &list, const UnaryMatchPredicate &matcher)
Extract list indices for all items with 'name()' that matches.
Foam::bitSet::set
void set(const bitSet &bitset)
Set specified bits from another bitset.
Definition: bitSetI.H:574
Foam::Map
A HashTable to objects of type <T> with a label key.
Definition: lumpedPointController.H:69
Foam::one
A class representing the concept of 1 (one) that can be used to avoid manipulating objects known to b...
Definition: one.H:61
Foam::List::append
void append(const T &val)
Append an element at the end of the list.
Definition: ListI.H:175
PtrListOps.H
Functions to operate on Pointer Lists.
Foam::endl
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:369
Foam::PtrList::set
const T * set(const label i) const
Return const pointer to element (can be nullptr),.
Definition: PtrList.H:138
Foam::dictionary::set
entry * set(entry *entryPtr)
Assign a new entry, overwriting any existing entry.
Definition: dictionary.C:780
append
rAUs append(new volScalarField(IOobject::groupName("rAU", phase1.name()), 1.0/(U1Eqn.A()+byDt(max(phase1.residualAlpha() - alpha1, scalar(0)) *rho1))))
Foam::HashSetOps::bitset
bitSet bitset(const labelHashSet &locations)
Transform the on locations to a bitSet.
Definition: HashOps.C:72
Foam::HashSet< label, Hash< label > >
Foam::wordRe
A wordRe is a Foam::word, but can contain a regular expression for matching words or strings.
Definition: wordRe.H:80
entry.H
zoneIDs
const labelIOList & zoneIDs
Definition: correctPhi.H:59
forAll
#define forAll(list, i)
Loop across all elements in list.
Definition: stdFoam.H:296
Foam::wordRes::match
bool match(const std::string &text, bool literal=false) const
Smart match as literal or regex, stopping on the first match.
Definition: wordResI.H:91
Foam::wordList
List< word > wordList
A List of words.
Definition: fileName.H:62
Foam::blockMeshTools::read
void read(Istream &, label &val, const dictionary &)
In-place read with dictionary lookup.
Definition: blockMeshTools.C:57
Foam::ZoneMesh::~ZoneMesh
~ZoneMesh()
Destructor.
Definition: ZoneMesh.C:266
Foam::ZoneMesh::setGroup
void setGroup(const word &groupName, const labelUList &zoneIDs)
Set/add group with zones.
Definition: ZoneMesh.C:666
Foam::ZoneMesh::movePoints
void movePoints(const pointField &pts)
Correct zone mesh after moving points.
Definition: ZoneMesh.C:828
Foam::Field< vector >
Foam::Info
messageStream Info
Information stream (stdout output on master, null elsewhere)
DebugInFunction
#define DebugInFunction
Report an information message using Foam::Info.
Definition: messageStream.H:388
Foam::sort
void sort(UList< T > &a)
Definition: UList.C:261
Foam::ZoneMesh
A list of mesh zones.
Definition: cellZoneMeshFwd.H:44
Foam::nameOp
Extract name (as a word) from an object, typically using its name() method.
Definition: word.H:237
Foam::PtrList
A list of pointers to objects of type <T>, with allocation/deallocation management of the pointers....
Definition: List.H:59
Foam::ZoneMesh::whichZone
label whichZone(const label objectIndex) const
Given a global object index, return the zone it is in.
Definition: ZoneMesh.C:289
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::FatalError
error FatalError
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:123
os
OBJstream os(runTime.globalPath()/outputName)
mesh
dynamicFvMesh & mesh
Definition: createDynamicFvMesh.H:6
Pstream.H
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::abort
errorManip< error > abort(error &err)
Definition: errorManip.H:144
Foam::ZoneMesh::findZoneID
label findZoneID(const word &zoneName) const
Find zone index by name, return -1 if not found.
Definition: ZoneMesh.C:519
Foam::ZoneMesh::indices
labelList indices(const wordRe &matcher, const bool useGroups=true) const
Return (sorted) zone indices for all matches.
Definition: ZoneMesh.C:371
Foam::ZoneMesh::operator
friend Ostream & operator(Ostream &os, const ZoneMesh< ZoneType, MeshType > &zones)
Foam::ZoneMesh::names
wordList names() const
A list of the zone names.
Definition: ZoneMesh.C:305
Foam::PtrList::resize
void resize(const label newLen)
Adjust size of PtrList.
Definition: PtrList.C:103
Foam::HashTable
A HashTable similar to std::unordered_map.
Definition: HashTable.H:105
Foam::New
tmp< DimensionedField< TypeR, GeoMesh > > New(const tmp< DimensionedField< TypeR, GeoMesh >> &tdf1, const word &name, const dimensionSet &dimensions)
Global function forwards to reuseTmpDimensionedField::New.
Definition: DimensionedFieldReuseFunctions.H:105
Foam::ZoneMesh::sortedNames
wordList sortedNames() const
Sorted list of the zone names.
Definition: ZoneMesh.C:333
Foam::regIOobject
regIOobject is an abstract class derived from IOobject to handle automatic object registration with t...
Definition: regIOobject.H:73
FatalErrorInFunction
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition: error.H:453
clear
patchWriters clear()
Foam::nl
constexpr char nl
Definition: Ostream.H:404
forAllConstIters
forAllConstIters(mixture.phases(), phase)
Definition: pEqn.H:28
Foam::List< word >
Foam::UList< label >
Foam::wordRes
A List of wordRe with additional matching capabilities.
Definition: wordRes.H:51
Foam::HashSet::insert
bool insert(const Key &key)
Insert a new entry, not overwriting existing entries.
Definition: HashSet.H:191
bool
bool
Definition: EEqn.H:20
Foam::PtrListOps::firstMatching
label firstMatching(const UPtrList< T > &list, const UnaryMatchPredicate &matcher)
Find first list item with 'name()' that matches, -1 on failure.
FUNCTION_NAME
#define FUNCTION_NAME
Definition: messageStream.H:295
Foam::ZoneMesh::updateMetaData
void updateMetaData()
Update internal meta-data (eg, prior to writing)
Definition: ZoneMesh.C:840
Foam::ZoneMesh::disallowGenericZones
static int disallowGenericZones
Debug switch to disallow the use of generic zones.
Definition: ZoneMesh.H:106
DynamicList.H
Foam::ZoneMesh::selection
bitSet selection(const labelUList &zoneIds) const
Definition: ZoneMesh.C:599
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:56
Foam::ZoneMesh::clearAddressing
void clearAddressing()
Clear addressing.
Definition: ZoneMesh.C:709
Foam::PtrListOps::names
List< word > names(const UPtrList< T > &list, const UnaryMatchPredicate &matcher)
Foam::ZoneMesh::findZone
ZoneType * findZone(const word &zoneName)
Find zone by name and return pointer, nullptr on error.
Definition: ZoneMesh.C:589
Foam::typeOp
Extract type (as a word) from an object, typically using its type() method.
Definition: word.H:248
Foam::ZoneMesh::checkParallelSync
bool checkParallelSync(const bool report=false) const
Check whether all procs have all zones and in same order.
Definition: ZoneMesh.C:752
WarningInFunction
#define WarningInFunction
Report a warning using Foam::Warning.
Definition: messageStream.H:328
Foam::wordRe::match
bool match(const std::string &text, bool literal=false) const
Smart match as regular expression or as a string.
Definition: wordReI.H:174
Foam::ZoneMesh::types
wordList types() const
Return a list of zone types.
Definition: ZoneMesh.C:298