mappedPatchBase.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-2016 OpenFOAM Foundation
9  Copyright (C) 2020-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 Class
28  Foam::mappedPatchBase
29 
30 Description
31  Determines a mapping between patch face centres and mesh cell or face
32  centres and processors they're on.
33 
34  If constructed from dictionary:
35  \verbatim
36  // Optional world to sample (default is all)
37  //sampleWorld solidSim;
38 
39  // Optional explicit coupling (requires functionObject to synchronise
40  // databases. Default is close coupling (bc to bc)
41  //sampleDatabase true;
42 
43  // Region to sample (default is region0)
44  sampleRegion region0;
45 
46  // What to sample:
47  // - nearestCell : sample cell containing point
48  // - nearestOnlyCell : nearest sample cell (even if not containing
49  // point)
50  // - nearestPatchFace : nearest face on selected patch
51  // - nearestPatchFaceAMI : nearest face on selected patch
52  - patches need not conform
53  - uses AMI interpolation
54  // - nearestFace : nearest boundary face on any patch
55  // - nearestPatchPoint : nearest patch point (for coupled points
56  // this might be any of the points so you have
57  // to guarantee the point data is synchronised
58  // beforehand)
59  sampleMode nearestCell;
60 
61  // If sampleMode is nearestPatchFace : patch to find faces of
62  samplePatch movingWall;
63 
64  // If sampleMode is nearestPatchFace : specify patchgroup to find
65  // samplePatch and sampleRegion (if not provided)
66  coupleGroup baffleGroup;
67 
68  // How to supply offset (w.r.t. my patch face centres):
69  // - uniform : single offset vector
70  // - nonuniform : per-face offset vector
71  // - normal : using supplied distance and face normal
72  offsetMode uniform;
73 
74  // According to offsetMode (see above) supply one of
75  // offset, offsets or distance
76  offset (1 0 0);
77  \endverbatim
78 
79  Note: if offsetMode is \c normal it uses outwards pointing normals. So
80  supply a negative distance if sampling inside the domain.
81 
82 Note
83  Storage is not optimal. It temporary collects all (patch)face centres
84  on all processors to keep the addressing calculation simple.
85 
86 SourceFiles
87  mappedPatchBase.C
88 
89 \*---------------------------------------------------------------------------*/
90 
91 #ifndef Foam_mappedPatchBase_H
92 #define Foam_mappedPatchBase_H
93 
94 #include "pointField.H"
95 #include "Tuple2.H"
96 #include "pointIndexHit.H"
98 #include "coupleGroupIdentifier.H"
100 
101 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
102 
103 namespace Foam
104 {
105 
106 // Forward Declarations
107 class polyPatch;
108 class polyMesh;
109 class mapDistribute;
111 /*---------------------------------------------------------------------------*\
112  Class mappedPatchBase Declaration
113 \*---------------------------------------------------------------------------*/
114 
115 class mappedPatchBase
116 {
117 public:
118 
119  // Type enumerations
120 
121  //- Mesh items to sample
123  {
128  NEARESTFACE,
130  };
131 
132  //- How to project face centres
133  enum offsetMode
134  {
137  NORMAL
138  };
140  static const Enum<sampleMode> sampleModeNames_;
142  static const Enum<offsetMode> offsetModeNames_;
143 
144 
145  //- Helper class for finding nearest
146  // Nearest:
147  // - point+local index
148  // - sqr(distance)
149  // - processor
151 
153  {
154  public:
155 
156  void operator()(nearInfo& x, const nearInfo& y) const
157  {
158  if (y.first().hit())
159  {
160  if (!x.first().hit())
161  {
162  x = y;
163  }
164  else if (y.second().first() < x.second().first())
165  {
166  x = y;
167  }
168  }
169  }
170  };
171 
172  class maxProcEqOp
173  {
174  public:
175 
176  void operator()(nearInfo& x, const nearInfo& y) const
177  {
178  if (y.first().hit())
179  {
180  if (!x.first().hit())
181  {
182  x = y;
183  }
184  else if (y.second().second() > x.second().second())
185  {
186  x = y;
187  }
188  }
189  }
190  };
191 
192 
193  //- nearest + world
194  // Used to only look at entries from same world
195  typedef Tuple2<nearInfo, label> nearInfoWorld;
196 
197  class nearestWorldEqOp
198  {
199  public:
201  void operator()(nearInfoWorld& x, const nearInfoWorld& y) const
202  {
203  // Is there a hit and is it sampling the same world
204  const nearInfo& xi = x.first();
205  const nearInfo& yi = y.first();
206  if (yi.first().hit())
207  {
208  if (x.second() == y.second())
209  {
210  if (!xi.first().hit())
211  {
212  x = y;
213  }
214  else if (yi.second().first() < xi.second().first())
215  {
216  x = y;
217  }
218  }
219  }
220  }
221  };
222 
223 
224 protected:
225 
226  // Protected Data
227 
228  //- Patch to sample
229  const polyPatch& patch_;
230 
231  //- World to sample
232  mutable word sampleWorld_;
233 
234  //- Region to sample
235  mutable word sampleRegion_;
237  //- What to sample
238  const sampleMode mode_;
239 
240  //- Patch (if in sampleMode NEARESTPATCH*)
242 
243  //- PatchGroup (if in sampleMode NEARESTPATCH*)
245 
246  //- Empty or location of database
248 
249  //- How to obtain samples
252  //- Offset vector (uniform)
253  vector offset_;
254 
255  //- Offset vector (nonuniform)
257 
258  //- Offset distance (normal)
259  scalar distance_;
260 
261  //- Communicator
262  label communicator_;
263 
264  //- Same region
265  mutable bool sameRegion_;
267 
268  // Derived information
269 
270  //- Communication schedule:
271  //
272  // - Cells/faces to sample per processor
273  // - Patch faces to receive per processor
274  // - schedule
277 
278  // AMI interpolator (only for NEARESTPATCHFACEAMI)
279 
280  //- Flag to indicate that slave patch should be reversed for AMI
281  const bool AMIReverse_;
282 
283  //- Pointer to AMI interpolator
285 
286  //- Pointer to projection surface employed by AMI interpolator
288 
289  //- Dictionary storing projection surface description
292 
293  // Mesh update IOobjects
294 
295  //- Local mesh update time
297 
298  //- Sample mesh update time
301 
302 
303  // Protected Member Functions
304 
305  // polyPatch callbacks
306 
307  //- Initialise the calculation of the patch geometry
308  virtual void initGeometry(PstreamBuffers&)
309  {}
310 
311  //- Calculate the patch geometry
312  virtual void calcGeometry(PstreamBuffers&)
313  {}
314 
315  //- Initialise the patches for moving points
316  virtual void initMovePoints(PstreamBuffers&, const pointField&)
317  {}
318 
319  //- Correct patches after moving points
320  virtual void movePoints(PstreamBuffers&, const pointField&)
321  {}
323  //- Initialise the update of the patch topology
324  virtual void initUpdateMesh(PstreamBuffers&)
325  {}
326 
327  //- Update of the patch topology
328  virtual void updateMesh(PstreamBuffers&);
329 
330 
331  //- Add a world-world connection
333 
334  //- Get the communicator for the world-world connection
335  label getWorldCommunicator() const;
336 
337  //- Lookup mesh
338  const polyMesh& lookupMesh(const word& region) const;
339 
340  //- Lookup patch
341  const polyPatch& lookupPatch
342  (
343  const word& sampleRegion,
344  const word& samplePatch
345  ) const;
347 
348  //- Get the points from face-centre-decomposition face centres
349  //- and project them onto the face-diagonal-decomposition triangles.
350  tmp<pointField> facePoints(const polyPatch&) const;
351 
352  //- Collect single list of samples and originating processor+face +
353  //- wanted world
354  void collectSamples
355  (
356  const label mySampleWorld, // My wanted sampling world
357  const pointField& facePoints,
358  pointField& samples, // Per sample: coordinate
359  labelList& patchFaceWorlds, // Per sample: wanted world
360  labelList& patchFaceProcs, // Per sample: originating proc
361  labelList& patchFaces, // Per sample: originating face
362  pointField& patchFc
363  ) const;
364 
365  //- Find (local) cells/faces containing samples
366  void findLocalSamples
367  (
369  const label sampleWorld, // my world as index
370  const word& sampleRegion,
371  const word& samplePatch,
372  const pointField& samplePoints,
373 
375  ) const;
376 
377  //- Find (global) cells/faces containing samples
378  void findSamples
379  (
380  const sampleMode mode, // search mode
381  const label myWorldIndex, // my world (in index form)
382 
383  const pointField&,
384  const labelList& wantedWorlds,
385  const labelList& origProcs, // per sample the originating proc
386 
387  labelList& sampleProcs, // processor containing sample
388  labelList& sampleIndices, // local index of cell/face
389  pointField& sampleLocations // actual representative location
390  ) const;
391 
392  //- Get the sample points given the face points
394 
395  //- Calculate mapping
396  void calcMapping() const;
397 
398  //- Calculate AMI interpolator
399  void calcAMI() const;
400 
401 
402  // Database Handling
403 
404  //- Read optional database name from dictionary
406 
407  //- Lookup (sub)objectRegistry by following names of sub registries.
408  //- Creates non-existing intermediate ones.
410  static const objectRegistry& subRegistry
411  (
412  const objectRegistry& obr,
413  const wordList& names,
414  const label index
415  );
416 
417  //- Attempt to detect an IOField<Type> and write to dictionary
418  template<class Type>
419  static bool writeIOField
420  (
421  const regIOobject& obj,
423  );
424 
425  //- Attempt to read an IOField<Type> and store on objectRegistry
426  template<class Type>
427  static bool constructIOField
428  (
429  const word& name,
430  token& tok,
431  Istream& is,
432  objectRegistry& obr
433  );
434 
435 public:
436 
437  //- Runtime type information
438  TypeName("mappedPatchBase");
439 
440 
441  // Constructors
442 
443  //- Construct from patch
444  explicit mappedPatchBase(const polyPatch&);
445 
446  //- Construct with offsetMode=non-uniform
448  (
449  const polyPatch& pp,
450  const word& sampleRegion,
451  const sampleMode sampleMode,
452  const word& samplePatch,
453  const vectorField& offsets
454  );
455 
456  //- Construct from offsetMode=uniform
458  (
459  const polyPatch& pp,
460  const word& sampleRegion,
461  const sampleMode sampleMode,
462  const word& samplePatch,
463  const vector& uniformOffset
464  );
465 
466  //- Construct from offsetMode=normal and distance
468  (
469  const polyPatch& pp,
470  const word& sampleRegion,
471  const sampleMode sampleMode,
472  const word& samplePatch,
473  const scalar normalDistance
474  );
475 
476  //- Construct from dictionary
477  mappedPatchBase(const polyPatch&, const dictionary&);
478 
479  //- Construct from dictionary and (collocated) sample mode
480  // (only for nearestPatchFace, nearestPatchFaceAMI, nearestPatchPoint)
481  // Assumes zero offset.
482  mappedPatchBase(const polyPatch&, const sampleMode, const dictionary&);
483 
484  //- Construct as copy, resetting patch
485  mappedPatchBase(const polyPatch&, const mappedPatchBase&);
486 
487  //- Construct as copy, resetting patch, map original data
489  (
490  const polyPatch&,
491  const mappedPatchBase&,
492  const labelUList& mapAddressing
493  );
494 
495 
496  //- Destructor
497  virtual ~mappedPatchBase();
498 
499 
500  // Member Functions
501 
502  // Edit
503 
504  void clearOut();
505 
506  //- Change to normal offset with given distance
507  void setOffset(const scalar normalDist);
508 
509  //- Change to uniform offset with value
510  void setOffset(const vector& uniformOffset);
511 
512  //- Change to non-uniform offsets
513  void setOffset(const vectorField& offsets);
514 
515 
516  // Access
517 
518  //- What to sample
519  inline sampleMode mode() const noexcept;
520 
521  //- World to sample
522  inline const word& sampleWorld() const noexcept;
523 
524  //- Region to sample
525  inline const word& sampleRegion() const;
526 
527  //- Patch (only if NEARESTPATCHFACE)
528  inline const word& samplePatch() const;
529 
530  //- PatchGroup (only if NEARESTPATCHFACE)
531  inline const word& coupleGroup() const;
532 
533  //- Return size of mapped mesh/patch/boundary
534  inline label sampleSize() const;
535 
536  //- Offset vector (from patch faces to destination mesh objects)
537  inline const vector& offset() const noexcept;
538 
539  //- Offset vectors (from patch faces to destination mesh objects)
540  inline const vectorField& offsets() const noexcept;
541 
542  //- Get the communicator (worldComm or world-to-world)
543  inline label getCommunicator() const;
544 
545  //- Identical to getCommunicator()
546  inline label comm() const;
547 
548  //- Is sample world the local world?
549  inline bool sameWorld() const;
550 
551  //- Is my world ordered before the sampleWorld?
552  inline bool masterWorld() const;
553 
554  //- Cached sampleRegion != mesh.name()
555  inline bool sameRegion() const noexcept;
556 
557  //- Local mesh update time
559 
560  //- Sample mesh upate time
562 
563  bool upToDate() const;
564 
565  //- Return reference to the parallel distribution map
566  inline const mapDistribute& map() const;
567 
568  //- Return reference to the AMI interpolator
569  inline const AMIPatchToPatchInterpolation& AMI
570  (
571  const bool forceUpdate = false
572  ) const;
573 
574  //- Is it owner
575  inline bool owner() const;
576 
577  //- Return a pointer to the AMI projection surface
578  const autoPtr<Foam::searchableSurface>& surfPtr() const;
579 
580  //- Get the region mesh
581  const polyMesh& sampleMesh() const;
582 
583  //- Get the patch on the region
584  const polyPatch& samplePolyPatch() const;
585 
586 
587  // Helpers
588 
589  //- Get the sample points
590  tmp<pointField> samplePoints() const;
591 
592  //- Get a point on the face given a face decomposition method:
593  // face-centre-tet : face centre. Returns index of face.
594  // face-planes : face centre. Returns index of face.
595  // face-diagonal : intersection of ray from cellcentre to
596  // facecentre with any of the triangles.
597  // Returns index (0..size-2) of triangle.
598  static pointIndexHit facePoint
599  (
600  const polyMesh&,
601  const label facei,
602  const polyMesh::cellDecomposition
603  );
604 
605 
606  // For database storage
607 
608  const fileName& sampleDatabasePath() const
609  {
610  return *sampleDatabasePtr_;
611  }
612 
613  bool sampleDatabase() const noexcept
614  {
615  return bool(sampleDatabasePtr_);
616  }
617 
618  //- Helper: return path to store data to be sent to processor i
619  static fileName sendPath(const fileName& root, const label proci);
620 
621  virtual fileName sendPath(const label proci) const;
622 
623  //- Helper: return path to store data to be received from
624  //- processor i
625  static fileName receivePath
626  (
627  const fileName& root,
628  const label proci
629  );
630 
631  virtual fileName receivePath(const label proci) const;
632 
633  //- Lookup (sub)objectRegistry from '/' separated path (relative to
634  //- objectRegistry). Creates non-existing intermediate ones.
636  static const objectRegistry& subRegistry
637  (
638  const objectRegistry& obr,
639  const fileName& path
640  );
641 
642  //- Store an IOField on the objectRegistry relative to obr
643  template<class Type>
644  static void storeField
645  (
646  objectRegistry& obr,
647  const word& fieldName,
648  const Field<Type>& values
649  );
650 
651  //- Convert objectRegistry contents into dictionary
652  static void writeDict
653  (
654  const objectRegistry& obr,
655  dictionary& dict
656  );
657 
658  //- (recursively) construct and register IOFields from dictionary
659  static void readDict(const dictionary& d, objectRegistry& obr);
660 
661 
662  // Distribute
663 
664  //- Wrapper around map/interpolate data distribution
665  template<class Type>
666  void distribute(List<Type>& lst) const;
667 
668  //- Wrapper around map/interpolate data distribution with operation
669  template<class Type, class CombineOp>
670  void distribute(List<Type>& lst, const CombineOp& cop) const;
671 
672  //- Wrapper around map/interpolate data distribution
673  template<class Type>
674  void reverseDistribute(List<Type>& lst) const;
675 
676  //- Wrapper around map/interpolate data distribution with operation
677  template<class Type, class CombineOp>
678  void reverseDistribute(List<Type>& lst, const CombineOp& cop) const;
679 
680 
681  // I/O
682 
683  //- Write as a dictionary
684  virtual void write(Ostream& os) const;
685 };
686 
687 
688 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
689 
690 } // End namespace Foam
691 
692 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
693 
694 #include "mappedPatchBaseI.H"
695 
696 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
697 
698 #ifdef NoRepository
699  #include "mappedPatchBaseTemplates.C"
700 #endif
701 
702 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
703 
704 #endif
705 
706 // ************************************************************************* //
label getWorldCommunicator() const
Get the communicator for the world-world connection.
const autoPtr< fileName > sampleDatabasePtr_
Empty or location of database.
word samplePatch_
Patch (if in sampleMode NEARESTPATCH*)
use face normal + distance
nearest point on selected patch
Tuple2< nearInfo, label > nearInfoWorld
nearest + world
dictionary dict
void operator()(nearInfoWorld &x, const nearInfoWorld &y) const
const polyMesh & lookupMesh(const word &region) const
Lookup mesh.
nearest face on selected patch
vector offset_
Offset vector (uniform)
A class for handling file names.
Definition: fileName.H:72
const vector & offset() const noexcept
Offset vector (from patch faces to destination mesh objects)
void operator()(nearInfo &x, const nearInfo &y) const
autoPtr< AMIPatchToPatchInterpolation > AMIPtr_
Pointer to AMI interpolator.
static const Enum< offsetMode > offsetModeNames_
word sampleRegion_
Region to sample.
static bool constructIOField(const word &name, token &tok, Istream &is, objectRegistry &obr)
Attempt to read an IOField<Type> and store on objectRegistry.
autoPtr< mapDistribute > mapPtr_
Communication schedule:
A list of keyword definitions, which are a keyword followed by a number of values (eg...
Definition: dictionary.H:130
tmp< pointField > samplePoints() const
Get the sample points.
const polyPatch & patch_
Patch to sample.
A 2-tuple for storing two objects of dissimilar types. The container is similar in purpose to std::pa...
Definition: stringOps.H:57
const polyMesh & sampleMesh() const
Get the region mesh.
const polyPatch & lookupPatch(const word &sampleRegion, const word &samplePatch) const
Lookup patch.
bool sameRegion_
Same region.
autoPtr< searchableSurface > surfPtr_
Pointer to projection surface employed by AMI interpolator.
const coupleGroupIdentifier coupleGroup_
PatchGroup (if in sampleMode NEARESTPATCH*)
virtual ~mappedPatchBase()
Destructor.
An Istream is an abstract base class for all input systems (streams, files, token lists etc)...
Definition: Istream.H:57
A token holds an item read from Istream.
Definition: token.H:69
Various UniformDimensionedField types.
static fileName sendPath(const fileName &root, const label proci)
Helper: return path to store data to be sent to processor i.
autoPtr< uniformDimensionedScalarField > updateMeshTimePtr_
Local mesh update time.
uniformDimensionedScalarField & updateMeshTime() const
Sample mesh upate time.
scalarField samples(nIntervals, Zero)
static FOAM_NO_DANGLING_REFERENCE const objectRegistry & subRegistry(const objectRegistry &obr, const wordList &names, const label index)
Lookup (sub)objectRegistry by following names of sub registries. Creates non-existing intermediate on...
void setOffset(const scalar normalDist)
Change to normal offset with given distance.
This class describes the interaction of an object (often a face) and a point. It carries the info of ...
Definition: pointIndexHit.H:44
Base class of (analytical or triangulated) surface. Encapsulates all the search routines. WIP.
uniformDimensionedScalarField & updateSampleMeshTime() const
Local mesh update time.
constexpr const T2 & second() const noexcept
Access the second element.
Definition: Tuple2.H:171
const mapDistribute & map() const
Return reference to the parallel distribution map.
vectorField offsets_
Offset vector (nonuniform)
#define FOAM_NO_DANGLING_REFERENCE
Definition: stdFoam.H:81
scalar distance_
Offset distance (normal)
bool sampleDatabase() const noexcept
nearest patch face + AMI interpolation
List< T > values(const HashTable< T, Key, Hash > &tbl, const bool doSort=false)
List of values from HashTable, optionally sorted.
Definition: HashOps.H:164
static void writeDict(const objectRegistry &obr, dictionary &dict)
Convert objectRegistry contents into dictionary.
scalar y
bool sameWorld() const
Is sample world the local world?
word sampleWorld_
World to sample.
vectorField pointField
pointField is a vectorField.
Definition: pointFieldFwd.H:38
static fileName receivePath(const fileName &root, const label proci)
Helper: return path to store data to be received from processor i.
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for expressions::valueTypeCode::INVALID.
Definition: exprTraits.C:127
bool masterWorld() const
Is my world ordered before the sampleWorld?
A class for handling words, derived from Foam::string.
Definition: word.H:63
TypeName("mappedPatchBase")
Runtime type information.
void findSamples(const sampleMode mode, const label myWorldIndex, const pointField &, const labelList &wantedWorlds, const labelList &origProcs, labelList &sampleProcs, labelList &sampleIndices, pointField &sampleLocations) const
Find (global) cells/faces containing samples.
void calcMapping() const
Calculate mapping.
const AMIPatchToPatchInterpolation & AMI(const bool forceUpdate=false) const
Return reference to the AMI interpolator.
Determines a mapping between patch face centres and mesh cell or face centres and processors they&#39;re ...
offsetMode offsetMode_
How to obtain samples.
Encapsulates using "patchGroups" to specify coupled patch.
tmp< pointField > facePoints(const polyPatch &) const
Get the points from face-centre-decomposition face centres and project them onto the face-diagonal-de...
const autoPtr< Foam::searchableSurface > & surfPtr() const
Return a pointer to the AMI projection surface.
static const Enum< sampleMode > sampleModeNames_
virtual void initGeometry(PstreamBuffers &)
Initialise the calculation of the patch geometry.
const direction noexcept
Definition: scalarImpl.H:265
A Vector of values with scalar precision, where scalar is float/double depending on the compilation f...
const fileName & sampleDatabasePath() const
label sampleSize() const
Return size of mapped mesh/patch/boundary.
fileName path(UMean.rootPath()/UMean.caseName()/"graphs"/UMean.instance())
virtual void write(Ostream &os) const
Write as a dictionary.
static pointIndexHit facePoint(const polyMesh &, const label facei, const polyMesh::cellDecomposition)
Get a point on the face given a face decomposition method:
static autoPtr< fileName > readDatabase(const dictionary &dict)
Read optional database name from dictionary.
virtual void initMovePoints(PstreamBuffers &, const pointField &)
Initialise the patches for moving points.
Buffers for inter-processor communications streams (UOPstream, UIPstream).
offsetMode
How to project face centres.
dictionary surfDict_
Dictionary storing projection surface description.
autoPtr< uniformDimensionedScalarField > updateSampleMeshTimePtr_
Sample mesh update time.
void operator()(nearInfo &x, const nearInfo &y) const
void distribute(List< Type > &lst) const
Wrapper around map/interpolate data distribution.
label comm() const
Identical to getCommunicator()
label getCommunicator() const
Get the communicator (worldComm or world-to-world)
sampleMode mode() const noexcept
What to sample.
decomposeUsingBbs false
Use bounding boxes (default) or unique decomposition of triangles (i.e. do not duplicate triangles) ...
virtual void movePoints(PstreamBuffers &, const pointField &)
Correct patches after moving points.
bool owner() const
Is it owner.
Class containing processor-to-processor mapping information.
void calcAMI() const
Calculate AMI interpolator.
Tuple2< pointIndexHit, Tuple2< scalar, label > > nearInfo
Helper class for finding nearest.
bool sameRegion() const noexcept
Cached sampleRegion != mesh.name()
const word & coupleGroup() const
PatchGroup (only if NEARESTPATCHFACE)
nearest cell containing sample
sampleMode
Mesh items to sample.
nearest cell (even if not containing cell)
Interpolation class dealing with transfer of data between two primitive patches with an arbitrary mes...
const word & sampleWorld() const noexcept
World to sample.
constexpr const T1 & first() const noexcept
Access the first element.
Definition: Tuple2.H:161
const bool AMIReverse_
Flag to indicate that slave patch should be reversed for AMI.
static void readDict(const dictionary &d, objectRegistry &obr)
(recursively) construct and register IOFields from dictionary
static bool writeIOField(const regIOobject &obj, dictionary &dict)
Attempt to detect an IOField<Type> and write to dictionary.
regIOobject is an abstract class derived from IOobject to handle automatic object registration with t...
Definition: regIOobject.H:68
const word & samplePatch() const
Patch (only if NEARESTPATCHFACE)
void reverseDistribute(List< Type > &lst) const
Wrapper around map/interpolate data distribution.
Pointer management similar to std::unique_ptr, with some additional methods and type checking...
Definition: HashPtrTable.H:48
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:76
void collectSamples(const label mySampleWorld, const pointField &facePoints, pointField &samples, labelList &patchFaceWorlds, labelList &patchFaceProcs, labelList &patchFaces, pointField &patchFc) const
Collect single list of samples and originating processor+face + wanted world.
auto & names
A class for managing temporary objects.
Definition: HashPtrTable.H:50
Registry of regIOobjects.
A patch is a list of labels that address the faces in the global face list.
Definition: polyPatch.H:69
const word & sampleRegion() const
Region to sample.
label communicator_
Communicator.
virtual void updateMesh(PstreamBuffers &)
Update of the patch topology.
const polyPatch & samplePolyPatch() const
Get the patch on the region.
virtual void calcGeometry(PstreamBuffers &)
Calculate the patch geometry.
virtual void initUpdateMesh(PstreamBuffers &)
Initialise the update of the patch topology.
static void storeField(objectRegistry &obr, const word &fieldName, const Field< Type > &values)
Store an IOField on the objectRegistry relative to obr.
bool addWorldConnection()
Add a world-world connection.
mappedPatchBase(const polyPatch &)
Construct from patch.
void findLocalSamples(const sampleMode mode, const label sampleWorld, const word &sampleRegion, const word &samplePatch, const pointField &samplePoints, List< nearInfoWorld > &nearest) const
Find (local) cells/faces containing samples.
const vectorField & offsets() const noexcept
Offset vectors (from patch faces to destination mesh objects)
uindirectPrimitivePatch pp(UIndirectList< face >(mesh.faces(), faceLabels), mesh.points())
Namespace for OpenFOAM.
const sampleMode mode_
What to sample.