59 if (
dict.found(
"offsetMode"))
65 const bool haveDistance =
dict.found(
"distance");
66 const bool haveOffset =
dict.found(
"offset");
68 if (haveDistance == haveOffset)
73 else if (haveDistance)
93 const polyMesh& nbrMesh = this->nbrMesh();
100 labelList sampleGlobalPatchFaces, sampleIndices;
110 forAll(procSamplePoints, proci)
112 forAll(procSamplePoints[proci], procSamplei)
116 patchGlobalIndex.
toGlobal(proci, procSamplei)
117 ] = 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;
177 const point&
p = allPoints[alli];
179 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())
258 mapPtr_->distribute(ccs);
259 forAll(patch_, patchFacei)
261 const point& fc = patchFaceCentres[patchFacei];
262 const point mid = 0.51*fc + 0.49*ccs[patchFacei];
268 mapPtr_->reverseDistribute(cellIndices_.size(), fcs);
271 const label celli = cellIndices_[i];
272 if (celli == -1)
continue;
274 const point mid = 0.51*cc + 0.49*fcs[i];
289 nbrRegionName_(patch_.
mesh().
name()),
292 offset_(
vector::uniform(NaN)),
301 const word& neighbourRegion
305 nbrRegionName_(neighbourRegion),
308 offset_(
vector::uniform(NaN)),
323 dict.lookupOrDefaultBackwardsCompatible<
word>
325 {
"neighbourRegion",
"sampleRegion"},
329 offsetMode_(readOffsetMode(
dict)),
332 offsetMode_ == NORMAL
338 offsetMode_ == DIRECTION
354 nbrRegionName_(mpb.nbrRegionName_),
355 offsetMode_(mpb.offsetMode_),
356 distance_(mpb.distance_),
357 offset_(mpb.offset_),
397 forAll(patch_, patchFacei)
401 const face&
f = patch_[patchFacei];
402 const point& fc = patchFaceCentres[patchFacei];
404 result[patchFacei] = fc;
408 const label facei = patch_.start() + patchFacei;
409 const label celli = patch_.faceCells()[patchFacei];
416 for (
label tetPtI = 1; tetPtI <
f.
size() - 1; tetPtI ++)
418 const label facePtI = (tetPtI + faceBasePtI) %
f.
size();
433 result[patchFacei] = hitInfo.
hitPoint();
444 result += distance_*patch_.faceNormals();
458 cellIndices_.clear();
478 patch_.mesh().
name(),
482 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.
Pre-declare related SubField type.
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.
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.
Mesh object that implements searches within the local cells and faces.
label findCell(const point &p, const pointInCellShapes=pointInCellShapes::tets) const
Find the cell containing the given point.
static const meshSearch & New(const polyMesh &mesh, const pointInCellShapes=pointInCellShapes::tets)
Lookup or construct from mesh and cell decomposition option.
const indexedOctree< treeDataCell > & cellTree() const
Access the cell tree.
const Time & time() const
Return time.
const Type & lookupObject(const word &name) const
Lookup and return the object of the given Type and name.
Mesh consisting of general polyhedral cells.
const labelIOList & tetBasePtIs() const
Return the tetBasePtIs.
virtual const pointField & points() const
Return raw points.
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.
tmp< DimensionedField< typename outerProduct< Type, Type >::type, GeoMesh, Field >> sqr(const DimensionedField< Type, GeoMesh, PrimitiveField > &df)
T returnReduce(const T &Value, const BinaryOp &bop, const int tag=Pstream::msgType(), const label comm=UPstream::worldComm)
word name(const LagrangianState state)
Return a string representation of a Lagrangian state enumeration.
tmp< DimensionedField< scalar, GeoMesh, Field > > magSqr(const DimensionedField< Type, GeoMesh, PrimitiveField > &df)
defineTypeNameAndDebug(atmosphericBoundaryLayer, 0)
void writeEntry(Ostream &os, const word &key, const DimensionedFieldFunction< DimensionedFieldType > &f)
Operator to take smallest valid value.