34template<
class Type,
class CombineOp>
43 addProfiling(ami,
"AMIInterpolation::interpolateToTarget");
48 <<
"Supplied field size is not equal to source patch size" <<
nl
51 <<
" supplied field = " <<
fld.size()
60 <<
"Employing default values when sum of weights falls below "
62 <<
" but supplied default field size is not equal to target "
64 <<
" default values = " << defaultValues.
size() <<
nl
83 result[facei] = defaultValues[facei];
92 cop(result[facei], facei, work[faces[i]], weights[i]);
103 result[facei] = defaultValues[facei];
112 cop(result[facei], facei,
fld[faces[i]], weights[i]);
120template<
class Type,
class CombineOp>
124 const CombineOp& cop,
129 addProfiling(ami,
"AMIInterpolation::interpolateToSource");
131 if (
fld.size() != tgtAddress_.size())
134 <<
"Supplied field size is not equal to target patch size" <<
nl
135 <<
" source patch = " << srcAddress_.size() <<
nl
136 <<
" target patch = " << tgtAddress_.size() <<
nl
137 <<
" supplied field = " <<
fld.size()
141 if (lowWeightCorrection_ > 0)
143 if (defaultValues.
size() != srcAddress_.size())
146 <<
"Employing default values when sum of weights falls below "
147 << lowWeightCorrection_
148 <<
" but supplied default field size is not equal to source "
149 <<
"patch size" <<
nl
150 <<
" default values = " << defaultValues.
size() <<
nl
151 <<
" source patch = " << srcAddress_.size() <<
nl
156 result.
setSize(srcAddress_.size());
167 if (srcWeightsSum_[facei] < lowWeightCorrection_)
169 result[facei] = defaultValues[facei];
173 const labelList& faces = srcAddress_[facei];
174 const scalarList& weights = srcWeights_[facei];
178 cop(result[facei], facei, work[faces[i]], weights[i]);
187 if (srcWeightsSum_[facei] < lowWeightCorrection_)
189 result[facei] = defaultValues[facei];
193 const labelList& faces = srcAddress_[facei];
194 const scalarList& weights = srcWeights_[facei];
198 cop(result[facei], facei,
fld[faces[i]], weights[i]);
206template<
class Type,
class CombineOp>
210 const CombineOp& cop,
228template<
class Type,
class CombineOp>
232 const CombineOp& cop,
236 return interpolateToSource(tFld(), cop, defaultValues);
240template<
class Type,
class CombineOp>
244 const CombineOp& cop,
262template<
class Type,
class CombineOp>
266 const CombineOp& cop,
270 return interpolateToTarget(tFld(), cop, defaultValues);
292 return interpolateToSource(tFld(),
plusEqOp<Type>(), defaultValues);
314 return interpolateToTarget(tFld(),
plusEqOp<Type>(), defaultValues);
Info<< nl<< "Wrote faMesh in vtk format: "<< writer.output().name()<< nl;}{ vtk::lineWriter writer(aMesh.points(), aMesh.edges(), fileName(aMesh.mesh().time().globalPath()/"finiteArea-edges"));writer.writeGeometry();writer.beginCellData(4);writer.writeProcIDs();{ Field< scalar > fld(faMeshTools::flattenEdgeField(aMesh.magLe(), true))
labelListList srcAddress_
Addresses of target faces per source face.
bool distributed() const
Access to the distributed flag.
autoPtr< mapDistribute > srcMapPtr_
Source map pointer - parallel running only.
void interpolateToSource(const UList< Type > &fld, const CombineOp &cop, List< Type > &result, const UList< Type > &defaultValues=UList< Type >::null()) const
labelListList tgtAddress_
Addresses of source faces per target face.
const scalar lowWeightCorrection_
Threshold weight below which interpolation is deactivated.
scalarListList tgtWeights_
Weights of source faces per target face.
scalarField tgtWeightsSum_
Sum of weights of source faces per target face.
void interpolateToTarget(const UList< Type > &fld, const CombineOp &cop, List< Type > &result, const UList< Type > &defaultValues=UList< Type >::null()) const
Generic templated field type.
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
void setSize(const label n)
Alias for resize()
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
void size(const label n)
Older name for setAddressableSize.
Class containing processor-to-processor mapping information.
void distribute(List< T > &fld, const bool dummyTransform=true, const int tag=UPstream::msgType()) const
Distribute data using default commsType.
A class for managing temporary objects.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
errorManip< error > abort(error &err)
static constexpr const zero Zero
Global zero (0)
tmp< DimensionedField< TypeR, GeoMesh > > New(const tmp< DimensionedField< TypeR, GeoMesh > > &tdf1, const word &name, const dimensionSet &dimensions)
Global function forwards to reuseTmpDimensionedField::New.
constexpr char nl
The newline '\n' character (0x0a)
#define addProfiling(name, descr)
Define profiling trigger with specified name and description string.
#define forAll(list, i)
Loop across all elements in list.