Loading...
Searching...
No Matches
nearestFaceAMI Class Reference

Nearest-face Arbitrary Mesh Interface (AMI) method. More...

#include <nearestFaceAMI.H>

Inheritance diagram for nearestFaceAMI:
Collaboration diagram for nearestFaceAMI:

Classes

class  nearestEqOp
 Helper class for finding nearest. More...

Public Types

typedef Tuple2< pointIndexHit, scalar > nearestAndDist

Public Member Functions

 TypeName ("nearestFaceAMI")
 Runtime type information.
 nearestFaceAMI (const dictionary &dict, const bool reverseTarget=false)
 Construct from dictionary.
 nearestFaceAMI (const bool requireMatch=true, const bool reverseTarget=false, const scalar lowWeightCorrection=-1)
 Construct from components.
 nearestFaceAMI (const nearestFaceAMI &ami)
 Construct as copy.
virtual autoPtr< AMIInterpolationclone () const
 Construct and return a clone.
virtual ~nearestFaceAMI ()=default
 Destructor.
virtual bool calculate (const primitivePatch &srcPatch, const primitivePatch &tgtPatch, const autoPtr< searchableSurface > &surfPtr=nullptr)
 Update addressing and weights.
virtual void write (Ostream &os) const
 Write.
Public Member Functions inherited from AMIInterpolation
 TypeName ("AMIInterpolation")
 Runtime type information.
 declareRunTimeSelectionTable (autoPtr, AMIInterpolation, dict,(const dictionary &dict, const bool reverseTarget),(dict, reverseTarget))
 Selection table for dictionary construction.
 declareRunTimeSelectionTable (autoPtr, AMIInterpolation, component,(const bool requireMatch, const bool reverseTarget, const scalar lowWeightCorrection),(requireMatch, reverseTarget, lowWeightCorrection))
 Selection table for component-wise construction.
 AMIInterpolation (const dictionary &dict, const bool reverseTarget=false)
 Construct from dictionary.
 AMIInterpolation (const bool requireMatch=true, const bool reverseTarget=false, const scalar lowWeightCorrection=-1)
 Construct from components.
 AMIInterpolation (const AMIInterpolation &fineAMI, const labelList &sourceRestrictAddressing, const labelList &neighbourRestrictAddressing)
 Construct from agglomeration of AMIInterpolation. Agglomeration passed in as new coarse size and addressing from fine from coarse.
 AMIInterpolation (const AMIInterpolation &ami)
 Construct as copy.
 AMIInterpolation (Istream &is)
 Construct from Istream.
virtual ~AMIInterpolation ()=default
 Destructor.
bool upToDate () const noexcept
 Is up-to-date?
bool upToDate (bool flag) noexcept
 Set as up-to-date, return the previous value.
const AMICachecache () const noexcept
 Return a reference to the AMI cache.
AMICachecache () noexcept
bool distributed () const noexcept
 Distributed across processors (singlePatchProc == -1).
bool requireMatch () const noexcept
 Return the requireMatch flag.
bool setRequireMatch (bool flag) noexcept
 Set the require match flag, return the new value.
bool mustMatchFaces () const
 Return true if requireMatch and but not lowWeightCorrection.
bool reverseTarget () const noexcept
 Access to the reverseTarget flag.
scalar lowWeightCorrection () const
 Threshold weight below which interpolation is deactivated.
bool applyLowWeightCorrection () const
 Return true if employing a 'lowWeightCorrection'.
label singlePatchProc () const noexcept
 The processor holding all faces (both sides), or -1 if distributed.
label comm () const noexcept
 Communicator (local or otherwise) for parallel operations.
label comm (label communicator) noexcept
 Set (non-local) communicator for parallel operations.
bool cacheActive () const
 Return true if caching is active.
const List< scalar > & srcMagSf () const
 Return const access to source patch face areas.
List< scalar > & srcMagSf ()
 Return access to source patch face areas.
const labelListListsrcAddress () const
 Return const access to source patch addressing.
labelListListsrcAddress ()
 Return access to source patch addressing.
const scalarListListsrcWeights () const
 Return const access to source patch weights.
scalarListListsrcWeights ()
 Return access to source patch weights.
const scalarFieldsrcWeightsSum () const
 Return const access to normalisation factor of source patch weights (i.e. the sum before normalisation).
scalarFieldsrcWeightsSum ()
 Return access to normalisation factor of source patch weights (i.e. the sum before normalisation).
const pointListListsrcCentroids () const
 Return const access to source patch face centroids.
pointListListsrcCentroids ()
 Return access to source patch face centroids.
const mapDistributesrcMap () const
 Source map - valid only if singlePatchProc = -1 This gets source data into a form to be consumed by tgtAddress, tgtWeights.
const mapDistributehasSrcMap () const noexcept
 Pointer to the source map (if distributed). Can be checked as a bool.
const List< scalar > & tgtMagSf () const
 Return const access to target patch face areas.
List< scalar > & tgtMagSf ()
 Return access to target patch face areas.
const labelListListtgtAddress () const
 Return const access to target patch addressing.
labelListListtgtAddress ()
 Return access to target patch addressing.
const scalarListListtgtWeights () const
 Return const access to target patch weights.
scalarListListtgtWeights ()
 Return access to target patch weights.
const scalarFieldtgtWeightsSum () const
 Return const access to normalisation factor of target patch weights (i.e. the sum before normalisation).
scalarFieldtgtWeightsSum ()
 Return access to normalisation factor of target patch weights (i.e. the sum before normalisation).
const mapDistributetgtMap () const
 Target map - valid only if singlePatchProc=-1. This gets target data into a form to be consumed by srcAddress, srcWeights.
const mapDistributehasTgtMap () const noexcept
 Pointer to the target map (if distributed). Can be checked as a bool.
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.
void append (const primitivePatch &srcPatch, const primitivePatch &tgtPatch)
 Append additional addressing and weights.
void normaliseWeights (const bool conformal, const bool output)
 Normalise the weights.
template<class Type>
void weightedSum (const bool toSource, const UList< Type > &fld, List< Type > &result, const UList< Type > &defaultValues) const
 Weighted sum of contributions (includes caching+interp) (for primitive types only).
template<class Type, class CombineOp, class InterpolateOp>
void interpolate (const bool toSource, const UList< Type > &fld, const CombineOp &cop, const InterpolateOp &iop, List< Type > &result, const UList< Type > &defaultValues) const
 Weighted sum of (potentially distributed) contributions and apply caching+interpolation. Note: iop operates on single Type only.
template<class Type, class CombineOp>
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 weight.
template<class Type, class CombineOp>
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 weight.
template<class Type, class CombineOp>
tmp< Field< Type > > interpolateToSource (const Field< Type > &fld, const CombineOp &cop, const UList< Type > &defaultValues=UList< Type >::null()) const
 Interpolate from target to source with supplied op.
template<class Type, class CombineOp>
tmp< Field< Type > > interpolateToSource (const tmp< Field< Type > > &tFld, const CombineOp &cop, const UList< Type > &defaultValues=UList< Type >::null()) const
 Interpolate from target tmp field to source with supplied op.
template<class Type, class CombineOp>
tmp< Field< Type > > interpolateToTarget (const Field< Type > &fld, const CombineOp &cop, const UList< Type > &defaultValues=UList< Type >::null()) const
 Interpolate from source to target with supplied op.
template<class Type, class CombineOp>
tmp< Field< Type > > interpolateToTarget (const tmp< Field< Type > > &tFld, const CombineOp &cop, const UList< Type > &defaultValues=UList< Type >::null()) const
 Interpolate from source tmp field to target with supplied op.
template<class Type>
tmp< Field< Type > > interpolateToSource (const Field< Type > &fld, const UList< Type > &defaultValues=UList< Type >::null()) const
 Interpolate from target to source.
template<class Type>
tmp< Field< Type > > interpolateToSource (const tmp< Field< Type > > &tFld, const UList< Type > &defaultValues=UList< Type >::null()) const
 Interpolate from target tmp field.
template<class Type>
tmp< Field< Type > > interpolateToTarget (const Field< Type > &fld, const UList< Type > &defaultValues=UList< Type >::null()) const
 Interpolate from source to target.
template<class Type>
tmp< Field< Type > > interpolateToTarget (const tmp< Field< Type > > &tFld, const UList< Type > &defaultValues=UList< Type >::null()) const
 Interpolate from source tmp field.
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.
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.
bool restoreCache (const point &refPt)
 Restore AMI weights and addressing from the cache.
void addToCache (const point &refPt)
 Add AMI weights and addressing to the cache.
bool checkSymmetricWeights (const bool log) const
 Check if src addresses are present in tgt addresses and viceversa.
void writeFaceConnectivity (const primitivePatch &srcPatch, const primitivePatch &tgtPatch, const labelListList &srcAddress) const
 Write face connectivity as OBJ file.
virtual bool writeData (Ostream &os) const
 Write AMI raw.
bool & upToDate () noexcept
 Non-const access to the up-to-date flag.
template<class Type, class CombineOp>
Foam::tmp< Foam::Field< Type > > interpolateToSource (const Field< Type > &fld, const CombineOp &cop, const UList< Type > &defaultValues) const
template<class Type, class CombineOp>
Foam::tmp< Foam::Field< Type > > interpolateToSource (const tmp< Field< Type > > &tFld, const CombineOp &cop, const UList< Type > &defaultValues) const
template<class Type, class CombineOp>
Foam::tmp< Foam::Field< Type > > interpolateToTarget (const Field< Type > &fld, const CombineOp &cop, const UList< Type > &defaultValues) const
template<class Type, class CombineOp>
Foam::tmp< Foam::Field< Type > > interpolateToTarget (const tmp< Field< Type > > &tFld, const CombineOp &cop, const UList< Type > &defaultValues) const
template<class Type>
Foam::tmp< Foam::Field< Type > > interpolateToSource (const Field< Type > &fld, const UList< Type > &defaultValues) const
template<class Type>
Foam::tmp< Foam::Field< Type > > interpolateToSource (const tmp< Field< Type > > &tFld, const UList< Type > &defaultValues) const
template<class Type>
Foam::tmp< Foam::Field< Type > > interpolateToTarget (const Field< Type > &fld, const UList< Type > &defaultValues) const
template<class Type>
Foam::tmp< Foam::Field< Type > > interpolateToTarget (const tmp< Field< Type > > &tFld, const UList< Type > &defaultValues) const

Additional Inherited Members

Static Public Member Functions inherited from AMIInterpolation
static autoPtr< AMIInterpolationNew (const word &modelName, const dictionary &dict, const bool reverseTarget=false)
 Selector for dictionary.
static autoPtr< AMIInterpolationNew (const word &modelName, const bool requireMatch=true, const bool reverseTarget=false, const scalar lowWeightCorrection=-1)
 Selector for components.
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)
template<class Type, class CombineOp>
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.
Static Public Attributes inherited from AMIInterpolation
static bool cacheIntersections_ = false
 Flag to store face-to-face intersection triangles; default = false.
static int useLocalComm_
 Control use of local communicator for AMI communication.
static scalar cacheThetaTolerance_
 Tolerance used when caching the AMI to identify e.g. if the current rotation angle has already been captured.
Protected Types inherited from AMIInterpolation
typedef treeDataPrimitivePatch< primitivePatchtreeType
 Local typedef to octree tree-type.
Protected Member Functions inherited from AMIInterpolation
void operator= (const AMIInterpolation &)=delete
 No copy assignment.
autoPtr< indexedOctree< treeType > > createTree (const primitivePatch &patch) const
 Reset the octree for the patch face search.
label calcDistribution (const primitivePatch &srcPatch, const primitivePatch &tgtPatch, const label comm, autoPtr< UPstream::communicator > &geomComm) const
 Calculate if patches are on multiple processors. Allocates local communicator and returns -1 or processor containing all faces.
void projectPointsToSurface (const searchableSurface &surf, pointField &pts) const
 Project points to surface.
const primitivePatchsrcPatch0 () const
 Return the original src patch with optionally updated points.
const primitivePatchtgtPatch0 () const
 Return the original tgt patch with optionally updated points.
Static Protected Member Functions inherited from AMIInterpolation
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.
Protected Attributes inherited from AMIInterpolation
bool requireMatch_
 Flag to indicate that the two patches must be matched/an overlap exists between them.
const bool reverseTarget_
 Flag to indicate that the two patches are co-directional and that the orientation of the target patch should be reversed.
const scalar lowWeightCorrection_
 Threshold weight below which interpolation is deactivated.
label singlePatchProc_
 Index of processor that holds all of both sides. The value is -1 for distributed cases.
label comm_
 Communicator to use for parallel operations.
autoPtr< UPstream::communicatorgeomComm_
 Communicator to use for geometry calculations. Not valid (-1) on processors that do not have faces.
scalarList srcMagSf_
 Source face areas.
labelListList srcAddress_
 Addresses of target faces per source face.
scalarListList srcWeights_
 Weights of target faces per source face.
scalarField srcWeightsSum_
 Sum of weights of target faces per source face.
pointListList srcCentroids_
 Centroid of target faces per source face.
pointField srcPatchPts_
 Source patch points if input points are manipulated, e.g. projected.
refPtr< primitivePatchtsrcPatch0_
 Source patch using manipulated input points.
autoPtr< mapDistributesrcMapPtr_
 Source map pointer - parallel running only.
scalarList tgtMagSf_
 Target face areas.
labelListList tgtAddress_
 Addresses of source faces per target face.
scalarListList tgtWeights_
 Weights of source faces per target face.
scalarField tgtWeightsSum_
 Sum of weights of source faces per target face.
pointListList tgtCentroids_
 Centroid of source faces per target face.
pointField tgtPatchPts_
 Target patch points if input points are manipulated, e.g. projected.
refPtr< primitivePatchttgtPatch0_
 Target patch using manipulated input points.
autoPtr< mapDistributetgtMapPtr_
 Target map pointer - parallel running only.
bool upToDate_
 Up-to-date flag.
AMICache cache_
 Cache.

Detailed Description

Nearest-face Arbitrary Mesh Interface (AMI) method.

Source files

Definition at line 47 of file nearestFaceAMI.H.

Member Typedef Documentation

◆ nearestAndDist

Definition at line 53 of file nearestFaceAMI.H.

Constructor & Destructor Documentation

◆ nearestFaceAMI() [1/3]

nearestFaceAMI ( const dictionary & dict,
const bool reverseTarget = false )

Construct from dictionary.

Definition at line 243 of file nearestFaceAMI.C.

References AMIInterpolation::AMIInterpolation(), dict, and AMIInterpolation::reverseTarget().

Referenced by clone(), nearestFaceAMI(), and TypeName().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ nearestFaceAMI() [2/3]

nearestFaceAMI ( const bool requireMatch = true,
const bool reverseTarget = false,
const scalar lowWeightCorrection = -1 )

Construct from components.

Definition at line 254 of file nearestFaceAMI.C.

References AMIInterpolation::AMIInterpolation(), AMIInterpolation::lowWeightCorrection(), AMIInterpolation::requireMatch(), and AMIInterpolation::reverseTarget().

Here is the call graph for this function:

◆ nearestFaceAMI() [3/3]

nearestFaceAMI ( const nearestFaceAMI & ami)

Construct as copy.

Definition at line 266 of file nearestFaceAMI.C.

References AMIInterpolation::AMIInterpolation(), and nearestFaceAMI().

Here is the call graph for this function:

◆ ~nearestFaceAMI()

virtual ~nearestFaceAMI ( )
virtualdefault

Destructor.

References os().

Here is the call graph for this function:

Member Function Documentation

◆ TypeName()

TypeName ( "nearestFaceAMI" )

Runtime type information.

References dict, AMIInterpolation::lowWeightCorrection(), nearestFaceAMI(), AMIInterpolation::requireMatch(), and AMIInterpolation::reverseTarget().

Here is the call graph for this function:

◆ clone()

virtual autoPtr< AMIInterpolation > clone ( ) const
inlinevirtual

Construct and return a clone.

Reimplemented from AMIInterpolation.

Definition at line 150 of file nearestFaceAMI.H.

References nearestFaceAMI().

Here is the call graph for this function:

◆ calculate()

◆ write()

void write ( Ostream & os) const
virtual

Write.

Reimplemented from AMIInterpolation.

Definition at line 417 of file nearestFaceAMI.C.

References os(), and AMIInterpolation::write().

Here is the call graph for this function:

The documentation for this class was generated from the following files:
  • src/meshTools/AMIInterpolation/AMIInterpolation/nearestFaceAMI/nearestFaceAMI.H
  • src/meshTools/AMIInterpolation/AMIInterpolation/nearestFaceAMI/nearestFaceAMI.C