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 nbrRegionName_(patch_.boundaryMesh().mesh().
name()),
328 nbrPatchName_(patch_.
name()),
331 treeMapPtr_(nullptr),
332 treeNbrPatchFaceIndices_(),
333 patchToPatchIsValid_(false),
334 patchToPatchPtr_(nullptr),
335 matchTol_(defaultMatchTol_),
336 reMapAfterMove_(true),
344 const word& nbrRegionName,
345 const word& nbrPatchName,
351 nbrRegionName_(nbrRegionName),
352 nbrPatchName_(nbrPatchName),
355 treeMapPtr_(nullptr),
356 treeNbrPatchFaceIndices_(),
357 patchToPatchIsValid_(false),
358 patchToPatchPtr_(nullptr),
359 matchTol_(defaultMatchTol_),
360 reMapAfterMove_(true),
369 const bool defaultTransformIsNone
377 :
dict.lookupOrDefaultBackwardsCompatible<
word>
379 {
"neighbourRegion",
"sampleRegion"},
380 pp.boundaryMesh().mesh().name()
391 treeMapPtr_(
nullptr),
392 treeNbrPatchFaceIndices_(),
393 patchToPatchIsValid_(
false),
408 const bool haveCoupleGroup = coupleGroup_.valid();
410 const bool haveNbrRegion =
412 const bool haveNbrPatch =
417 if ((haveNbrRegion || haveNbrPatch || isSamePatch) && haveCoupleGroup)
420 <<
"Either neighbourRegion/Patch information or a coupleGroup "
424 if (haveNbrPatch && isSamePatch)
427 <<
"Either a neighbourPatch should be specified, or samePatch "
440 coupleGroup_(mpb.coupleGroup_),
441 nbrRegionName_(mpb.nbrRegionName_),
442 nbrPatchName_(mpb.nbrPatchName_),
443 transform_(mpb.transform_),
444 usingTree_(mpb.usingTree_),
445 treeMapPtr_(nullptr),
446 treeNbrPatchFaceIndices_(),
447 patchToPatchIsValid_(false),
454 matchTol_(mpb.matchTol_),
455 reMapAfterMove_(true),
479 const polyMesh& nbrMesh = this->nbrMesh();
486 <<
"Cannot find patch " << nbrPatchName()
487 <<
" in region " << nbrRegionName() <<
endl
501 if (!isA<mappedPatchBase>(patch))
504 <<
"Patch " << patch.
name() <<
" is not of type "
508 return refCast<const mappedPatchBase>(patch);
517 treeNbrPatchFaceIndices_.clear();
518 patchToPatchIsValid_ =
false;
541 coupleGroup_.write(os);
543 transform_.write(os);
547 writeEntry(os,
"method", patchToPatchPtr_->type());
552 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.
A list of faces which address into the list of points.
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,.
ITstream & lookupBackwardsCompatible(const wordList &, bool recursive=false, bool patternMatch=true) const
Find and return an entry data stream, trying a list of keywords.
bool found(const word &, bool recursive=false, bool patternMatch=true) const
Search dictionary for given keyword.
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.
Engine which provides mapping between two patches.
tmp< pointField > nbrPatchLocalPoints() const
Get the local points for the neighbour patch.
const polyPatch & nbrPolyPatch() const
Get the patch to map from.
static const mappedPatchBase & getMap(const polyPatch &patch)
Cast the given polyPatch to a mappedPatchBase. Handle errors.
const polyPatch & patch_
Patch to map to.
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.
const polyMesh & nbrMesh() const
Get the mesh for the region to map from.
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.
static bool specified(const dictionary &dict)
Return whether or not the given dictionary contains a.
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 Time & time() const
Return time.
const Type & lookupObject(const word &name) const
Lookup and return the object of the given Type and name.
const word & name() const
Return name.
Class to generate coupling geometry between two primitive patches.
static autoPtr< patchToPatch > New(const word &patchToPatchType, const bool reverse)
Select from name.
label findPatchID(const word &patchName) const
Find patch index given a name.
wordList names() const
Return a list of patch names.
const polyMesh & mesh() const
Return the mesh reference.
Mesh consisting of general polyhedral cells.
const polyBoundaryMesh & boundaryMesh() const
Return boundary mesh.
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.
static const word null
An empty word.
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
bool valid(const PtrList< ModelType > &l)
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)
Ostream & endl(Ostream &os)
Add newline and flush stream.
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)
word name(const complex &)
Return a string representation of a complex.
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.