42 cyclicACMIGAMGInterface,
48 cyclicACMIGAMGInterface,
56 Foam::cyclicACMIGAMGInterface::cyclicACMIGAMGInterface
63 const label fineLevelIndex,
64 const label coarseComm
89 const auto& fineCyclicACMIInterface =
90 refCast<const cyclicACMILduInterface>(fineInterface);
100 localRestrictAddressing.
size()
105 for (
const label curMaster : localRestrictAddressing)
107 const auto iter = masterToCoarseFace.
cfind(curMaster);
112 dynFaceRestrictAddressing.append(iter.val());
117 const label coarseI = dynFaceCells.size();
118 dynFaceRestrictAddressing.append(coarseI);
119 dynFaceCells.append(curMaster);
120 masterToCoarseFace.insert(curMaster, coarseI);
131 if (fineCyclicACMIInterface.owner())
140 DynamicList<label> dynNbrFaceRestrictAddressing
142 neighbourRestrictAddressing.
size()
145 Map<label> masterToCoarseFace(neighbourRestrictAddressing.
size());
147 for (
const label curMaster : neighbourRestrictAddressing)
149 const auto iter = masterToCoarseFace.cfind(curMaster);
154 dynNbrFaceRestrictAddressing.
append(iter.val());
159 const label coarseI = masterToCoarseFace.size();
160 dynNbrFaceRestrictAddressing.append(coarseI);
161 masterToCoarseFace.insert(curMaster, coarseI);
165 nbrFaceRestrictAddressing.transfer(dynNbrFaceRestrictAddressing);
173 fineCyclicACMIInterface.AMI(),
175 nbrFaceRestrictAddressing
182 Foam::cyclicACMIGAMGInterface::cyclicACMIGAMGInterface
189 GAMGInterface(index, coarseInterfaces, is),
204 Foam::cyclicACMIGAMGInterface::cyclicACMIGAMGInterface
208 const lduInterface& fineInterface,
214 const label coarseComm,
215 const label myProcNo,
224 faceRestrictAddresssing
232 const cyclicACMILduInterface
233 >(fineInterface).neighbPatchID()
238 refCast<const cyclicACMILduInterface>(fineInterface).owner()
242 refCast<const cyclicACMILduInterface>(fineInterface).forwardT()
246 refCast<const cyclicACMILduInterface>(fineInterface).reverseT()
249 const auto& fineCyclicACMIInterface =
250 refCast<const cyclicACMIGAMGInterface>(fineInterface);
252 if (fineCyclicACMIInterface.amiPtr_)
256 fineCyclicACMIInterface.AMI()
265 bool hasSrcMagSf =
false;
266 bool hasSrcCentroids =
false;
267 bool hasTgtMagSf =
false;
269 forAll(allInterfaces, inti)
271 if (allInterfaces.set(inti))
274 refCast<const cyclicACMIGAMGInterface>(allInterfaces[inti]);
275 const auto&
AMI = intf.AMI();
292 hasSrcCentroids =
true;
328 autoPtr<mapDistribute> srcToTgtMap;
331 autoPtr<mapDistribute> tgtToSrcMap;
336 UPtrList<const mapDistribute> srcMaps(allInterfaces.size());
337 UPtrList<const mapDistribute> tgtMaps(allInterfaces.size());
338 forAll(allInterfaces, inti)
340 if (allInterfaces.set(inti))
342 const auto& intf = refCast<const cyclicACMIGAMGInterface>
346 const auto&
AMI = intf.AMI();
354 const label myAgglom =
366 const labelList& localRanks = newToOldRanks[myAgglom];
371 List<Map<label>> srcCompactMaps;
388 if (tgtAddress.size())
391 forAll(allInterfaces, inti)
393 if (allInterfaces.set(inti))
396 refCast<const cyclicACMIGAMGInterface>
400 const auto&
AMI = intf.AMI();
402 const label localSize =
403 srcStartOfLocal[inti+1]
404 - srcStartOfLocal[inti];
409 auto& newSlots = tgtAddress[alli++];
410 newSlots = tgtSlots[tgti];
417 srcStartOfLocal[inti],
418 srcCompactMaps[inti],
422 for (
const label slot : newSlots)
427 || slot >= srcToTgtMap().constructSize()
447 List<Map<label>> tgtCompactMaps;
464 if (srcAddress.size())
467 forAll(allInterfaces, inti)
469 if (allInterfaces.set(inti))
472 refCast<const cyclicACMIGAMGInterface>
476 const auto&
AMI = intf.AMI();
478 const label localSize =
479 tgtStartOfLocal[inti+1]
480 - tgtStartOfLocal[inti];
485 auto& newSlots = srcAddress[alli++];
486 newSlots = srcSlots[srci];
492 tgtStartOfLocal[inti],
493 tgtCompactMaps[inti],
497 for (
const label slot : newSlots)
502 || slot >= tgtToSrcMap().constructSize()
526 const auto& map = srcToTgtMap().subMap();
528 bool usesRemote =
false;
531 if (proci != myAgglom)
533 const auto& ss = srcToTgtMap().subMap()[proci];
534 const auto& sc = srcToTgtMap().constructMap()[proci];
535 const auto& ts = tgtToSrcMap().subMap()[proci];
536 const auto& tc = tgtToSrcMap().constructMap()[proci];
538 if (ss.size() || sc.size() || ts.size() || tc.size())
550 singlePatchProc = myAgglom;
560 srcAddress.setSize(nSrc);
561 tgtAddress.setSize(nTgt);
565 forAll(allInterfaces, inti)
567 if (allInterfaces.set(inti))
569 const auto& intf = refCast<const cyclicACMIGAMGInterface>
573 const auto&
AMI = intf.AMI();
576 if (srcAddress.size())
581 srcAddress[srci++] = srcA[i]+nTgt;
586 if (tgtAddress.size())
591 tgtAddress[tgti++] = tgtA[i]+nSrc;
601 srcWeights.setSize(nSrc);
604 srcMagSf.setSize(nSrc);
608 srcCentroids.setSize(nSrc);
610 tgtWeights.setSize(nTgt);
613 tgtMagSf.setSize(nTgt);
620 forAll(allInterfaces, inti)
622 if (allInterfaces.set(inti))
624 const auto& intf = refCast<const cyclicACMIGAMGInterface>
628 const auto&
AMI = intf.AMI();
633 SubList<scalarList>(srcWeights, srcA.size(), nSrc) =
639 SubList<scalar>(srcMagSf, srcA.size(), nSrc) =
646 SubList<pointList>(srcCentroids, srcA.size(), nSrc) =
654 SubList<scalarList>(tgtWeights, tgtA.size(), nTgt) =
659 SubList<scalar>(tgtMagSf, tgtA.size(), nTgt) =
680 amiPtr_().comm(coarseComm),
683 std::move(srcToTgtMap),
684 std::move(tgtToSrcMap),
685 std::move(srcAddress),
686 std::move(srcWeights),
687 std::move(tgtAddress),
688 std::move(tgtWeights),
691 amiPtr_().srcMagSf() = std::move(srcMagSf);
692 amiPtr_().srcCentroids() = std::move(srcCentroids);
693 amiPtr_().tgtMagSf() = std::move(tgtMagSf);
716 pnf[facei] = iF[nbrFaceCells[facei]];
727 const bool hasAMI = bool(amiPtr_);
List< scalar > scalarList
List of scalar.
label find(const ListType &input, const UnaryPredicate &pred, const label start=0)
Same as ListOps::find_if.
GAMG agglomerated cyclic ACMI interface.
void size(const label n)
Older name for setAddressableSize.
const pointListList & srcCentroids() const
Return const access to source patch face centroids.
errorManipArg< error, int > exit(error &err, const int errNo=1)
commsTypes
Communications types.
void transfer(List< T > &list)
Transfer the contents of the argument List into this list and annul the argument list.
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
const scalarListList & tgtWeights() const
Return const access to target patch weights.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
void append(const T &val)
Append an element at the end of the list.
AMIInterpolation AMIPatchToPatchInterpolation
Patch-to-patch interpolation == Foam::AMIInterpolation.
virtual const labelUList & faceCells() const
Return faceCell addressing.
const mapDistribute & srcMap() const
Source map - valid only if singlePatchProc = -1 This gets source data into a form to be consumed by t...
Type & refCast(U &obj)
A dynamic_cast (for references) to Type reference.
virtual void write(Ostream &) const
Write to stream.
const labelListList & tgtAddress() const
Return const access to target patch addressing.
bool requireMatch() const noexcept
Return the requireMatch flag.
label singlePatchProc() const noexcept
The processor holding all faces (both sides), or -1 if distributed.
label readLabel(const char *buf)
Parse entire buffer as a label, skipping leading/trailing whitespace.
labelList faceRestrictAddressing_
Face restrict addressing.
static int myProcNo(const label communicator=worldComm)
Rank of this process in the communicator (starting from masterNo()). Can be negative if the process i...
bool distributed() const noexcept
Distributed across processors (singlePatchProc == -1)
List< labelList > labelListList
List of labelList.
Macros for easy insertion into run-time selection tables.
UList< label > labelUList
A UList of labels.
#define forAll(list, i)
Loop across all elements in list.
static label nProcs(const label communicator=worldComm)
Number of ranks in parallel run (for given communicator). It is 1 for serial run. ...
void setSize(const label n)
Alias for resize()
const List< scalar > & tgtMagSf() const
Return const access to target patch face areas.
labelListList invertOneToMany(const label len, const labelUList &map)
Invert one-to-many map. Unmapped elements will be size 0.
const_iterator cfind(const Key &key) const
Find and return an const_iterator set at the hashed entry.
List< scalarList > scalarListList
List of scalarList.
UPtrList< const lduInterface > lduInterfacePtrsList
Store lists of lduInterface as a UPtrList.
static tmp< T > New(Args &&... args)
Construct tmp with forwarding arguments.
An abstract base class for cyclic ACMI coupled interfaces.
const scalarListList & srcWeights() const
Return const access to source patch weights.
bool constructHasFlip() const noexcept
Does constructMap include a sign.
OBJstream os(runTime.globalPath()/outputName)
defineTypeNameAndDebug(combustionModel, 0)
bool reverseTarget() const noexcept
Access to the reverseTarget flag.
const List< scalar > & srcMagSf() const
Return const access to source patch face areas.
Abstract base class for GAMG agglomerated interfaces.
virtual void write(Ostream &) const =0
Write to stream.
An abstract base class for implicitly-coupled interfaces e.g. processor and cyclic patches...
virtual const AMIPatchToPatchInterpolation & AMI() const
labelList faceCells_
Face-cell addressing.
virtual tmp< labelField > internalFieldTransfer(const Pstream::commsTypes commsType, const labelUList &iF) const
Transfer and return internal field adjacent to the interface.
List< label > labelList
A List of labels.
const mapDistribute & tgtMap() const
Target map - valid only if singlePatchProc=-1. This gets target data into a form to be consumed by sr...
List< pointList > pointListList
List of pointList.
A class for managing temporary objects.
scalar lowWeightCorrection() const
Threshold weight below which interpolation is deactivated.
const labelListList & srcAddress() const
Return const access to source patch addressing.
bool readBool(Istream &is)
Read bool from stream using Foam::Switch(Istream&)
label comm() const
Communicator to use for parallel operations.
static label renumberMap(labelListList &mapElements, const labelUList &oldToNew, const bool hasFlip)
Helper for renumbering the (compacted) map elements using the supplied old-to-new mapping...
addToRunTimeSelectionTable(functionObject, pointHistory, dictionary)