67 void Foam::meshToMesh::add
87 if (result.
size() != tgtToSrcCellAddr_.size())
90 <<
"Supplied field size is not equal to target mesh size" <<
nl 91 <<
" source mesh = " << srcToTgtCellAddr_.size() <<
nl 92 <<
" target mesh = " << tgtToSrcCellAddr_.size() <<
nl 93 <<
" supplied field = " << result.
size()
97 if (singleMeshProc_ == -1)
106 const labelList& srcAddress = tgtToSrcCellAddr_[celli];
107 const scalarList& srcWeight = tgtToSrcCellWght_[celli];
109 if (srcAddress.
size())
111 result[celli] *= (1.0 -
sum(srcWeight));
114 result[celli] += srcWeight[i]*work[srcAddress[i]];
123 const labelList& srcAddress = tgtToSrcCellAddr_[celli];
124 const scalarList& srcWeight = tgtToSrcCellWght_[celli];
126 if (srcAddress.
size())
128 result[celli] *= (1.0 -
sum(srcWeight));
131 result[celli] += srcWeight[i]*srcField[srcAddress[i]];
149 tgtToSrcCellAddr_.size(),
154 mapSrcToTgt(srcField, tresult.
ref());
166 return mapSrcToTgt(tsrcField());
177 if (result.
size() != srcToTgtCellAddr_.size())
180 <<
"Supplied field size is not equal to source mesh size" <<
nl 181 <<
" source mesh = " << srcToTgtCellAddr_.size() <<
nl 182 <<
" target mesh = " << tgtToSrcCellAddr_.size() <<
nl 183 <<
" supplied field = " << result.
size()
187 if (singleMeshProc_ == -1)
196 const labelList& tgtAddress = srcToTgtCellAddr_[celli];
197 const scalarList& tgtWeight = srcToTgtCellWght_[celli];
199 if (tgtAddress.
size())
201 result[celli] *= (1.0 -
sum(tgtWeight));
204 result[celli] += tgtWeight[i]*work[tgtAddress[i]];
213 const labelList& tgtAddress = srcToTgtCellAddr_[celli];
214 const scalarList& tgtWeight = srcToTgtCellWght_[celli];
216 if (tgtAddress.
size())
218 result[celli] *= (1.0 -
sum(tgtWeight));
221 result[celli] += tgtWeight[i]*tgtField[tgtAddress[i]];
239 srcToTgtCellAddr_.size(),
244 mapTgtToSrc(tgtField, tresult.
ref());
256 return mapTgtToSrc(ttgtField());
261 void Foam::meshToMesh::mapAndOpSrcToTgt
295 label srcPatchi = srcPatchID_[i];
296 label tgtPatchi = tgtPatchID_[i];
311 AMIList[i].singlePatchProc(),
313 AMIList[i].singlePatchProc() == -1
314 ? &AMIList[i].srcMap()
317 AMIList[i].tgtAddress(),
318 AMIList[i].tgtWeights()
329 mapAndOpSrcToTgt(AMIList[i], srcField, tgtField);
332 forAll(cuttingPatches_, i)
350 const fvMesh& tgtMesh =
static_cast<const fvMesh&
>(tgtRegion_);
353 const typename fieldType::Boundary& srcBfld =
363 label srcPatchi = srcPatchID_[i];
364 label tgtPatchi = tgtPatchID_[i];
366 if (!tgtPatchFields.set(tgtPatchi))
386 forAll(tgtPatchFields, tgtPatchi)
388 if (!tgtPatchFields.set(tgtPatchi))
411 type() +
":interpolate(" + field.
name() +
")",
424 mapSrcToTgt(field, tresult.
ref());
437 return mapSrcToTgt(tfield());
442 void Foam::meshToMesh::mapAndOpTgtToSrc
473 label srcPatchi = srcPatchID_[i];
474 label tgtPatchi = tgtPatchID_[i];
490 AMIList[i].singlePatchProc(),
492 AMIList[i].singlePatchProc() == -1
493 ? &AMIList[i].tgtMap()
496 AMIList[i].srcAddress(),
497 AMIList[i].srcWeights()
509 mapAndOpTgtToSrc(AMIList[i], srcField, tgtField);
512 forAll(cuttingPatches_, i)
530 const fvMesh& srcMesh =
static_cast<const fvMesh&
>(srcRegion_);
533 const typename fieldType::Boundary& tgtBfld =
543 label srcPatchi = srcPatchID_[i];
544 label tgtPatchi = tgtPatchID_[i];
546 if (!srcPatchFields.set(tgtPatchi))
566 forAll(srcPatchFields, srcPatchi)
568 if (!srcPatchFields.set(srcPatchi))
591 type() +
":interpolate(" + field.
name() +
")",
604 mapTgtToSrc(field, tresult.
ref());
617 return mapTgtToSrc(tfield());
void operator()(List< Type > &x, const List< Type > y) const
#define forAll(list, i)
Loop across all elements in list.
const word & name() const
Return name.
FieldMapper with weighted mapping from (optionally remote) quantities.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
const Boundary & boundaryField() const
Return const-reference to the boundary field.
T & ref() const
Return non-const reference or generate a fatal error.
void size(const label)
Override size to be inconsistent with allocated storage.
Traits class for primitives.
Abstract base class with a fat-interface to all derived classes covering all possible ways in which t...
labelList identity(const label len)
Create identity map (map[i] == i) of given length.
Generic GeometricField class.
void mapSrcToTgt(const UList< Type > &srcFld, List< Type > &result) const
Map field from src to tgt mesh with defined operation.
const Time & time() const
Return the top-level database.
void distribute(List< T > &fld, const bool dummyTransform=true, const int tag=UPstream::msgType()) const
Distribute data using default commsType.
dimensioned< Type > sum(const DimensionedField< Type, GeoMesh > &df)
const dimensionSet & dimensions() const
Return dimensions.
static const DimensionedField< Type, GeoMesh > & null()
Return a null DimensionedField.
Pre-declare SubField and related Field type.
static word timeName(const scalar, const int precision=curPrecision_)
Return time name of given scalar time.
This boundary condition is not designed to be evaluated; it is assumed that the value is assigned via...
virtual void rmap(const fvPatchField< Type > &, const labelList &)
Reverse map the given fvPatchField onto this fvPatchField.
List< label > labelList
A List of labels.
void interpolateToTarget(const UList< Type > &fld, const CombineOp &cop, List< Type > &result, const UList< Type > &defaultValues=UList< Type >::null()) const
Interpolate from source to target with supplied op.
errorManip< error > abort(error &err)
const fvPatch & patch() const
Return patch.
Internal::FieldType & primitiveFieldRef()
Return a reference to the internal field.
virtual tmp< Field< Type > > patchInternalField() const
Return internal field next to patch as patch field.
void interpolateToSource(const UList< Type > &fld, const CombineOp &cop, List< Type > &result, const UList< Type > &defaultValues=UList< Type >::null()) const
Interpolate from target to source with supplied op.
direct fvPatchFieldMapper
Internal & ref()
Return a reference to the dimensioned internal field.
label size() const
Return the number of elements in the UPtrList.
void setSize(const label)
Reset size of List.
Class containing processor-to-processor mapping information.
Boundary & boundaryFieldRef()
Return a reference to the boundary field.
A templated 1D list of pointers to objects of type <T>, where the size of the array is known and used...
Mesh data needed to do the Finite Volume discretisation.
fileType type(const fileName &, const bool checkVariants=true, const bool followLink=true)
Return the file type: directory or file.
Interpolation class dealing with transfer of data between two primitive patches with an arbitrary mes...
void mapTgtToSrc(const UList< Type > &tgtFld, List< Type > &result) const
Map field from tgt to src mesh with defined operation.
A class for managing temporary objects.
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
const fvBoundaryMesh & boundary() const
Return reference to boundary mesh.