AMIInterpolation.H
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) 2016-2024 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 Class
28  Foam::AMIInterpolation
29 
30 Description
31  Interpolation class dealing with transfer of data between two
32  primitive patches with an arbitrary mesh interface (AMI).
33 
34  Based on the algorithm given in:
35 
36  Conservative interpolation between volume meshes by local Galerkin
37  projection, Farrell PE and Maddison JR, 2011, Comput. Methods Appl.
38  Mech Engrg, Volume 200, Issues 1-4, pp 89-100
39 
40  Interpolation requires that the two patches should have opposite
41  orientations (opposite normals). The 'reverseTarget' flag can be used to
42  reverse the orientation of the target patch.
43 
44 SourceFiles
45  AMIInterpolationI.H
46  AMIInterpolation.C
47  AMIInterpolationNew.C
48  AMIInterpolationTemplates.C
49 
50 \*---------------------------------------------------------------------------*/
51 
52 #ifndef Foam_AMIInterpolation_H
53 #define Foam_AMIInterpolation_H
54 
55 #include "searchableSurface.H"
56 #include "boolList.H"
57 #include "primitivePatch.H"
58 #include "ops.H"
59 #include "refPtr.H"
60 #include "pointList.H"
61 #include "indexedOctree.H"
62 #include "treeDataPrimitivePatch.H"
63 #include "runTimeSelectionTables.H"
64 
65 
66 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
67 
68 namespace Foam
69 {
70 
71 /*---------------------------------------------------------------------------*\
72  Class AMIInterpolation Declaration
73 \*---------------------------------------------------------------------------*/
74 
75 class AMIInterpolation
76 {
77 public:
78 
79  // Public Data Types
80 
81  static bool cacheIntersections_;
82 
83  //- Control use of local communicator for AMI communication
84  // localComm : 0 : all processors (backwards compatible)
85  // localComm : 1 : only processors with patch faces
86  // localComm : 2 : like 1 but always include master (for messages)
87  static int useLocalComm_;
88 
89 
90 protected:
91 
92  //- Local typedef to octree tree-type
94 
95  // Protected data
96 
97  //- Flag to indicate that the two patches must be matched/an overlap
98  //- exists between them
99  bool requireMatch_;
100 
101  //- Flag to indicate that the two patches are co-directional and
102  //- that the orientation of the target patch should be reversed
103  const bool reverseTarget_;
104 
105  //- Threshold weight below which interpolation is deactivated
106  const scalar lowWeightCorrection_;
108  //- Index of processor that holds all of both sides.
109  //- The value is -1 for distributed cases
110  label singlePatchProc_;
111 
112  //- Communicator to use for parallel operations.
113  label comm_;
114 
115  //- Communicator to use for geometry calculations. Not valid (-1) on
116  //- processors that do not have faces
119 
120  // Source patch
121 
122  //- Source face areas
124 
125  //- Addresses of target faces per source face
127 
128  //- Weights of target faces per source face
130 
131  //- Sum of weights of target faces per source face
133 
134  //- Centroid of target faces per source face
136 
137  //- Source patch points if input points are manipulated, e.g.
138  //- projected
140 
141  //- Source patch using manipulated input points
143 
144  //- Source map pointer - parallel running only
146 
148 
149  // Target patch
150 
151  //- Target face areas
153 
154  //- Addresses of source faces per target face
156 
157  //- Weights of source faces per target face
159 
160  //- Sum of weights of source faces per target face
162 
163  //- Centroid of source faces per target face
165 
166  //- Target patch points if input points are manipulated, e.g.
167  //- projected
169 
170  //- Target patch using manipulated input points
172 
173  //- Target map pointer - parallel running only
175 
176  //- Up-to-date flag
177  bool upToDate_;
178 
179 
180  // Protected Member Functions
181 
182  //- No copy assignment
183  void operator=(const AMIInterpolation&) = delete;
184 
185 
186  // Initialisation
188  //- Reset the octree for the patch face search
190  (
191  const primitivePatch& patch
192  ) const;
193 
194  //- Calculate if patches are on multiple processors. Allocates
195  //- local communicator and returns -1 or processor containing all
196  //- faces
198  (
199  const primitivePatch& srcPatch,
200  const primitivePatch& tgtPatch,
201  const label comm,
203  ) const;
204 
205  //- Project points to surface
207  (
208  const searchableSurface& surf,
209  pointField& pts
210  ) const;
211 
212 
213  // Access
214 
215  //- Return the orginal src patch with optionally updated points
216  inline const primitivePatch& srcPatch0() const;
217 
218  //- Return the orginal tgt patch with optionally updated points
219  inline const primitivePatch& tgtPatch0() const;
220 
221 
222  // Evaluation
224  //- Normalise the (area) weights - suppresses numerical error in
225  //- weights calculation
226  // NOTE: if area weights are incorrect by 'a significant amount'
227  // normalisation may stabilise the solution, but will introduce
228  // numerical error!
229  static void normaliseWeights
230  (
231  const scalarList& patchAreas,
232  const word& patchName,
233  const labelListList& addr,
234  scalarListList& wght,
235  scalarField& wghtSum,
236  const bool conformal,
237  const bool output,
238  const scalar lowWeightTol,
239  const label comm
240  );
241 
242 
243  // Constructor helpers
244 
245  static void agglomerate
246  (
247  const autoPtr<mapDistribute>& targetMap,
248  const scalarList& fineSrcMagSf,
249  const labelListList& fineSrcAddress,
250  const scalarListList& fineSrcWeights,
251 
252  const labelList& sourceRestrictAddressing,
253  const labelList& targetRestrictAddressing,
254 
260  const label comm
261  );
262 
263 
264 public:
265 
266  //- Runtime type information
267  TypeName("AMIInterpolation");
268 
269  // Selection tables
270 
271  //- Selection table for dictionary construction
273  (
274  autoPtr,
276  dict,
277  (
278  const dictionary& dict,
279  const bool reverseTarget
280  ),
281  (
282  dict,
284  )
285  );
286 
287  //- Selection table for component-wise construction
289  (
290  autoPtr,
292  component,
293  (
294  const bool requireMatch,
295  const bool reverseTarget,
296  const scalar lowWeightCorrection
297  ),
298  (
299  requireMatch,
302  )
303  );
304 
305  //- Selector for dictionary
307  (
308  const word& modelName,
309  const dictionary& dict,
310  const bool reverseTarget = false
311  );
312 
313  //- Selector for components
315  (
316  const word& modelName,
317  const bool requireMatch = true,
318  const bool reverseTarget = false,
319  const scalar lowWeightCorrection = -1
320  );
321 
322 
323  // Constructors
324 
325  //- Construct from dictionary
326  explicit AMIInterpolation
327  (
328  const dictionary& dict,
329  const bool reverseTarget = false
330  );
331 
332  //- Construct from components
333  explicit AMIInterpolation
334  (
335  const bool requireMatch = true,
336  const bool reverseTarget = false,
337  const scalar lowWeightCorrection = -1
338  );
339 
340  //- Construct from agglomeration of AMIInterpolation. Agglomeration
341  //- passed in as new coarse size and addressing from fine from coarse
343  (
344  const AMIInterpolation& fineAMI,
345  const labelList& sourceRestrictAddressing,
346  const labelList& neighbourRestrictAddressing
347  );
348 
349  //- Construct as copy
351 
352  //- Construct and return a clone
353  virtual autoPtr<AMIInterpolation> clone() const
354  {
355  return autoPtr<AMIInterpolation>::New(*this);
356  }
357 
358  //- Construct from Istream
359  // Note: does not transfer src(tgt)PatchPts, tsrc(tgt)Patch0_
361 
362 
363  //- Destructor
364  virtual ~AMIInterpolation() = default;
365 
366 
367  // Member Functions
368 
369  // Access
370 
371  //- Is up-to-date?
372  bool upToDate() const noexcept { return upToDate_; }
373 
374  //- Set as up-to-date, return the previous value
375  bool upToDate(bool flag) noexcept
376  {
377  bool old(upToDate_);
378  upToDate_ = flag;
379  return old;
380  }
381 
382  //- Distributed across processors (singlePatchProc == -1)
383  inline bool distributed() const noexcept;
384 
385  //- Return the requireMatch flag
386  inline bool requireMatch() const noexcept;
387 
388  //- Set the require match flag, return the \em new value
389  inline bool setRequireMatch(bool flag) noexcept;
390 
391  //- Return true if requireMatch and but not lowWeightCorrection
392  inline bool mustMatchFaces() const;
393 
394  //- Access to the reverseTarget flag
395  inline bool reverseTarget() const noexcept;
396 
397  //- Threshold weight below which interpolation is deactivated
398  inline scalar lowWeightCorrection() const;
399 
400  //- Return true if employing a 'lowWeightCorrection'
401  inline bool applyLowWeightCorrection() const;
402 
403  //- The processor holding all faces (both sides),
404  //- or -1 if distributed
405  inline label singlePatchProc() const noexcept;
406 
407  //- Communicator (local or otherwise) for parallel operations
408  inline label comm() const noexcept;
409 
410  //- Set (non-local) communicator for parallel operations.
411  // \returns old value
412  inline label comm(label communicator) noexcept;
413 
414 
415  // Source patch
416 
417  //- Return const access to source patch face areas
418  inline const List<scalar>& srcMagSf() const;
419 
420  //- Return access to source patch face areas
421  inline List<scalar>& srcMagSf();
422 
423  //- Return const access to source patch addressing
424  inline const labelListList& srcAddress() const;
425 
426  //- Return access to source patch addressing
427  inline labelListList& srcAddress();
428 
429  //- Return const access to source patch weights
430  inline const scalarListList& srcWeights() const;
431 
432  //- Return access to source patch weights
433  inline scalarListList& srcWeights();
435  //- Return const access to normalisation factor of source
436  //- patch weights (i.e. the sum before normalisation)
437  inline const scalarField& srcWeightsSum() const;
438 
439  //- Return access to normalisation factor of source
440  //- patch weights (i.e. the sum before normalisation)
441  inline scalarField& srcWeightsSum();
442 
443  //- Return const access to source patch face centroids
444  inline const pointListList& srcCentroids() const;
445 
446  //- Return access to source patch face centroids
447  inline pointListList& srcCentroids();
448 
449  //- Source map - valid only if singlePatchProc = -1
450  //- This gets source data into a form to be consumed by
451  //- tgtAddress, tgtWeights
452  inline const mapDistribute& srcMap() const;
453 
454  //- Pointer to the source map (if distributed).
455  //- Can be checked as a bool.
456  inline const mapDistribute* hasSrcMap() const noexcept;
457 
458 
459  // Target patch
461  //- Return const access to target patch face areas
462  inline const List<scalar>& tgtMagSf() const;
463 
464  //- Return access to target patch face areas
465  inline List<scalar>& tgtMagSf();
466 
467  //- Return const access to target patch addressing
468  inline const labelListList& tgtAddress() const;
469 
470  //- Return access to target patch addressing
471  inline labelListList& tgtAddress();
472 
473  //- Return const access to target patch weights
474  inline const scalarListList& tgtWeights() const;
475 
476  //- Return access to target patch weights
477  inline scalarListList& tgtWeights();
478 
479  //- Return const access to normalisation factor of target
480  //- patch weights (i.e. the sum before normalisation)
481  inline const scalarField& tgtWeightsSum() const;
482 
483  //- Return access to normalisation factor of target
484  //- patch weights (i.e. the sum before normalisation)
485  inline scalarField& tgtWeightsSum();
486 
487  //- Target map - valid only if singlePatchProc=-1.
488  //- This gets target data into a form to be consumed by
489  //- srcAddress, srcWeights
490  inline const mapDistribute& tgtMap() const;
491 
492  //- Pointer to the target map (if distributed).
493  //- Can be checked as a bool.
494  inline const mapDistribute* hasTgtMap() const noexcept;
495 
496 
497  // Manipulation
498 
499  //- Update addressing, weights and (optional) centroids
500  virtual bool calculate
501  (
502  const primitivePatch& srcPatch,
503  const primitivePatch& tgtPatch,
504  const autoPtr<searchableSurface>& surfPtr = nullptr
505  );
506 
507  //- Set the maps, addresses and weights from an external source
508  void reset
509  (
510  autoPtr<mapDistribute>&& srcToTgtMap,
511  autoPtr<mapDistribute>&& tgtToSrcMap,
516  const label singlePatchProc
517  );
518 
519  //- Append additional addressing and weights
520  void append
521  (
522  const primitivePatch& srcPatch,
523  const primitivePatch& tgtPatch
524  );
525 
526  //- Normalise the weights
527  void normaliseWeights(const bool conformal, const bool output);
528 
529 
530  // Evaluation
531 
532  // Low-level
533 
534  //- Weighted sum of contributions
535  template<class Type, class CombineOp>
536  static void weightedSum
537  (
538  const scalar lowWeightCorrection,
539  const labelListList& allSlots,
540  const scalarListList& allWeights,
541  const scalarField& weightsSum,
542  const UList<Type>& fld,
543  const CombineOp& cop,
544  List<Type>& result,
545  const UList<Type>& defaultValues
546  );
547 
548  //- Weighted sum of contributions
549  template<class Type>
550  void weightedSum
551  (
552  const bool interpolateToSource,
553  const UList<Type>& fld,
554  List<Type>& result,
555  const UList<Type>& defaultValues
556  ) const;
557 
558  //- Interpolate from target to source with supplied op
559  //- to combine existing value with remote value and weight
560  template<class Type, class CombineOp>
562  (
563  const UList<Type>& fld,
564  const CombineOp& cop,
565  List<Type>& result,
566  const UList<Type>& defaultValues = UList<Type>::null()
567  ) const;
568 
569  //- Interpolate from source to target with supplied op
570  //- to combine existing value with remote value and weight
571  template<class Type, class CombineOp>
573  (
574  const UList<Type>& fld,
575  const CombineOp& cop,
576  List<Type>& result,
577  const UList<Type>& defaultValues = UList<Type>::null()
578  ) const;
579 
580 
581  //- Interpolate from target to source with supplied op
582  template<class Type, class CombineOp>
584  (
585  const Field<Type>& fld,
586  const CombineOp& cop,
587  const UList<Type>& defaultValues = UList<Type>::null()
588  ) const;
589 
590  //- Interpolate from target tmp field to source with supplied op
591  template<class Type, class CombineOp>
593  (
594  const tmp<Field<Type>>& tFld,
595  const CombineOp& cop,
596  const UList<Type>& defaultValues = UList<Type>::null()
597  ) const;
598 
599  //- Interpolate from source to target with supplied op
600  template<class Type, class CombineOp>
602  (
603  const Field<Type>& fld,
604  const CombineOp& cop,
605  const UList<Type>& defaultValues = UList<Type>::null()
606  ) const;
607 
608  //- Interpolate from source tmp field to target with supplied op
609  template<class Type, class CombineOp>
611  (
612  const tmp<Field<Type>>& tFld,
613  const CombineOp& cop,
614  const UList<Type>& defaultValues = UList<Type>::null()
615  ) const;
616 
617  //- Interpolate from target to source
618  template<class Type>
620  (
621  const Field<Type>& fld,
622  const UList<Type>& defaultValues = UList<Type>::null()
623  ) const;
624 
625  //- Interpolate from target tmp field
626  template<class Type>
628  (
629  const tmp<Field<Type>>& tFld,
630  const UList<Type>& defaultValues = UList<Type>::null()
631  ) const;
632 
633  //- Interpolate from source to target
634  template<class Type>
636  (
637  const Field<Type>& fld,
638  const UList<Type>& defaultValues = UList<Type>::null()
639  ) const;
640 
641  //- Interpolate from source tmp field
642  template<class Type>
644  (
645  const tmp<Field<Type>>& tFld,
646  const UList<Type>& defaultValues = UList<Type>::null()
647  ) const;
648 
649 
650  // Point intersections
651 
652  //- Return source patch face index of point on target patch face
653  label srcPointFace
654  (
655  const primitivePatch& srcPatch,
656  const primitivePatch& tgtPatch,
657  const vector& n,
658  const label tgtFacei,
659  point& tgtPoint
660  )
661  const;
662 
663  //- Return target patch face index of point on source patch face
664  label tgtPointFace
665  (
666  const primitivePatch& srcPatch,
667  const primitivePatch& tgtPatch,
668  const vector& n,
669  const label srcFacei,
670  point& srcPoint
671  )
672  const;
673 
674 
675  // Checks
676 
677  //- Check if src addresses are present in tgt addresses and
678  //- viceversa
679  bool checkSymmetricWeights(const bool log) const;
680 
681  //- Write face connectivity as OBJ file
683  (
684  const primitivePatch& srcPatch,
685  const primitivePatch& tgtPatch,
687  ) const;
688 
689 
690  // I-O
691 
692  //- Write AMI as a dictionary
693  virtual void write(Ostream& os) const;
694 
695  //- Write AMI raw
696  virtual bool writeData(Ostream& os) const;
697 
698 
699  // Housekeeping
700 
701  //- Non-const access to the up-to-date flag
702  // \deprecated Prefer the upToDate(bool) setter (JAN-2023)
703  bool& upToDate() noexcept { return upToDate_; }
704 };
705 
706 
707 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
708 
709 } // End namespace Foam
710 
711 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
712 
713 #include "AMIInterpolationI.H"
714 
715 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
716 
717 #ifdef NoRepository
718  #include "AMIInterpolationTemplates.C"
719 #endif
720 
721 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
722 
723 #endif
724 
725 // ************************************************************************* //
TypeName("AMIInterpolation")
Runtime type information.
label singlePatchProc_
Index of processor that holds all of both sides. The value is -1 for distributed cases.
dictionary dict
void append(const primitivePatch &srcPatch, const primitivePatch &tgtPatch)
Append additional addressing and weights.
const pointListList & srcCentroids() const
Return const access to source patch face centroids.
label comm() const noexcept
Communicator (local or otherwise) for parallel operations.
refPtr< primitivePatch > tsrcPatch0_
Source patch using manipulated input points.
virtual ~AMIInterpolation()=default
Destructor.
pointListList tgtCentroids_
Centroid of source faces per target face.
labelListList tgtAddress_
Addresses of source faces per target face.
pointListList srcCentroids_
Centroid of target faces per source face.
dimensionedScalar log(const dimensionedScalar &ds)
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.
A list of keyword definitions, which are a keyword followed by a number of values (eg...
Definition: dictionary.H:129
const scalarListList & tgtWeights() const
Return const access to target patch weights.
pointField tgtPatchPts_
Target patch points if input points are manipulated, e.g. projected.
bool mustMatchFaces() const
Return true if requireMatch and but not lowWeightCorrection.
autoPtr< mapDistribute > tgtMapPtr_
Target map pointer - parallel running only.
virtual autoPtr< AMIInterpolation > clone() const
Construct and return a clone.
treeDataPrimitivePatch< primitivePatch > treeType
Local typedef to octree tree-type.
void writeFaceConnectivity(const primitivePatch &srcPatch, const primitivePatch &tgtPatch, const labelListList &srcAddress) const
Write face connectivity as OBJ file.
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.
void projectPointsToSurface(const searchableSurface &surf, pointField &pts) const
Project points to surface.
autoPtr< indexedOctree< treeType > > createTree(const primitivePatch &patch) const
Reset the octree for the patch face search.
An Istream is an abstract base class for all input systems (streams, files, token lists etc)...
Definition: Istream.H:57
const mapDistribute & srcMap() const
Source map - valid only if singlePatchProc = -1 This gets source data into a form to be consumed by t...
virtual bool writeData(Ostream &os) const
Write AMI raw.
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.
Various functors for unary and binary operations. Can be used for parallel combine-reduce operations ...
refPtr< primitivePatch > ttgtPatch0_
Target patch using manipulated input points.
Base class of (analytical or triangulated) surface. Encapsulates all the search routines. WIP.
bool distributed() const noexcept
Distributed across processors (singlePatchProc == -1)
static bool cacheIntersections_
List< labelList > labelListList
List of labelList.
Definition: labelList.H:38
declareRunTimeSelectionTable(autoPtr, AMIInterpolation, dict,(const dictionary &dict, const bool reverseTarget),(dict, reverseTarget))
Selection table for dictionary construction.
A class for managing references or pointers (no reference counting)
Definition: HashPtrTable.H:49
autoPtr< mapDistribute > srcMapPtr_
Source map pointer - parallel running only.
label comm_
Communicator to use for parallel operations.
AMIInterpolation(const dictionary &dict, const bool reverseTarget=false)
Construct from dictionary.
A list of faces which address into the list of points.
const primitivePatch & tgtPatch0() const
Return the orginal tgt patch with optionally updated points.
virtual bool calculate(const primitivePatch &srcPatch, const primitivePatch &tgtPatch, const autoPtr< searchableSurface > &surfPtr=nullptr)
Update addressing, weights and (optional) centroids.
const List< scalar > & tgtMagSf() const
Return const access to target patch face areas.
bool upToDate() const noexcept
Is up-to-date?
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)
List< scalarList > scalarListList
List of scalarList.
Definition: scalarList.H:35
A class for handling words, derived from Foam::string.
Definition: word.H:63
static int useLocalComm_
Control use of local communicator for AMI communication.
bool upToDate_
Up-to-date flag.
const mapDistribute * hasTgtMap() const noexcept
Pointer to the target map (if distributed). Can be checked as a bool.
Encapsulation of data needed to search on PrimitivePatches.
const primitivePatch & srcPatch0() const
Return the orginal src patch with optionally updated points.
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...
const scalarField & tgtWeightsSum() const
Return const access to normalisation factor of target patch weights (i.e. the sum before normalisatio...
bool checkSymmetricWeights(const bool log) const
Check if src addresses are present in tgt addresses and viceversa.
void interpolateToTarget(const UList< Type > &fld, const CombineOp &cop, List< Type > &result, const UList< Type > &defaultValues=UList< Type >::null()) const
Interpolate from source to target with supplied op to combine existing value with remote value and we...
scalarListList srcWeights_
Weights of target faces per source face.
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
Definition: HashTable.H:105
autoPtr< UPstream::communicator > geomComm_
Communicator to use for geometry calculations. Not valid (-1) on processors that do not have faces...
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:56
const direction noexcept
Definition: scalarImpl.H:255
scalarField srcWeightsSum_
Sum of weights of target faces per source face.
const mapDistribute * hasSrcMap() const noexcept
Pointer to the source map (if distributed). Can be checked as a bool.
A Vector of values with scalar precision, where scalar is float/double depending on the compilation f...
const scalarListList & srcWeights() const
Return const access to source patch weights.
static void weightedSum(const scalar lowWeightCorrection, const labelListList &allSlots, const scalarListList &allWeights, const scalarField &weightsSum, const UList< Type > &fld, const CombineOp &cop, List< Type > &result, const UList< Type > &defaultValues)
Weighted sum of contributions.
OBJstream os(runTime.globalPath()/outputName)
bool setRequireMatch(bool flag) noexcept
Set the require match flag, return the new value.
bool reverseTarget() const noexcept
Access to the reverseTarget flag.
void interpolateToSource(const UList< Type > &fld, const CombineOp &cop, List< Type > &result, const UList< Type > &defaultValues=UList< Type >::null()) const
Interpolate from target to source with supplied op to combine existing value with remote value and we...
const List< scalar > & srcMagSf() const
Return const access to source patch face areas.
const scalarField & srcWeightsSum() const
Return const access to normalisation factor of source patch weights (i.e. the sum before normalisatio...
scalarList tgtMagSf_
Target face areas.
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))
scalarField tgtWeightsSum_
Sum of weights of source faces per target face.
labelListList srcAddress_
Addresses of target faces per source face.
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. ...
Class containing processor-to-processor mapping information.
bool requireMatch_
Flag to indicate that the two patches must be matched/an overlap exists between them.
scalarListList tgtWeights_
Weights of source faces per target face.
pointField srcPatchPts_
Source patch points if input points are manipulated, e.g. projected.
Interpolation class dealing with transfer of data between two primitive patches with an arbitrary mes...
const std::string patch
OpenFOAM patch number as a std::string.
static Ostream & output(Ostream &os, const IntRange< T > &range)
Definition: IntRanges.C:44
label n
Pointer management similar to std::unique_ptr, with some additional methods and type checking...
Definition: HashPtrTable.H:48
static autoPtr< AMIInterpolation > New(const word &modelName, const dictionary &dict, const bool reverseTarget=false)
Selector for dictionary.
Macros to ease declaration of run-time selection tables.
const mapDistribute & tgtMap() const
Target map - valid only if singlePatchProc=-1. This gets target data into a form to be consumed by sr...
A class for managing temporary objects.
Definition: HashPtrTable.H:50
static autoPtr< T > New(Args &&... args)
Construct autoPtr with forwarding arguments.
Definition: autoPtr.H:178
scalar lowWeightCorrection() const
Threshold weight below which interpolation is deactivated.
void component(FieldField< Field, typename FieldField< Field, Type >::cmptType > &sf, const FieldField< Field, Type > &f, const direction d)
const labelListList & srcAddress() const
Return const access to source patch addressing.
scalarList srcMagSf_
Source face areas.
void operator=(const AMIInterpolation &)=delete
No copy assignment.
const scalar lowWeightCorrection_
Threshold weight below which interpolation is deactivated.
const bool reverseTarget_
Flag to indicate that the two patches are co-directional and that the orientation of the target patch...
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.
bool applyLowWeightCorrection() const
Return true if employing a &#39;lowWeightCorrection&#39;.
Namespace for OpenFOAM.
virtual void write(Ostream &os) const
Write AMI as a dictionary.
const pointField & pts