52 debug::optimisationSwitch(
"localAMIComm", 1)
68 cache_.addToCache(*
this, refPt);
118 bool inCommGroup = (srcPatch.
size() > 0 || tgtPatch.
size() > 0);
137 label whichProci(-1);
145 DynamicList<label> subProcs(hasFaces.size());
148 if (hasFaces.test(i))
152 subProcs.push_back(i);
175 else if (nCommProcs == 1)
183 <<
"AMI local to processor" << proci <<
endl;
189 const label currComm = (geomComm.
good() ? geomComm().comm() : -1);
191 if (useLocalComm_ == 0)
201 else if (inCommGroup)
208 Pout<<
"Retained geomComm:" << currComm
209 <<
" with " << subProcs.size()
219 Pout<<
"Allocated geomComm:" << geomComm().comm()
220 <<
" from " << subProcs.size()
232 Pout<<
"Allocated dummy geomComm:" << geomComm().comm()
233 <<
" src-size:" << srcPatch.
size()
234 <<
" tgt-size:" << tgtPatch.
size() <<
endl;
240 <<
"AMI split across multiple processors "
250 const searchableSurface& surf,
254 addProfiling(ami,
"AMIInterpolation::projectPointsToSurface");
258 List<pointIndexHit> nearInfo;
281 <<
"Error projecting points to surface: "
282 << nMiss <<
" faces could not be determined"
291 const word& patchName,
295 const bool conformal,
297 const scalar lowWeightTol,
301 addProfiling(ami,
"AMIInterpolation::normaliseWeights");
304 wghtSum.resize_nocopy(wght.size());
305 label nLowWeight = 0;
313 scalar denom = patchAreas[facei];
328 if (t < lowWeightTol)
347 Info.masterStream(comm)
349 <<
"AMI: Patch " << patchName
351 <<
" min:" <<
limits.min()
352 <<
" max:" <<
limits.max()
353 <<
" average:" << avg <<
nl;
357 Info.masterStream(comm)
359 <<
"AMI: Patch " << patchName
360 <<
" identified " << nLow
361 <<
" faces with weights less than " << lowWeightTol
375 const labelList& sourceRestrictAddressing,
376 const labelList& targetRestrictAddressing,
388 const label sourceCoarseSize =
390 sourceRestrictAddressing.size()
391 ?
max(sourceRestrictAddressing)+1
395 const label targetCoarseSize =
397 targetRestrictAddressing.size()
398 ?
max(targetRestrictAddressing)+1
405 srcMagSf.setSize(sourceCoarseSize, 0.0);
407 forAll(sourceRestrictAddressing, facei)
409 label coarseFacei = sourceRestrictAddressing[facei];
410 srcMagSf[coarseFacei] += fineSrcMagSf[facei];
421 if (map.constructMap().empty())
426 if (map.subMap().empty())
434 labelList allRestrict(targetRestrictAddressing);
435 map.distribute(allRestrict);
470 forAll(map.subMap(), proci)
482 const labelList& elems = map.subMap()[proci];
486 newSubMap.resize_nocopy(elems.size());
488 labelList oldToNew(targetCoarseSize, -1);
491 for (
const label elemi : elems)
493 label fineElem = elemsMap[elemi];
494 label coarseElem = allRestrict[fineElem];
495 if (oldToNew[coarseElem] == -1)
497 oldToNew[coarseElem] = newi;
498 newSubMap[newi] = coarseElem;
502 newSubMap.resize(newi);
518 labelList tgtCompactMap(map.constructSize());
529 for (
const label fineElem : elemsMap)
531 label coarseElem = allRestrict[fineElem];
532 tgtCompactMap[fineElem] = coarseElem;
536 label compacti = targetCoarseSize;
539 forAll(map.constructMap(), proci)
546 const labelList& elems = map.constructMap()[proci];
548 labelList& newConstructMap = tgtConstructMap[proci];
549 newConstructMap.resize_nocopy(elems.size());
555 label remoteTargetCoarseSize =
labelMin;
556 for (
const label elemi : elems)
558 remoteTargetCoarseSize =
max
560 remoteTargetCoarseSize,
564 remoteTargetCoarseSize += 1;
567 labelList oldToNew(remoteTargetCoarseSize, -1);
570 for (
const label fineElem : elems)
573 label coarseElem = allRestrict[fineElem];
574 if (oldToNew[coarseElem] == -1)
576 oldToNew[coarseElem] = newi;
577 tgtCompactMap[fineElem] = compacti;
578 newConstructMap[newi] = compacti++;
584 label compacti = oldToNew[coarseElem];
585 tgtCompactMap[fineElem] = newConstructMap[compacti];
588 newConstructMap.resize(newi);
593 srcAddress.setSize(sourceCoarseSize);
594 srcWeights.setSize(sourceCoarseSize);
596 forAll(fineSrcAddress, facei)
600 const labelList& elems = fineSrcAddress[facei];
601 const scalarList& weights = fineSrcWeights[facei];
602 const scalar fineArea = fineSrcMagSf[facei];
604 label coarseFacei = sourceRestrictAddressing[facei];
606 labelList& newElems = srcAddress[coarseFacei];
607 scalarList& newWeights = srcWeights[coarseFacei];
611 label elemi = elems[i];
612 label coarseElemi = tgtCompactMap[elemi];
614 label index = newElems.find(coarseElemi);
617 newElems.append(coarseElemi);
618 newWeights.append(fineArea*weights[i]);
622 newWeights[index] += fineArea*weights[i];
632 std::move(tgtSubMap),
633 std::move(tgtConstructMap),
642 srcAddress.setSize(sourceCoarseSize);
643 srcWeights.setSize(sourceCoarseSize);
645 forAll(fineSrcAddress, facei)
649 const labelList& elems = fineSrcAddress[facei];
650 const scalarList& weights = fineSrcWeights[facei];
651 const scalar fineArea = fineSrcMagSf[facei];
653 label coarseFacei = sourceRestrictAddressing[facei];
655 labelList& newElems = srcAddress[coarseFacei];
656 scalarList& newWeights = srcWeights[coarseFacei];
660 const label elemi = elems[i];
661 const label coarseElemi = targetRestrictAddressing[elemi];
663 const label index = newElems.find(coarseElemi);
666 newElems.append(coarseElemi);
667 newWeights.append(fineArea*weights[i]);
671 newWeights[index] += fineArea*weights[i];
698 const bool reverseTarget
701 requireMatch_(
dict.getOrDefault(
"requireMatch", true)),
702 reverseTarget_(
dict.getOrDefault(
"reverseTarget", reverseTarget)),
703 lowWeightCorrection_(
dict.getOrDefault<scalar>(
"lowWeightCorrection", -1)),
704 singlePatchProc_(-999),
725 const bool requireMatch,
726 const bool reverseTarget,
727 const scalar lowWeightCorrection
730 requireMatch_(requireMatch),
731 reverseTarget_(reverseTarget),
732 lowWeightCorrection_(lowWeightCorrection),
733 singlePatchProc_(-999),
757 const labelList& sourceRestrictAddressing,
758 const labelList& targetRestrictAddressing
761 requireMatch_(fineAMI.requireMatch_),
762 reverseTarget_(fineAMI.reverseTarget_),
763 lowWeightCorrection_(-1.0),
764 singlePatchProc_(fineAMI.singlePatchProc_),
765 comm_(fineAMI.comm()),
784 sourceRestrictAddressing,
785 targetRestrictAddressing
788 const label sourceCoarseSize =
790 sourceRestrictAddressing.
size()
791 ?
max(sourceRestrictAddressing)+1
795 const label neighbourCoarseSize =
797 targetRestrictAddressing.
size()
798 ?
max(targetRestrictAddressing)+1
804 Pout<<
"AMI: Creating addressing and weights as agglomeration of AMI :"
807 <<
" fineComm:" << fineAMI.
comm()
808 <<
" coarse source size:" << sourceCoarseSize
809 <<
" neighbour source size:" << neighbourCoarseSize
820 <<
"Size mismatch." << nl
821 <<
"Source patch size:" << fineAMI.srcAddress().size() << nl
822 <<
"Source agglomeration size:"
823 << sourceRestrictAddressing.size() << nl
824 <<
"Target patch size:" << fineAMI.tgtAddress().size() << nl
825 <<
"Target agglomeration size:"
826 << targetRestrictAddressing.size()
860 sourceRestrictAddressing,
861 targetRestrictAddressing,
895 targetRestrictAddressing,
896 sourceRestrictAddressing,
911 requireMatch_(ami.requireMatch_),
912 reverseTarget_(ami.reverseTarget_),
913 lowWeightCorrection_(ami.lowWeightCorrection_),
914 singlePatchProc_(ami.singlePatchProc_),
916 geomComm_(ami.geomComm_),
917 srcMagSf_(ami.srcMagSf_),
918 srcAddress_(ami.srcAddress_),
919 srcWeights_(ami.srcWeights_),
920 srcWeightsSum_(ami.srcWeightsSum_),
921 srcCentroids_(ami.srcCentroids_),
922 srcMapPtr_(ami.srcMapPtr_.clone()),
923 tgtMagSf_(ami.tgtMagSf_),
924 tgtAddress_(ami.tgtAddress_),
925 tgtWeights_(ami.tgtWeights_),
926 tgtWeightsSum_(ami.tgtWeightsSum_),
938 lowWeightCorrection_(readScalar(is)),
979 const autoPtr<searchableSurface>& surfPtr
992 if (srcMagSf_.size())
994 srcMagSf_.resize_nocopy(srcPatch.size());
996 srcAddress_.resize_nocopy(srcPatch.size());
997 srcWeights_.resize_nocopy(srcPatch.size());
998 srcWeightsSum_.resize_nocopy(srcPatch.size());
999 if (srcCentroids_.size())
1001 srcCentroids_.resize_nocopy(srcPatch.size());
1004 if (tgtMagSf_.size())
1006 tgtMagSf_.resize_nocopy(tgtPatch.size());
1008 tgtAddress_.resize_nocopy(tgtPatch.size());
1009 tgtWeights_.resize_nocopy(tgtPatch.size());
1010 tgtWeightsSum_.resize_nocopy(tgtPatch.size());
1012 if (tgtCentroids_.size())
1014 tgtCentroids_.resize_nocopy(tgtPatch.size());
1021 srcPatchPts_ = srcPatch.points();
1022 projectPointsToSurface(surfPtr(), srcPatchPts_);
1029 tgtPatchPts_ = tgtPatch.points();
1030 projectPointsToSurface(surfPtr(), tgtPatchPts_);
1039 tsrcPatch0_.cref(srcPatch);
1040 ttgtPatch0_.cref(tgtPatch);
1052 if (srcTotalSize == 0)
1055 <<
"AMI: no source faces present - no addressing constructed"
1075 singlePatchProc_ = calcDistribution(srcPatch, tgtPatch, comm_, geomComm_);
1077 Info<<
indent <<
"AMI: Patch source faces: " << srcTotalSize <<
nl
1078 <<
indent <<
"AMI: Patch target faces: " << tgtTotalSize <<
nl;
1101 const label singlePatchProc
1106 srcAddress_.transfer(srcAddress);
1107 srcWeights_.transfer(srcWeights);
1108 tgtAddress_.transfer(tgtAddress);
1109 tgtWeights_.transfer(tgtWeights);
1112 srcWeightsSum_.resize_nocopy(srcWeights_.size());
1113 forAll(srcWeights_, facei)
1115 srcWeightsSum_[facei] =
sum(srcWeights_[facei]);
1118 tgtWeightsSum_.resize_nocopy(tgtWeights_.size());
1119 forAll(tgtWeights_, facei)
1121 tgtWeightsSum_[facei] =
sum(tgtWeights_[facei]);
1124 srcMapPtr_ = std::move(srcToTgtMap);
1125 tgtMapPtr_ = std::move(tgtToSrcMap);
1143 auto newPtr = clone();
1144 newPtr->upToDate(
false);
1146 newPtr->calculate(srcPatch, tgtPatch);
1149 if (distributed() && comm() != -1)
1152 labelListList& srcConstructMap = srcMapPtr_->constructMap();
1155 labelListList& tgtConstructMap = tgtMapPtr_->constructMap();
1158 labelListList& newSrcConstructMap = newPtr->srcMapPtr_->constructMap();
1161 labelListList& newTgtConstructMap = newPtr->tgtMapPtr_->constructMap();
1168 srcMapPtr_->constructMapTotalSize(),
1169 tgtMapPtr_->constructMapTotalSize()
1176 newPtr->srcMapPtr_->constructMapTotalSize(),
1177 newPtr->tgtMapPtr_->constructMapTotalSize()
1184 auto iter1 = oldMapMap.
begin();
1185 auto iter2 = newMapMap.
begin();
1189 const label len1 = srcConstructMap[proci].
size();
1190 const label len2 = newSrcConstructMap[proci].
size();
1192 std::iota(iter1, (iter1 + len1), total);
1196 std::iota(iter2, (iter2 + len2), total);
1206 for (label& value : list)
1208 value = oldMapMap[value];
1212 for (
labelList& list : newSrcConstructMap)
1214 for (label& value : list)
1216 value = newMapMap[value];
1222 for (label& value : list)
1224 value = oldMapMap[value];
1228 for (
labelList& list : newPtr->tgtAddress_)
1230 for (label& value : list)
1232 value = newMapMap[value];
1241 auto iter1 = oldMapMap.
begin();
1242 auto iter2 = newMapMap.
begin();
1246 const label len1 = tgtConstructMap[proci].
size();
1247 const label len2 = newTgtConstructMap[proci].
size();
1249 std::iota(iter1, (iter1 + len1), total);
1253 std::iota(iter2, (iter2 + len2), total);
1263 for (label& value : list)
1265 value = oldMapMap[value];
1269 for (
labelList& list : newTgtConstructMap)
1271 for (label& value : list)
1273 value = newMapMap[value];
1279 for (label& value : list)
1281 value = oldMapMap[value];
1285 for (
labelList& list : newPtr->srcAddress_)
1287 for (label& value : list)
1289 value = newMapMap[value];
1295 srcMapPtr_->constructSize() += newPtr->srcMapPtr_->constructSize();
1296 tgtMapPtr_->constructSize() += newPtr->tgtMapPtr_->constructSize();
1301 srcSubMap[proci].
push_back(newSrcSubMap[proci]);
1302 srcConstructMap[proci].
push_back(newSrcConstructMap[proci]);
1304 tgtSubMap[proci].
push_back(newTgtSubMap[proci]);
1305 tgtConstructMap[proci].
push_back(newTgtConstructMap[proci]);
1310 forAll(srcMagSf_, srcFacei)
1312 srcAddress_[srcFacei].push_back(newPtr->srcAddress()[srcFacei]);
1313 srcWeights_[srcFacei].push_back(newPtr->srcWeights()[srcFacei]);
1314 srcWeightsSum_[srcFacei] += newPtr->srcWeightsSum()[srcFacei];
1318 forAll(tgtMagSf_, tgtFacei)
1321 tgtWeights_[tgtFacei].push_back(newPtr->tgtWeights()[tgtFacei]);
1329 const bool conformal,
1342 lowWeightCorrection_,
1366 const label tgtFacei,
1374 const labelList& addr = tgtAddress_[tgtFacei];
1378 label nearestFacei = -1;
1380 for (
const label srcFacei : addr)
1382 const face&
f = srcPatch[srcFacei];
1389 tgtPoint = ray.
point();
1395 nearestFacei = srcFacei;
1401 tgtPoint = nearest.
point();
1402 return nearestFacei;
1414 const label srcFacei,
1419 const pointField& tgtPoints = tgtPatch.points();
1423 label nearestFacei = -1;
1426 const labelList& addr = srcAddress_[srcFacei];
1428 for (
const label tgtFacei : addr)
1430 const face&
f = tgtPatch[tgtFacei];
1437 srcPoint = ray.point();
1440 const pointHit near =
f.nearestPoint(srcPoint, tgtPoints);
1442 if (near.distance() < nearest.distance())
1445 nearestFacei = tgtFacei;
1448 if (nearest.hit() || nearest.eligibleMiss())
1450 srcPoint = nearest.point();
1451 return nearestFacei;
1462 Log <<
"Checks only valid for serial running (currently)" <<
endl;
1467 bool symmetricSrc =
true;
1469 Log <<
" Checking for missing src face in tgt lists" <<
nl;
1471 forAll(srcAddress_, srcFacei)
1473 const labelList& tgtIds = srcAddress_[srcFacei];
1474 for (
const label tgtFacei : tgtIds)
1476 if (!tgtAddress_[tgtFacei].
found(srcFacei))
1478 symmetricSrc =
false;
1480 Log <<
" srcFacei:" << srcFacei
1481 <<
" not found in tgtToSrc list for tgtFacei:"
1489 Log <<
" - symmetric" <<
endl;
1492 bool symmetricTgt =
true;
1494 Log <<
" Checking for missing tgt face in src lists" <<
nl;
1496 forAll(tgtAddress_, tgtFacei)
1498 const labelList& srcIds = tgtAddress_[tgtFacei];
1499 for (
const label srcFacei : srcIds)
1501 if (!srcAddress_[srcFacei].
found(tgtFacei))
1503 symmetricTgt =
false;
1505 Log <<
" tgtFacei:" << tgtFacei
1506 <<
" not found in srcToTgt list for srcFacei:"
1517 return symmetricSrc && symmetricTgt;
1536 const point& srcPt = srcPatch.faceCentres()[i];
1538 for (
const label tgtPti : addr)
1540 const point& tgtPt = tgtPatch.faceCentres()[tgtPti];
1545 os <<
"l " << pti <<
" " << pti + 1 <<
endl;
1567 if (lowWeightCorrection_ > 0)
1578 os << requireMatch()
1598 cache_.writeData(
os);
1600 if (distributed() && comm() != -1)
constexpr scalar pi(M_PI)
Various functions to operate on Lists.
Interpolation class dealing with transfer of data between two primitive patches with an arbitrary mes...
bool requireMatch_
Flag to indicate that the two patches must be matched/an overlap exists between them.
const mapDistribute & srcMap() const
Source map - valid only if singlePatchProc = -1 This gets source data into a form to be consumed by t...
const AMICache & cache() const noexcept
Return a reference to the AMI cache.
virtual autoPtr< AMIInterpolation > clone() const
Construct and return a clone.
refPtr< primitivePatch > tsrcPatch0_
Source patch using manipulated input points.
label singlePatchProc_
Index of processor that holds all of both sides. The value is -1 for distributed cases.
const scalarField & srcWeightsSum() const
Return const access to normalisation factor of source patch weights (i.e. the sum before normalisatio...
bool reverseTarget() const noexcept
Access to the reverseTarget flag.
labelListList srcAddress_
Addresses of target faces per source face.
label comm() const noexcept
Communicator (local or otherwise) for parallel operations.
bool distributed() const noexcept
Distributed across processors (singlePatchProc == -1).
label calcDistribution(const primitivePatch &srcPatch, const primitivePatch &tgtPatch, const label comm, autoPtr< UPstream::communicator > &geomComm) const
Calculate if patches are on multiple processors. Allocates local communicator and returns -1 or proce...
scalarList tgtMagSf_
Target face areas.
const mapDistribute & tgtMap() const
Target map - valid only if singlePatchProc=-1. This gets target data into a form to be consumed by sr...
bool upToDate() const noexcept
Is up-to-date?
const scalarListList & tgtWeights() const
Return const access to target patch weights.
void projectPointsToSurface(const searchableSurface &surf, pointField &pts) const
Project points to surface.
const labelListList & srcAddress() const
Return const access to source patch addressing.
const bool reverseTarget_
Flag to indicate that the two patches are co-directional and that the orientation of the target patch...
autoPtr< mapDistribute > srcMapPtr_
Source map pointer - parallel running only.
autoPtr< UPstream::communicator > geomComm_
Communicator to use for geometry calculations. Not valid (-1) on processors that do not have faces.
const scalarField & tgtWeightsSum() const
Return const access to normalisation factor of target patch weights (i.e. the sum before normalisatio...
AMIInterpolation(const dictionary &dict, const bool reverseTarget=false)
Construct from dictionary.
treeDataPrimitivePatch< primitivePatch > treeType
Local typedef to octree tree-type.
pointField srcPatchPts_
Source patch points if input points are manipulated, e.g. projected.
virtual bool calculate(const primitivePatch &srcPatch, const primitivePatch &tgtPatch, const autoPtr< searchableSurface > &surfPtr=nullptr)
Update addressing, weights and (optional) centroids.
bool checkSymmetricWeights(const bool log) const
Check if src addresses are present in tgt addresses and viceversa.
pointField tgtPatchPts_
Target patch points if input points are manipulated, e.g. projected.
virtual bool writeData(Ostream &os) const
Write AMI raw.
bool requireMatch() const noexcept
Return the requireMatch flag.
bool upToDate_
Up-to-date flag.
autoPtr< mapDistribute > tgtMapPtr_
Target map pointer - parallel running only.
const scalarListList & srcWeights() const
Return const access to source patch weights.
virtual void write(Ostream &os) const
Write AMI as a dictionary.
void reset(autoPtr< mapDistribute > &&srcToTgtMap, autoPtr< mapDistribute > &&tgtToSrcMap, labelListList &&srcAddress, scalarListList &&srcWeights, labelListList &&tgtAddress, scalarListList &&tgtWeights, const label singlePatchProc)
Set the maps, addresses and weights from an external source.
labelListList tgtAddress_
Addresses of source faces per target face.
label srcPointFace(const primitivePatch &srcPatch, const primitivePatch &tgtPatch, const vector &n, const label tgtFacei, point &tgtPoint) const
Return source patch face index of point on target patch face.
const scalar lowWeightCorrection_
Threshold weight below which interpolation is deactivated.
pointListList srcCentroids_
Centroid of target faces per source face.
label singlePatchProc() const noexcept
The processor holding all faces (both sides), or -1 if distributed.
const pointListList & srcCentroids() const
Return const access to source patch face centroids.
static bool cacheIntersections_
Flag to store face-to-face intersection triangles; default = false.
void writeFaceConnectivity(const primitivePatch &srcPatch, const primitivePatch &tgtPatch, const labelListList &srcAddress) const
Write face connectivity as OBJ file.
label comm_
Communicator to use for parallel operations.
static void normaliseWeights(const scalarList &patchAreas, const word &patchName, const labelListList &addr, scalarListList &wght, scalarField &wghtSum, const bool conformal, const bool output, const scalar lowWeightTol, const label comm)
Normalise the (area) weights - suppresses numerical error in weights calculation.
scalar lowWeightCorrection() const
Threshold weight below which interpolation is deactivated.
scalarField srcWeightsSum_
Sum of weights of target faces per source face.
refPtr< primitivePatch > ttgtPatch0_
Target patch using manipulated input points.
void append(const primitivePatch &srcPatch, const primitivePatch &tgtPatch)
Append additional addressing and weights.
autoPtr< indexedOctree< treeType > > createTree(const primitivePatch &patch) const
Reset the octree for the patch face search.
scalarListList tgtWeights_
Weights of source faces per target face.
pointListList tgtCentroids_
Centroid of source faces per target face.
scalarListList srcWeights_
Weights of target faces per source face.
const List< scalar > & srcMagSf() const
Return const access to source patch face areas.
label tgtPointFace(const primitivePatch &srcPatch, const primitivePatch &tgtPatch, const vector &n, const label srcFacei, point &srcPoint) const
Return target patch face index of point on source patch face.
static void agglomerate(const autoPtr< mapDistribute > &targetMap, const scalarList &fineSrcMagSf, const labelListList &fineSrcAddress, const scalarListList &fineSrcWeights, const labelList &sourceRestrictAddressing, const labelList &targetRestrictAddressing, scalarList &srcMagSf, labelListList &srcAddress, scalarListList &srcWeights, scalarField &srcWeightsSum, autoPtr< mapDistribute > &tgtMap, const label comm)
scalarList srcMagSf_
Source face areas.
void addToCache(const point &refPt)
Add AMI weights and addressing to the cache.
bool restoreCache(const point &refPt)
Restore AMI weights and addressing from the cache.
scalarField tgtWeightsSum_
Sum of weights of source faces per target face.
static int useLocalComm_
Control use of local communicator for AMI communication.
const List< scalar > & tgtMagSf() const
Return const access to target patch face areas.
const labelListList & tgtAddress() const
Return const access to target patch addressing.
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects.
void push_back(const T &val)
Copy append an element to the end of this list.
bool good() const noexcept
True if next operation might succeed.
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
void resize_nocopy(const label len)
Adjust allocated size of list without necessarily.
void append(const T &val)
Append an element at the end of the list.
void push_back(const T &val)
Append an element at the end of the list.
void resize(const label len)
Adjust allocated size of list.
Output to file stream as an OSstream, normally using std::ofstream for the actual output.
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Ostream & writeEntry(const keyType &key, const T &value)
Write a keyword/value entry.
virtual bool write(const token &tok)=0
Write token to stream or otherwise handle it.
bool eligibleMiss() const noexcept
Is this an eligible miss.
scalar distance() const noexcept
Return distance to hit.
void setDistance(const scalar d) noexcept
Set the distance.
bool hit() const noexcept
Is there a hit.
const point_type & point() const noexcept
Return the point, no checks.
const Field< point_type > & points() const noexcept
Return reference to global points.
const Field< point_type > & faceCentres() const
Return face centres for patch.
A non-owning sub-view of a List (allocated or unallocated storage).
iterator begin() noexcept
Return an iterator to begin traversing the UList.
bool test(const label i) const
Test bool value at specified position, always false for out-of-range access.
bool empty() const noexcept
True if List is empty (ie, size() is zero).
void size(const label n)
Older name for setAddressableSize.
label find(const T &val) const
Find index of the first occurrence of the value.
Wrapper for internally indexed communicator label. Always invokes UPstream::allocateCommunicatorCompo...
Inter-processor communications stream.
static int myProcNo(const label communicator=worldComm)
Rank of this process in the communicator (starting from masterNo()). Negative if the process is not a...
static bool parRun(const bool on) noexcept
Set as parallel run on/off.
static int & msgType() noexcept
Message tag of standard messages.
static constexpr int masterNo() noexcept
Relative rank for the master process - is always 0.
static bool master(const label communicator=worldComm)
True if process corresponds to the master rank in the communicator.
static label nProcs(const label communicator=worldComm)
Number of ranks in parallel run (for given communicator). It is 1 for serial run.
static bool sameProcs(int communicator1, int communicator2)
Test for communicator equality.
static List< T > allGatherValues(const T &localValue, const int communicator=UPstream::worldComm)
Allgather individual values into list locations.
static bool & parRun() noexcept
Test if this a parallel run.
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
bool good() const noexcept
True if the managed pointer is non-null.
void reset(T *p=nullptr) noexcept
Delete managed object and set to new given pointer.
void inflate(const scalar factor)
Expand box by factor*mag(span) in all dimensions.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
A face is a list of labels corresponding to mesh vertices.
static scalar & perturbTol() noexcept
Get the perturbation tolerance.
const labelListList & constructMap() const noexcept
From subsetted data to new reconstructed data.
const labelListList & subMap() const noexcept
From subsetted data back to original data.
label comm() const noexcept
The communicator used.
label constructSize() const noexcept
Constructed data size.
Class containing processor-to-processor mapping information.
void distribute(List< T > &fld, const bool dummyTransform=true, const int tag=UPstream::msgType()) const
Distribute List data using default commsType, default flip/negate operator.
static refPtr< T > New(Args &&... args)
Construct refPtr with forwarding arguments.
Base class of (analytical or triangulated) surface. Encapsulates all the search routines....
virtual void findNearest(const pointField &sample, const scalarField &nearestDistSqr, List< pointIndexHit > &) const =0
Standard boundBox with extra functionality for use in octree.
A Vector of values with scalar precision, where scalar is float/double depending on the compilation f...
A class for handling words, derived from Foam::string.
#define defineTypeNameAndDebug(Type, DebugSwitch)
Define the typeName and debug information.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
OBJstream os(runTime.globalPath()/outputName)
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;forAll(lagrangianScalarNames, i){ word name=lagrangianScalarNames[i];IOField< scalar > s(IOobject(name, runTime.timeName(), cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE))
#define DebugInfo
Report an information message using Foam::Info.
#define DebugInFunction
Report an information message using Foam::Info.
Namespace for handling debugging switches.
List< scalarList > scalarListList
List of scalarList.
Type gAverage(const FieldField< Field, Type > &f, const label comm)
The global arithmetic average of a FieldField.
bool returnReduceOr(const bool value, const int communicator=UPstream::worldComm)
Perform logical (or) MPI Allreduce on a copy. Uses UPstream::reduceOr.
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
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.
List< labelList > labelListList
List of labelList.
PointHit< point > pointHit
A PointHit with a 3D point.
List< label > labelList
A List of labels.
void component(FieldField< Field, typename FieldField< Field, Type >::cmptType > &sf, const FieldField< Field, Type > &f, const direction d)
label readLabel(const char *buf)
Parse entire buffer as a label, skipping leading/trailing whitespace.
messageStream Info
Information stream (stdout output on master, null elsewhere).
PrimitivePatch< SubList< face >, const pointField & > primitivePatch
A PrimitivePatch with a SubList addressing for the faces, const reference for the point field.
fileName::Type type(const fileName &name, const bool followLink=true)
Return the file type: DIRECTORY or FILE, normally following symbolic links.
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
dimensionedScalar log(const dimensionedScalar &ds)
T returnReduce(const T &value, BinaryOp bop, const int tag=UPstream::msgType(), const int communicator=UPstream::worldComm)
Perform reduction on a copy, using specified binary operation.
Ostream & endl(Ostream &os)
Add newline and flush stream.
Ostream & indent(Ostream &os)
Indent stream.
FlatOutput::OutputAdaptor< Container, Delimiters > flatOutput(const Container &obj, Delimiters delim)
Global flatOutput() function with specified output delimiters.
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...
errorManip< error > abort(error &err)
vector point
Point is a vector.
MinMax< Type > gMinMax(const FieldField< Field, Type > &f)
dimensioned< Type > sum(const DimensionedField< Type, GeoMesh > &f1, const label comm)
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for expressions::valueTypeCode::INVALID.
prefixOSstream Pout
OSstream wrapped stdout (std::cout) with parallel prefix.
vectorField pointField
pointField is a vectorField.
PointIndexHit< point > pointIndexHit
A PointIndexHit with a 3D point.
List< scalar > scalarList
List of scalar.
bool readBool(Istream &is)
Read bool from stream using Foam::Switch(Istream&).
constexpr char nl
The newline '\n' character (0x0a).
#define addProfiling(Name,...)
Define profiling trigger with specified name and description string. The description is generated by ...
#define registerOptSwitch(Name, Type, SwitchVar)
#define defineRunTimeSelectionTable(baseType, argNames)
Define run-time selection table.
#define forAll(list, i)
Loop across all elements in list.