34 template<
class ZoneType,
class MeshType>
42 <<
"zone map already calculated" 52 nObjects += this->operator[](zoneI).size();
55 zoneMapPtr_ =
new Map<label>(2*nObjects);
56 Map<label>& zm = *zoneMapPtr_;
62 const labelList& zoneObjects = this->operator[](zoneI);
66 zm.insert(zoneObjects[objI], zoneI);
73 template<
class ZoneType,
class MeshType>
78 readOpt() == IOobject::MUST_READ
79 || readOpt() == IOobject::MUST_READ_IF_MODIFIED
80 || (readOpt() == IOobject::READ_IF_PRESENT && headerOk())
83 if (readOpt() == IOobject::MUST_READ_IF_MODIFIED)
86 <<
"Specified IOobject::MUST_READ_IF_MODIFIED but class" 87 <<
" does not support automatic rereading." 91 PtrList<ZoneType>& zones = *
this;
94 Istream& is = readStream(typeName);
96 PtrList<entry> patchEntries(is);
97 zones.setSize(patchEntries.size());
106 patchEntries[zoneI].keyword(),
107 patchEntries[zoneI].
dict(),
118 "(const IOobject&, const MeshType&)" 135 template<
class ZoneType,
class MeshType>
151 template<
class ZoneType,
class MeshType>
155 const MeshType& mesh,
169 template<
class ZoneType,
class MeshType>
173 const MeshType& mesh,
189 zones.
set(zoneI, pzm[zoneI].clone(*this).ptr());
197 template<
class ZoneType,
class MeshType>
206 template<
class ZoneType,
class MeshType>
219 template<
class ZoneType,
class MeshType>
222 const label objectIndex
228 if (zmIter == zm.
end())
239 template<
class ZoneType,
class MeshType>
248 lst[zoneI] = zones[zoneI].type();
255 template<
class ZoneType,
class MeshType>
264 lst[zoneI] = zones[zoneI].name();
271 template<
class ZoneType,
class MeshType>
291 if (key ==
operator[](i).
name())
293 indices[nFound++] = i;
304 template<
class ZoneType,
class MeshType>
317 if (!indices.
empty())
326 if (key ==
operator[](i).
name())
339 template<
class ZoneType,
class MeshType>
349 if (zones[zoneI].
name() == zoneName)
359 <<
"Zone named " << zoneName <<
" not found. " 360 <<
"List of available zone names: " << names() <<
endl;
368 template<
class ZoneType,
class MeshType>
379 lst |=
static_cast<const labelList&
>(this->operator[](indices[i]));
386 template<
class ZoneType,
class MeshType>
395 zones[zoneI].clearAddressing();
400 template<
class ZoneType,
class MeshType>
408 template<
class ZoneType,
class MeshType>
414 bool inError =
false;
420 inError |= zones[zoneI].checkDefinition(report);
426 template<
class ZoneType,
class MeshType>
432 if (!Pstream::parRun())
440 bool hasError =
false;
444 allNames[Pstream::myProcNo()] = this->names();
445 Pstream::gatherList(allNames);
446 Pstream::scatterList(allNames);
449 allTypes[Pstream::myProcNo()] = this->types();
450 Pstream::gatherList(allTypes);
451 Pstream::scatterList(allTypes);
455 for (
label proci = 1; proci < allNames.
size(); proci++)
459 (allNames[proci] != allNames[0])
460 || (allTypes[proci] != allTypes[0])
465 if (debug || (report && Pstream::master()))
467 Info<<
" ***Inconsistent zones across processors, " 468 "processor 0 has zone names:" << allNames[0]
469 <<
" zone types:" << allTypes[0]
470 <<
" processor " << proci <<
" has zone names:" 472 <<
" zone types:" << allTypes[proci]
483 if (zones[zoneI].checkParallelSync(
false))
487 if (debug || (report && Pstream::master()))
489 Info<<
" ***Zone " << zones[zoneI].name()
490 <<
" of type " << zones[zoneI].type()
491 <<
" is not correctly synchronised" 492 <<
" across coupled boundaries." 493 <<
" (coupled faces are either not both" 494 <<
" present in set or have same flipmap)" <<
endl;
504 template<
class ZoneType,
class MeshType>
511 zones[zoneI].movePoints(p);
516 template<
class ZoneType,
class MeshType>
526 template<
class ZoneType,
class MeshType>
532 const label zoneI = findZoneID(zoneName);
537 <<
"Zone named " << zoneName <<
" not found." <<
nl 538 <<
"Available zone names: " << names() <<
endl 542 return operator[](zoneI);
546 template<
class ZoneType,
class MeshType>
552 const label zoneI = findZoneID(zoneName);
557 <<
"Zone named " << zoneName <<
" not found." <<
nl 558 <<
"Available zone names: " << names() <<
endl 562 return operator[](zoneI);
568 template<
class ZoneType,
class MeshType>
575 os << zones.size() <<
nl << token::BEGIN_LIST;
579 zones[zoneI].writeDict(os);
582 os << token::END_LIST;
A class for handling keywords in dictionaries.
bool checkDefinition(const bool report=false) const
Check zone definition. Return true if in error.
#define forAll(list, i)
Loop across all elements in list.
void clearAddressing()
Clear addressing.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
void clear()
Clear the zones.
static iteratorEnd end()
iteratorEnd set to beyond the end of any HashTable
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
bool empty() const
Return true if the UList is empty (ie, size() is zero)
wordList types() const
Return a list of zone types.
PackedBoolList findMatching(const keyType &) const
Mark cells that match the zone specification.
void size(const label)
Override size to be inconsistent with allocated storage.
bool good() const
Return true if next operation might succeed.
Ostream & endl(Ostream &os)
Add newline and flush stream.
Operations on lists of strings.
labelList findIndices(const ListType &, typename ListType::const_reference, const label start=0)
Find all occurences of given element. Linear search.
bool checkParallelSync(const bool report=false) const
Check whether all procs have all zones and in same order. Return.
void movePoints(const pointField &)
Correct zone mesh after moving points.
tmp< DimensionedField< TypeR, GeoMesh > > New(const tmp< DimensionedField< TypeR, GeoMesh >> &tdf1, const word &name, const dimensionSet &dimensions)
bool findStrings(const wordReListMatcher &matcher, const std::string &str)
Return true if string matches one of the regular expressions.
iterator find(const Key &)
Find and return an iterator set at the hashedEntry.
bool read(const char *, int32_t &)
label findZoneID(const word &zoneName) const
Find zone index given a name.
A class for handling words, derived from string.
bool writeData(Ostream &) const
writeData member function required by regIOobject
wordList names() const
Return a list of zone names.
bool set(const label) const
Is element set.
List< label > labelList
A List of labels.
errorManip< error > abort(error &err)
label findIndex(const keyType &) const
Return zone index for the first match, return -1 if not found.
void setSize(const label)
Reset size of PtrList. If extending the PtrList, new entries are.
const Map< label > & zoneMap() const
Map of zones containing zone index for all zoned elements.
labelList findIndices(const keyType &) const
Return zone indices for all matches.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
word name(const complex &)
Return a string representation of a complex.
void setSize(const label)
Reset size of List.
Template functions to aid in the implementation of demand driven data.
#define WarningInFunction
Report a warning using Foam::Warning.
label whichZone(const label objectIndex) const
Given a global object index, return the zone it is in.
regIOobject is an abstract class derived from IOobject to handle automatic object registration with t...
void deleteDemandDrivenData(DataPtr &dataPtr)
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
bool isPattern() const
Should be treated as a match rather than a literal string.
label size() const
Return the number of elements in the UPtrList.
A HashTable to objects of type <T> with a label key.
#define InfoInFunction
Report an information message using Foam::Info.