52 const Field<Type>&
fld,
53 const UList<Type>& defaultValues
60 autoPtr<coordSystem::cylindrical> cs;
64 if constexpr (transform_supported)
72 return interpolateUntransformed(
fld, defaultValues);
75 if constexpr (transform_supported)
81 Pout<<
"cyclicAMIPolyPatch::interpolate :"
82 <<
" patch:" << this->
name()
83 <<
" size:" << this->size()
84 <<
" nbrPatch:" << nbrPp.name()
85 <<
" size:" << nbrPp.size()
89 if (
fld.size() != nbrPp.size())
92 <<
"Patch:" << this->
name()
93 <<
" size:" << this->size()
94 <<
" neighbour patch:" << nbrPp.name()
95 <<
" size:" << nbrPp.size()
96 <<
" fld size:" <<
fld.size()
114 <<
" size:" << this->size()
115 <<
" fc:" <<
gAverage(this->faceCentres())
116 <<
" getting remote data from:" << nbrPp.name()
117 <<
" size:" << nbrPp.size()
123 Pout<<
"At:" << nbrFc[i] <<
nl
124 <<
" cart:" <<
fld[i] <<
nl
125 <<
" cyli:" << localFld[i] <<
nl
134 if (defaultValues.size() != 0 && defaultValues.size() == size())
149 interpolateUntransformed(localFld, localDeflt)
155 <<
"CODING ERROR??" <<
nl
156 <<
"calculated cylindrical coordinate system,"
157 " but does not appear to be a vector-space type" <<
endl
167 const tmp<Field<Type>>& tFld,
168 const UList<Type>& defaultValues
190 const auto& AMI = (owner() ? this->AMI() : neighbPatch().AMI());
192 if (AMI.distributed() && AMI.comm() != -1)
194 const auto& cache = AMI.cache();
196 if (cache.index0() == -1 && cache.index1() == -1)
200 const auto& map = (owner() ? AMI.tgtMap() : AMI.srcMap());
217 cache.setDirection(owner());
219 if (cache.index0() != -1)
221 const auto& map0 = cache.cTgtMapPtr0()();
235 if (cache.index1() != -1)
237 const auto& map1 = cache.cTgtMapPtr1()();
270 const auto& AMI = (owner() ? this->AMI() : neighbPatch().AMI());
272 if (!AMI.distributed() || AMI.comm() == -1)
280 if constexpr (transform_supported)
293 initInterpolateUntransformed
311 initInterpolateUntransformed
341 const auto& AMI = (owner() ? this->AMI() : neighbPatch().AMI());
343 const auto& cache = AMI.cache();
344 cache.setDirection(owner());
348 if (AMI.distributed())
350 if (AMI.comm() == -1)
355 if (cache.index0() == -1 && cache.index1() == -1)
358 const auto& map = (owner() ? AMI.tgtMap() : AMI.srcMap());
374 if (cache.index0() != -1)
376 cache.cTgtMapPtr0()().receive
385 if (cache.index1() != -1)
387 cache.cTgtMapPtr1()().receive
399 const Field<Type>& fld1 = (AMI.distributed() ? work1 : localFld);
408 if constexpr (transform_supported)
416 ownTransform = cs().R(this->faceCentres());
417 localDeflt = defaultValues;
419 if (defaultValues.
size() == size())
432 const auto& localDefaultValues =
433 localDeflt.
size() ? localDeflt : defaultValues;
435 if (cache.index0() == -1 && cache.index1() == -1)
447 if (ownTransform.size())
449 Foam::transform(tresult.ref(), ownTransform, tresult());
456 if (cache.index0() != -1)
460 AMI.lowWeightCorrection(),
461 cache.cSrcAddress0(),
462 cache.cSrcWeights0(),
463 cache.cSrcWeightsSum0(),
470 if (ownTransform.size())
476 tresult.ref() *= (1 - cache.weight());
479 if (cache.index1() != -1)
485 AMI.lowWeightCorrection(),
486 cache.cSrcAddress1(),
487 cache.cSrcWeights1(),
488 cache.cSrcWeightsSum1(),
495 if (ownTransform.size())
500 tresult1.ref() *= cache.weight();
501 tresult.ref() += tresult1();
509template<
class Type,
class CombineOp>
512 const UList<Type>&
fld,
513 const CombineOp& cop,
515 const UList<Type>& defaultValues
588 AMI().interpolateToSource
598 neighbPatch().AMI().interpolateToTarget
#define R(A, B, C, D, E, F, K, M)
Info<< nl;Info<< "Write faMesh in vtk format:"<< nl;{ vtk::uindirectPatchWriter writer(aMesh.patch(), fileName(aMesh.time().globalPath()/vtkBaseFileName));writer.writeGeometry();globalIndex procAddr(aMesh.nFaces());labelList cellIDs;if(UPstream::master()) { cellIDs.resize(procAddr.totalSize());for(const labelRange &range :procAddr.ranges()) { auto slice=cellIDs.slice(range);slice=identity(range);} } writer.beginCellData(4);writer.writeProcIDs();writer.write("cellID", cellIDs);writer.write("area", aMesh.S().field());writer.write("normal", aMesh.faceAreaNormals());writer.beginPointData(1);writer.write("normal", aMesh.pointAreaNormals());Info<< " "<< writer.output().name()<< nl;}{ vtk::lineWriter writer(aMesh.points(), aMesh.edges(), fileName(aMesh.time().globalPath()/(vtkBaseFileName+"-edges")));writer.writeGeometry();writer.beginCellData(4);writer.writeProcIDs();{ Field< scalar > fld(faMeshTools::flattenEdgeField(aMesh.magLe(), true))
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 to combine existing value with remote value and we...
static void weightedSum(const scalar lowWeightCorrection, const labelListList &allSlots, const scalarListList &allWeights, const scalarField &weightsSum, const UList< Type > &fld, const CombineOp &cop, List< Type > &result, const UList< Type > &defaultValues)
Weighted sum of contributions. Note: cop operates on single Type only.
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 to combine existing value with remote value and we...
Generic templated field type that is much like a Foam::List except that it is expected to hold numeri...
SubField< vector > subField
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
A list of pointers to objects of type <T>, with allocation/deallocation management of the pointers....
SubField is a Field obtained as a section of another Field, without its own allocation....
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
void reset(T *p=nullptr) noexcept
Delete managed object and set to new given pointer.
Cyclic patch for Arbitrary Mesh Interface (AMI).
virtual bool owner() const
Does this side own the patch?
tmp< Field< Type > > interpolateUntransformed(const Field< Type > &fld, const UList< Type > &defaultValues) const
Interpolate without periodic.
const AMIPatchToPatchInterpolation & AMI() const
Return a reference to the AMI interpolator.
virtual const cyclicAMIPolyPatch & neighbPatch() const
Return a reference to the neighbour patch.
tmp< Field< Type > > interpolate(const Field< Type > &fld, const UList< Type > &defaultValues=UList< Type >()) const
Interpolate field.
void initInterpolateUntransformed(const Field< Type > &fld, labelRange &sendRequests, labelRange &recvRequests, PtrList< List< Type > > &sendBuffers, PtrList< List< Type > > &recvBuffers, labelRange &sendRequests1, labelRange &recvRequests1, PtrList< List< Type > > &sendBuffers1, PtrList< List< Type > > &recvBuffers1) const
void initInterpolate(const Field< Type > &fld, labelRange &sendRequests, labelRange &recvRequests, PtrList< List< Type > > &sendBuffers, PtrList< List< Type > > &recvBuffers, labelRange &sendRequests1, labelRange &recvRequests1, PtrList< List< Type > > &sendBuffers1, PtrList< List< Type > > &recvBuffers1) const
cyclicAMIPolyPatch(const word &name, const label size, const label start, const label index, const polyBoundaryMesh &bm, const word &patchType, const transformType transform=UNKNOWN, const word &defaultAMIMethod=faceAreaWeightAMI::typeName)
Construct from (base coupled patch) components.
A range or interval of labels defined by a start and a size.
label index() const noexcept
The index of this patch in the boundaryMesh.
const word & name() const noexcept
The patch name.
const vectorField::subField faceCentres() const
Return face centres.
A class for managing temporary objects.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Namespace for handling debugging switches.
Type gAverage(const FieldField< Field, Type > &f, const label comm)
The global arithmetic average of a FieldField.
dimensionSet invTransform(const dimensionSet &ds)
Return the argument; transformations do not change the dimensions.
tmp< DimensionedField< TypeR, GeoMesh > > New(const tmp< DimensionedField< TypeR, GeoMesh > > &tf1, const word &name, const dimensionSet &dimensions, const bool initCopy=false)
Global function forwards to reuseTmpDimensionedField::New.
refinementData transform(const tensor &, const refinementData val)
No-op rotational transform for base types.
Ostream & endl(Ostream &os)
Add newline and flush stream.
coordSystem::cylindrical cylindricalCS
Compatibility typedef 1806.
errorManip< error > abort(error &err)
static constexpr const zero Zero
Global zero (0).
bool interpolate(const vector &p1, const vector &p2, const vector &o, vector &n, scalar l)
Field< tensor > tensorField
Specialisation of Field<T> for tensor.
constexpr bool is_rotational_vectorspace_v
The is_rotational_vectorspace value of Type.
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
prefixOSstream Pout
OSstream wrapped stdout (std::cout) with parallel prefix.
errorManipArg< error, int > exit(error &err, const int errNo=1)
constexpr char nl
The newline '\n' character (0x0a).
#define forAll(list, i)
Loop across all elements in list.