60 if (
dict.found(
"offsetMode"))
66 const bool haveDistance =
dict.found(
"distance");
67 const bool haveOffset =
dict.found(
"offset");
69 if (haveDistance == haveOffset)
74 else if (haveDistance)
94 const polyMesh& nbrMesh = this->nbrMesh();
99 labelList sampleGlobalPatchFaces, sampleIndices;
109 forAll(procSamplePoints, proci)
111 forAll(procSamplePoints[proci], procSamplei)
115 patchGlobalIndex.
toGlobal(proci, procSamplei)
116 ] = procSamplePoints[proci][procSamplei];
128 const point&
p = allPoints[alli];
137 allNearest[alli].elementi = celli;
155 if (allNearest[alli].proci == -1)
168 <<
"Did not find a containing cell for " << nNotFound
170 <<
" total faces. Using nearest cell for these faces instead."
171 <<
endl <<
"On patch " << patch_.
name() <<
" on region "
172 << nbrRegionName() <<
" with offset mode "
173 << offsetModeNames_[offsetMode_] <<
"." <<
endl;
178 const point&
p = allPoints[alli];
180 if (allNearest[alli].proci == -1)
185 allNearest[alli].elementi = pih.
index();
205 samplePatchGlobalFacesDyn.
append(alli);
206 sampleIndicesDyn.
append(allNearest[alli].elementi);
209 sampleGlobalPatchFaces.
transfer(samplePatchGlobalFacesDyn);
210 sampleIndices.
transfer(sampleIndicesDyn);
220 sampleGlobalPatchFaces,
224 const labelList oldToNew(move(sampleGlobalPatchFaces));
225 const labelList oldSampleIndices(move(sampleIndices));
228 cellIndices_ =
labelList(mapPtr_->constructSize(), -1);
238 move(mapPtr_->constructMap()),
239 move(mapPtr_->subMap())
256 mapPtr_->distribute(ccs);
257 forAll(patch_, patchFacei)
259 const point& fc = patch_.faceCentres()[patchFacei];
260 const point mid = 0.51*fc + 0.49*ccs[patchFacei];
266 mapPtr_->reverseDistribute(cellIndices_.size(), fcs);
269 const label celli = cellIndices_[i];
270 if (celli == -1)
continue;
272 const point mid = 0.51*cc + 0.49*fcs[i];
287 nbrRegionName_(patch_.boundaryMesh().
mesh().
name()),
290 offset_(
vector::uniform(NaN)),
299 const word& neighbourRegion
303 nbrRegionName_(neighbourRegion),
306 offset_(
vector::uniform(NaN)),
321 dict.lookupOrDefaultBackwardsCompatible<
word>
323 {
"neighbourRegion",
"sampleRegion"},
324 patch_.boundaryMesh().mesh().name()
327 offsetMode_(readOffsetMode(
dict)),
330 offsetMode_ == NORMAL
336 offsetMode_ == DIRECTION
352 nbrRegionName_(mpb.nbrRegionName_),
353 offsetMode_(mpb.offsetMode_),
354 distance_(mpb.distance_),
355 offset_(mpb.offset_),
394 forAll(patch_, patchFacei)
398 const face&
f = patch_[patchFacei];
399 const point& fc = patch_.faceCentres()[patchFacei];
401 result[patchFacei] = fc;
405 const label facei = patch_.start() + patchFacei;
406 const label celli = patch_.faceCells()[patchFacei];
413 for (
label tetPtI = 1; tetPtI <
f.
size() - 1; tetPtI ++)
415 const label facePtI = (tetPtI + faceBasePtI) %
f.
size();
430 result[patchFacei] = hitInfo.
hitPoint();
441 result += distance_*patch_.faceNormals();
455 cellIndices_.clear();
475 patch_.boundaryMesh().mesh().
name(),
479 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 keywords followed by any number of values (e.g. words and numbers) or sub-dictionaries.
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.
Foam::fvMesh mesh(Foam::IOobject(regionName, runTime.name(), runTime, Foam::IOobject::MUST_READ), false)
#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.
Ostream & endl(Ostream &os)
Add newline and flush stream.
line< point, const point & > linePointRef
Line using referred points.
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)
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)
Operator to take smallest valid value.