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();
195 <<
"[rank=" << myRank <<
" procs=" << nProcs
196 <<
" comm=" << myComm <<
"] collect samples" <<
endl;
201 List<pointField> globalFc(nProcs);
202 globalFc[myRank] = facePoints;
207 patchFc = ListListOps::combine<pointField>
210 accessOp<pointField>()
215 List<pointField> globalSamples(nProcs);
216 globalSamples[myRank] = samplePoints(facePoints);
220 samples = ListListOps::combine<pointField>
223 accessOp<pointField>()
229 globalFaces[myRank] =
identity(patch_.size());
233 patchFaces = ListListOps::combine<labelList>
236 accessOp<labelList>()
243 UPstream::allGatherValues<label>(mySampleWorld, myComm)
247 UPstream::allGatherValues<label>(patch_.size(), myComm)
250 patchFaceWorlds.resize(patchFaces.size());
251 patchFaceProcs.resize(patchFaces.size());
256 for (label i = 0; i < nPerProc[proci]; i++)
258 patchFaceWorlds[sampleI] = procToWorldIndex[proci];
259 patchFaceProcs[sampleI] = proci;
272 const sampleMode
mode,
274 const label mySampleWorld,
275 const word& sampleRegion,
276 const word& samplePatch,
284 const label myComm = getCommunicator();
305 if (samplePatch.size() && samplePatch !=
"none")
308 <<
"No need to supply a patch name when in " 318 nearInfoWorld& near = nearest[sampleI];
320 label celli =
tree.findInside(sample);
324 near.first().second().first() =
Foam::sqr(GREAT);
325 near.first().second().second() = myRank;
326 near.second() = mySampleWorld;
338 near.first().second().first() = sample.distSqr(cc);
339 near.first().second().second() = myRank;
340 near.second() = mySampleWorld;
346 case NEARESTONLYCELL:
348 if (samplePatch.size() && samplePatch !=
"none")
351 <<
"No need to supply a patch name when in " 361 nearInfoWorld& near = nearest[sampleI];
363 near.
first().first() =
tree.findNearest(sample,
sqr(GREAT));
365 near.first().second().first() =
366 near.first().first().hitPoint().distSqr(sample);
368 near.first().second().second() = myRank;
369 near.second() = mySampleWorld;
374 case NEARESTPATCHFACE:
378 const polyPatch&
pp = lookupPatch(sampleRegion, samplePatch);
384 nearInfoWorld& near = nearest[sampleI];
386 near.first().second().second() = myRank;
387 near.second() = mySampleWorld;
402 indexedOctree<treeDataFace> boundaryTree
404 treeDataFace(
mesh,
pp.range()),
411 const auto& treeData = boundaryTree.shapes();
417 nearInfoWorld& near = nearest[sampleI];
419 nearInfo = boundaryTree.findNearest
427 near.first().second().first() =
Foam::sqr(GREAT);
428 near.first().second().second() = myRank;
429 near.second() = mySampleWorld;
433 const point& fc = treeData.centre(nearInfo.index());
435 nearInfo.setPoint(fc);
436 near.
first().second().first() = sample.distSqr(fc);
437 near.first().second().second() = myRank;
438 near.second() = mySampleWorld;
445 case NEARESTPATCHPOINT:
449 const polyPatch&
pp = lookupPatch(sampleRegion, samplePatch);
455 nearInfoWorld& near = nearest[sampleI];
457 near.first().second().second() = myRank;
458 near.second() = mySampleWorld;
474 indexedOctree<treeDataPoint> boundaryTree
489 nearInfoWorld& near = nearest[sampleI];
491 nearInfo = boundaryTree.findNearest
499 near.first().second().first() =
Foam::sqr(GREAT);
500 near.first().second().second() = myRank;
501 near.second() = mySampleWorld;
505 const point& pt = nearInfo.point();
507 near.first().second().first() = sample.distSqr(pt);
508 near.first().second().second() = myRank;
509 near.second() = mySampleWorld;
518 if (samplePatch.size() && samplePatch !=
"none")
521 <<
"No need to supply a patch name when in " 526 const meshSearchMeshObject& meshSearchEngine =
532 nearInfoWorld& near = nearest[sampleI];
534 label facei = meshSearchEngine.findNearestFace(sample);
539 near.first().second().second() = myRank;
540 near.second() = mySampleWorld;
547 near.first().second().first() = sample.distSqr(fc);
548 near.first().second().second() = myRank;
549 near.second() = mySampleWorld;
555 case NEARESTPATCHFACEAMI:
588 const label myComm = getCommunicator();
596 samplePatches[myRank] = samplePatch_;
601 sampleRegions[myRank] = sampleRegion_;
615 nearest[samplei].second() = wantedWorlds[samplei];
622 forAll(wantedWorlds, samplei)
624 if (wantedWorlds[samplei] == myWorld)
626 localMap.append(samplei);
633 labelList localOrigProcs(origProcs, localMap);
636 const word localOrigPatch(samplePatches[localOrigProcs[0]]);
637 const word localOrigRegion(sampleRegions[localOrigProcs[0]]);
642 Pout<<
"Searching locally for " << localSamples.
size()
643 <<
" samples on region:" << localOrigRegion
644 <<
" on patch:" << localOrigPatch <<
endl;
697 if (!ni.
first().hit())
699 sampleProcs[sampleI] = -1;
700 sampleIndices[sampleI] = -1;
705 sampleProcs[sampleI] = ni.
second().second();
706 sampleIndices[sampleI] = ni.
first().index();
707 sampleLocations[sampleI] = ni.
first().point();
720 static bool hasWarned =
false;
733 (void)patch_.boundaryMesh().mesh().tetBasePtIs();
735 const label myComm = getCommunicator();
767 const pointField offsettedPoints(samplePoints(patchPoints()));
773 mode_ == NEARESTPATCHFACE
775 && sampleRegion() == patch_.boundaryMesh().mesh().name()
776 && samplePatch() == patch_.name()
783 bool coincident = (
gAverage(
mag(d)) <= ROOTVSMALL);
785 if (sampleMyself && coincident)
788 <<
"Invalid offset " << d <<
endl 789 <<
"Offset is the vector added to the patch face centres to" 790 <<
" find the patch face supplying the data." <<
endl 791 <<
"Setting it to " << d
792 <<
" on the same patch, on the same region" 793 <<
" will find the faces themselves which does not make sense" 794 <<
" for anything but testing." <<
endl 795 <<
"patch:" << patch_.
name() <<
endl 796 <<
"sampleRegion:" << sampleRegion() <<
endl 797 <<
"mode:" << sampleModeNames_[mode_] <<
endl 798 <<
"samplePatch:" << samplePatch() <<
endl 799 <<
"offsetMode:" << offsetModeNames_[offsetMode_] <<
endl;
856 if (mode_ == NEARESTCELL)
859 forAll(sampleProcs, sampleI)
861 if (sampleProcs[sampleI] == -1)
873 <<
"Did not find " << nNotFound
874 <<
" out of " << sampleProcs.
size() <<
" total samples." 875 <<
" Sampling these on owner cell centre instead." <<
endl 876 <<
"On patch " << patch_.
name()
877 <<
" on region " << sampleRegion()
878 <<
" in mode " << sampleModeNames_[mode_] <<
endl 879 <<
"with offset mode " << offsetModeNames_[offsetMode_]
880 <<
". Suppressing further warnings from " <<
type() <<
endl;
887 forAll(sampleProcs, sampleI)
889 if (sampleProcs[sampleI] == -1)
930 if (sampleProcs[i] == -1)
933 << patchFc[i] <<
" on patch " << patch_.name()
935 << patch_.boundaryMesh().mesh().name()
936 <<
" on processor " << patchFaceProcs[i]
961 patch_.boundaryMesh().mesh().time().path()
965 Pout<<
"Dumping mapping as lines from patch faceCentres to" 966 <<
" sampled cell/faceCentres/points to file " << str.
name()
977 str <<
"l " << vertI-1 <<
' ' << vertI <<
nl;
982 mapPtr_.reset(
new mapDistribute(sampleProcs, patchFaceProcs, myComm));
993 constructMap[proci] =
labelUIndList(patchFaces, constructMap[proci]);
997 Pout<<
"To proc:" << proci <<
" sending values of cells/faces:" 998 << subMap[proci] <<
endl;
999 Pout<<
"From proc:" << proci
1000 <<
" receiving values of patch faces:" 1001 << constructMap[proci] <<
endl;
1007 mapPtr_().constructSize() = patch_.size();
1013 forAll(constructMap, proci)
1015 const labelList& map = constructMap[proci];
1019 label facei = map[i];
1024 <<
"On patch " << patch_.name()
1025 <<
" patchface " << facei
1026 <<
" is assigned to more than once." 1040 <<
"On patch " << patch_.name()
1041 <<
" patchface " << facei
1042 <<
" is never assigned to." 1048 updateMeshTime().setUpToDate();
1051 updateSampleMeshTime().setUpToDate();
1059 const word surfType(surfDict_.getOrDefault<
word>(
"type",
"none"));
1061 if (!surfPtr_ && surfType !=
"none")
1063 word surfName(surfDict_.getOrDefault(
"name", patch_.name()));
1090 if (AMIPtr_->upToDate())
1093 <<
"AMI already up-to-date" 1101 const label myComm = getCommunicator();
1104 const auto& surf = surfPtr();
1107 if (sampleWorld_.empty() || sameWorld())
1109 const polyPatch& nbr = samplePolyPatch();
1127 OFstream os(patch_.name() +
"_neighbourPatch-org.obj");
1130 OFstream osN(patch_.name() +
"_neighbourPatch-trans.obj");
1133 OFstream osO(patch_.name() +
"_ownerPatch.obj");
1144 AMIPtr_->calculate(patch_, nbrPatch0, surf);
1169 AMIPtr_->calculate(patch_, dummyPatch, surf);
1176 AMIPtr_->calculate(dummyPatch, patch_, surf);
1202 return subRegistry(sub,
names, index+1);
1214 mode_(NEARESTPATCHFACE),
1217 sampleDatabasePtr_(),
1218 offsetMode_(UNIFORM),
1220 offsets_(
pp.size(), offset_),
1237 const word& sampleRegion,
1239 const word& samplePatch,
1259 const word& sampleRegion,
1261 const word& samplePatch,
1262 const vector& uniformOffset
1281 const word& sampleRegion,
1283 const word& samplePatch,
1284 const scalar normalDistance
1289 sampleRegion_(sampleRegion),
1291 samplePatch_(samplePatch),
1293 sampleDatabasePtr_(),
1294 offsetMode_(NORMAL),
1297 distance_(normalDistance),
1301 sampleWorld_.empty()
1321 sampleWorld_(
dict.getOrDefault<
word>(
"sampleWorld",
word::null)),
1322 sampleRegion_(
dict.getOrDefault<
word>(
"sampleRegion",
word::null)),
1323 mode_(sampleModeNames_.
get(
"sampleMode",
dict)),
1324 samplePatch_(
dict.getOrDefault<
word>(
"samplePatch",
word::null)),
1326 sampleDatabasePtr_(readDatabase(
dict)),
1327 offsetMode_(UNIFORM),
1334 sampleWorld_.empty()
1360 surfDict_(
dict.subOrEmptyDict(
"surface"))
1401 else if (
dict.found(
"offsets"))
1409 <<
"Please supply the offsetMode as one of " 1424 sampleWorld_(
dict.getOrDefault<
word>(
"sampleWorld",
word::null)),
1425 sampleRegion_(
dict.getOrDefault<
word>(
"sampleRegion",
word::null)),
1427 samplePatch_(
dict.getOrDefault<
word>(
"samplePatch",
word::null)),
1429 sampleDatabasePtr_(readDatabase(
dict)),
1430 offsetMode_(UNIFORM),
1437 sampleWorld_.empty()
1463 surfDict_(
dict.subOrEmptyDict(
"surface"))
1470 <<
"Construct from sampleMode and dictionary only applicable for " 1471 <<
" collocated patches in modes " 1496 sampleWorld_(mpb.sampleWorld_),
1497 sampleRegion_(mpb.sampleRegion_),
1499 samplePatch_(mpb.samplePatch_),
1500 coupleGroup_(mpb.coupleGroup_),
1503 mpb.sampleDatabasePtr_
1504 ? new
fileName(mpb.sampleDatabasePtr_())
1507 offsetMode_(mpb.offsetMode_),
1508 offset_(mpb.offset_),
1509 offsets_(mpb.offsets_),
1510 distance_(mpb.distance_),
1511 communicator_(mpb.communicator_),
1512 sameRegion_(mpb.sameRegion_),
1514 AMIReverse_(mpb.AMIReverse_),
1515 AMIPtr_(mpb.AMIPtr_->clone()),
1517 surfDict_(mpb.surfDict_)
1529 sampleWorld_(mpb.sampleWorld_),
1530 sampleRegion_(mpb.sampleRegion_),
1532 samplePatch_(mpb.samplePatch_),
1533 coupleGroup_(mpb.coupleGroup_),
1536 mpb.sampleDatabasePtr_
1537 ? new
fileName(mpb.sampleDatabasePtr_())
1540 offsetMode_(mpb.offsetMode_),
1541 offset_(mpb.offset_),
1544 offsetMode_ == NONUNIFORM
1548 distance_(mpb.distance_),
1549 communicator_(mpb.communicator_),
1550 sameRegion_(mpb.sameRegion_),
1552 AMIReverse_(mpb.AMIReverse_),
1553 AMIPtr_(mpb.AMIPtr_->clone()),
1555 surfDict_(mpb.surfDict_)
1569 mapPtr_.reset(
nullptr);
1570 surfPtr_.reset(
nullptr);
1571 AMIPtr_->upToDate(
false);
1580 offsetMode_ = offsetMode::NORMAL;
1583 distance_ = normalDist;
1590 offsetMode_ = offsetMode::UNIFORM;
1591 offset_ = uniformOffset;
1600 offsetMode_ = offsetMode::NONUNIFORM;
1609 const word& sampleRegion
1615 sampleRegion.empty() || sampleRegion == thisMesh.
name()
1624 const word& sampleRegion,
1625 const word& samplePatch
1628 const polyMesh& nbrMesh = lookupMesh(sampleRegion);
1635 <<
"Cannot find patch " << samplePatch
1636 <<
" in region " << sampleRegion_ <<
endl 1648 <<
"sampleWorld : " << sampleWorld_
1652 return lookupMesh(sampleRegion());
1658 const polyMesh& nbrMesh = sampleMesh();
1665 <<
"Cannot find patch " << samplePatch()
1666 <<
" in region " << sampleRegion_ <<
endl 1681 auto&
fld = tfld.ref();
1683 switch (offsetMode_)
1712 return samplePoints(facePoints(patch_));
1757 const point& basePoint =
p[
f[fp0]];
1760 for (label i = 2; i <
f.
size(); i++)
1762 const point& thisPoint =
p[
f[fp]];
1764 const point& nextPoint =
p[
f[nextFp]];
1766 const triPointRef tri(basePoint, thisPoint, nextPoint);
1807 cleanedPath.
clean();
1816 return subRegistry(obr,
names, 0);
1828 return root/
"send"/processorName;
1834 return sendPath(sampleDatabasePath(), proci);
1845 return root/
"receive"/processorName;
1851 return receivePath(sampleDatabasePath(), proci);
1866 if (isA<objectRegistry>(obj))
1869 writeDict(dynamic_cast<const objectRegistry&>(obj), d);
1873 writeIOField<scalar>(obj,
dict)
1874 || writeIOField<vector>(obj,
dict)
1875 || writeIOField<sphericalTensor>(obj,
dict)
1876 || writeIOField<symmTensor>(obj,
dict)
1877 || writeIOField<tensor>(obj,
dict)
1908 readDict(
e.dict(), sub);
1917 constructIOField<scalar>(
e.keyword(), tok, is, obr)
1918 || constructIOField<vector>(
e.keyword(), tok, is, obr)
1919 || constructIOField<sphericalTensor>(
e.keyword(), tok, is, obr)
1920 || constructIOField<symmTensor>(
e.keyword(), tok, is, obr)
1921 || constructIOField<tensor>(
e.keyword(), tok, is, obr)
1943 if (sampleDatabasePtr_)
1949 "sampleDatabasePath",
1951 sampleDatabasePtr_()
1954 coupleGroup_.write(
os);
1958 offsetMode_ == UNIFORM
1959 && offset_ == vector::zero
1960 && (mode_ == NEARESTPATCHFACE || mode_ == NEARESTPATCHFACEAMI)
1967 os.
writeEntry(
"offsetMode", offsetModeNames_[offsetMode_]);
1969 switch (offsetMode_)
1989 if (mode_ == NEARESTPATCHFACEAMI)
1998 if (!surfDict_.empty())
2000 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.
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
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.
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 a new 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, 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 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...
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.
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.
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 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 INVALID.
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)
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 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.
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 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))
const vectorField & faceCentres() const
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.
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)
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)
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)