52 #ifndef Foam_AMIInterpolation_H 53 #define Foam_AMIInterpolation_H 218 const word& patchName,
222 const bool conformal,
224 const scalar lowWeightTol,
238 const labelList& sourceRestrictAddressing,
239 const labelList& targetRestrictAddressing,
294 const word& modelName,
302 const word& modelName,
331 const labelList& sourceRestrictAddressing,
332 const labelList& neighbourRestrictAddressing
394 inline label
comm() const;
398 inline label
comm(const label newComm);
404 inline const List<scalar>&
srcMagSf() const;
521 template<class Type, class CombineOp>
529 const CombineOp& cop,
531 const
UList<Type>& defaultValues
541 const
UList<Type>& defaultValues
546 template<class Type, class CombineOp>
550 const CombineOp& cop,
552 const
UList<Type>& defaultValues =
UList<Type>::null()
557 template<class Type, class CombineOp>
561 const CombineOp& cop,
563 const
UList<Type>& defaultValues =
UList<Type>::null()
568 template<class Type, class CombineOp>
572 const CombineOp& cop,
573 const
UList<Type>& defaultValues =
UList<Type>::null()
577 template<class Type, class CombineOp>
581 const CombineOp& cop,
582 const
UList<Type>& defaultValues =
UList<Type>::null()
586 template<class Type, class CombineOp>
590 const CombineOp& cop,
591 const
UList<Type>& defaultValues =
UList<Type>::null()
595 template<class Type, class CombineOp>
599 const CombineOp& cop,
600 const
UList<Type>& defaultValues =
UList<Type>::null()
608 const
UList<Type>& defaultValues =
UList<Type>::null()
616 const
UList<Type>& defaultValues =
UList<Type>::null()
624 const
UList<Type>& defaultValues =
UList<Type>::null()
632 const
UList<Type>& defaultValues =
UList<Type>::null()
644 const label tgtFacei,
655 const label srcFacei,
TypeName("AMIInterpolation")
Runtime type information.
label singlePatchProc_
Index of processor that holds all of both sides. The value is -1 for distributed cases.
void append(const primitivePatch &srcPatch, const primitivePatch &tgtPatch)
Append additional addressing and weights.
const pointListList & srcCentroids() const
Return const access to source patch face centroids.
refPtr< primitivePatch > tsrcPatch0_
Source patch using manipulated input points.
virtual ~AMIInterpolation()=default
Destructor.
pointListList tgtCentroids_
Centroid of source faces per target face.
labelListList tgtAddress_
Addresses of source faces per target face.
pointListList srcCentroids_
Centroid of target faces per source face.
dimensionedScalar log(const dimensionedScalar &ds)
label tgtPointFace(const primitivePatch &srcPatch, const primitivePatch &tgtPatch, const vector &n, const label srcFacei, point &srcPoint) const
Return target patch face index of point on source patch face.
A list of keyword definitions, which are a keyword followed by a number of values (eg...
const scalarListList & tgtWeights() const
Return const access to target patch weights.
pointField tgtPatchPts_
Target patch points if input points are manipulated, e.g. projected.
bool mustMatchFaces() const
Return true if requireMatch and but not lowWeightCorrection.
autoPtr< mapDistribute > tgtMapPtr_
Target map pointer - parallel running only.
virtual autoPtr< AMIInterpolation > clone() const
Construct and return a clone.
treeDataPrimitivePatch< primitivePatch > treeType
Local typedef to octree tree-type.
void writeFaceConnectivity(const primitivePatch &srcPatch, const primitivePatch &tgtPatch, const labelListList &srcAddress) const
Write face connectivity as OBJ file.
label srcPointFace(const primitivePatch &srcPatch, const primitivePatch &tgtPatch, const vector &n, const label tgtFacei, point &tgtPoint) const
Return source patch face index of point on target patch face.
void projectPointsToSurface(const searchableSurface &surf, pointField &pts) const
Project points to surface.
autoPtr< indexedOctree< treeType > > createTree(const primitivePatch &patch) const
Reset the octree for the patch face search.
An Istream is an abstract base class for all input systems (streams, files, token lists etc)...
const mapDistribute & srcMap() const
Source map - valid only if singlePatchProc = -1 This gets source data into a form to be consumed by t...
virtual bool writeData(Ostream &os) const
Write AMI raw.
const labelListList & tgtAddress() const
Return const access to target patch addressing.
bool requireMatch() const noexcept
Return the requireMatch flag.
label singlePatchProc() const noexcept
The processor holding all faces (both sides), or -1 if distributed.
Various functors for unary and binary operations. Can be used for parallel combine-reduce operations ...
refPtr< primitivePatch > ttgtPatch0_
Target patch using manipulated input points.
Base class of (analytical or triangulated) surface. Encapsulates all the search routines. WIP.
bool distributed() const noexcept
Distributed across processors (singlePatchProc == -1)
static bool cacheIntersections_
List< labelList > labelListList
List of labelList.
declareRunTimeSelectionTable(autoPtr, AMIInterpolation, dict,(const dictionary &dict, const bool reverseTarget),(dict, reverseTarget))
Selection table for dictionary construction.
A class for managing references or pointers (no reference counting)
autoPtr< mapDistribute > srcMapPtr_
Source map pointer - parallel running only.
label comm_
Communicator to use for parallel operations.
AMIInterpolation(const dictionary &dict, const bool reverseTarget=false)
Construct from dictionary.
A list of faces which address into the list of points.
const primitivePatch & tgtPatch0() const
Return the orginal tgt patch with optionally updated points.
virtual bool calculate(const primitivePatch &srcPatch, const primitivePatch &tgtPatch, const autoPtr< searchableSurface > &surfPtr=nullptr)
Update addressing, weights and (optional) centroids.
const List< scalar > & tgtMagSf() const
Return const access to target patch face areas.
bool upToDate() const noexcept
Is up-to-date?
static void agglomerate(const autoPtr< mapDistribute > &targetMap, const scalarList &fineSrcMagSf, const labelListList &fineSrcAddress, const scalarListList &fineSrcWeights, const labelList &sourceRestrictAddressing, const labelList &targetRestrictAddressing, scalarList &srcMagSf, labelListList &srcAddress, scalarListList &srcWeights, scalarField &srcWeightsSum, autoPtr< mapDistribute > &tgtMap, const label comm)
A class for handling words, derived from Foam::string.
bool upToDate_
Up-to-date flag.
const mapDistribute * hasTgtMap() const noexcept
Pointer to the target map (if distributed). Can be checked as a bool.
Encapsulation of data needed to search on PrimitivePatches.
const primitivePatch & srcPatch0() const
Return the orginal src patch with optionally updated points.
const scalarField & tgtWeightsSum() const
Return const access to normalisation factor of target patch weights (i.e. the sum before normalisatio...
bool checkSymmetricWeights(const bool log) const
Check if src addresses are present in tgt addresses and viceversa.
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...
scalarListList srcWeights_
Weights of target faces per source face.
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
An Ostream is an abstract base class for all output systems (streams, files, token lists...
scalarField srcWeightsSum_
Sum of weights of target faces per source face.
const mapDistribute * hasSrcMap() const noexcept
Pointer to the source map (if distributed). Can be checked as a bool.
A Vector of values with scalar precision, where scalar is float/double depending on the compilation f...
const scalarListList & srcWeights() const
Return const access to source patch weights.
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.
OBJstream os(runTime.globalPath()/outputName)
bool setRequireMatch(bool flag) noexcept
Set the require match flag, return the new value.
bool reverseTarget() const noexcept
Access to the reverseTarget flag.
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...
const List< scalar > & srcMagSf() const
Return const access to source patch face areas.
const scalarField & srcWeightsSum() const
Return const access to normalisation factor of source patch weights (i.e. the sum before normalisatio...
scalarList tgtMagSf_
Target face areas.
gmvFile<< "tracers "<< particles.size()<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().x()<< ' ';}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().y()<< ' ';}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().z()<< ' ';}gmvFile<< nl;for(const word &name :lagrangianScalarNames){ IOField< scalar > fld(IOobject(name, runTime.timeName(), cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE))
scalarField tgtWeightsSum_
Sum of weights of source faces per target face.
labelListList srcAddress_
Addresses of target faces per source face.
static void normaliseWeights(const scalarList &patchAreas, const word &patchName, const labelListList &addr, scalarListList &wght, scalarField &wghtSum, const bool conformal, const bool output, const scalar lowWeightTol, const label comm)
Normalise the (area) weights - suppresses numerical error in weights calculation. ...
Class containing processor-to-processor mapping information.
bool requireMatch_
Flag to indicate that the two patches must be matched/an overlap exists between them.
scalarListList tgtWeights_
Weights of source faces per target face.
pointField srcPatchPts_
Source patch points if input points are manipulated, e.g. projected.
Interpolation class dealing with transfer of data between two primitive patches with an arbitrary mes...
const std::string patch
OpenFOAM patch number as a std::string.
static Ostream & output(Ostream &os, const IntRange< T > &range)
label calcDistribution(const primitivePatch &srcPatch, const primitivePatch &tgtPatch) const
Calculate if patches are on multiple processors.
Pointer management similar to std::unique_ptr, with some additional methods and type checking...
static autoPtr< AMIInterpolation > New(const word &modelName, const dictionary &dict, const bool reverseTarget=false)
Selector for dictionary.
Macros to ease declaration of run-time selection tables.
const mapDistribute & tgtMap() const
Target map - valid only if singlePatchProc=-1. This gets target data into a form to be consumed by sr...
A class for managing temporary objects.
static autoPtr< T > New(Args &&... args)
Construct autoPtr with forwarding arguments.
scalar lowWeightCorrection() const
Threshold weight below which interpolation is deactivated.
void component(FieldField< Field, typename FieldField< Field, Type >::cmptType > &sf, const FieldField< Field, Type > &f, const direction d)
const labelListList & srcAddress() const
Return const access to source patch addressing.
scalarList srcMagSf_
Source face areas.
void operator=(const AMIInterpolation &)=delete
No copy assignment.
const scalar lowWeightCorrection_
Threshold weight below which interpolation is deactivated.
const bool reverseTarget_
Flag to indicate that the two patches are co-directional and that the orientation of the target patch...
void reset(autoPtr< mapDistribute > &&srcToTgtMap, autoPtr< mapDistribute > &&tgtToSrcMap, labelListList &&srcAddress, scalarListList &&srcWeights, labelListList &&tgtAddress, scalarListList &&tgtWeights, const label singlePatchProc)
Set the maps, addresses and weights from an external source.
bool applyLowWeightCorrection() const
Return true if employing a 'lowWeightCorrection'.
label comm() const
Communicator to use for parallel operations.
virtual void write(Ostream &os) const
Write AMI as a dictionary.