49 return patch_.primitivePatch::faceAreas();
55 return patch_.primitivePatch::faceCentres();
61 return patch_.localPoints();
69 ? nbrMappedPatch().patchFaceAreas()
78 ? nbrMappedPatch().patchFaceCentres()
87 ? nbrMappedPatch().patchLocalPoints()
94 if (treeMapPtr_.valid())
100 if (sameUntransformedPatch())
103 <<
"Patch " << patch_.name() <<
" is mapping itself with no "
104 <<
"transform. Mapping data does not need to be constructed."
116 nbrPolyPatch().
name(),
117 nbrPatchFaceCentres(),
120 ? nbrMappedPatch().transform_
132 labelList sampleGlobalPatchFaces, sampleIndices;
139 transform_.transform().invTransformPosition
146 forAll(procSamplePoints, proci)
148 forAll(procSamplePoints[proci], procSamplei)
152 patchGlobalIndex.
toGlobal(proci, procSamplei)
153 ] = procSamplePoints[proci][procSamplei];
162 if (nbrPolyPatch().empty())
166 allNearest[alli].proci = -1;
167 allNearest[alli].elementi = -1;
173 const pointField nbrPoints(nbrPatchFaceCentres());
191 const point&
p = allPoints[alli];
199 allNearest[alli].elementi = pih.
index();
200 allNearest[alli].
data =
220 if (allNearest[alli].proci == -1)
233 <<
"Mapping failed for " <<
nl
234 <<
" patch: " << patch_.name() <<
nl
235 <<
" neighbourRegion: " << nbrRegionName() <<
nl
236 <<
" neighbourPatch: " << nbrPatchName() <<
nl
247 samplePatchGlobalFacesDyn.
append(alli);
248 sampleIndicesDyn.
append(allNearest[alli].elementi);
251 sampleGlobalPatchFaces.
transfer(samplePatchGlobalFacesDyn);
252 sampleIndices.
transfer(sampleIndicesDyn);
262 sampleGlobalPatchFaces,
266 const labelList oldToNew(move(sampleGlobalPatchFaces));
267 const labelList oldSampleIndices(move(sampleIndices));
270 treeNbrPatchFaceIndices_ =
labelList(treeMapPtr_->constructSize(), -1);
281 move(treeMapPtr_->constructMap()),
282 move(treeMapPtr_->subMap())
288 if (patchToPatchIsValid_)
294 const pointField patchLocalPoints(this->patchLocalPoints());
295 const pointField nbrPatchLocalPoints(this->nbrPatchLocalPoints());
304 SubList<face>(nbrPolyPatch().localFaces(), nbrPolyPatch().size()),
308 patchToPatchPtr_->update
313 transform_.transform()
316 patchToPatchIsValid_ =
true;
327 treeMapPtr_(nullptr),
328 treeNbrPatchFaceIndices_(),
329 patchToPatchIsValid_(false),
330 patchToPatchPtr_(nullptr),
331 matchTol_(defaultMatchTol_),
332 reMapAfterMove_(true),
340 const word& nbrRegionName,
341 const word& nbrPatchName,
347 treeMapPtr_(nullptr),
348 treeNbrPatchFaceIndices_(),
349 patchToPatchIsValid_(false),
350 patchToPatchPtr_(nullptr),
351 matchTol_(defaultMatchTol_),
352 reMapAfterMove_(true),
361 const bool defaultTransformIsNone
366 treeMapPtr_(nullptr),
367 treeNbrPatchFaceIndices_(),
368 patchToPatchIsValid_(false),
374 dict.lookupBackwardsCompatible<
word>({
"method",
"sampleMode"}),
392 usingTree_(mpb.usingTree_),
393 treeMapPtr_(nullptr),
394 treeNbrPatchFaceIndices_(),
395 patchToPatchIsValid_(false),
402 matchTol_(mpb.matchTol_),
403 reMapAfterMove_(mpb.reMapAfterMove_),
421 if (!isA<mappedPatchBase>(patch))
424 <<
"Patch " << patch.
name() <<
" is not of type "
428 return refCast<const mappedPatchBase>(patch);
437 treeNbrPatchFaceIndices_.clear();
438 patchToPatchIsValid_ =
false;
450 writeEntry(os,
"method", patchToPatchPtr_->type());
455 writeEntryIfDifferent<bool>(os,
"reMapAfterMove",
true, reMapAfterMove_);
#define forAll(list, i)
Loop across all elements in list.
DynamicList< T, SizeInc, SizeMult, SizeDiv > & append(const T &)
Append an element at the end of the list.
void transfer(List< T > &)
Transfer the contents of the argument List into this list.
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
This class describes the interaction of (usually) a face and a point. It carries the info of a succes...
label index() const
Return index.
bool hit() const
Is there a hit.
const Field< PointType > & pointNormals() const
Return point normals for patch.
const Field< PointType > & faceAreas() const
Return face areas for patch.
const Field< PointType > & faceCentres() const
Return face centres for patch.
static void scatterList(const List< commsStruct > &comms, List< T > &Values, const int tag, const label comm)
Scatter data. Reverse of gatherList.
static void listCombineGather(const List< commsStruct > &comms, List< T > &Value, const CombineOp &cop, const int tag, const label comm)
static void listCombineScatter(const List< commsStruct > &comms, List< T > &Value, const int tag, const label comm)
Scatter data. Reverse of combineGather.
static void gatherList(const List< commsStruct > &comms, List< T > &Values, const int tag, const label comm)
Gather data but keep individual values separate.
A List obtained as a section of another List.
A List with indirect addressing.
T * data()
Return a pointer to the first data element,.
static label nProcs(const label communicator=0)
Number of processes in parallel run.
static int myProcNo(const label communicator=0)
Number of this process (starting from masterNo() = 0)
vector span() const
The bounding box span (from minimum to maximum)
A list of keyword definitions, which are a keyword followed by any number of values (e....
T lookupOrDefault(const word &, const T &, bool recursive=false, bool patternMatch=true) const
Find and return a T, if not found return the given default.
Class containing processor-to-processor mapping information.
Calculates a unique integer (label so might not have enough room - 2G max) for processor + local inde...
label size() const
Global sum of localSizes.
label toGlobal(const label i) const
From local to global.
Non-pointer based hierarchical recursive searching.
Base class for engines and poly patches which provide mapping between two poly patches.
const polyPatch & patch_
Patch to map to.
virtual void write(Ostream &) const
Write as a dictionary.
Engine and base class for poly patches which provides interpolative mapping between two globally conf...
tmp< pointField > nbrPatchLocalPoints() const
Get the local points for the neighbour patch.
static const mappedPatchBase & getMap(const polyPatch &patch)
Cast the given polyPatch to a mappedPatchBase. Handle errors.
virtual void write(Ostream &) const
Write as a dictionary.
virtual tmp< vectorField > patchFaceAreas() const
Get the face-areas for this patch.
virtual tmp< pointField > patchLocalPoints() const
Get the local points for this patch.
static const scalar defaultMatchTol_
Default Matching tolerance.
mappedPatchBase(const polyPatch &)
Construct from patch.
tmp< vectorField > nbrPatchFaceAreas() const
Get the face-areas for the neighbour patch.
tmp< pointField > nbrPatchFaceCentres() const
Get the face-centres for the neighbour patch.
virtual ~mappedPatchBase()
Destructor.
void calcMapping() const
Calculate mapping.
virtual tmp< pointField > patchFaceCentres() const
Get the face-centres for this patch.
virtual void clearOut()
Clear out data on mesh change.
const word & name() const
Return name.
Class to generate coupling geometry between two primitive patches.
A patch is a list of labels that address the faces in the global face list.
A class for managing temporary objects.
Standard boundBox + extra functionality for use in octree.
Holds (reference to) pointField. Encapsulation of data needed for octree searches....
A class for handling words, derived from string.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
errorManipArg< error, int > exit(error &err, const int errNo=1)
void writeEntryIfDifferent(Ostream &os, const word &entryName, const EntryType &value1, const EntryType &value2)
Helper function to write the keyword and entry only if the.
List< label > labelList
A List of labels.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
dimensionedSymmTensor sqr(const dimensionedVector &dv)
word name(const bool)
Return a word representation of a bool.
void writeEntry(Ostream &os, const HashTable< T, Key, Hash > &ht)
dimensionSet transform(const dimensionSet &)
defineTypeNameAndDebug(combustionModel, 0)
tmp< DimensionedField< TypeR, GeoMesh > > New(const tmp< DimensionedField< TypeR, GeoMesh >> &tdf1, const word &name, const dimensionSet &dimensions)
dimensioned< scalar > magSqr(const dimensioned< Type > &)
fileType type(const fileName &, const bool checkVariants=true, const bool followLink=true)
Return the file type: directory or file.
Operator to take smallest valid value.