66 { sampleMode::NEARESTCELL,
"nearestCell" },
67 { sampleMode::NEARESTPATCHFACE,
"nearestPatchFace" },
68 { sampleMode::NEARESTPATCHFACEAMI,
"nearestPatchFaceAMI" },
69 { sampleMode::NEARESTPATCHPOINT,
"nearestPatchPoint" },
70 { sampleMode::NEARESTFACE,
"nearestFace" },
71 { sampleMode::NEARESTONLYCELL,
"nearestOnlyCell" },
83 { offsetMode::NORMAL,
"normal" },
102 if (
dict.
get<
bool>(
"sampleDatabase"))
108 "sampleDatabasePath",
114 else if (
dict.
found(
"sampleDatabasePath"))
130 const Time&
runTime = patch_.boundaryMesh().mesh().
time();
134 ).addConnectionByName(sampleWorld_);
163 auto& facePoints = tfacePoints.ref();
181 const label mySampleWorld,
192 const label myComm = getCommunicator();
201 <<
"[rank=" << myRank <<
" procs=" << nProcs
202 <<
" comm=" << myComm <<
"] collect samples" <<
endl;
207 List<pointField> globalFc(nProcs);
208 globalFc[myRank] = facePoints;
213 patchFc = ListListOps::combine<pointField>
216 accessOp<pointField>()
221 List<pointField> globalSamples(nProcs);
222 globalSamples[myRank] = samplePoints(facePoints);
226 samples = ListListOps::combine<pointField>
229 accessOp<pointField>()
235 globalFaces[myRank] =
identity(patch_.size());
239 patchFaces = ListListOps::combine<labelList>
242 accessOp<labelList>()
249 UPstream::allGatherValues<label>(mySampleWorld, myComm)
253 UPstream::allGatherValues<label>(patch_.size(), myComm)
256 patchFaceWorlds.resize(patchFaces.size());
257 patchFaceProcs.resize(patchFaces.size());
262 for (label i = 0; i < nPerProc[proci]; i++)
264 patchFaceWorlds[sampleI] = procToWorldIndex[proci];
265 patchFaceProcs[sampleI] = proci;
278 const sampleMode
mode,
280 const label mySampleWorld,
281 const word& sampleRegion,
282 const word& samplePatch,
290 const label myComm = getCommunicator();
311 if (samplePatch.size() && samplePatch !=
"none")
314 <<
"No need to supply a patch name when in " 324 nearInfoWorld& near = nearest[sampleI];
326 label celli =
tree.findInside(sample);
330 near.first().second().first() =
Foam::sqr(GREAT);
331 near.first().second().second() = myRank;
332 near.second() = mySampleWorld;
344 near.first().second().first() = sample.distSqr(cc);
345 near.first().second().second() = myRank;
346 near.second() = mySampleWorld;
352 case NEARESTONLYCELL:
354 if (samplePatch.size() && samplePatch !=
"none")
357 <<
"No need to supply a patch name when in " 367 nearInfoWorld& near = nearest[sampleI];
369 near.
first().first() =
tree.findNearest(sample,
sqr(GREAT));
371 near.first().second().first() =
372 near.first().first().hitPoint().distSqr(sample);
374 near.first().second().second() = myRank;
375 near.second() = mySampleWorld;
380 case NEARESTPATCHFACE:
384 const polyPatch&
pp = lookupPatch(sampleRegion, samplePatch);
390 nearInfoWorld& near = nearest[sampleI];
392 near.first().second().second() = myRank;
393 near.second() = mySampleWorld;
408 indexedOctree<treeDataFace> boundaryTree
410 treeDataFace(
mesh,
pp.range()),
417 const auto& treeData = boundaryTree.shapes();
423 nearInfoWorld& near = nearest[sampleI];
425 nearInfo = boundaryTree.findNearest
433 near.first().second().first() =
Foam::sqr(GREAT);
434 near.first().second().second() = myRank;
435 near.second() = mySampleWorld;
439 const point& fc = treeData.centre(nearInfo.index());
441 nearInfo.setPoint(fc);
442 near.
first().second().first() = sample.distSqr(fc);
443 near.first().second().second() = myRank;
444 near.second() = mySampleWorld;
451 case NEARESTPATCHPOINT:
455 const polyPatch&
pp = lookupPatch(sampleRegion, samplePatch);
461 nearInfoWorld& near = nearest[sampleI];
463 near.first().second().second() = myRank;
464 near.second() = mySampleWorld;
480 indexedOctree<treeDataPoint> boundaryTree
495 nearInfoWorld& near = nearest[sampleI];
497 nearInfo = boundaryTree.findNearest
505 near.first().second().first() =
Foam::sqr(GREAT);
506 near.first().second().second() = myRank;
507 near.second() = mySampleWorld;
511 const point& pt = nearInfo.point();
513 near.first().second().first() = sample.distSqr(pt);
514 near.first().second().second() = myRank;
515 near.second() = mySampleWorld;
524 if (samplePatch.size() && samplePatch !=
"none")
527 <<
"No need to supply a patch name when in " 532 const meshSearchMeshObject& meshSearchEngine =
538 nearInfoWorld& near = nearest[sampleI];
540 label facei = meshSearchEngine.findNearestFace(sample);
545 near.first().second().second() = myRank;
546 near.second() = mySampleWorld;
553 near.first().second().first() = sample.distSqr(fc);
554 near.first().second().second() = myRank;
555 near.second() = mySampleWorld;
561 case NEARESTPATCHFACEAMI:
594 const label myComm = getCommunicator();
602 samplePatches[myRank] = samplePatch_;
607 sampleRegions[myRank] = sampleRegion_;
621 nearest[samplei].second() = wantedWorlds[samplei];
628 forAll(wantedWorlds, samplei)
630 if (wantedWorlds[samplei] == myWorld)
632 localMap.append(samplei);
639 labelList localOrigProcs(origProcs, localMap);
642 const word localOrigPatch(samplePatches[localOrigProcs[0]]);
643 const word localOrigRegion(sampleRegions[localOrigProcs[0]]);
648 Pout<<
"Searching locally for " << localSamples.
size()
649 <<
" samples on region:" << localOrigRegion
650 <<
" on patch:" << localOrigPatch <<
endl;
703 if (!ni.
first().hit())
705 sampleProcs[sampleI] = -1;
706 sampleIndices[sampleI] = -1;
711 sampleProcs[sampleI] = ni.
second().second();
712 sampleIndices[sampleI] = ni.
first().index();
713 sampleLocations[sampleI] = ni.
first().point();
726 static bool hasWarned =
false;
739 (void)patch_.boundaryMesh().mesh().tetBasePtIs();
741 const label myComm = getCommunicator();
773 const pointField offsettedPoints(samplePoints(patchPoints()));
779 mode_ == NEARESTPATCHFACE
781 && sampleRegion() == patch_.boundaryMesh().mesh().name()
782 && samplePatch() == patch_.name()
789 bool coincident = (
gAverage(
mag(d)) <= ROOTVSMALL);
791 if (sampleMyself && coincident)
794 <<
"Invalid offset " << d <<
endl 795 <<
"Offset is the vector added to the patch face centres to" 796 <<
" find the patch face supplying the data." <<
endl 797 <<
"Setting it to " << d
798 <<
" on the same patch, on the same region" 799 <<
" will find the faces themselves which does not make sense" 800 <<
" for anything but testing." <<
endl 801 <<
"patch:" << patch_.
name() <<
endl 802 <<
"sampleRegion:" << sampleRegion() <<
endl 803 <<
"mode:" << sampleModeNames_[mode_] <<
endl 804 <<
"samplePatch:" << samplePatch() <<
endl 805 <<
"offsetMode:" << offsetModeNames_[offsetMode_] <<
endl;
862 if (mode_ == NEARESTCELL)
865 forAll(sampleProcs, sampleI)
867 if (sampleProcs[sampleI] == -1)
879 <<
"Did not find " << nNotFound
880 <<
" out of " << sampleProcs.
size() <<
" total samples." 881 <<
" Sampling these on owner cell centre instead." <<
endl 882 <<
"On patch " << patch_.
name()
883 <<
" on region " << sampleRegion()
884 <<
" in mode " << sampleModeNames_[mode_] <<
endl 885 <<
"with offset mode " << offsetModeNames_[offsetMode_]
886 <<
". Suppressing further warnings from " <<
type() <<
endl;
893 forAll(sampleProcs, sampleI)
895 if (sampleProcs[sampleI] == -1)
936 if (sampleProcs[i] == -1)
939 << patchFc[i] <<
" on patch " << patch_.name()
941 << patch_.boundaryMesh().mesh().name()
942 <<
" on processor " << patchFaceProcs[i]
967 patch_.boundaryMesh().mesh().time().path()
971 Pout<<
"Dumping mapping as lines from patch faceCentres to" 972 <<
" sampled cell/faceCentres/points to file " << str.
name()
983 str <<
"l " << vertI-1 <<
' ' << vertI <<
nl;
988 mapPtr_.reset(
new mapDistribute(sampleProcs, patchFaceProcs, myComm));
999 constructMap[proci] =
labelUIndList(patchFaces, constructMap[proci]);
1003 Pout<<
"To proc:" << proci <<
" sending values of cells/faces:" 1004 << subMap[proci] <<
endl;
1005 Pout<<
"From proc:" << proci
1006 <<
" receiving values of patch faces:" 1007 << constructMap[proci] <<
endl;
1013 mapPtr_().constructSize() = patch_.size();
1019 forAll(constructMap, proci)
1021 const labelList& map = constructMap[proci];
1025 label facei = map[i];
1030 <<
"On patch " << patch_.name()
1031 <<
" patchface " << facei
1032 <<
" is assigned to more than once." 1046 <<
"On patch " << patch_.name()
1047 <<
" patchface " << facei
1048 <<
" is never assigned to." 1054 updateMeshTime().setUpToDate();
1057 updateSampleMeshTime().setUpToDate();
1065 const word surfType(surfDict_.getOrDefault<
word>(
"type",
"none"));
1067 if (!surfPtr_ && surfType !=
"none")
1069 word surfName(surfDict_.getOrDefault(
"name", patch_.name()));
1096 if (AMIPtr_->upToDate())
1099 <<
"AMI already up-to-date" 1107 const label myComm = getCommunicator();
1110 const auto& surf = surfPtr();
1113 if (sampleWorld_.empty() || sameWorld())
1115 const polyPatch& nbr = samplePolyPatch();
1133 OFstream os(patch_.name() +
"_neighbourPatch-org.obj");
1136 OFstream osN(patch_.name() +
"_neighbourPatch-trans.obj");
1139 OFstream osO(patch_.name() +
"_ownerPatch.obj");
1150 AMIPtr_->calculate(patch_, nbrPatch0, surf);
1167 AMIPtr_->comm(myComm);
1177 AMIPtr_->calculate(patch_, dummyPatch, surf);
1184 AMIPtr_->calculate(dummyPatch, patch_, surf);
1210 return subRegistry(sub,
names, index+1);
1222 mode_(NEARESTPATCHFACE),
1225 sampleDatabasePtr_(),
1228 offsets_(
pp.size(), offset_),
1245 const word& sampleRegion,
1247 const word& samplePatch,
1267 const word& sampleRegion,
1269 const word& samplePatch,
1270 const vector& uniformOffset
1289 const word& sampleRegion,
1291 const word& samplePatch,
1292 const scalar normalDistance
1297 sampleRegion_(sampleRegion),
1299 samplePatch_(samplePatch),
1301 sampleDatabasePtr_(),
1302 offsetMode_(NORMAL),
1305 distance_(normalDistance),
1309 sampleWorld_.empty()
1329 sampleWorld_(
dict.getOrDefault<
word>(
"sampleWorld",
word::null)),
1330 sampleRegion_(
dict.getOrDefault<
word>(
"sampleRegion",
word::null)),
1331 mode_(sampleModeNames_.
get(
"sampleMode",
dict)),
1332 samplePatch_(
dict.getOrDefault<
word>(
"samplePatch",
word::null)),
1334 sampleDatabasePtr_(readDatabase(
dict)),
1342 sampleWorld_.empty()
1368 surfDict_(
dict.subOrEmptyDict(
"surface"))
1409 else if (
dict.found(
"offsets"))
1417 <<
"Please supply the offsetMode as one of " 1432 sampleWorld_(
dict.getOrDefault<
word>(
"sampleWorld",
word::null)),
1433 sampleRegion_(
dict.getOrDefault<
word>(
"sampleRegion",
word::null)),
1435 samplePatch_(
dict.getOrDefault<
word>(
"samplePatch",
word::null)),
1437 sampleDatabasePtr_(readDatabase(
dict)),
1445 sampleWorld_.empty()
1471 surfDict_(
dict.subOrEmptyDict(
"surface"))
1478 <<
"Construct from sampleMode and dictionary only applicable for " 1479 <<
" collocated patches in modes " 1504 sampleWorld_(mpb.sampleWorld_),
1505 sampleRegion_(mpb.sampleRegion_),
1507 samplePatch_(mpb.samplePatch_),
1508 coupleGroup_(mpb.coupleGroup_),
1511 mpb.sampleDatabasePtr_
1512 ? new
fileName(mpb.sampleDatabasePtr_())
1515 offsetMode_(mpb.offsetMode_),
1516 offset_(mpb.offset_),
1517 offsets_(mpb.offsets_),
1518 distance_(mpb.distance_),
1519 communicator_(mpb.communicator_),
1520 sameRegion_(mpb.sameRegion_),
1522 AMIReverse_(mpb.AMIReverse_),
1523 AMIPtr_(mpb.AMIPtr_->clone()),
1525 surfDict_(mpb.surfDict_)
1537 sampleWorld_(mpb.sampleWorld_),
1538 sampleRegion_(mpb.sampleRegion_),
1540 samplePatch_(mpb.samplePatch_),
1541 coupleGroup_(mpb.coupleGroup_),
1544 mpb.sampleDatabasePtr_
1545 ? new
fileName(mpb.sampleDatabasePtr_())
1548 offsetMode_(mpb.offsetMode_),
1549 offset_(mpb.offset_),
1556 distance_(mpb.distance_),
1557 communicator_(mpb.communicator_),
1558 sameRegion_(mpb.sameRegion_),
1560 AMIReverse_(mpb.AMIReverse_),
1561 AMIPtr_(mpb.AMIPtr_->clone()),
1563 surfDict_(mpb.surfDict_)
1577 mapPtr_.reset(
nullptr);
1578 AMIPtr_->upToDate(
false);
1589 offsetMode_ = offsetMode::NORMAL;
1592 distance_ = normalDist;
1600 offset_ = uniformOffset;
1618 const word& sampleRegion
1624 sampleRegion.empty() || sampleRegion == thisMesh.
name()
1633 const word& sampleRegion,
1634 const word& samplePatch
1637 const polyMesh& nbrMesh = lookupMesh(sampleRegion);
1644 <<
"Cannot find patch " << samplePatch
1645 <<
" in region " << sampleRegion_ <<
endl 1657 <<
"sampleWorld : " << sampleWorld_
1661 return lookupMesh(sampleRegion());
1667 const polyMesh& nbrMesh = sampleMesh();
1674 <<
"Cannot find patch " << samplePatch()
1675 <<
" in region " << sampleRegion_ <<
endl 1689 bool sampleUpToDate =
1692 ? sampleMesh().upToDatePoints(updateSampleMeshTime())
1698 auto checkPointMovement = []
1705 bool upToDate =
true;
1709 for (
const label pointi :
patch.meshPoints())
1711 const point& oldPt = oldPoints[pointi];
1714 if (
mag(oldPt - currentPt) > SMALL)
1725 state.setUpToDate();
1732 if (!thisUpToDate && thisMesh.
moving())
1737 thisUpToDate = checkPointMovement(thisMesh, patch_, updateMeshTime());
1743 && sampleMesh().moving()
1745 mode_ == NEARESTPATCHFACE
1746 || mode_ == NEARESTPATCHFACEAMI
1747 || mode_ == NEARESTPATCHPOINT
1751 sampleUpToDate = checkPointMovement
1755 updateSampleMeshTime()
1759 return (thisUpToDate && sampleUpToDate);
1769 auto&
fld = tfld.ref();
1771 switch (offsetMode_)
1800 return samplePoints(facePoints(patch_));
1845 const point& basePoint =
p[
f[fp0]];
1848 for (label i = 2; i <
f.
size(); i++)
1850 const point& thisPoint =
p[
f[fp]];
1852 const point& nextPoint =
p[
f[nextFp]];
1854 const triPointRef tri(basePoint, thisPoint, nextPoint);
1895 cleanedPath.
clean();
1904 return subRegistry(obr,
names, 0);
1916 return root/
"send"/processorName;
1922 return sendPath(sampleDatabasePath(), proci);
1933 return root/
"receive"/processorName;
1939 return receivePath(sampleDatabasePath(), proci);
1954 if (isA<objectRegistry>(obj))
1957 writeDict(dynamic_cast<const objectRegistry&>(obj), d);
1961 writeIOField<scalar>(obj,
dict)
1962 || writeIOField<vector>(obj,
dict)
1963 || writeIOField<sphericalTensor>(obj,
dict)
1964 || writeIOField<symmTensor>(obj,
dict)
1965 || writeIOField<tensor>(obj,
dict)
1996 readDict(
e.dict(), sub);
2005 constructIOField<scalar>(
e.keyword(), tok, is, obr)
2006 || constructIOField<vector>(
e.keyword(), tok, is, obr)
2007 || constructIOField<sphericalTensor>(
e.keyword(), tok, is, obr)
2008 || constructIOField<symmTensor>(
e.keyword(), tok, is, obr)
2009 || constructIOField<tensor>(
e.keyword(), tok, is, obr)
2031 if (sampleDatabasePtr_)
2037 "sampleDatabasePath",
2039 sampleDatabasePtr_()
2042 coupleGroup_.write(
os);
2047 && offset_ == vector::zero
2048 && (mode_ == NEARESTPATCHFACE || mode_ == NEARESTPATCHFACEAMI)
2055 os.
writeEntry(
"offsetMode", offsetModeNames_[offsetMode_]);
2057 switch (offsetMode_)
2066 offsets_.writeEntry(
"offsets",
os);
2077 if (mode_ == NEARESTPATCHFACEAMI)
2086 if (!surfDict_.empty())
2088 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.
static const word & myWorld()
My world.
use face normal + distance
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.
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 readIfPresent(const word &key, const dictionary &dict, EnumType &val, const bool warnOnly=false) const
Find an entry if present, and assign to T val.
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
bool test(const Key &key) const
Same as contains() - return true if key exists in the set.
static const meshSearchMeshObject & New(const polyMesh &mesh, Args &&... args)
Get existing or create MeshObject registered with typeName.
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
dimensionedSymmTensor sqr(const dimensionedVector &dv)
Output to file stream as an OSstream, normally using std::ofstream for the actual output...
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 List is empty (ie, size() is zero)
A token holds an item read from Istream.
static const fileName null
An empty fileName.
UIndirectList< label > labelUIndList
UIndirectList of labels.
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.
tmp< DimensionedField< TypeR, GeoMesh > > New(const tmp< DimensionedField< TypeR, GeoMesh >> &tf1, const word &name, const dimensionSet &dimensions, const bool initCopy=false)
Global function forwards to reuseTmpDimensionedField::New.
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)
Rank of this process in the communicator (starting from masterNo()). Can be negative if the process i...
T get(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
Find and return a T. FatalIOError if not found, or if the number of tokens is incorrect.
const Time & time() const
Return the top-level database.
const objectRegistry & subRegistry(const word &name, const bool forceCreate=false, const bool recursive=false) const
Lookup and return a const sub-objectRegistry.
virtual const fileName & name() const override
Get the name of the output serial stream. (eg, the name of the Fstream file name) ...
List< labelList > labelListList
List of labelList.
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.
const labelList & meshPoints() const
Return labelList of mesh points in patch.
scalar distance_
Offset distance (normal)
dictionary & subDictOrAdd(const word &keyword, enum keyType::option matchOpt=keyType::REGEX)
Find and return a sub-dictionary for manipulation.
bool found(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
Find an entry (const access) with the given keyword.
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...
Container (non-empty) with different values.
nearest patch face + AMI interpolation
bool hit() const noexcept
Is there a hit.
static label commWarn(const label communicator) noexcept
Alter communicator debugging setting. Warns for use of any communicator differing from specified...
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). It 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 expressions::valueTypeCode::INVALID.
static void reduceAnd(bool &value, const label communicator=worldComm)
Logical (and) reduction (MPI_AllReduce)
bool good() const noexcept
The patchGroup has a non-empty name.
const polyBoundaryMesh & boundaryMesh() const noexcept
Return boundaryMesh reference.
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), works like std::iota() but returning a...
const polyBoundaryMesh & boundaryMesh() const noexcept
Return boundary mesh.
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 pointField & oldPoints() const
Return old points (mesh motion)
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...
const Field< point_type > & points() const noexcept
Return reference to global points.
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
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.
label find(const T &val) const
Find index of the first occurrence of the value.
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.
Buffers for inter-processor communications streams (UOPstream, UIPstream).
offsetMode
How to project face centres.
static label commWorld() noexcept
Communicator for all ranks (respecting any local worlds)
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))
virtual bool upToDatePoints(const regIOobject &io) const
Return true if io is up-to-date with points.
bool moving() const noexcept
Is mesh moving.
const vectorField & faceCentres() const
static void allGatherList(UList< T > &values, const int tag=UPstream::msgType(), const label comm=UPstream::worldComm)
Gather data, but keep individual values separate. Uses MPI_Allgather or manual linear/tree communicat...
const indexedOctree< treeDataCell > & cellTree() const
Return the cell search tree.
sampleMode mode() const noexcept
What to sample.
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)
True if process corresponds to the master rank in the communicator.
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.
const std::string patch
OpenFOAM patch number as a std::string.
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...
Container (non-empty) with identical values.
Mesh consisting of general polyhedral cells.
T getOrDefault(const word &keyword, const T &deflt, enum keyType::option matchOpt=keyType::REGEX) const
Find and return a T, or return the given default value. FatalIOError if it is found and the number of...
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...
virtual void updateMesh(PstreamBuffers &)
Update of the patch topology.
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 reduce(T &value, const BinaryOp &bop, const int tag=UPstream::msgType(), const label comm=UPstream::worldComm)
Reduce inplace (cf. MPI Allreduce) using linear/tree communication schedule.
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)
uindirectPrimitivePatch pp(UIndirectList< face >(mesh.faces(), faceLabels), mesh.points())
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)
Combines List elements. 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)