49 return patch_.primitivePatch::faceAreas();
55 return patch_.primitivePatch::faceCentres();
61 return patch_.localPoints();
69 ? nbrMappedPatch().patchFaceAreas()
78 ? nbrMappedPatch().patchFaceCentres()
87 ? nbrMappedPatch().patchLocalPoints()
94 const label bothMappingIsValid =
96 ?
min(mappingIsValid_, nbrMappedPatch().nbrMappingIsValid_)
100 (bothMappingIsValid == 2)
102 bothMappingIsValid == 1
116 if (sameUntransformedPatch())
119 <<
"Patch " << patch_.name() <<
" is mapping itself with no "
120 <<
"transform. Mapping data does not need to be constructed."
132 nbrPolyPatch().
name(),
133 nbrPatchFaceCentres(),
136 ? nbrMappedPatch().transform_
148 labelList sampleGlobalPatchFaces, sampleIndices;
155 transform_.transform().invTransformPosition
162 forAll(procSamplePoints, proci)
164 forAll(procSamplePoints[proci], procSamplei)
168 patchGlobalIndex.
toGlobal(proci, procSamplei)
169 ] = procSamplePoints[proci][procSamplei];
178 if (nbrPolyPatch().empty())
182 allNearest[alli].proci = -1;
183 allNearest[alli].elementi = -1;
187 else if (nbrPolyPatch().size() == 1)
189 const pointField nbrPoints(nbrPatchFaceCentres());
193 const point&
p = allPoints[alli];
196 allNearest[alli].elementi = 0;
202 const pointField nbrPoints(nbrPatchFaceCentres());
220 const point&
p = allPoints[alli];
228 allNearest[alli].elementi = pih.
index();
229 allNearest[alli].
data =
249 if (allNearest[alli].proci == -1)
259 <<
"Mapping to patch '" << patch_.name();
264 << patch_.boundaryMesh().mesh().name();
267 <<
"' from patch '" << nbrPatchName();
271 <<
"' in region '" << nbrRegionName();
284 samplePatchGlobalFacesDyn.
append(alli);
285 sampleIndicesDyn.
append(allNearest[alli].elementi);
288 sampleGlobalPatchFaces.
transfer(samplePatchGlobalFacesDyn);
289 sampleIndices.
transfer(sampleIndicesDyn);
299 sampleGlobalPatchFaces,
303 const labelList oldToNew(move(sampleGlobalPatchFaces));
304 const labelList oldSampleIndices(move(sampleIndices));
307 treeNbrPatchFaceIndices_ =
labelList(treeMapPtr_->constructSize(), -1);
318 move(treeMapPtr_->constructMap()),
319 move(treeMapPtr_->subMap())
325 const pointField patchLocalPoints(this->patchLocalPoints());
326 const pointField nbrPatchLocalPoints(this->nbrPatchLocalPoints());
335 SubList<face>(nbrPolyPatch().localFaces(), nbrPolyPatch().size()),
339 patchToPatchPtr_->update
344 transform_.transform()
348 auto checkPatchToPatch = [&]
357 ? patchToPatchPtr_->srcCoupled()
358 : patchToPatchPtr_->tgtCoupled();
361 forAll(coupled, patchFacei)
363 if (!coupled[patchFacei])
369 if (nonCoupledCfs.
size())
372 <<
"Mapping to patch '" << patch.name();
377 << patch.boundaryMesh().mesh().name();
380 <<
"' from patch '" << nbrPatch.name();
385 << nbrPatch.boundaryMesh().mesh().name();
388 <<
"' failed because faces at the following locations "
389 <<
"were not coupled: " << nonCoupledCfs
394 checkPatchToPatch(patch_, nbrPolyPatch(),
true);
398 checkPatchToPatch(nbrPolyPatch(), patch_,
false);
404 if (nbrPatchIsMapped()) nbrMappedPatch().nbrMappingIsValid_ = 2;
411 treeNbrPatchFaceIndices_.clear();
421 treeMapPtr_(nullptr),
422 treeNbrPatchFaceIndices_(),
423 patchToPatchPtr_(nullptr),
424 matchTol_(defaultMatchTol_),
426 nbrMappingIsValid_(0)
433 const word& nbrRegionName,
434 const word& nbrPatchName,
440 treeMapPtr_(nullptr),
441 treeNbrPatchFaceIndices_(),
442 patchToPatchPtr_(nullptr),
443 matchTol_(defaultMatchTol_),
445 nbrMappingIsValid_(0)
458 treeMapPtr_(nullptr),
459 treeNbrPatchFaceIndices_(),
465 dict.lookupBackwardsCompatible<
word>({
"method",
"sampleMode"}),
472 nbrMappingIsValid_(0)
483 usingTree_(mpb.usingTree_),
484 treeMapPtr_(nullptr),
485 treeNbrPatchFaceIndices_(),
492 matchTol_(mpb.matchTol_),
494 nbrMappingIsValid_(0)
511 if (!isA<mappedPatchBase>(patch))
514 <<
"Patch " << patch.
name() <<
" is not of type "
518 return refCast<const mappedPatchBase>(patch);
524 if (move && moveUpdate_ == moveUpdate::never)
528 else if (move && moveUpdate_ == moveUpdate::detect)
530 mappingIsValid_ =
min(mappingIsValid_, 1);
531 nbrMappingIsValid_ =
min(nbrMappingIsValid_, 1);
537 nbrMappingIsValid_ = 0;
548 writeEntry(os,
"method", patchToPatchPtr_->type());
#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.
void size(const label)
Override size to be inconsistent with allocated storage.
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 keywords followed by any number of values (e.g. words and numbers) or sub-dictionaries.
T lookupOrDefault(const word &, const T &, const bool writeDefault=writeOptionalEntries > 0) 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.
transformType
The type of the transformation permitted/required by this patch.
static bool moving(const polyPatch &patch, const polyPatch &nbrPatch)
Return whether or not the patches have moved.
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.
virtual void clearOut() const
Clear out data on mesh change.
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.
bool mappingIsValid() const
Return whether or not the mapping is valid.
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.
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.
layerAndWeight min(const layerAndWeight &a, const layerAndWeight &b)
void writeEntry(Ostream &os, const HashTable< T, Key, Hash > &ht)
dimensionSet transform(const dimensionSet &)
defineTypeNameAndDebug(combustionModel, 0)
void sqr(LagrangianPatchField< typename outerProduct< Type, Type >::type > &f, const LagrangianPatchField< Type > &f1)
word name(const LagrangianState state)
Return a string representation of a Lagrangian state enumeration.
void magSqr(LagrangianPatchField< scalar > &f, const LagrangianPatchField< Type > &f1)
tmp< DimensionedField< TypeR, GeoMesh, Field > > New(const tmp< DimensionedField< TypeR, GeoMesh, Field >> &tdf1, const word &name, const dimensionSet &dimensions)
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.