66 { sampleMode::NEARESTCELL,
"nearestCell" },
67 { sampleMode::NEARESTPATCHFACE,
"nearestPatchFace" },
68 { sampleMode::NEARESTPATCHFACEAMI,
"nearestPatchFaceAMI" },
69 { sampleMode::NEARESTPATCHPOINT,
"nearestPatchPoint" },
70 { sampleMode::NEARESTFACE,
"nearestFace" },
71 { sampleMode::NEARESTONLYCELL,
"nearestOnlyCell" },
81 { offsetMode::UNIFORM,
"uniform" },
82 { offsetMode::NONUNIFORM,
"nonuniform" },
83 { offsetMode::NORMAL,
"normal" },
91 const dictionary&
dict 94 if (
dict.found(
"sampleDatabase"))
96 if (
dict.get<
bool>(
"sampleDatabase"))
100 dict.lookupOrDefault<fileName>
102 "sampleDatabasePath",
108 else if (
dict.found(
"sampleDatabasePath"))
124 const Time&
runTime = patch_.boundaryMesh().mesh().
time();
128 ).addConnectionByName(sampleWorld_);
157 auto& facePoints = tfacePoints.ref();
175 const label mySampleWorld,
186 const label myComm = getCommunicator();
196 <<
"[rank=" << myRank <<
" procs=" << nProcs
197 <<
" comm=" << myComm <<
"] collect samples" <<
endl;
202 List<pointField> globalFc(nProcs);
203 globalFc[myRank] = facePoints;
208 patchFc = ListListOps::combine<pointField>
211 accessOp<pointField>()
216 List<pointField> globalSamples(nProcs);
217 globalSamples[myRank] = samplePoints(facePoints);
221 samples = ListListOps::combine<pointField>
224 accessOp<pointField>()
230 globalFaces[myRank] =
identity(patch_.size());
234 patchFaces = ListListOps::combine<labelList>
237 accessOp<labelList>()
244 UPstream::listGatherValues<label>(mySampleWorld, myComm)
248 UPstream::listGatherValues<label>(patch_.size(), myComm)
253 patchFaceWorlds.setSize(patchFaces.size());
254 patchFaceProcs.setSize(patchFaces.size());
259 for (label i = 0; i < nPerProc[proci]; i++)
261 patchFaceWorlds[sampleI] = procToWorldIndex[proci];
262 patchFaceProcs[sampleI] = proci;
274 const sampleMode
mode,
276 const label mySampleWorld,
277 const word& sampleRegion,
278 const word& samplePatch,
281 List<nearInfoWorld>& nearest
286 const label myComm = getCommunicator();
292 const polyMesh&
mesh = lookupMesh(sampleRegion);
298 miss.first().second() = Tuple2<scalar, label>(
Foam::sqr(GREAT), -1);
307 if (samplePatch.size() && samplePatch !=
"none")
310 <<
"No need to supply a patch name when in " 320 nearInfoWorld& near = nearest[sampleI];
322 label celli =
tree.findInside(sample);
326 near.first().second().first() =
Foam::sqr(GREAT);
327 near.first().second().second() = myRank;
328 near.second() = mySampleWorld;
340 near.first().second().first() = sample.distSqr(cc);
341 near.first().second().second() = myRank;
342 near.second() = mySampleWorld;
348 case NEARESTONLYCELL:
350 if (samplePatch.size() && samplePatch !=
"none")
353 <<
"No need to supply a patch name when in " 363 nearInfoWorld& near = nearest[sampleI];
365 near.
first().first() =
tree.findNearest(sample,
sqr(GREAT));
367 near.first().second().first() =
368 near.first().first().hitPoint().distSqr(sample);
370 near.first().second().second() = myRank;
371 near.second() = mySampleWorld;
376 case NEARESTPATCHFACE:
380 const polyPatch& pp = lookupPatch(sampleRegion, samplePatch);
386 nearInfoWorld& near = nearest[sampleI];
387 near.first().second().first() =
Foam::sqr(GREAT);
388 near.first().second().second() = myRank;
389 near.second() = mySampleWorld;
396 treeBoundBox(pp.points(), pp.meshPoints()).extend
404 indexedOctree<treeDataFace> boundaryTree
406 treeDataFace(
mesh, pp.range()),
413 const auto& treeData = boundaryTree.shapes();
419 nearInfoWorld& near = nearest[sampleI];
421 nearInfo = boundaryTree.findNearest
429 near.first().second().first() =
Foam::sqr(GREAT);
430 near.first().second().second() = myRank;
431 near.second() = mySampleWorld;
435 const point& fc = treeData.centre(nearInfo.index());
437 nearInfo.setPoint(fc);
438 near.
first().second().first() = sample.distSqr(fc);
439 near.first().second().second() = myRank;
440 near.second() = mySampleWorld;
447 case NEARESTPATCHPOINT:
451 const polyPatch& pp = lookupPatch(sampleRegion, samplePatch);
457 nearInfoWorld& near = nearest[sampleI];
458 near.first().second().first() =
Foam::sqr(GREAT);
459 near.first().second().second() = myRank;
460 near.second() = mySampleWorld;
468 treeBoundBox(pp.points(), pp.meshPoints()).extend
476 indexedOctree<treeDataPoint> boundaryTree
479 treeDataPoint(
mesh.
points(), pp.meshPoints()),
491 nearInfoWorld& near = nearest[sampleI];
493 nearInfo = boundaryTree.findNearest
501 near.first().second().first() =
Foam::sqr(GREAT);
502 near.first().second().second() = myRank;
503 near.second() = mySampleWorld;
507 const point& pt = nearInfo.point();
509 near.first().second().first() = sample.distSqr(pt);
510 near.first().second().second() = myRank;
511 near.second() = mySampleWorld;
520 if (samplePatch.size() && samplePatch !=
"none")
523 <<
"No need to supply a patch name when in " 528 const meshSearchMeshObject& meshSearchEngine =
534 nearInfoWorld& near = nearest[sampleI];
536 label facei = meshSearchEngine.findNearestFace(sample);
541 near.first().second().second() = myRank;
542 near.second() = mySampleWorld;
549 near.first().second().first() = sample.distSqr(fc);
550 near.first().second().second() = myRank;
551 near.second() = mySampleWorld;
557 case NEARESTPATCHFACEAMI:
590 const label myComm = getCommunicator();
599 samplePatches[myRank] = samplePatch_;
604 sampleRegions[myRank] = sampleRegion_;
618 nearest[samplei].second() = wantedWorlds[samplei];
625 forAll(wantedWorlds, samplei)
627 if (wantedWorlds[samplei] == myWorld)
629 localMap.append(samplei);
636 labelList localOrigProcs(origProcs, localMap);
639 const word localOrigPatch(samplePatches[localOrigProcs[0]]);
640 const word localOrigRegion(sampleRegions[localOrigProcs[0]]);
645 Pout<<
"Searching locally for " << localSamples.
size()
646 <<
" samples on region:" << localOrigRegion
647 <<
" on patch:" << localOrigPatch <<
endl;
700 if (!ni.
first().hit())
702 sampleProcs[sampleI] = -1;
703 sampleIndices[sampleI] = -1;
708 sampleProcs[sampleI] = ni.
second().second();
709 sampleIndices[sampleI] = ni.
first().index();
710 sampleLocations[sampleI] = ni.
first().point();
722 static bool hasWarned =
false;
735 (void)patch_.boundaryMesh().mesh().tetBasePtIs();
737 const label myComm = getCommunicator();
769 const pointField offsettedPoints(samplePoints(patchPoints()));
775 mode_ == NEARESTPATCHFACE
777 && sampleRegion() == patch_.boundaryMesh().mesh().name()
778 && samplePatch() == patch_.name()
785 bool coincident = (
gAverage(
mag(d)) <= ROOTVSMALL);
787 if (sampleMyself && coincident)
790 <<
"Invalid offset " << d <<
endl 791 <<
"Offset is the vector added to the patch face centres to" 792 <<
" find the patch face supplying the data." <<
endl 793 <<
"Setting it to " << d
794 <<
" on the same patch, on the same region" 795 <<
" will find the faces themselves which does not make sense" 796 <<
" for anything but testing." <<
endl 797 <<
"patch:" << patch_.
name() <<
endl 798 <<
"sampleRegion:" << sampleRegion() <<
endl 799 <<
"mode:" << sampleModeNames_[mode_] <<
endl 800 <<
"samplePatch:" << samplePatch() <<
endl 801 <<
"offsetMode:" << offsetModeNames_[offsetMode_] <<
endl;
858 if (mode_ == NEARESTCELL)
861 forAll(sampleProcs, sampleI)
863 if (sampleProcs[sampleI] == -1)
875 <<
"Did not find " << nNotFound
876 <<
" out of " << sampleProcs.
size() <<
" total samples." 877 <<
" Sampling these on owner cell centre instead." <<
endl 878 <<
"On patch " << patch_.
name()
879 <<
" on region " << sampleRegion()
880 <<
" in mode " << sampleModeNames_[mode_] <<
endl 881 <<
"with offset mode " << offsetModeNames_[offsetMode_]
882 <<
". Suppressing further warnings from " <<
type() <<
endl;
889 forAll(sampleProcs, sampleI)
891 if (sampleProcs[sampleI] == -1)
932 if (sampleProcs[i] == -1)
935 << patchFc[i] <<
" on patch " << patch_.name()
937 << patch_.boundaryMesh().mesh().name()
938 <<
" on processor " << patchFaceProcs[i]
963 patch_.boundaryMesh().mesh().time().path()
967 Pout<<
"Dumping mapping as lines from patch faceCentres to" 968 <<
" sampled cell/faceCentres/points to file " << str.
name()
979 str <<
"l " << vertI-1 <<
' ' << vertI <<
nl;
984 mapPtr_.reset(
new mapDistribute(sampleProcs, patchFaceProcs, myComm));
995 constructMap[proci] =
labelUIndList(patchFaces, constructMap[proci]);
999 Pout<<
"To proc:" << proci <<
" sending values of cells/faces:" 1000 << subMap[proci] <<
endl;
1001 Pout<<
"From proc:" << proci
1002 <<
" receiving values of patch faces:" 1003 << constructMap[proci] <<
endl;
1009 mapPtr_().constructSize() = patch_.size();
1015 forAll(constructMap, proci)
1017 const labelList& map = constructMap[proci];
1021 label facei = map[i];
1026 <<
"On patch " << patch_.name()
1027 <<
" patchface " << facei
1028 <<
" is assigned to more than once." 1042 <<
"On patch " << patch_.name()
1043 <<
" patchface " << facei
1044 <<
" is never assigned to." 1050 updateMeshTime().setUpToDate();
1053 updateSampleMeshTime().setUpToDate();
1061 const word surfType(surfDict_.getOrDefault<
word>(
"type",
"none"));
1063 if (!surfPtr_ && surfType !=
"none")
1065 word surfName(surfDict_.getOrDefault(
"name", patch_.name()));
1092 if (AMIPtr_->upToDate())
1095 <<
"AMI already up-to-date" 1103 const label myComm = getCommunicator();
1106 const auto& surf = surfPtr();
1112 if (sampleWorld_.empty() || sameWorld())
1114 const polyPatch& nbr = samplePolyPatch();
1132 OFstream os(patch_.name() +
"_neighbourPatch-org.obj");
1135 OFstream osN(patch_.name() +
"_neighbourPatch-trans.obj");
1138 OFstream osO(patch_.name() +
"_ownerPatch.obj");
1149 AMIPtr_->calculate(patch_, nbrPatch0, surf);
1173 AMIPtr_->calculate(patch_, dummyPatch, surf);
1180 AMIPtr_->calculate(dummyPatch, patch_, surf);
1205 return subRegistry(sub,
names, index+1);
1217 mode_(NEARESTPATCHFACE),
1220 sampleDatabasePtr_(),
1221 offsetMode_(UNIFORM),
1223 offsets_(pp.size(), offset_),
1240 const word& sampleRegion,
1242 const word& samplePatch,
1262 const word& sampleRegion,
1264 const word& samplePatch,
1265 const vector& uniformOffset
1284 const word& sampleRegion,
1286 const word& samplePatch,
1287 const scalar normalDistance
1292 sampleRegion_(sampleRegion),
1294 samplePatch_(samplePatch),
1296 sampleDatabasePtr_(),
1297 offsetMode_(NORMAL),
1300 distance_(normalDistance),
1304 sampleWorld_.empty()
1324 sampleWorld_(
dict.getOrDefault<
word>(
"sampleWorld",
word::null)),
1325 sampleRegion_(
dict.getOrDefault<
word>(
"sampleRegion",
word::null)),
1326 mode_(sampleModeNames_.
get(
"sampleMode",
dict)),
1327 samplePatch_(
dict.getOrDefault<
word>(
"samplePatch",
word::null)),
1329 sampleDatabasePtr_(readDatabase(
dict)),
1330 offsetMode_(UNIFORM),
1337 sampleWorld_.empty()
1363 surfDict_(
dict.subOrEmptyDict(
"surface"))
1404 else if (
dict.found(
"offsets"))
1412 <<
"Please supply the offsetMode as one of " 1427 sampleWorld_(
dict.getOrDefault<
word>(
"sampleWorld",
word::null)),
1428 sampleRegion_(
dict.getOrDefault<
word>(
"sampleRegion",
word::null)),
1430 samplePatch_(
dict.getOrDefault<
word>(
"samplePatch",
word::null)),
1432 sampleDatabasePtr_(readDatabase(
dict)),
1433 offsetMode_(UNIFORM),
1440 sampleWorld_.empty()
1466 surfDict_(
dict.subOrEmptyDict(
"surface"))
1473 <<
"Construct from sampleMode and dictionary only applicable for " 1474 <<
" collocated patches in modes " 1499 sampleWorld_(mpb.sampleWorld_),
1500 sampleRegion_(mpb.sampleRegion_),
1502 samplePatch_(mpb.samplePatch_),
1503 coupleGroup_(mpb.coupleGroup_),
1506 mpb.sampleDatabasePtr_
1507 ? new
fileName(mpb.sampleDatabasePtr_())
1510 offsetMode_(mpb.offsetMode_),
1511 offset_(mpb.offset_),
1512 offsets_(mpb.offsets_),
1513 distance_(mpb.distance_),
1514 communicator_(mpb.communicator_),
1515 sameRegion_(mpb.sameRegion_),
1517 AMIReverse_(mpb.AMIReverse_),
1518 AMIPtr_(mpb.AMIPtr_->clone()),
1520 surfDict_(mpb.surfDict_)
1532 sampleWorld_(mpb.sampleWorld_),
1533 sampleRegion_(mpb.sampleRegion_),
1535 samplePatch_(mpb.samplePatch_),
1536 coupleGroup_(mpb.coupleGroup_),
1539 mpb.sampleDatabasePtr_
1540 ? new
fileName(mpb.sampleDatabasePtr_())
1543 offsetMode_(mpb.offsetMode_),
1544 offset_(mpb.offset_),
1547 offsetMode_ == NONUNIFORM
1551 distance_(mpb.distance_),
1552 communicator_(mpb.communicator_),
1553 sameRegion_(mpb.sameRegion_),
1555 AMIReverse_(mpb.AMIReverse_),
1556 AMIPtr_(mpb.AMIPtr_->clone()),
1558 surfDict_(mpb.surfDict_)
1572 mapPtr_.reset(
nullptr);
1573 surfPtr_.reset(
nullptr);
1574 AMIPtr_->upToDate() =
false;
1583 offsetMode_ = offsetMode::NORMAL;
1586 distance_ = normalDist;
1593 offsetMode_ = offsetMode::UNIFORM;
1594 offset_ = uniformOffset;
1603 offsetMode_ = offsetMode::NONUNIFORM;
1612 const word& sampleRegion
1618 sampleRegion.empty() || sampleRegion == thisMesh.
name()
1627 const word& sampleRegion,
1628 const word& samplePatch
1631 const polyMesh& nbrMesh = lookupMesh(sampleRegion);
1638 <<
"Cannot find patch " << samplePatch
1639 <<
" in region " << sampleRegion_ <<
endl 1651 <<
"sampleWorld : " << sampleWorld_
1655 return lookupMesh(sampleRegion());
1661 const polyMesh& nbrMesh = sampleMesh();
1668 <<
"Cannot find patch " << samplePatch()
1669 <<
" in region " << sampleRegion_ <<
endl 1684 auto&
fld = tfld.ref();
1686 switch (offsetMode_)
1715 return samplePoints(facePoints(patch_));
1760 const point& basePoint =
p[
f[fp0]];
1763 for (label i = 2; i <
f.
size(); i++)
1765 const point& thisPoint =
p[
f[fp]];
1767 const point& nextPoint =
p[
f[nextFp]];
1769 const triPointRef tri(basePoint, thisPoint, nextPoint);
1810 cleanedPath.
clean();
1819 return subRegistry(obr,
names, 0);
1831 return root/
"send"/processorName;
1837 return sendPath(sampleDatabasePath(), proci);
1848 return root/
"receive"/processorName;
1854 return receivePath(sampleDatabasePath(), proci);
1869 if (isA<objectRegistry>(obj))
1872 writeDict(dynamic_cast<const objectRegistry&>(obj), d);
1876 writeIOField<scalar>(obj,
dict)
1877 || writeIOField<vector>(obj,
dict)
1878 || writeIOField<sphericalTensor>(obj,
dict)
1879 || writeIOField<symmTensor>(obj,
dict)
1880 || writeIOField<tensor>(obj,
dict)
1911 readDict(
e.dict(), sub);
1920 constructIOField<scalar>(
e.keyword(), tok, is, obr)
1921 || constructIOField<vector>(
e.keyword(), tok, is, obr)
1922 || constructIOField<sphericalTensor>(
e.keyword(), tok, is, obr)
1923 || constructIOField<symmTensor>(
e.keyword(), tok, is, obr)
1924 || constructIOField<tensor>(
e.keyword(), tok, is, obr)
1946 if (sampleDatabasePtr_)
1952 "sampleDatabasePath",
1954 sampleDatabasePtr_()
1957 coupleGroup_.write(
os);
1961 offsetMode_ == UNIFORM
1962 && offset_ == vector::zero
1963 && (mode_ == NEARESTPATCHFACE || mode_ == NEARESTPATCHFACEAMI)
1970 os.
writeEntry(
"offsetMode", offsetModeNames_[offsetMode_]);
1972 switch (offsetMode_)
1992 if (mode_ == NEARESTPATCHFACEAMI)
2001 if (!surfDict_.empty())
2003 surfDict_.writeEntry(surfDict_.dictName(),
os);
label getWorldCommunicator() const
Get the communicator for the world-world connection.
List< ReturnType > get(const UPtrList< T > &list, const AccessOp &aop)
List of values generated by applying the access operation to each list item.
label findPatchID(const word &patchName, const bool allowNotFound=true) const
Find patch index given a name, return -1 if not found.
const polyBoundaryMesh & boundaryMesh() const
Return boundary mesh.
static const word & myWorld()
My world.
virtual const fileName & name() const
Get the name of the output serial stream. (eg, the name of the Fstream file name) ...
use face normal + distance
List< labelList > labelListList
A List of labelList.
prefixOSstream Perr
OSstream wrapped stderr (std::cerr) with parallel prefix.
const List< face_type > & localFaces() const
Return patch faces addressing into local point list.
bool set(const Key &key)
Same as insert (no value to overwrite)
void size(const label n)
Older name for setAddressableSize.
const Type & lookupObject(const word &name, const bool recursive=false) const
Lookup and return const reference to the object of the given Type. Fatal if not found or the wrong ty...
const polyMesh & lookupMesh(const word ®ion) const
Lookup mesh.
A triangle primitive used to calculate face normals and swept volumes. Uses referred points...
nearest face on selected patch
vector offset_
Offset vector (uniform)
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.
A class for handling file names.
virtual const fileName & name() const
The name of the stream.
errorManipArg< error, int > exit(error &err, const int errNo=1)
static const Enum< offsetMode > offsetModeNames_
A face is a list of labels corresponding to mesh vertices.
word sampleRegion_
Region to sample.
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
const Field< point_type > & localPoints() const
Return pointField of points in patch.
labelHashSet used(const bitSet &select)
Convert a bitset to a labelHashSet of the indices used.
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
A list of keyword definitions, which are a keyword followed by a number of values (eg...
tmp< pointField > samplePoints() const
Get the sample points.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
const polyPatch & patch_
Patch to sample.
A 2-tuple for storing two objects of dissimilar types. The container is similar in purpose to std::pa...
const polyMesh & sampleMesh() const
Get the region mesh.
bool valid() const noexcept
Is a valid patchGroup (non-empty) name.
label find(const T &val, label pos=0) const
Find index of the first occurrence of the value.
const labelIOList & tetBasePtIs() const
Return the tetBasePtIs.
const polyPatch & lookupPatch(const word &sampleRegion, const word &samplePatch) const
Lookup patch.
Centralized handling of multi-world MPI connections.
bool sameRegion_
Same region.
const word & name() const noexcept
Return the object name.
bool test(const Key &key) const
Same as found() - return true if key exists in the set.
static const meshSearchMeshObject & New(const polyMesh &mesh, Args &&... args)
Get existing or create a new MeshObject.
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
dimensionedSymmTensor sqr(const dimensionedVector &dv)
const polyBoundaryMesh & boundaryMesh() const
Return boundaryMesh reference.
Output to file stream, using an OSstream.
const coupleGroupIdentifier coupleGroup_
PatchGroup (if in sampleMode NEARESTPATCH*)
virtual ~mappedPatchBase()
Destructor.
constexpr char nl
The newline '\n' character (0x0a)
bool empty() const noexcept
True if the UList is empty (ie, size() is zero)
A token holds an item read from Istream.
static const fileName null
An empty fileName.
static fileName sendPath(const fileName &root, const label proci)
Helper: return path to store data to be sent to processor i.
T & first()
Access first element of the list, position [0].
Addressing for all faces on surface of mesh. Can either be read from polyMesh or from triSurface...
static const multiWorldConnections & New(const Time &runTime)
Access mesh object.
scalarField samples(nIntervals, Zero)
Ostream & endl(Ostream &os)
Add newline and flush stream.
PointIndexHit< point > pointIndexHit
A PointIndexHit with a 3D point.
static const objectRegistry & subRegistry(const objectRegistry &obr, const wordList &names, const label index)
Lookup (sub)objectRegistry by following names of sub registries. Creates non-existing intermediate on...
void setOffset(const scalar normalDist)
Change to normal offset with given distance.
A simple output token stream that can be used to build token lists. Always UNCOMPRESSED.
Ostream & writeEntry(const keyType &key, const T &value)
Write a keyword/value entry.
static int & msgType() noexcept
Message tag of standard messages.
This class describes the interaction of an object (often a face) and a point. It carries the info of ...
entry * add(entry *entryPtr, bool mergeEntry=false)
Add a new entry.
Ignore writing from objectRegistry::writeObject()
static int myProcNo(const label communicator=worldComm)
Number of this process (starting from masterNo() = 0)
tmp< DimensionedField< TypeR, GeoMesh > > New(const tmp< DimensionedField< TypeR, GeoMesh >> &tdf1, const word &name, const dimensionSet &dimensions, const bool initCopy=false)
Global function forwards to reuseTmpDimensionedField::New.
const Time & time() const
Return the top-level database.
static label worldComm
Default world communicator (all processors). May differ from globalComm if local worlds are in use...
const objectRegistry & subRegistry(const word &name, const bool forceCreate=false, const bool recursive=false) const
Lookup and return a const sub-objectRegistry.
cellDecomposition
Enumeration defining the decomposition of the cell for.
vectorField offsets_
Offset vector (nonuniform)
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Macros for easy insertion into run-time selection tables.
scalar distance_
Offset distance (normal)
dictionary & subDictOrAdd(const word &keyword, enum keyType::option matchOpt=keyType::REGEX)
Find and return a sub-dictionary for manipulation.
virtual const pointField & points() const
Return raw points.
#define forAll(list, i)
Loop across all elements in list.
label fcIndex(const label i) const noexcept
The forward circular index. The next index in the list which returns to the first at the end of the l...
Face area weighted Arbitrary Mesh Interface (AMI) method.
A keyword and a list of tokens comprise a primitiveEntry. A primitiveEntry can be read...
nearest patch face + AMI interpolation
static void allGatherList(List< T > &values, const int tag=UPstream::msgType(), const label comm=UPstream::worldComm)
Gather data, but keep individual values separate. Uses linear/tree communication. ...
bool hit() const noexcept
Is there a hit.
static void writeDict(const objectRegistry &obr, dictionary &dict)
Convert objectRegistry contents into dictionary.
fileName::Type type(const fileName &name, const bool followLink=true)
Return the file type: DIRECTORY or FILE, normally following symbolic links.
A list of faces which address into the list of points.
A List obtained as a section of another List.
static const char * name(const bool b) noexcept
A string representation of bool as "false" / "true".
static label nProcs(const label communicator=worldComm)
Number of ranks in parallel run (for given communicator) is 1 for serial run.
word sampleWorld_
World to sample.
vectorField pointField
pointField is a vectorField.
const dimensionedScalar e
Elementary charge.
void setSize(const label n)
Alias for resize()
static fileName receivePath(const fileName &root, const label proci)
Helper: return path to store data to be received from processor i.
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for INVALID.
const polyMesh & mesh() const noexcept
Return the mesh reference.
labelList identity(const label len, label start=0)
Return an identity map of the given length with (map[i] == i)
A class for handling words, derived from Foam::string.
const Time & time() const noexcept
Return time registry.
#define DebugInFunction
Report an information message using Foam::Info.
wordList names() const
Return a list of patch names.
Tree tree(triangles.begin(), triangles.end())
void findSamples(const sampleMode mode, const label myWorldIndex, const pointField &, const labelList &wantedWorlds, const labelList &origProcs, labelList &sampleProcs, labelList &sampleIndices, pointField &sampleLocations) const
Find (global) cells/faces containing samples.
virtual const labelList & faceOwner() const
Return face owner.
#define forAllIters(container, iter)
Iterate across all elements in the container object.
static const word null
An empty word.
void calcMapping() const
Calculate mapping.
static tmp< T > New(Args &&... args)
Construct tmp with forwarding arguments.
Determines a mapping between patch face centres and mesh cell or face centres and processors they're ...
virtual bool write(const token &tok)=0
Write token to stream or otherwise handle it.
offsetMode offsetMode_
How to obtain samples.
Describes the interaction of a object and a (templated) point. It carries the info of a successful hi...
void append(const T &val)
Copy append an element to the end of this list.
virtual const faceList & faces() const
Return raw faces.
const vectorField & cellCentres() const
static label warnComm
Debugging: warn for use of any communicator differing from warnComm.
errorManip< error > abort(error &err)
Ostream & writeEntryIfDifferent(const word &key, const T &value1, const T &value2)
Write a keyword/value entry only when the two values differ.
tmp< pointField > facePoints(const polyPatch &) const
Get the points from face-centre-decomposition face centres and project them onto the face-diagonal-de...
const autoPtr< Foam::searchableSurface > & surfPtr() const
Return a pointer to the AMI projection surface.
static const Enum< sampleMode > sampleModeNames_
An Ostream is an abstract base class for all output systems (streams, files, token lists...
label getCommByName(const word &otherWorld) const
Get communicator for myWorld to other world connection by NAME.
A Vector of values with scalar precision, where scalar is float/double depending on the compilation f...
const word & constant() const noexcept
Return constant name.
wordList components(const char delim='/') const
Return path components as wordList.
int debug
Static debugging option.
label facePoint(const int facei, const block &block, const label i, const label j)
OBJstream os(runTime.globalPath()/outputName)
fileName path(UMean.rootPath()/UMean.caseName()/"graphs"/UMean.instance())
virtual void write(Ostream &os) const
Write as a dictionary.
defineTypeNameAndDebug(combustionModel, 0)
static bool clean(std::string &str)
Cleanup filename string, possibly applies other transformations such as changing the path separator e...
static pointIndexHit facePoint(const polyMesh &, const label facei, const polyMesh::cellDecomposition)
Get a point on the face given a face decomposition method:
static autoPtr< fileName > readDatabase(const dictionary &dict)
Read optional database name from dictionary.
offsetMode
How to project face centres.
static void broadcasts(const label comm, Type &arg1, Args &&... args)
Broadcast multiple items to all processes in communicator.
gmvFile<< "tracers "<< particles.size()<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().x()<< ' ';}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().y()<< ' ';}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().z()<< ' ';}gmvFile<< nl;for(const word &name :lagrangianScalarNames){ IOField< scalar > fld(IOobject(name, runTime.timeName(), cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE))
const vectorField & faceCentres() const
const indexedOctree< treeDataCell > & cellTree() const
Return the cell search tree.
sampleMode mode() const noexcept
What to sample.
UIndirectList< label > labelUIndList
UIndirectList of labels.
Class containing processor-to-processor mapping information.
void calcAMI() const
Calculate AMI interpolator.
vector point
Point is a vector.
A bitSet stores bits (elements with only two states) in packed internal format and supports a variety...
#define WarningInFunction
Report a warning using Foam::Warning.
Enum is a wrapper around a list of names/values that represent particular enumeration (or int) values...
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.
Type gAverage(const FieldField< Field, Type > &f)
A List with indirect addressing. Like IndirectList but does not store addressing. ...
const T2 & second() const noexcept
Access the second element.
sampleMode
Mesh items to sample.
scalar distance() const noexcept
Return distance to hit.
static bool master(const label communicator=worldComm)
Am I the master rank.
label start() const
Return start label of this patch in the polyMesh face list.
Interpolation class dealing with transfer of data between two primitive patches with an arbitrary mes...
static autoPtr< searchableSurface > New(const word &surfaceType, const IOobject &io, const dictionary &dict)
Return a reference to the selected searchableSurface.
bool readIfPresent(const word &key, const dictionary &dict, EnumType &val) const
Find an entry if present, and assign to T val.
void reduce(const List< UPstream::commsStruct > &comms, T &value, const BinaryOp &bop, const int tag, const label comm)
Reduce inplace (cf. MPI Allreduce) using specified communication schedule.
static void readDict(const dictionary &d, objectRegistry &obr)
(recursively) construct and register IOFields from dictionary
const point_type & point() const noexcept
Return the point, no checks.
regIOobject is an abstract class derived from IOobject to handle automatic object registration with t...
Mesh consisting of general polyhedral cells.
void collectSamples(const label mySampleWorld, const pointField &facePoints, pointField &samples, labelList &patchFaceWorlds, labelList &patchFaceProcs, labelList &patchFaces, pointField &patchFc) const
Collect single list of samples and originating processor+face + wanted world.
List< label > labelList
A List of labels.
A class for managing temporary objects.
pointHit intersection(const point &p, const vector &q, const intersection::algorithm alg, const scalar tol=0.0) const
Fast intersection with a ray.
Registry of regIOobjects.
static autoPtr< T > New(Args &&... args)
Construct autoPtr with forwarding arguments.
A patch is a list of labels that address the faces in the global face list.
virtual bool writeData(Ostream &) const =0
Pure virtual writeData function.
const T1 & first() const noexcept
Access the first element.
static const wordList & allWorlds() noexcept
All worlds.
Defines the attributes of an object for which implicit objectRegistry management is supported...
mode_t mode(const fileName &name, const bool followLink=true)
Return the file mode, normally following symbolic links.
const polyPatch & samplePolyPatch() const
Get the patch on the region.
prefixOSstream Pout
OSstream wrapped stdout (std::cout) with parallel prefix.
bool addWorldConnection()
Add a world-world connection.
mappedPatchBase(const polyPatch &)
Construct from patch.
void findLocalSamples(const sampleMode mode, const label sampleWorld, const word &sampleRegion, const word &samplePatch, const pointField &samplePoints, List< nearInfoWorld > &nearest) const
Find (local) cells/faces containing samples.
An input stream of tokens.
const vectorField & offsets() const noexcept
Offset vectors (from patch faces to destination mesh objects)
A keyword and a list of tokens is an 'entry'.
static label myWorldID()
My worldID.
static void listCombineReduce(List< T > &values, const CombineOp &cop, const int tag=UPstream::msgType(), const label comm=UPstream::worldComm)
After completion all processors have the same data.
const sampleMode mode_
What to sample.
IOerror FatalIOError
Error stream (stdout output on all processes), with additional 'FOAM FATAL IO ERROR' header text and ...
static constexpr const zero Zero
Global zero (0)