AMIInterpolation.C
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2011-2017 OpenFOAM Foundation
9  Copyright (C) 2015-2021 OpenCFD Ltd.
10 -------------------------------------------------------------------------------
11 License
12  This file is part of OpenFOAM.
13 
14  OpenFOAM is free software: you can redistribute it and/or modify it
15  under the terms of the GNU General Public License as published by
16  the Free Software Foundation, either version 3 of the License, or
17  (at your option) any later version.
18 
19  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22  for more details.
23 
24  You should have received a copy of the GNU General Public License
25  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26 
27 \*---------------------------------------------------------------------------*/
28 
29 #include "AMIInterpolation.H"
30 #include "meshTools.H"
31 #include "mapDistribute.H"
32 #include "flipOp.H"
33 #include "profiling.H"
34 #include "triPointRef.H"
35 #include "OFstream.H"
36 
37 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
38 
39 namespace Foam
40 {
41  defineTypeNameAndDebug(AMIInterpolation, 0);
42  defineRunTimeSelectionTable(AMIInterpolation, dict);
43  defineRunTimeSelectionTable(AMIInterpolation, component);
44 }
45 
47 
48 
49 // * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
50 
53 (
54  const primitivePatch& patch
55 ) const
56 {
57  treeBoundBox bb(patch.points(), patch.meshPoints());
58  bb.inflate(0.01);
59 
61  (
62  treeType
63  (
64  false,
65  patch,
67  ),
68  bb, // overall search domain
69  8, // maxLevel
70  10, // leaf size
71  3.0 // duplicity
72  );
73 }
74 
75 
77 (
78  const primitivePatch& srcPatch,
79  const primitivePatch& tgtPatch
80 ) const
81 {
82  label proci = 0;
83 
84  if (Pstream::parRun())
85  {
86  labelList facesPresentOnProc(Pstream::nProcs(), Zero);
87  if ((srcPatch.size() > 0) || (tgtPatch.size() > 0))
88  {
89  facesPresentOnProc[Pstream::myProcNo()] = 1;
90  }
91  else
92  {
93  facesPresentOnProc[Pstream::myProcNo()] = 0;
94  }
95 
96  Pstream::gatherList(facesPresentOnProc);
97  Pstream::scatterList(facesPresentOnProc);
98 
99  label nHaveFaces = sum(facesPresentOnProc);
100 
101  if (nHaveFaces > 1)
102  {
103  proci = -1;
104  if (debug)
105  {
107  << "AMI split across multiple processors" << endl;
108  }
109  }
110  else if (nHaveFaces == 1)
111  {
112  proci = facesPresentOnProc.find(1);
113  if (debug)
114  {
116  << "AMI local to processor" << proci << endl;
117  }
118  }
119  }
120 
121 
122  // Either not parallel or no faces on any processor
123  return proci;
124 }
125 
126 
128 (
129  const searchableSurface& surf,
130  pointField& pts
131 ) const
132 {
133  addProfiling(ami, "AMIInterpolation::projectPointsToSurface");
134 
135  DebugInfo<< "AMI: projecting points to surface" << endl;
136 
137  List<pointIndexHit> nearInfo;
138 
139  surf.findNearest(pts, scalarField(pts.size(), GREAT), nearInfo);
140 
141  label nMiss = 0;
142  forAll(nearInfo, i)
143  {
144  const pointIndexHit& pi = nearInfo[i];
145 
146  if (pi.hit())
147  {
148  pts[i] = pi.hitPoint();
149  }
150  else
151  {
152  // Point remains unchanged
153  ++nMiss;
154  }
155  }
156 
157  if (nMiss > 0)
158  {
160  << "Error projecting points to surface: "
161  << nMiss << " faces could not be determined"
162  << abort(FatalError);
163  }
164 }
165 
166 
168 (
169  const scalarList& patchAreas,
170  const word& patchName,
171  const labelListList& addr,
172  scalarListList& wght,
173  scalarField& wghtSum,
174  const bool conformal,
175  const bool output,
176  const scalar lowWeightTol
177 )
178 {
179  addProfiling(ami, "AMIInterpolation::normaliseWeights");
180 
181  // Normalise the weights
182  wghtSum.setSize(wght.size(), 0.0);
183  label nLowWeight = 0;
184 
185  forAll(wght, facei)
186  {
187  scalarList& w = wght[facei];
188 
189  if (w.size())
190  {
191  scalar denom = patchAreas[facei];
192 
193  scalar s = sum(w);
194  scalar t = s/denom;
195  if (conformal)
196  {
197  denom = s;
198  }
199 
200  forAll(w, i)
201  {
202  w[i] /= denom;
203  }
204 
205  wghtSum[facei] = t;
206  if (t < lowWeightTol)
207  {
208  ++nLowWeight;
209  }
210  }
211  else
212  {
213  wghtSum[facei] = 0;
214  }
215  }
216 
217  if (output)
218  {
219  const label nFace = returnReduce(wght.size(), sumOp<label>());
220 
221  if (nFace)
222  {
223  Info<< indent
224  << "AMI: Patch " << patchName
225  << " sum(weights)"
226  << " min:" << gMin(wghtSum)
227  << " max:" << gMax(wghtSum)
228  << " average:" << gAverage(wghtSum) << nl;
229 
230  const label nLow = returnReduce(nLowWeight, sumOp<label>());
231 
232  if (nLow)
233  {
234  Info<< indent
235  << "AMI: Patch " << patchName
236  << " identified " << nLow
237  << " faces with weights less than " << lowWeightTol
238  << endl;
239  }
240  }
241  }
242 }
243 
244 
246 (
247  const autoPtr<mapDistribute>& targetMapPtr,
248  const scalarList& fineSrcMagSf,
249  const labelListList& fineSrcAddress,
250  const scalarListList& fineSrcWeights,
251 
252  const labelList& sourceRestrictAddressing,
253  const labelList& targetRestrictAddressing,
254 
255  scalarList& srcMagSf,
256  labelListList& srcAddress,
257  scalarListList& srcWeights,
258  scalarField& srcWeightsSum,
259  autoPtr<mapDistribute>& tgtMap
260 )
261 {
262  addProfiling(ami, "AMIInterpolation::agglomerate");
263 
264  label sourceCoarseSize =
265  (
266  sourceRestrictAddressing.size()
267  ? max(sourceRestrictAddressing)+1
268  : 0
269  );
270 
271  label targetCoarseSize =
272  (
273  targetRestrictAddressing.size()
274  ? max(targetRestrictAddressing)+1
275  : 0
276  );
277 
278  // Agglomerate face areas
279  {
280  srcMagSf.setSize(sourceRestrictAddressing.size(), 0.0);
281  forAll(sourceRestrictAddressing, facei)
282  {
283  label coarseFacei = sourceRestrictAddressing[facei];
284  srcMagSf[coarseFacei] += fineSrcMagSf[facei];
285  }
286  }
287 
288  // Agglomerate weights and indices
289  if (targetMapPtr)
290  {
291  const mapDistribute& map = *targetMapPtr;
292 
293  // Get all restriction addressing.
294  labelList allRestrict(targetRestrictAddressing);
295  map.distribute(allRestrict);
296 
297  // So now we have agglomeration of the target side in
298  // allRestrict:
299  // 0..size-1 : local agglomeration (= targetRestrictAddressing
300  // (but potentially permutated))
301  // size.. : agglomeration data from other processors
302 
303 
304  // The trickiness in this algorithm is finding out the compaction
305  // of the remote data (i.e. allocation of the coarse 'slots'). We could
306  // either send across the slot compaction maps or just make sure
307  // that we allocate the slots in exactly the same order on both sending
308  // and receiving side (e.g. if the submap is set up to send 4 items,
309  // the constructMap is also set up to receive 4 items.
310 
311 
312  // Short note about the various types of indices:
313  // - face indices : indices into the geometry.
314  // - coarse face indices : how the faces get agglomerated
315  // - transferred data : how mapDistribute sends/receives data,
316  // - slots : indices into data after distribution (e.g. stencil,
317  // srcAddress/tgtAddress). Note: for fully local addressing
318  // the slots are equal to face indices.
319  // A mapDistribute has:
320  // - a subMap : these are face indices
321  // - a constructMap : these are from 'transferred-data' to slots
322 
323  labelListList tgtSubMap(Pstream::nProcs());
324 
325  // Local subMap is just identity
326  {
327  tgtSubMap[Pstream::myProcNo()] = identity(targetCoarseSize);
328  }
329 
330  forAll(map.subMap(), proci)
331  {
332  if (proci != Pstream::myProcNo())
333  {
334  // Combine entries that point to the same coarse element.
335  // The important bit is to loop over the data (and hand out
336  // compact indices ) in 'transferred data' order. This
337  // guarantees that we're doing exactly the
338  // same on sending and receiving side - e.g. the fourth element
339  // in the subMap is the fourth element received in the
340  // constructMap
341 
342  const labelList& elems = map.subMap()[proci];
343  const labelList& elemsMap =
344  map.constructMap()[Pstream::myProcNo()];
345  labelList& newSubMap = tgtSubMap[proci];
346  newSubMap.setSize(elems.size());
347 
348  labelList oldToNew(targetCoarseSize, -1);
349  label newi = 0;
350 
351  for (const label elemi : elems)
352  {
353  label fineElem = elemsMap[elemi];
354  label coarseElem = allRestrict[fineElem];
355  if (oldToNew[coarseElem] == -1)
356  {
357  oldToNew[coarseElem] = newi;
358  newSubMap[newi] = coarseElem;
359  ++newi;
360  }
361  }
362  newSubMap.setSize(newi);
363  }
364  }
365 
366  // Reconstruct constructMap by combining entries. Note that order
367  // of handing out indices should be the same as loop above to compact
368  // the sending map
369 
370  labelListList tgtConstructMap(Pstream::nProcs());
371 
372  // Local constructMap is just identity
373  {
374  tgtConstructMap[Pstream::myProcNo()] = identity(targetCoarseSize);
375  }
376 
377  labelList tgtCompactMap(map.constructSize());
378 
379  {
380  // Note that in special cases (e.g. 'appending' two AMIs) the
381  // local size after distributing can be longer than the number
382  // of faces. I.e. it duplicates elements.
383  // Since we don't know this size instead we loop over all
384  // reachable elements (using the local constructMap)
385 
386  const labelList& elemsMap = map.constructMap()[Pstream::myProcNo()];
387  for (const label fineElem : elemsMap)
388  {
389  label coarseElem = allRestrict[fineElem];
390  tgtCompactMap[fineElem] = coarseElem;
391  }
392  }
393 
394  label compacti = targetCoarseSize;
395 
396  // Compact data from other processors
397  forAll(map.constructMap(), proci)
398  {
399  if (proci != Pstream::myProcNo())
400  {
401  // Combine entries that point to the same coarse element. All
402  // elements now are remote data so we cannot use any local
403  // data here - use allRestrict instead.
404  const labelList& elems = map.constructMap()[proci];
405 
406  labelList& newConstructMap = tgtConstructMap[proci];
407  newConstructMap.setSize(elems.size());
408 
409  if (elems.size())
410  {
411  // Get the maximum target coarse size for this set of
412  // received data.
413  label remoteTargetCoarseSize = labelMin;
414  for (const label elemi : elems)
415  {
416  remoteTargetCoarseSize = max
417  (
418  remoteTargetCoarseSize,
419  allRestrict[elemi]
420  );
421  }
422  remoteTargetCoarseSize += 1;
423 
424  // Combine locally data coming from proci
425  labelList oldToNew(remoteTargetCoarseSize, -1);
426  label newi = 0;
427 
428  for (const label fineElem : elems)
429  {
430  // fineElem now points to section from proci
431  label coarseElem = allRestrict[fineElem];
432  if (oldToNew[coarseElem] == -1)
433  {
434  oldToNew[coarseElem] = newi;
435  tgtCompactMap[fineElem] = compacti;
436  newConstructMap[newi] = compacti++;
437  ++newi;
438  }
439  else
440  {
441  // Get compact index
442  label compacti = oldToNew[coarseElem];
443  tgtCompactMap[fineElem] = newConstructMap[compacti];
444  }
445  }
446  newConstructMap.setSize(newi);
447  }
448  }
449  }
450 
451  srcAddress.setSize(sourceCoarseSize);
452  srcWeights.setSize(sourceCoarseSize);
453 
454  forAll(fineSrcAddress, facei)
455  {
456  // All the elements contributing to facei. Are slots in
457  // mapDistribute'd data.
458  const labelList& elems = fineSrcAddress[facei];
459  const scalarList& weights = fineSrcWeights[facei];
460  const scalar fineArea = fineSrcMagSf[facei];
461 
462  label coarseFacei = sourceRestrictAddressing[facei];
463 
464  labelList& newElems = srcAddress[coarseFacei];
465  scalarList& newWeights = srcWeights[coarseFacei];
466 
467  forAll(elems, i)
468  {
469  label elemi = elems[i];
470  label coarseElemi = tgtCompactMap[elemi];
471 
472  label index = newElems.find(coarseElemi);
473  if (index == -1)
474  {
475  newElems.append(coarseElemi);
476  newWeights.append(fineArea*weights[i]);
477  }
478  else
479  {
480  newWeights[index] += fineArea*weights[i];
481  }
482  }
483  }
484 
485  tgtMap.reset
486  (
487  new mapDistribute
488  (
489  compacti,
490  std::move(tgtSubMap),
491  std::move(tgtConstructMap)
492  )
493  );
494  }
495  else
496  {
497  srcAddress.setSize(sourceCoarseSize);
498  srcWeights.setSize(sourceCoarseSize);
499 
500  forAll(fineSrcAddress, facei)
501  {
502  // All the elements contributing to facei. Are slots in
503  // mapDistribute'd data.
504  const labelList& elems = fineSrcAddress[facei];
505  const scalarList& weights = fineSrcWeights[facei];
506  const scalar fineArea = fineSrcMagSf[facei];
507 
508  label coarseFacei = sourceRestrictAddressing[facei];
509 
510  labelList& newElems = srcAddress[coarseFacei];
511  scalarList& newWeights = srcWeights[coarseFacei];
512 
513  forAll(elems, i)
514  {
515  const label elemi = elems[i];
516  const label coarseElemi = targetRestrictAddressing[elemi];
517 
518  const label index = newElems.find(coarseElemi);
519  if (index == -1)
520  {
521  newElems.append(coarseElemi);
522  newWeights.append(fineArea*weights[i]);
523  }
524  else
525  {
526  newWeights[index] += fineArea*weights[i];
527  }
528  }
529  }
530  }
531 
532  // Weights normalisation
533  normaliseWeights
534  (
535  srcMagSf,
536  "source",
537  srcAddress,
538  srcWeights,
539  srcWeightsSum,
540  true,
541  false,
542  -1
543  );
544 }
545 
546 
547 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
548 
550 (
551  const dictionary& dict,
552  const bool reverseTarget
553 )
554 :
555  requireMatch_(dict.getOrDefault("requireMatch", true)),
556  reverseTarget_(dict.getOrDefault("reverseTarget", reverseTarget)),
557  lowWeightCorrection_(dict.getOrDefault<scalar>("lowWeightCorrection", -1)),
558  singlePatchProc_(-999),
559  srcMagSf_(),
560  srcAddress_(),
561  srcWeights_(),
562  srcWeightsSum_(),
563  srcCentroids_(),
564  srcMapPtr_(nullptr),
565  tgtMagSf_(),
566  tgtAddress_(),
567  tgtWeights_(),
568  tgtWeightsSum_(),
569  tgtCentroids_(),
570  tgtMapPtr_(nullptr),
571  upToDate_(false)
572 {}
573 
574 
576 (
577  const bool requireMatch,
578  const bool reverseTarget,
579  const scalar lowWeightCorrection
580 )
581 :
582  requireMatch_(requireMatch),
583  reverseTarget_(reverseTarget),
584  lowWeightCorrection_(lowWeightCorrection),
585  singlePatchProc_(-999),
586  srcMagSf_(),
587  srcAddress_(),
588  srcWeights_(),
589  srcWeightsSum_(),
590  srcCentroids_(),
591  srcPatchPts_(),
592  srcMapPtr_(nullptr),
593  tgtMagSf_(),
594  tgtAddress_(),
595  tgtWeights_(),
596  tgtWeightsSum_(),
597  tgtCentroids_(),
598  tgtPatchPts_(),
599  tgtMapPtr_(nullptr),
600  upToDate_(false)
601 {}
602 
603 
605 (
606  const AMIInterpolation& fineAMI,
607  const labelList& sourceRestrictAddressing,
608  const labelList& targetRestrictAddressing
609 )
610 :
611  requireMatch_(fineAMI.requireMatch_),
612  reverseTarget_(fineAMI.reverseTarget_),
613  lowWeightCorrection_(-1.0),
614  singlePatchProc_(fineAMI.singlePatchProc_),
615  srcMagSf_(),
616  srcAddress_(),
617  srcWeights_(),
618  srcWeightsSum_(),
619  srcPatchPts_(),
620  srcMapPtr_(nullptr),
621  tgtMagSf_(),
622  tgtAddress_(),
623  tgtWeights_(),
624  tgtWeightsSum_(),
625  tgtPatchPts_(),
626  tgtMapPtr_(nullptr),
627  upToDate_(false)
628 {
629  label sourceCoarseSize =
630  (
631  sourceRestrictAddressing.size()
632  ? max(sourceRestrictAddressing)+1
633  : 0
634  );
635 
636  label neighbourCoarseSize =
637  (
638  targetRestrictAddressing.size()
639  ? max(targetRestrictAddressing)+1
640  : 0
641  );
642 
643  if (debug & 2)
644  {
645  Pout<< "AMI: Creating addressing and weights as agglomeration of AMI :"
646  << " source:" << fineAMI.srcAddress().size()
647  << " target:" << fineAMI.tgtAddress().size()
648  << " coarse source size:" << sourceCoarseSize
649  << " neighbour source size:" << neighbourCoarseSize
650  << endl;
651  }
652 
653  if
654  (
655  fineAMI.srcAddress().size() != sourceRestrictAddressing.size()
656  || fineAMI.tgtAddress().size() != targetRestrictAddressing.size()
657  )
658  {
660  << "Size mismatch." << nl
661  << "Source patch size:" << fineAMI.srcAddress().size() << nl
662  << "Source agglomeration size:"
663  << sourceRestrictAddressing.size() << nl
664  << "Target patch size:" << fineAMI.tgtAddress().size() << nl
665  << "Target agglomeration size:"
666  << targetRestrictAddressing.size()
667  << exit(FatalError);
668  }
669 
670 
671  // Agglomerate addresses and weights
672 
673  agglomerate
674  (
675  fineAMI.tgtMapPtr_,
676  fineAMI.srcMagSf(),
677  fineAMI.srcAddress(),
678  fineAMI.srcWeights(),
679 
680  sourceRestrictAddressing,
681  targetRestrictAddressing,
682 
683  srcMagSf_,
684  srcAddress_,
685  srcWeights_,
686  srcWeightsSum_,
687  tgtMapPtr_
688  );
689 
690  agglomerate
691  (
692  fineAMI.srcMapPtr_,
693  fineAMI.tgtMagSf(),
694  fineAMI.tgtAddress(),
695  fineAMI.tgtWeights(),
696 
697  targetRestrictAddressing,
698  sourceRestrictAddressing,
699 
700  tgtMagSf_,
701  tgtAddress_,
702  tgtWeights_,
703  tgtWeightsSum_,
704  srcMapPtr_
705  );
706 }
707 
708 
710 :
711  requireMatch_(ami.requireMatch_),
712  reverseTarget_(ami.reverseTarget_),
713  lowWeightCorrection_(ami.lowWeightCorrection_),
714  singlePatchProc_(ami.singlePatchProc_),
715  srcMagSf_(ami.srcMagSf_),
716  srcAddress_(ami.srcAddress_),
717  srcWeights_(ami.srcWeights_),
718  srcWeightsSum_(ami.srcWeightsSum_),
719  srcCentroids_(ami.srcCentroids_),
720  srcMapPtr_(nullptr),
721  tgtMagSf_(ami.tgtMagSf_),
722  tgtAddress_(ami.tgtAddress_),
723  tgtWeights_(ami.tgtWeights_),
724  tgtWeightsSum_(ami.tgtWeightsSum_),
725  tgtCentroids_(ami.tgtCentroids_),
726  tgtMapPtr_(nullptr),
727  upToDate_(false)
728 {}
729 
730 
731 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
732 
734 (
735  const primitivePatch& srcPatch,
736  const primitivePatch& tgtPatch,
737  const autoPtr<searchableSurface>& surfPtr
738 )
739 {
740  if (upToDate_)
741  {
742  return false;
743  }
744 
745  addProfiling(ami, "AMIInterpolation::calculate");
746 
747  if (surfPtr)
748  {
749  srcPatchPts_ = srcPatch.points();
750  projectPointsToSurface(surfPtr(), srcPatchPts_);
751  tsrcPatch0_ = refPtr<primitivePatch>::New
752  (
753  SubList<face>(srcPatch),
754  srcPatchPts_
755  );
756 
757  tgtPatchPts_ = tgtPatch.points();
758  projectPointsToSurface(surfPtr(), tgtPatchPts_);
759  ttgtPatch0_ = refPtr<primitivePatch>::New
760  (
761  SubList<face>(tgtPatch),
762  tgtPatchPts_
763  );
764  }
765  else
766  {
767  tsrcPatch0_.cref(srcPatch);
768  ttgtPatch0_.cref(tgtPatch);
769  }
770 
771  label srcTotalSize = returnReduce(srcPatch.size(), sumOp<label>());
772  label tgtTotalSize = returnReduce(tgtPatch.size(), sumOp<label>());
773 
774  if (srcTotalSize == 0)
775  {
776  DebugInfo<< "AMI: no source faces present - no addressing constructed"
777  << endl;
778 
779  return false;
780  }
781 
782  Info<< indent
783  << "AMI: Creating addressing and weights between "
784  << srcTotalSize << " source faces and "
785  << tgtTotalSize << " target faces"
786  << endl;
787 
788  singlePatchProc_ = calcDistribution(srcPatch, tgtPatch);
789 
790  if (debug)
791  {
792  Info<< "AMIInterpolation:" << nl
793  << " singlePatchProc:" << singlePatchProc_ << nl
794  << endl;
795  }
796 
797  return true;
798 }
799 
800 
802 (
803  autoPtr<mapDistribute>&& srcToTgtMap,
804  autoPtr<mapDistribute>&& tgtToSrcMap,
805  labelListList&& srcAddress,
806  scalarListList&& srcWeights,
807  labelListList&& tgtAddress,
808  scalarListList&& tgtWeights
809 )
810 {
812 
813  srcAddress_.transfer(srcAddress);
814  srcWeights_.transfer(srcWeights);
815  tgtAddress_.transfer(tgtAddress);
816  tgtWeights_.transfer(tgtWeights);
817 
818  // Reset the sums of the weights
819  srcWeightsSum_.setSize(srcWeights_.size());
820  forAll(srcWeights_, facei)
821  {
822  srcWeightsSum_[facei] = sum(srcWeights_[facei]);
823  }
824 
825  tgtWeightsSum_.setSize(tgtWeights_.size());
826  forAll(tgtWeights_, facei)
827  {
828  tgtWeightsSum_[facei] = sum(tgtWeights_[facei]);
829  }
830 
831  srcMapPtr_ = std::move(srcToTgtMap);
832  tgtMapPtr_ = std::move(tgtToSrcMap);
833 
834  upToDate_ = true;
835 }
836 
837 
839 (
840  const primitivePatch& srcPatch,
841  const primitivePatch& tgtPatch
842 )
843 {
844  addProfiling(ami, "AMIInterpolation::append");
845 
846  // Create a new interpolation
847  auto newPtr = clone();
848  newPtr->calculate(srcPatch, tgtPatch);
849 
850  // If parallel then combine the mapDistribution and re-index
851  if (distributed())
852  {
853  labelListList& srcSubMap = srcMapPtr_->subMap();
854  labelListList& srcConstructMap = srcMapPtr_->constructMap();
855 
856  labelListList& tgtSubMap = tgtMapPtr_->subMap();
857  labelListList& tgtConstructMap = tgtMapPtr_->constructMap();
858 
859  labelListList& newSrcSubMap = newPtr->srcMapPtr_->subMap();
860  labelListList& newSrcConstructMap = newPtr->srcMapPtr_->constructMap();
861 
862  labelListList& newTgtSubMap = newPtr->tgtMapPtr_->subMap();
863  labelListList& newTgtConstructMap = newPtr->tgtMapPtr_->constructMap();
864 
865  // Re-calculate the source indices
866  {
867  labelList mapMap(0), newMapMap(0);
868  forAll(srcSubMap, proci)
869  {
870  mapMap.append
871  (
872  identity
873  (
874  srcConstructMap[proci].size(),
875  (mapMap.size() + newMapMap.size())
876  )
877  );
878  newMapMap.append
879  (
880  identity
881  (
882  newSrcConstructMap[proci].size(),
883  (mapMap.size() + newMapMap.size())
884  )
885  );
886  }
887 
888  forAll(srcSubMap, proci)
889  {
890  forAll(srcConstructMap[proci], srci)
891  {
892  srcConstructMap[proci][srci] =
893  mapMap[srcConstructMap[proci][srci]];
894  }
895  }
896 
897  forAll(srcSubMap, proci)
898  {
899  forAll(newSrcConstructMap[proci], srci)
900  {
901  newSrcConstructMap[proci][srci] =
902  newMapMap[newSrcConstructMap[proci][srci]];
903  }
904  }
905 
906  forAll(tgtAddress_, tgti)
907  {
908  forAll(tgtAddress_[tgti], tgtj)
909  {
910  tgtAddress_[tgti][tgtj] = mapMap[tgtAddress_[tgti][tgtj]];
911  }
912  }
913 
914  forAll(newPtr->tgtAddress_, tgti)
915  {
916  forAll(newPtr->tgtAddress_[tgti], tgtj)
917  {
918  newPtr->tgtAddress_[tgti][tgtj] =
919  newMapMap[newPtr->tgtAddress_[tgti][tgtj]];
920  }
921  }
922  }
923 
924  // Re-calculate the target indices
925  {
926  labelList mapMap(0), newMapMap(0);
927  forAll(srcSubMap, proci)
928  {
929  mapMap.append
930  (
931  identity
932  (
933  tgtConstructMap[proci].size(),
934  (mapMap.size() + newMapMap.size())
935  )
936  );
937  newMapMap.append
938  (
939  identity
940  (
941  newTgtConstructMap[proci].size(),
942  (mapMap.size() + newMapMap.size())
943  )
944  );
945  }
946 
947  forAll(srcSubMap, proci)
948  {
949  forAll(tgtConstructMap[proci], tgti)
950  {
951  tgtConstructMap[proci][tgti] =
952  mapMap[tgtConstructMap[proci][tgti]];
953  }
954  }
955 
956  forAll(srcSubMap, proci)
957  {
958  forAll(newTgtConstructMap[proci], tgti)
959  {
960  newTgtConstructMap[proci][tgti] =
961  newMapMap[newTgtConstructMap[proci][tgti]];
962  }
963  }
964 
965  forAll(srcAddress_, srci)
966  {
967  forAll(srcAddress_[srci], srcj)
968  {
969  srcAddress_[srci][srcj] =
970  mapMap[srcAddress_[srci][srcj]];
971  }
972  }
973 
974  forAll(newPtr->srcAddress_, srci)
975  {
976  forAll(newPtr->srcAddress_[srci], srcj)
977  {
978  newPtr->srcAddress_[srci][srcj] =
979  newMapMap[newPtr->srcAddress_[srci][srcj]];
980  }
981  }
982  }
983 
984  // Sum the construction sizes
985  srcMapPtr_->constructSize() += newPtr->srcMapPtr_->constructSize();
986  tgtMapPtr_->constructSize() += newPtr->tgtMapPtr_->constructSize();
987 
988  // Combine the maps
989  forAll(srcSubMap, proci)
990  {
991  srcSubMap[proci].append(newSrcSubMap[proci]);
992  srcConstructMap[proci].append(newSrcConstructMap[proci]);
993 
994  tgtSubMap[proci].append(newTgtSubMap[proci]);
995  tgtConstructMap[proci].append(newTgtConstructMap[proci]);
996  }
997  }
998 
999  // Combine new and current source data
1000  forAll(srcMagSf_, srcFacei)
1001  {
1002  srcAddress_[srcFacei].append(newPtr->srcAddress()[srcFacei]);
1003  srcWeights_[srcFacei].append(newPtr->srcWeights()[srcFacei]);
1004  srcWeightsSum_[srcFacei] += newPtr->srcWeightsSum()[srcFacei];
1005  }
1006 
1007  // Combine new and current target data
1008  forAll(tgtMagSf_, tgtFacei)
1009  {
1010  tgtAddress_[tgtFacei].append(newPtr->tgtAddress()[tgtFacei]);
1011  tgtWeights_[tgtFacei].append(newPtr->tgtWeights()[tgtFacei]);
1012  tgtWeightsSum_[tgtFacei] += newPtr->tgtWeightsSum()[tgtFacei];
1013  }
1014 }
1015 
1016 
1019  const bool conformal,
1020  const bool output
1021 )
1022 {
1023  normaliseWeights
1024  (
1025  srcMagSf_,
1026  "source",
1027  srcAddress_,
1028  srcWeights_,
1029  srcWeightsSum_,
1030  conformal,
1031  output,
1032  lowWeightCorrection_
1033  );
1034 
1035  normaliseWeights
1036  (
1037  tgtMagSf_,
1038  "target",
1039  tgtAddress_,
1040  tgtWeights_,
1041  tgtWeightsSum_,
1042  conformal,
1043  output,
1044  lowWeightCorrection_
1045  );
1046 }
1047 
1048 
1051  const primitivePatch& srcPatch,
1052  const primitivePatch& tgtPatch,
1053  const vector& n,
1054  const label tgtFacei,
1055  point& tgtPoint
1056 )
1057 const
1058 {
1059  const pointField& srcPoints = srcPatch.points();
1060 
1061  // Source face addresses that intersect target face tgtFacei
1062  const labelList& addr = tgtAddress_[tgtFacei];
1063 
1064  pointHit nearest;
1065  nearest.setDistance(GREAT);
1066  label nearestFacei = -1;
1067 
1068  for (const label srcFacei : addr)
1069  {
1070  const face& f = srcPatch[srcFacei];
1071 
1072  pointHit ray =
1073  f.ray(tgtPoint, n, srcPoints, intersection::algorithm::VISIBLE);
1074 
1075  if (ray.hit())
1076  {
1077  tgtPoint = ray.rawPoint();
1078  return srcFacei;
1079  }
1080  else if (ray.distance() < nearest.distance())
1081  {
1082 
1083  nearest = ray;
1084  nearestFacei = srcFacei;
1085  }
1086  }
1087 
1088  if (nearest.hit() || nearest.eligibleMiss())
1089  {
1090  tgtPoint = nearest.rawPoint();
1091  return nearestFacei;
1092  }
1093 
1094  return -1;
1095 }
1096 
1097 
1100  const primitivePatch& srcPatch,
1101  const primitivePatch& tgtPatch,
1102  const vector& n,
1103  const label srcFacei,
1104  point& srcPoint
1105 )
1106 const
1107 {
1108  const pointField& tgtPoints = tgtPatch.points();
1109 
1110  pointHit nearest;
1111  nearest.setDistance(GREAT);
1112  label nearestFacei = -1;
1113 
1114  // Target face addresses that intersect source face srcFacei
1115  const labelList& addr = srcAddress_[srcFacei];
1116 
1117  for (const label tgtFacei : addr)
1118  {
1119  const face& f = tgtPatch[tgtFacei];
1120 
1121  pointHit ray =
1122  f.ray(srcPoint, n, tgtPoints, intersection::algorithm::VISIBLE);
1123 
1124  if (ray.hit())
1125  {
1126  srcPoint = ray.rawPoint();
1127  return tgtFacei;
1128  }
1129  const pointHit near = f.nearestPoint(srcPoint, tgtPoints);
1130 
1131  if (near.distance() < nearest.distance())
1132  {
1133  nearest = near;
1134  nearestFacei = tgtFacei;
1135  }
1136  }
1137  if (nearest.hit() || nearest.eligibleMiss())
1138  {
1139 
1140  srcPoint = nearest.rawPoint();
1141  return nearestFacei;
1142  }
1143 
1144  return -1;
1145 }
1146 
1147 
1149 {
1150  if (Pstream::parRun() && (singlePatchProc_ == -1))
1151  {
1152  Log << "Checks only valid for serial running (currently)" << endl;
1153 
1154  return true;
1155  }
1156 
1157  bool symmetricSrc = true;
1158 
1159  Log << " Checking for missing src face in tgt lists" << nl;
1160 
1161  forAll(srcAddress_, srcFacei)
1162  {
1163  const labelList& tgtIds = srcAddress_[srcFacei];
1164  for (const label tgtFacei : tgtIds)
1165  {
1166  if (!tgtAddress_[tgtFacei].found(srcFacei))
1167  {
1168  symmetricSrc = false;
1169 
1170  Log << " srcFacei:" << srcFacei
1171  << " not found in tgtToSrc list for tgtFacei:"
1172  << tgtFacei << nl;
1173  }
1174  }
1175  }
1176 
1177  if (symmetricSrc)
1178  {
1179  Log << " - symmetric" << endl;
1180  }
1181 
1182  bool symmetricTgt = true;
1183 
1184  Log << " Checking for missing tgt face in src lists" << nl;
1185 
1186  forAll(tgtAddress_, tgtFacei)
1187  {
1188  const labelList& srcIds = tgtAddress_[tgtFacei];
1189  for (const label srcFacei : srcIds)
1190  {
1191  if (!srcAddress_[srcFacei].found(tgtFacei))
1192  {
1193  symmetricTgt = false;
1194 
1195  Log << " tgtFacei:" << tgtFacei
1196  << " not found in srcToTgt list for srcFacei:"
1197  << srcFacei << nl;
1198  }
1199  }
1200  }
1201 
1202  if (symmetricTgt)
1203  {
1204  Log << " - symmetric" << endl;
1205  }
1206 
1207  return symmetricSrc && symmetricTgt;
1208 }
1209 
1210 
1213  const primitivePatch& srcPatch,
1214  const primitivePatch& tgtPatch,
1215  const labelListList& srcAddress
1216 )
1217 const
1218 {
1219  OFstream os("faceConnectivity" + Foam::name(Pstream::myProcNo()) + ".obj");
1220 
1221  label pti = 1;
1222 
1223  forAll(srcAddress, i)
1224  {
1225  const labelList& addr = srcAddress[i];
1226  const point& srcPt = srcPatch.faceCentres()[i];
1227 
1228  for (const label tgtPti : addr)
1229  {
1230  const point& tgtPt = tgtPatch.faceCentres()[tgtPti];
1231 
1232  meshTools::writeOBJ(os, srcPt);
1233  meshTools::writeOBJ(os, tgtPt);
1234 
1235  os << "l " << pti << " " << pti + 1 << endl;
1236 
1237  pti += 2;
1238  }
1239  }
1240 }
1241 
1242 
1244 {
1245  os.writeEntry("AMIMethod", type());
1246 
1247  if (!requireMatch_)
1248  {
1249  os.writeEntry("requireMatch", requireMatch_);
1250  }
1251 
1252  if (reverseTarget_)
1253  {
1254  os.writeEntry("reverseTarget", reverseTarget_);
1255  }
1256 
1257  if (lowWeightCorrection_ > 0)
1258  {
1259  os.writeEntry("lowWeightCorrection", lowWeightCorrection_);
1260  }
1261 }
1262 
1263 
1264 // ************************************************************************* //
Foam::expressions::patchExpr::debug
int debug
Static debugging option.
Foam::PrimitivePatch::points
const Field< point_type > & points() const noexcept
Return reference to global points.
Definition: PrimitivePatch.H:299
Foam::refPtr::New
static refPtr< T > New(Args &&... args)
Construct refPtr of T with forwarding arguments.
profiling.H
Foam::mapDistributeBase::subMap
const labelListList & subMap() const
From subsetted data back to original data.
Definition: mapDistributeBase.H:289
Foam::scalarField
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
Definition: primitiveFieldsFwd.H:52
meshTools.H
Foam::AMIInterpolation::calculate
virtual bool calculate(const primitivePatch &srcPatch, const primitivePatch &tgtPatch, const autoPtr< searchableSurface > &surfPtr=nullptr)
Update addressing, weights and (optional) centroids.
Definition: AMIInterpolation.C:734
InfoInFunction
#define InfoInFunction
Report an information message using Foam::Info.
Definition: messageStream.H:350
Log
#define Log
Definition: PDRblock.C:35
Foam::component
void component(FieldField< Field, typename FieldField< Field, Type >::cmptType > &sf, const FieldField< Field, Type > &f, const direction d)
Definition: FieldFieldFunctions.C:44
Foam::AMIInterpolation::tgtMapPtr_
autoPtr< mapDistribute > tgtMapPtr_
Target map pointer - parallel running only.
Definition: AMIInterpolation.H:165
Foam::output
static Ostream & output(Ostream &os, const IntRange< T > &range)
Definition: IntRanges.C:66
Foam::PointHit::setDistance
void setDistance(const scalar d) noexcept
Set the distance.
Definition: PointHit.H:201
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:65
Foam::returnReduce
T returnReduce(const T &Value, const BinaryOp &bop, const int tag=Pstream::msgType(), const label comm=UPstream::worldComm)
Definition: PstreamReduceOps.H:94
s
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))
Definition: gmvOutputSpray.H:25
Foam::PointHit
Describes the interaction of a face and a point. It carries the info of a successful hit and (if succ...
Definition: PointHit.H:53
Foam::Zero
static constexpr const zero Zero
Global zero (0)
Definition: zero.H:131
Foam::AMIInterpolation::srcPointFace
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.
Definition: AMIInterpolation.C:1050
Foam::gAverage
Type gAverage(const FieldField< Field, Type > &f)
Definition: FieldFieldFunctions.C:604
Foam::meshTools::writeOBJ
void writeOBJ(Ostream &os, const point &pt)
Write obj representation of a point.
Definition: meshTools.C:203
Foam::defineRunTimeSelectionTable
defineRunTimeSelectionTable(reactionRateFlameArea, dictionary)
Foam::boundBox::inflate
void inflate(const scalar s)
Inflate box by factor*mag(span) in all dimensions.
Definition: boundBox.C:175
Foam::SubList
A List obtained as a section of another List.
Definition: SubList.H:54
Foam::AMIInterpolation::singlePatchProc_
label singlePatchProc_
Definition: AMIInterpolation.H:108
Foam::treeBoundBox
Standard boundBox with extra functionality for use in octree.
Definition: treeBoundBox.H:86
Foam::AMIInterpolation::writeFaceConnectivity
void writeFaceConnectivity(const primitivePatch &srcPatch, const primitivePatch &tgtPatch, const labelListList &srcAddress) const
Write face connectivity as OBJ file.
Definition: AMIInterpolation.C:1212
Foam::PointHit::distance
scalar distance() const noexcept
Return distance to hit.
Definition: PointHit.H:139
Foam::List::append
void append(const T &val)
Append an element at the end of the list.
Definition: ListI.H:175
Foam::endl
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:369
Foam::Pout
prefixOSstream Pout
OSstream wrapped stdout (std::cout) with parallel prefix.
triPointRef.H
AMIInterpolation.H
Foam::AMIInterpolation::tgtAddress
const labelListList & tgtAddress() const
Return const access to target patch addressing.
Definition: AMIInterpolationI.H:195
Foam::AMIInterpolation::tgtWeights
const scalarListList & tgtWeights() const
Return const access to target patch weights.
Definition: AMIInterpolationI.H:207
Foam::sumOp
Definition: ops.H:213
forAll
#define forAll(list, i)
Loop across all elements in list.
Definition: stdFoam.H:296
OFstream.H
n
label n
Definition: TABSMDCalcMethod2.H:31
Foam::AMIInterpolation::calcDistribution
label calcDistribution(const primitivePatch &srcPatch, const primitivePatch &tgtPatch) const
Calculate if patches are on multiple processors.
Definition: AMIInterpolation.C:77
Foam::PointIndexHit
This class describes the interaction of (usually) a face and a point. It carries the info of a succes...
Definition: PointIndexHit.H:52
Foam::Field< vector >
Foam::PointHit::eligibleMiss
bool eligibleMiss() const noexcept
Is this an eligible miss.
Definition: PointHit.H:127
Foam::AMIInterpolation::cacheIntersections_
static bool cacheIntersections_
Definition: AMIInterpolation.H:85
Foam::AMIInterpolation::requireMatch_
bool requireMatch_
Definition: AMIInterpolation.H:97
Foam::Info
messageStream Info
Information stream (stdout output on master, null elsewhere)
DebugInFunction
#define DebugInFunction
Report an information message using Foam::Info.
Definition: messageStream.H:388
Foam::List::setSize
void setSize(const label n)
Alias for resize()
Definition: List.H:222
Foam::PointHit::rawPoint
const point_type & rawPoint() const noexcept
The point, no checks.
Definition: PointHit.H:172
Foam::searchableSurface
Base class of (analytical or triangulated) surface. Encapsulates all the search routines....
Definition: searchableSurface.H:69
Foam::mapDistribute
Class containing processor-to-processor mapping information.
Definition: mapDistribute.H:163
Foam::AMIInterpolation::AMIInterpolation
AMIInterpolation(const dictionary &dict, const bool reverseTarget=false)
Construct from dictionary.
Definition: AMIInterpolation.C:550
Foam::indexedOctree
Non-pointer based hierarchical recursive searching.
Definition: treeDataEdge.H:50
Foam::AMIInterpolation::write
virtual void write(Ostream &os) const
Write.
Definition: AMIInterpolation.C:1243
Foam::AMIInterpolation::srcMapPtr_
autoPtr< mapDistribute > srcMapPtr_
Source map pointer - parallel running only.
Definition: AMIInterpolation.H:136
Foam::AMIInterpolation::append
void append(const primitivePatch &srcPatch, const primitivePatch &tgtPatch)
Append additional addressing and weights.
Definition: AMIInterpolation.C:839
Foam::max
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
Definition: hashSets.C:47
Foam::mapDistribute::distribute
void distribute(List< T > &fld, const bool dummyTransform=true, const int tag=UPstream::msgType()) const
Distribute data using default commsType.
Definition: mapDistributeTemplates.C:152
dict
dictionary dict
Definition: searchingEngine.H:14
addProfiling
#define addProfiling(name, descr)
Define profiling trigger with specified name and description string.
Definition: profilingTrigger.H:113
Foam::FatalError
error FatalError
Foam::AMIInterpolation::normaliseWeights
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)
Definition: AMIInterpolation.C:168
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:123
Foam::log
dimensionedScalar log(const dimensionedScalar &ds)
Definition: dimensionedScalar.C:262
os
OBJstream os(runTime.globalPath()/outputName)
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
flipOp.H
Foam::searchableSurface::findNearest
virtual void findNearest(const pointField &sample, const scalarField &nearestDistSqr, List< pointIndexHit > &) const =0
Foam::abort
errorManip< error > abort(error &err)
Definition: errorManip.H:144
Foam::indent
Ostream & indent(Ostream &os)
Indent stream.
Definition: Ostream.H:339
Foam::AMIInterpolation::srcMagSf
const List< scalar > & srcMagSf() const
Return const access to source patch face areas.
Definition: AMIInterpolationI.H:117
Foam::exit
errorManipArg< error, int > exit(error &err, const int errNo=1)
Definition: errorManip.H:130
Foam::OFstream
Output to file stream, using an OSstream.
Definition: OFstream.H:53
Foam::New
tmp< DimensionedField< TypeR, GeoMesh > > New(const tmp< DimensionedField< TypeR, GeoMesh >> &tdf1, const word &name, const dimensionSet &dimensions)
Global function forwards to reuseTmpDimensionedField::New.
Definition: DimensionedFieldReuseFunctions.H:105
found
bool found
Definition: TABSMDCalcMethod2.H:32
Foam::autoPtr::reset
void reset(autoPtr< T > &&other) noexcept
Delete managed object and set to new given pointer.
Definition: autoPtrI.H:117
Foam::mapDistributeBase::constructSize
label constructSize() const
Constructed data size.
Definition: mapDistributeBase.H:277
Foam::autoPtr
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: HashPtrTable.H:53
Foam::AMIInterpolation::reset
void reset(autoPtr< mapDistribute > &&srcToTgtMap, autoPtr< mapDistribute > &&tgtToSrcMap, labelListList &&srcAddress, scalarListList &&srcWeights, labelListList &&tgtAddress, scalarListList &&tgtWeights)
Set the maps, addresses and weights from an external source.
Definition: AMIInterpolation.C:802
FatalErrorInFunction
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition: error.H:453
DebugInfo
#define DebugInfo
Report an information message using Foam::Info.
Definition: messageStream.H:382
Foam::UPstream::myProcNo
static int myProcNo(const label communicator=worldComm)
Number of this process (starting from masterNo() = 0)
Definition: UPstream.H:463
Foam::constant::mathematical::pi
constexpr scalar pi(M_PI)
Foam::nl
constexpr char nl
Definition: Ostream.H:404
mapDistribute.H
f
labelList f(nPoints)
Foam::foamVersion::patch
const std::string patch
OpenFOAM patch number as a std::string.
Foam::Vector< scalar >
Foam::AMIInterpolation::agglomerate
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)
Definition: AMIInterpolation.C:246
Foam::UPstream::parRun
static bool & parRun() noexcept
Test if this a parallel run.
Definition: UPstream.H:433
Foam::treeDataPrimitivePatch
Encapsulation of data needed to search on PrimitivePatches.
Definition: treeDataPrimitivePatch.H:63
Foam::List< label >
Foam::type
fileName::Type type(const fileName &name, const bool followLink=true)
Return the file type: DIRECTORY or FILE, normally following symbolic links.
Definition: MSwindows.C:590
Foam::AMIInterpolation
Interpolation class dealing with transfer of data between two primitive patches with an arbitrary mes...
Definition: AMIInterpolation.H:79
Foam::identity
labelList identity(const label len, label start=0)
Create identity map of the given length with (map[i] == i)
Definition: labelList.C:38
Foam::AMIInterpolation::checkSymmetricWeights
bool checkSymmetricWeights(const bool log) const
Definition: AMIInterpolation.C:1148
Foam::sum
dimensioned< Type > sum(const DimensionedField< Type, GeoMesh > &df)
Definition: DimensionedFieldFunctions.C:327
Foam::AMIInterpolation::reverseTarget_
const bool reverseTarget_
Definition: AMIInterpolation.H:101
Foam::Ostream::writeEntry
Ostream & writeEntry(const keyType &key, const T &value)
Write a keyword/value entry.
Definition: Ostream.H:236
Foam::labelMin
constexpr label labelMin
Definition: label.H:60
Foam::AMIInterpolation::projectPointsToSurface
void projectPointsToSurface(const searchableSurface &surf, pointField &pts) const
Project points to surface.
Definition: AMIInterpolation.C:128
Foam::name
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for INVALID.
Definition: exprTraits.C:59
Foam::face
A face is a list of labels corresponding to mesh vertices.
Definition: face.H:72
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:56
Foam::gMin
Type gMin(const FieldField< Field, Type > &f)
Definition: FieldFieldFunctions.C:593
Foam::AMIInterpolation::tgtMagSf
const List< scalar > & tgtMagSf() const
Return const access to target patch face areas.
Definition: AMIInterpolationI.H:183
Foam::mapDistributeBase::constructMap
const labelListList & constructMap() const
From subsetted data to new reconstructed data.
Definition: mapDistributeBase.H:301
Foam::defineTypeNameAndDebug
defineTypeNameAndDebug(combustionModel, 0)
Foam::PointHit::hit
bool hit() const noexcept
Is there a hit.
Definition: PointHit.H:121
Foam::PrimitivePatch::faceCentres
const Field< point_type > & faceCentres() const
Return face centres for patch.
Definition: PrimitivePatch.C:400
Foam::gMax
Type gMax(const FieldField< Field, Type > &f)
Definition: FieldFieldFunctions.C:592
Foam::AMIInterpolation::tgtPointFace
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.
Definition: AMIInterpolation.C:1099
Foam::AMIInterpolation::createTree
autoPtr< indexedOctree< treeType > > createTree(const primitivePatch &patch) const
Reset the octree for the patch face search.
Definition: AMIInterpolation.C:53
Foam::AMIInterpolation::srcAddress
const labelListList & srcAddress() const
Return const access to source patch addressing.
Definition: AMIInterpolationI.H:129
Foam::AMIInterpolation::srcWeights
const scalarListList & srcWeights() const
Return const access to source patch weights.
Definition: AMIInterpolationI.H:141
Foam::PrimitivePatch
A list of faces which address into the list of points.
Definition: PrimitivePatch.H:79