68 if (
dict.found(
"offsetMode"))
74 const bool haveDistance =
dict.found(
"distance");
75 const bool haveOffset =
dict.found(
"offset");
77 if (haveDistance == haveOffset)
82 else if (haveDistance)
102 const polyMesh& nbrMesh = this->nbrMesh();
107 labelList sampleGlobalPatchFaces, sampleIndices;
117 forAll(procSamplePoints, proci)
119 forAll(procSamplePoints[proci], procSamplei)
123 patchGlobalIndex.
toGlobal(proci, procSamplei)
124 ] = procSamplePoints[proci][procSamplei];
136 const point&
p = allPoints[alli];
145 allNearest[alli].elementi = celli;
163 if (allNearest[alli].proci == -1)
176 <<
"Did not find a containing cell for " << nNotFound
178 <<
" total faces. Using nearest cell for these faces instead."
179 <<
endl <<
"On patch " << patch_.
name() <<
" on region "
180 << nbrRegionName() <<
" with offset mode "
181 << offsetModeNames_[offsetMode_] <<
"." <<
endl;
186 const point&
p = allPoints[alli];
188 if (allNearest[alli].proci == -1)
193 allNearest[alli].elementi = pih.
index();
213 samplePatchGlobalFacesDyn.
append(alli);
214 sampleIndicesDyn.
append(allNearest[alli].elementi);
217 sampleGlobalPatchFaces.
transfer(samplePatchGlobalFacesDyn);
218 sampleIndices.
transfer(sampleIndicesDyn);
228 sampleGlobalPatchFaces,
232 const labelList oldToNew(move(sampleGlobalPatchFaces));
233 const labelList oldSampleIndices(move(sampleIndices));
236 cellIndices_ =
labelList(mapPtr_->constructSize(), -1);
246 move(mapPtr_->constructMap()),
247 move(mapPtr_->subMap())
264 mapPtr_->distribute(ccs);
265 forAll(patch_, patchFacei)
267 const point& fc = patch_.faceCentres()[patchFacei];
268 const point mid = 0.51*fc + 0.49*ccs[patchFacei];
274 mapPtr_->reverseDistribute(cellIndices_.size(), fcs);
277 const label celli = cellIndices_[i];
278 if (celli == -1)
continue;
280 const point mid = 0.51*cc + 0.49*fcs[i];
295 nbrRegionName_(patch_.boundaryMesh().mesh().
name()),
298 offset_(
vector::uniform(NaN)),
307 const word& neighbourRegion
311 nbrRegionName_(neighbourRegion),
314 offset_(
vector::uniform(NaN)),
329 dict.lookupOrDefaultBackwardsCompatible<
word>
331 {
"neighbourRegion",
"sampleRegion"},
332 patch_.boundaryMesh().mesh().name()
335 offsetMode_(readOffsetMode(
dict)),
338 offsetMode_ == NORMAL
344 offsetMode_ == DIRECTION
360 nbrRegionName_(mpb.nbrRegionName_),
361 offsetMode_(mpb.offsetMode_),
362 distance_(mpb.distance_),
363 offset_(mpb.offset_),
402 forAll(patch_, patchFacei)
406 const face&
f = patch_[patchFacei];
407 const point& fc = patch_.faceCentres()[patchFacei];
409 result[patchFacei] = fc;
413 const label facei = patch_.start() + patchFacei;
414 const label celli = patch_.faceCells()[patchFacei];
421 for (
label tetPtI = 1; tetPtI <
f.
size() - 1; tetPtI ++)
423 const label facePtI = (tetPtI + faceBasePtI) %
f.
size();
438 result[patchFacei] = hitInfo.
hitPoint();
449 result += distance_*patch_.faceNormals();
463 cellIndices_.clear();
483 patch_.boundaryMesh().mesh().
name(),
487 writeEntry(os,
"offsetMode", offsetModeNames_[offsetMode_]);
#define forAll(list, i)
Loop across all elements in list.
Macros for easy insertion into run-time selection tables.
DynamicList< T, SizeInc, SizeMult, SizeDiv > & append(const T &)
Append an element at the end of the list.
virtual const fileName & name() const
Return the name of the stream.
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.
Initialise the NamedEnum HashTable from the static list of names.
Enum read(Istream &) const
Read a word from Istream and return the corresponding.
OFstream which keeps track of vertices.
virtual Ostream & write(const char)
Write character.
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
const Point & hitPoint() const
Return hit point.
scalar distance() const
Return distance to hit.
bool hit() const
Is there a hit.
This class describes the interaction of (usually) a face and a point. It carries the info of a succes...
const Point & hitPoint() const
Return hit point.
label index() const
Return index.
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 with indirect addressing.
label fcIndex(const label i) const
Return the forward circular index, i.e. the next index.
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)
static Form uniform(const Cmpt &s)
Return a VectorSpace with all elements = s.
A list of keyword definitions, which are a keyword followed by any number of values (e....
ITstream & lookup(const word &, bool recursive=false, bool patternMatch=true) const
Find and return an entry data stream.
bool found(const word &, bool recursive=false, bool patternMatch=true) const
Search dictionary for given keyword.
Class containing processor-to-processor mapping information.
A face is a list of labels corresponding to mesh vertices.
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.
label findInside(const point &) const
Find shape containing point. Only implemented for certain.
Engine which provides mapping from cells to patch faces.
virtual void write(Ostream &) const
Write as a dictionary.
const polyMesh & nbrMesh() const
Get the region mesh.
tmp< pointField > samplePoints() const
Get the sample points.
virtual ~mappedInternalPatchBase()
Destructor.
static const NamedEnum< offsetMode, 2 > offsetModeNames_
offsetMode
How to project face centres.
static bool specified(const dictionary &dict)
Return whether or not the given dictionary contains a.
void calcMapping() const
Calculate mapping.
mappedInternalPatchBase(const polyPatch &)
Construct from patch.
offsetMode readOffsetMode(const dictionary &dict) const
Read the offset mode from a dictionary.
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 polyMesh & mesh() const
Return the mesh reference.
Mesh consisting of general polyhedral cells.
const labelIOList & tetBasePtIs() const
Return the tetBasePtIs.
const polyBoundaryMesh & boundaryMesh() const
Return boundary mesh.
virtual const pointField & points() const
Return raw points.
const indexedOctree< treeDataCell > & cellTree() const
Return the cell search tree.
A patch is a list of labels that address the faces in the global face list.
const vectorField & cellCentres() const
A class for managing temporary objects.
T & ref() const
Return non-const reference or generate a fatal error.
A triangle primitive used to calculate face areas and swept volumes.
pointHit intersection(const point &p, const vector &q, const intersection::algorithm alg, const scalar tol=0.0) const
Fast intersection with a ray.
A class for handling words, derived from string.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
#define WarningInFunction
Report a warning using Foam::Warning.
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.
line< point, const point & > linePointRef
Line using referred points.
word name(const bool)
Return a word representation of a bool.
vectorField pointField
pointField is a vectorField.
void writeEntry(Ostream &os, const HashTable< T, Key, Hash > &ht)
T returnReduce(const T &Value, const BinaryOp &bop, const int tag=Pstream::msgType(), const label comm=UPstream::worldComm)
defineTypeNameAndDebug(combustionModel, 0)
dimensioned< scalar > magSqr(const dimensioned< Type > &)
Operator to take smallest valid value.