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(),
117 "MeshZones::MeshZones" 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, mpz[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;
label findZoneID(const word &zoneName) const
Find zone index given a name.
#define forAll(list, i)
Loop across all elements in list.
bool empty() const
Return true if the UList is empty (ie, size() is zero)
FvWallInfoData< WallInfo, label > label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
autoPtr< CompressibleMomentumTransportModel > New(const volScalarField &rho, const volVectorField &U, const surfaceScalarField &phi, const viscosity &viscosity)
bool set(const label) const
Is element set.
static iteratorEnd end()
iteratorEnd set to beyond the end of any HashTable
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
void size(const label)
Override size to be inconsistent with allocated storage.
Ostream & endl(Ostream &os)
Add newline and flush stream.
bool checkParallelSync(const bool report=false) const
Check whether all procs have all zones and in same order. Return.
bool checkDefinition(const bool report=false) const
Check zone definition. Return true if in error.
Operations on lists of strings.
void clear()
Clear the zones.
labelList findIndices(const ListType &, typename ListType::const_reference, const label start=0)
Find all occurrences of given element. Linear search.
void movePoints(const pointField &)
Correct zones after moving points.
bool good() const
Return true if next operation might succeed.
bool findStrings(const wordReListMatcher &matcher, const std::string &str)
Return true if string matches one of the regular expressions.
PackedBoolList findMatching(const wordRe &) const
Mark cells that match the zone specification.
wordList names() const
Return a list of zone names.
iterator find(const Key &)
Find and return an iterator set at the hashedEntry.
wordList types() const
Return a list of zone types.
A class for handling words, derived from string.
static bool isPattern(const string &)
Test string for regular expression meta characters.
List< label > labelList
A List of labels.
errorManip< error > abort(error &err)
A wordRe is a word, but can also have a regular expression for matching words.
void setSize(const label)
Reset size of PtrList. If extending the PtrList, new entries are.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
const Map< label > & zoneMap() const
Map of zones containing zone index for all zoned elements.
word name(const complex &)
Return a string representation of a complex.
label size() const
Return the number of elements in the UPtrList.
void setSize(const label)
Reset size of List.
Template functions to aid in the implementation of demand driven data.
label whichZone(const label objectIndex) const
Given a global object index, return the zone it is in.
#define WarningInFunction
Report a warning using Foam::Warning.
label findIndex(const wordRe &) const
Return zone index for the first match, return -1 if not found.
regIOobject is an abstract class derived from IOobject to handle automatic object registration with t...
bool writeData(Ostream &) const
writeData member function required by regIOobject
void deleteDemandDrivenData(DataPtr &dataPtr)
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
void clearAddressing()
Clear addressing.
A HashTable to objects of type <T> with a label key.
labelList findIndices(const wordRe &) const
Return zone indices for all matches.
#define InfoInFunction
Report an information message using Foam::Info.