42 const word& fieldName,
43 const bool setAverage,
45 const word& interpolationScheme
49 patchField_(patchField),
50 fieldName_(fieldName),
51 setAverage_(setAverage),
53 interpolationScheme_(interpolationScheme)
66 patchField_(patchField),
69 dict.template lookupOrDefault<word>
72 patchField_.internalField().name()
81 dict.
lookup(
"interpolationScheme") >> interpolationScheme_;
94 patchField_(patchField),
95 fieldName_(patchField_.internalField().name()),
126 patchField_(patchField),
142 const fvMesh& nbrMesh = refCast<const fvMesh>(mapper_.sampleMesh());
144 if (mapper_.sameRegion())
146 if (fieldName_ == patchField_.internalField().name())
150 dynamic_cast<const fieldType&
> 152 patchField_.internalField()
158 return thisMesh.template lookupObject<fieldType>(fieldName_);
163 return nbrMesh.template lookupObject<fieldType>(fieldName_);
179 const fvMesh& nbrMesh = refCast<const fvMesh>(mapper_.sampleMesh());
185 switch (mapper_.mode())
210 interpolationScheme_,
231 newValues = sampleField();
241 const label nbrPatchID =
247 <<
"Unable to find sample patch " << mapper_.samplePatch()
248 <<
" in region " << mapper_.sampleRegion()
249 <<
" for patch " << patchField_.patch().name() <<
nl 253 const fieldType& nbrField = sampleField();
255 newValues = nbrField.boundaryField()[nbrPatchID];
256 mapper_.distribute(newValues);
264 const fieldType& nbrField = sampleField();
269 nbrField.boundaryField()[
patchi];
274 allValues[faceStart++] = pf[facei];
278 mapper_.distribute(allValues);
286 <<
"Unknown sampling mode: " << mapper_.mode()
294 gSum(patchField_.patch().magSf()*newValues)
295 /
gSum(patchField_.patch().magSf());
297 if (
mag(averagePsi)/
mag(average_) > 0.5)
299 newValues *=
mag(average_)/
mag(averagePsi);
303 newValues += (average_ - averagePsi);
320 writeEntry(os,
"interpolationScheme", interpolationScheme_);
const polyBoundaryMesh & boundaryMesh() const
Return boundary mesh.
#define forAll(list, i)
Loop across all elements in list.
static const Vector< scalar > max
void reverseDistribute(const label constructSize, List< T > &, const bool dummyTransform=true, const int tag=UPstream::msgType()) const
Reverse distribute data using default commsType.
word interpolationScheme_
Interpolation scheme to use for nearestcell mode.
A list of keyword definitions, which are a keyword followed by any number of values (e...
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
virtual label start() const
Return start label of this patch in the polyMesh face list.
virtual void write(Ostream &) const
Write.
const mappedPatchBase & mapper_
Mapping engine.
void size(const label)
Override size to be inconsistent with allocated storage.
Abstract base class with a fat-interface to all derived classes covering all possible ways in which t...
label findPatchID(const word &patchName) const
Find patch index given a name.
Generic GeometricField class.
static int & msgType()
Message tag of standard messages.
void distribute(List< T > &fld, const bool dummyTransform=true, const int tag=UPstream::msgType()) const
Distribute data using default commsType.
virtual Type interpolate(const vector &position, const label celli, const label facei=-1) const =0
Interpolate field to the given point in the given cell.
scalarField samples(nIntervals, 0)
Type gSum(const FieldField< Field, Type > &f)
Pre-declare SubField and related Field type.
const bool setAverage_
If true adjust the mapped field to maintain average value average_.
A class for handling words, derived from string.
const GeometricField< Type, fvPatchField, volMesh > & sampleField() const
Field to sample. Either on my or nbr mesh.
const polyMesh & mesh() const
Return the mesh reference.
Determines a mapping between patch face centres and mesh cell or face centres and processors they're ...
errorManip< error > abort(error &err)
const fvPatch & patch() const
Return patch.
const Type average_
Average value the mapped field is adjusted to maintain if.
const fvPatchField< Type > & patchField_
Underlying patch field.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
mappedPatchFieldBase(const mappedPatchBase &mapper, const fvPatchField< Type > &patchField, const word &fieldName, const bool setAverage, const Type average, const word &interpolationScheme)
Construct from components.
void writeEntry(Ostream &os, const HashTable< T, Key, Hash > &ht)
Functionality for sampling fields using mappedPatchBase. Every call to mappedField() returns a sample...
void setSize(const label)
Reset size of List.
Class containing processor-to-processor mapping information.
Mesh data needed to do the Finite Volume discretisation.
virtual tmp< Field< Type > > mappedField() const
Map sampleField onto *this patch.
Abstract base class for interpolation.
word fieldName_
Name of field to sample.
dimensioned< scalar > mag(const dimensioned< Type > &)
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
A class for managing temporary objects.
void transfer(List< Type > &)
Transfer the contents of the argument List into this list.
Uses the cell value for any point in the cell.
ITstream & lookup(const word &, bool recursive=false, bool patternMatch=true) const
Find and return an entry data stream.