67 void Foam::meshToMesh::add
80 template<
class Type,
class CombineOp>
88 if (result.
size() != tgtToSrcCellAddr_.size())
91 <<
"Supplied field size is not equal to target mesh size" <<
nl 92 <<
" source mesh = " << srcToTgtCellAddr_.size() <<
nl 93 <<
" target mesh = " << tgtToSrcCellAddr_.size() <<
nl 94 <<
" supplied field = " << result.
size()
100 if (singleMeshProc_ == -1)
109 const labelList& srcAddress = tgtToSrcCellAddr_[celli];
110 const scalarList& srcWeight = tgtToSrcCellWght_[celli];
112 if (srcAddress.
size())
115 result[celli] *= (1.0 -
sum(srcWeight));
118 label srcI = srcAddress[i];
119 scalar w = srcWeight[i];
120 cbop(result[celli], celli, work[srcI], w);
129 const labelList& srcAddress = tgtToSrcCellAddr_[celli];
130 const scalarList& srcWeight = tgtToSrcCellWght_[celli];
132 if (srcAddress.
size())
135 result[celli] *= (1.0 -
sum(srcWeight));
138 label srcI = srcAddress[i];
139 scalar w = srcWeight[i];
140 cbop(result[celli], celli, srcField[srcI], w);
148 template<
class Type,
class CombineOp>
159 tgtToSrcCellAddr_.size(),
164 mapSrcToTgt(srcField, cop, tresult.
ref());
170 template<
class Type,
class CombineOp>
177 return mapSrcToTgt(tsrcField(), cop);
197 return mapSrcToTgt(tsrcField());
201 template<
class Type,
class CombineOp>
205 const CombineOp& cop,
209 if (result.
size() != srcToTgtCellAddr_.size())
212 <<
"Supplied field size is not equal to source mesh size" <<
nl 213 <<
" source mesh = " << srcToTgtCellAddr_.size() <<
nl 214 <<
" target mesh = " << tgtToSrcCellAddr_.size() <<
nl 215 <<
" supplied field = " << result.
size()
221 if (singleMeshProc_ == -1)
230 const labelList& tgtAddress = srcToTgtCellAddr_[celli];
231 const scalarList& tgtWeight = srcToTgtCellWght_[celli];
233 if (tgtAddress.
size())
235 result[celli] *= (1.0 -
sum(tgtWeight));
238 label tgtI = tgtAddress[i];
239 scalar w = tgtWeight[i];
240 cbop(result[celli], celli, work[tgtI], w);
249 const labelList& tgtAddress = srcToTgtCellAddr_[celli];
250 const scalarList& tgtWeight = srcToTgtCellWght_[celli];
252 if (tgtAddress.
size())
254 result[celli] *= (1.0 -
sum(tgtWeight));
257 label tgtI = tgtAddress[i];
258 scalar w = tgtWeight[i];
259 cbop(result[celli], celli, tgtField[tgtI], w);
267 template<
class Type,
class CombineOp>
278 srcToTgtCellAddr_.size(),
283 mapTgtToSrc(tgtField, cop, tresult.
ref());
289 template<
class Type,
class CombineOp>
296 return mapTgtToSrc(ttgtField(), cop);
320 template<
class Type,
class CombineOp>
321 void Foam::meshToMesh::mapAndOpSrcToTgt
341 template<
class Type,
class CombineOp>
345 const CombineOp& cop,
358 label srcPatchi = srcPatchID_[i];
359 label tgtPatchi = tgtPatchID_[i];
374 AMIList[i].singlePatchProc(),
376 AMIList[i].singlePatchProc() == -1
377 ? &AMIList[i].srcMap()
380 AMIList[i].tgtAddress(),
381 AMIList[i].tgtWeights()
392 mapAndOpSrcToTgt(AMIList[i], srcField, tgtField, cop);
395 forAll(cuttingPatches_, i)
404 template<
class Type,
class CombineOp>
414 const fvMesh& tgtMesh =
static_cast<const fvMesh&
>(tgtRegion_);
417 const typename fieldType::Boundary& srcBfld =
427 label srcPatchi = srcPatchID_[i];
428 label tgtPatchi = tgtPatchID_[i];
430 if (!tgtPatchFields.set(tgtPatchi))
450 forAll(tgtPatchFields, tgtPatchi)
452 if (!tgtPatchFields.set(tgtPatchi))
475 type() +
":interpolate(" + field.
name() +
")",
488 mapSrcToTgt(field, cop, tresult.
ref());
494 template<
class Type,
class CombineOp>
502 return mapSrcToTgt(tfield(), cop);
528 template<
class Type,
class CombineOp>
529 void Foam::meshToMesh::mapAndOpTgtToSrc
549 template<
class Type,
class CombineOp>
553 const CombineOp& cop,
563 label srcPatchi = srcPatchID_[i];
564 label tgtPatchi = tgtPatchID_[i];
580 AMIList[i].singlePatchProc(),
582 AMIList[i].singlePatchProc() == -1
583 ? &AMIList[i].tgtMap()
586 AMIList[i].srcAddress(),
587 AMIList[i].srcWeights()
599 mapAndOpTgtToSrc(AMIList[i], srcField, tgtField, cop);
602 forAll(cuttingPatches_, i)
611 template<
class Type,
class CombineOp>
621 const fvMesh& srcMesh =
static_cast<const fvMesh&
>(srcRegion_);
624 const typename fieldType::Boundary& tgtBfld =
634 label srcPatchi = srcPatchID_[i];
635 label tgtPatchi = tgtPatchID_[i];
637 if (!srcPatchFields.set(tgtPatchi))
657 forAll(srcPatchFields, srcPatchi)
659 if (!srcPatchFields.set(srcPatchi))
682 type() +
":interpolate(" + field.
name() +
")",
695 mapTgtToSrc(field, cop, tresult.
ref());
701 template<
class Type,
class CombineOp>
709 return mapTgtToSrc(tfield(), cop);
void operator()(List< Type > &x, const List< Type > y) const
#define forAll(list, i)
Loop across all elements in list.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
const word & name() const
Return name.
FieldMapper with weighted mapping from (optionally remote) quantities.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
void distribute(List< T > &fld, const bool dummyTransform=true, const int tag=UPstream::msgType()) const
Distribute data using default commsType.
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.
static word timeName(const scalar, const int precision=precision_)
Return time name of given scalar time.
const Time & time() const
Return the top-level database.
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.
This boundary condition is not designed to be evaluated; it is assmued 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.
fileName::Type type(const fileName &, const bool followLink=true)
Return the file type: DIRECTORY or FILE.
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.
Interpolation class dealing with transfer of data between two primitive patches with an arbitrary mes...
A class for managing temporary objects.
void mapSrcToTgt(const UList< Type > &srcFld, const CombineOp &cop, List< Type > &result) const
Map field from src to tgt mesh with defined operation.
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
void mapTgtToSrc(const UList< Type > &tgtFld, const CombineOp &cop, List< Type > &result) const
Map field from tgt to src mesh with defined operation.
const fvBoundaryMesh & boundary() const
Return reference to boundary mesh.