51 #ifndef Foam_AMIInterpolation_H 52 #define Foam_AMIInterpolation_H 220 const word& patchName,
224 const bool conformal,
226 const scalar lowWeightTol
239 const labelList& sourceRestrictAddressing,
240 const labelList& targetRestrictAddressing,
294 const word& modelName,
302 const word& modelName,
331 const labelList& sourceRestrictAddressing,
332 const labelList& neighbourRestrictAddressing
397 inline const List<scalar>&
srcMagSf()
const;
506 template<
class Type,
class CombineOp>
510 const CombineOp& cop,
517 template<
class Type,
class CombineOp>
521 const CombineOp& cop,
528 template<
class Type,
class CombineOp>
532 const CombineOp& cop,
537 template<
class Type,
class CombineOp>
541 const CombineOp& cop,
546 template<
class Type,
class CombineOp>
550 const CombineOp& cop,
555 template<
class Type,
class CombineOp>
559 const CombineOp& cop,
604 const label tgtFacei,
615 const label srcFacei,
TypeName("AMIInterpolation")
Runtime type information.
label singlePatchProc_
Index of processor that holds all of both sides. -1 in all other 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.
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)
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.
label singlePatchProc() const
Set to -1, or the processor holding all faces (both sides) of the AMI.
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 lowWeightCorrectionin active.
bool setRequireMatch(const bool flag)
Access to the requireMatch flag.
void reset(autoPtr< mapDistribute > &&srcToTgtMap, autoPtr< mapDistribute > &&tgtToSrcMap, labelListList &&srcAddress, scalarListList &&srcWeights, labelListList &&tgtAddress, scalarListList &&tgtWeights)
Set the maps, addresses and weights from an external source.
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.
const mapDistribute & srcMap() const
Source map pointer - valid only if singlePatchProc = -1 This gets source data into a form to be consu...
const labelListList & tgtAddress() const
Return const access to target patch addressing.
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.
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.
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?
List< scalarList > scalarListList
List of scalarList.
A class for handling words, derived from Foam::string.
bool upToDate_
Up-to-date flag.
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.
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.
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.
OBJstream os(runTime.globalPath()/outputName)
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.
bool requireMatch() const
Access to the requireMatch flag.
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.
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.
Macro definitions for declaring ClassName(), NamespaceName(), etc.
pointField srcPatchPts_
Source patch points if input points are manipulated, e.g. projected.
bool distributed() const
Access to the distributed flag.
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 pointer - valid only if singlePatchProc=-1. This gets target data into a form to be consum...
A class for managing temporary objects.
static autoPtr< T > New(Args &&... args)
Construct autoPtr with forwarding arguments.
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)
Normalise the (area) weights - suppresses numerical error in weights calculation. ...
scalar lowWeightCorrection() const
Threshold weight below which interpolation is deactivated.
bool reverseTarget() const
Access to the reverseTarget flag.
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...
bool applyLowWeightCorrection() const
Return true if employing a 'lowWeightCorrection'.
virtual void write(Ostream &os) const
Write.