AMIInterpolation Class Reference

Interpolation class dealing with transfer of data between two primitive patches with an arbitrary mesh interface (AMI). More...

Inheritance diagram for AMIInterpolation:
Collaboration diagram for AMIInterpolation:

Public Member Functions

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

Static Public Member Functions

static autoPtr< AMIInterpolationNew (const word &modelName, const dictionary &dict, const bool reverseTarget=false)
 Selector for dictionary. More...
 
static autoPtr< AMIInterpolationNew (const word &modelName, const bool requireMatch=true, const bool reverseTarget=false, const scalar lowWeightCorrection=-1)
 Selector for components. More...
 
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. More...
 

Static Public Attributes

static bool cacheIntersections_ = false
 
static int useLocalComm_
 Control use of local communicator for AMI communication. More...
 

Protected Types

typedef treeDataPrimitivePatch< primitivePatchtreeType
 Local typedef to octree tree-type. More...
 

Protected Member Functions

void operator= (const AMIInterpolation &)=delete
 No copy assignment. More...
 
autoPtr< indexedOctree< treeType > > createTree (const primitivePatch &patch) const
 Reset the octree for the patch face search. More...
 
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. More...
 
void projectPointsToSurface (const searchableSurface &surf, pointField &pts) const
 Project points to surface. More...
 
const primitivePatchsrcPatch0 () const
 Return the orginal src patch with optionally updated points. More...
 
const primitivePatchtgtPatch0 () const
 Return the orginal tgt patch with optionally updated points. More...
 

Static Protected Member Functions

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. More...
 
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)
 

Protected Attributes

bool requireMatch_
 Flag to indicate that the two patches must be matched/an overlap exists between them. More...
 
const bool reverseTarget_
 Flag to indicate that the two patches are co-directional and that the orientation of the target patch should be reversed. More...
 
const scalar lowWeightCorrection_
 Threshold weight below which interpolation is deactivated. More...
 
label singlePatchProc_
 Index of processor that holds all of both sides. The value is -1 for distributed cases. More...
 
label comm_
 Communicator to use for parallel operations. More...
 
autoPtr< UPstream::communicatorgeomComm_
 Communicator to use for geometry calculations. Not valid (-1) on processors that do not have faces. More...
 
scalarList srcMagSf_
 Source face areas. More...
 
labelListList srcAddress_
 Addresses of target faces per source face. More...
 
scalarListList srcWeights_
 Weights of target faces per source face. More...
 
scalarField srcWeightsSum_
 Sum of weights of target faces per source face. More...
 
pointListList srcCentroids_
 Centroid of target faces per source face. More...
 
pointField srcPatchPts_
 Source patch points if input points are manipulated, e.g. projected. More...
 
refPtr< primitivePatchtsrcPatch0_
 Source patch using manipulated input points. More...
 
autoPtr< mapDistributesrcMapPtr_
 Source map pointer - parallel running only. More...
 
scalarList tgtMagSf_
 Target face areas. More...
 
labelListList tgtAddress_
 Addresses of source faces per target face. More...
 
scalarListList tgtWeights_
 Weights of source faces per target face. More...
 
scalarField tgtWeightsSum_
 Sum of weights of source faces per target face. More...
 
pointListList tgtCentroids_
 Centroid of source faces per target face. More...
 
pointField tgtPatchPts_
 Target patch points if input points are manipulated, e.g. projected. More...
 
refPtr< primitivePatchttgtPatch0_
 Target patch using manipulated input points. More...
 
autoPtr< mapDistributetgtMapPtr_
 Target map pointer - parallel running only. More...
 
bool upToDate_
 Up-to-date flag. More...
 

Detailed Description

Interpolation class dealing with transfer of data between two primitive patches with an arbitrary mesh interface (AMI).

Based on the algorithm given in:

Conservative interpolation between volume meshes by local Galerkin projection, Farrell PE and Maddison JR, 2011, Comput. Methods Appl. Mech Engrg, Volume 200, Issues 1-4, pp 89-100

Interpolation requires that the two patches should have opposite orientations (opposite normals). The 'reverseTarget' flag can be used to reverse the orientation of the target patch.

Source files

Definition at line 70 of file AMIInterpolation.H.

Member Typedef Documentation

◆ treeType

Local typedef to octree tree-type.

Definition at line 93 of file AMIInterpolation.H.

Constructor & Destructor Documentation

◆ AMIInterpolation() [1/5]

AMIInterpolation ( const dictionary dict,
const bool  reverseTarget = false 
)
explicit

Construct from dictionary.

Definition at line 678 of file AMIInterpolation.C.

◆ AMIInterpolation() [2/5]

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

Construct from components.

Definition at line 705 of file AMIInterpolation.C.

◆ AMIInterpolation() [3/5]

AMIInterpolation ( const AMIInterpolation fineAMI,
const labelList sourceRestrictAddressing,
const labelList neighbourRestrictAddressing 
)

◆ AMIInterpolation() [4/5]

Construct as copy.

Definition at line 882 of file AMIInterpolation.C.

◆ AMIInterpolation() [5/5]

Construct from Istream.

Note: does not transfer src(tgt)PatchPts, tsrc(tgt)Patch0_

Definition at line 906 of file AMIInterpolation.C.

References AMIInterpolation::comm_, AMIInterpolation::singlePatchProc_, AMIInterpolation::srcMapPtr_, and AMIInterpolation::tgtMapPtr_.

◆ ~AMIInterpolation()

virtual ~AMIInterpolation ( )
virtualdefault

Destructor.

Member Function Documentation

◆ operator=()

void operator= ( const AMIInterpolation )
protecteddelete

No copy assignment.

◆ createTree()

Foam::autoPtr< Foam::indexedOctree< Foam::AMIInterpolation::treeType > > createTree ( const primitivePatch patch) const
protected

Reset the octree for the patch face search.

Definition at line 59 of file AMIInterpolation.C.

References boundBox::inflate(), Foam::New(), and Foam::foamVersion::patch.

Here is the call graph for this function:

◆ calcDistribution()

Foam::label calcDistribution ( const primitivePatch srcPatch,
const primitivePatch tgtPatch,
const label  comm,
autoPtr< UPstream::communicator > &  geomComm 
) const
protected

Calculate if patches are on multiple processors. Allocates local communicator and returns -1 or processor containing all faces.

Definition at line 83 of file AMIInterpolation.C.

References Foam::ensightOutput::debug, DebugInFunction, Foam::endl(), Foam::ListOps::equal(), Foam::flatOutput(), forAll, autoPtr< T >::good(), Foam::Pout, autoPtr< T >::reset(), UList< T >::size(), and UList< T >::test().

Here is the call graph for this function:

◆ projectPointsToSurface()

void projectPointsToSurface ( const searchableSurface surf,
pointField pts 
) const
protected

Project points to surface.

Definition at line 231 of file AMIInterpolation.C.

References Foam::abort(), addProfiling, DebugInfo, Foam::endl(), Foam::FatalError, FatalErrorInFunction, searchableSurface::findNearest(), forAll, Foam::constant::mathematical::pi(), and pts.

Here is the call graph for this function:

◆ srcPatch0()

const Foam::primitivePatch & srcPatch0 ( ) const
inlineprotected

Return the orginal src patch with optionally updated points.

Definition at line 22 of file AMIInterpolationI.H.

References Foam::abort(), Foam::FatalError, FatalErrorInFunction, and AMIInterpolation::tsrcPatch0_.

Here is the call graph for this function:

◆ tgtPatch0()

const Foam::primitivePatch & tgtPatch0 ( ) const
inlineprotected

Return the orginal tgt patch with optionally updated points.

Definition at line 35 of file AMIInterpolationI.H.

References Foam::abort(), Foam::FatalError, and FatalErrorInFunction.

Here is the call graph for this function:

◆ normaliseWeights() [1/2]

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 
)
staticprotected

Normalise the (area) weights - suppresses numerical error in weights calculation.

NOTE: if area weights are incorrect by 'a significant amount' normalisation may stabilise the solution, but will introduce numerical error!

Definition at line 271 of file AMIInterpolation.C.

References addProfiling, Foam::endl(), forAll, Foam::gAverage(), Foam::gMinMax(), Foam::indent(), Foam::Info, limits, messageStream::masterStream(), Foam::nl, Foam::output(), List< T >::resize_nocopy(), returnReduce(), Foam::returnReduceOr(), s, UList< T >::size(), and Foam::sum().

Here is the call graph for this function:

◆ agglomerate()

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 
)
staticprotected

◆ TypeName()

TypeName ( "AMIInterpolation"  )

Runtime type information.

◆ declareRunTimeSelectionTable() [1/2]

declareRunTimeSelectionTable ( autoPtr  ,
AMIInterpolation  ,
dict  ,
(const dictionary &dict, const bool reverseTarget ,
(dict, reverseTarget  
)

Selection table for dictionary construction.

◆ declareRunTimeSelectionTable() [2/2]

declareRunTimeSelectionTable ( autoPtr  ,
AMIInterpolation  ,
component  ,
(const bool requireMatch, const bool reverseTarget, const scalar lowWeightCorrection ,
(requireMatch, reverseTarget, lowWeightCorrection  
)

Selection table for component-wise construction.

◆ New() [1/2]

Foam::autoPtr< Foam::AMIInterpolation > New ( const word modelName,
const dictionary dict,
const bool  reverseTarget = false 
)
static

Selector for dictionary.

Definition at line 26 of file AMIInterpolationNew.C.

References DebugInfo, dict, Foam::endl(), Foam::exit(), Foam::FatalError, and FatalErrorInLookup.

Referenced by regionModel::interRegionAMI().

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

◆ New() [2/2]

Foam::autoPtr< Foam::AMIInterpolation > New ( const word modelName,
const bool  requireMatch = true,
const bool  reverseTarget = false,
const scalar  lowWeightCorrection = -1 
)
static

Selector for components.

Definition at line 51 of file AMIInterpolationNew.C.

References DebugInfo, Foam::endl(), Foam::exit(), Foam::FatalError, and FatalErrorInLookup.

Here is the call graph for this function:

◆ clone()

virtual autoPtr<AMIInterpolation> clone ( ) const
inlinevirtual

Construct and return a clone.

Reimplemented in advancingFrontAMI, faceAreaWeightAMI, faceAreaWeightAMI2D, and nearestFaceAMI.

Definition at line 434 of file AMIInterpolation.H.

References autoPtr< T >::New().

Here is the call graph for this function:

◆ upToDate() [1/3]

bool upToDate ( ) const
inlinenoexcept

Is up-to-date?

Definition at line 460 of file AMIInterpolation.H.

References AMIInterpolation::upToDate_.

◆ upToDate() [2/3]

bool upToDate ( bool  flag)
inlinenoexcept

Set as up-to-date, return the previous value.

Definition at line 465 of file AMIInterpolation.H.

References AMIInterpolation::upToDate_.

◆ distributed()

bool distributed ( ) const
inlinenoexcept

Distributed across processors (singlePatchProc == -1)

Definition at line 49 of file AMIInterpolationI.H.

◆ requireMatch()

bool requireMatch ( ) const
inlinenoexcept

Return the requireMatch flag.

Definition at line 55 of file AMIInterpolationI.H.

◆ setRequireMatch()

bool setRequireMatch ( bool  flag)
inlinenoexcept

Set the require match flag, return the new value.

Definition at line 61 of file AMIInterpolationI.H.

◆ mustMatchFaces()

bool mustMatchFaces ( ) const
inline

Return true if requireMatch and but not lowWeightCorrection.

Definition at line 68 of file AMIInterpolationI.H.

◆ reverseTarget()

bool reverseTarget ( ) const
inlinenoexcept

Access to the reverseTarget flag.

Definition at line 74 of file AMIInterpolationI.H.

◆ lowWeightCorrection()

Foam::scalar lowWeightCorrection ( ) const
inline

Threshold weight below which interpolation is deactivated.

Definition at line 80 of file AMIInterpolationI.H.

◆ applyLowWeightCorrection()

bool applyLowWeightCorrection ( ) const
inline

Return true if employing a 'lowWeightCorrection'.

Definition at line 86 of file AMIInterpolationI.H.

◆ singlePatchProc()

Foam::label singlePatchProc ( ) const
inlinenoexcept

The processor holding all faces (both sides), or -1 if distributed.

Definition at line 92 of file AMIInterpolationI.H.

◆ comm() [1/2]

Foam::label comm ( ) const
inlinenoexcept

Communicator (local or otherwise) for parallel operations.

Definition at line 98 of file AMIInterpolationI.H.

Referenced by AMIInterpolation::AMIInterpolation(), advancingFrontAMI::checkPatches(), cyclicACMIGAMGInterface::write(), and cyclicAMIGAMGInterface::write().

Here is the caller graph for this function:

◆ comm() [2/2]

Foam::label comm ( label  communicator)
inlinenoexcept

Set (non-local) communicator for parallel operations.

Returns
old value

Definition at line 111 of file AMIInterpolationI.H.

◆ srcMagSf() [1/2]

const Foam::List< Foam::scalar > & srcMagSf ( ) const
inline

Return const access to source patch face areas.

Definition at line 119 of file AMIInterpolationI.H.

Referenced by AMIInterpolation::AMIInterpolation().

Here is the caller graph for this function:

◆ srcMagSf() [2/2]

Foam::List< Foam::scalar > & srcMagSf ( )
inline

Return access to source patch face areas.

Definition at line 125 of file AMIInterpolationI.H.

◆ srcAddress() [1/2]

const Foam::labelListList & srcAddress ( ) const
inline

Return const access to source patch addressing.

Definition at line 131 of file AMIInterpolationI.H.

Referenced by AMIInterpolation::AMIInterpolation(), mappedPatchFieldBase< scalar >::distribute(), and cyclicAMIPolyPatch::mapCollocatedFaces().

Here is the caller graph for this function:

◆ srcAddress() [2/2]

Foam::labelListList & srcAddress ( )
inline

Return access to source patch addressing.

Definition at line 137 of file AMIInterpolationI.H.

◆ srcWeights() [1/2]

const Foam::scalarListList & srcWeights ( ) const
inline

Return const access to source patch weights.

Definition at line 143 of file AMIInterpolationI.H.

Referenced by AMIInterpolation::AMIInterpolation(), assemblyFaceAreaPairGAMGAgglomeration::assemblyFaceAreaPairGAMGAgglomeration(), and mappedPatchFieldBase< scalar >::distribute().

Here is the caller graph for this function:

◆ srcWeights() [2/2]

Foam::scalarListList & srcWeights ( )
inline

Return access to source patch weights.

Definition at line 149 of file AMIInterpolationI.H.

◆ srcWeightsSum() [1/2]

const Foam::scalarField & srcWeightsSum ( ) const
inline

Return const access to normalisation factor of source patch weights (i.e. the sum before normalisation)

Definition at line 155 of file AMIInterpolationI.H.

Referenced by cyclicACMIPolyPatch::resetAMI(), and AMIWeights::writeWeightFields().

Here is the caller graph for this function:

◆ srcWeightsSum() [2/2]

Foam::scalarField & srcWeightsSum ( )
inline

Return access to normalisation factor of source patch weights (i.e. the sum before normalisation)

Definition at line 161 of file AMIInterpolationI.H.

◆ srcCentroids() [1/2]

const Foam::pointListList & srcCentroids ( ) const
inline

Return const access to source patch face centroids.

Definition at line 167 of file AMIInterpolationI.H.

◆ srcCentroids() [2/2]

Foam::pointListList & srcCentroids ( )
inline

Return access to source patch face centroids.

Definition at line 173 of file AMIInterpolationI.H.

◆ srcMap()

const Foam::mapDistribute & srcMap ( ) const
inline

Source map - valid only if singlePatchProc = -1 This gets source data into a form to be consumed by tgtAddress, tgtWeights.

Definition at line 179 of file AMIInterpolationI.H.

Referenced by mappedPatchFieldBase< scalar >::distribute().

Here is the caller graph for this function:

◆ hasSrcMap()

const Foam::mapDistribute * hasSrcMap ( ) const
inlinenoexcept

Pointer to the source map (if distributed). Can be checked as a bool.

Definition at line 186 of file AMIInterpolationI.H.

◆ tgtMagSf() [1/2]

const Foam::List< Foam::scalar > & tgtMagSf ( ) const
inline

Return const access to target patch face areas.

Definition at line 192 of file AMIInterpolationI.H.

Referenced by AMIInterpolation::AMIInterpolation().

Here is the caller graph for this function:

◆ tgtMagSf() [2/2]

Foam::List< Foam::scalar > & tgtMagSf ( )
inline

Return access to target patch face areas.

Definition at line 198 of file AMIInterpolationI.H.

◆ tgtAddress() [1/2]

const Foam::labelListList & tgtAddress ( ) const
inline

Return const access to target patch addressing.

Definition at line 204 of file AMIInterpolationI.H.

Referenced by AMIInterpolation::AMIInterpolation(), and mappedPatchFieldBase< scalar >::distribute().

Here is the caller graph for this function:

◆ tgtAddress() [2/2]

Foam::labelListList & tgtAddress ( )
inline

Return access to target patch addressing.

Definition at line 210 of file AMIInterpolationI.H.

◆ tgtWeights() [1/2]

const Foam::scalarListList & tgtWeights ( ) const
inline

Return const access to target patch weights.

Definition at line 216 of file AMIInterpolationI.H.

Referenced by AMIInterpolation::AMIInterpolation(), and mappedPatchFieldBase< scalar >::distribute().

Here is the caller graph for this function:

◆ tgtWeights() [2/2]

Foam::scalarListList & tgtWeights ( )
inline

Return access to target patch weights.

Definition at line 222 of file AMIInterpolationI.H.

◆ tgtWeightsSum() [1/2]

const Foam::scalarField & tgtWeightsSum ( ) const
inline

Return const access to normalisation factor of target patch weights (i.e. the sum before normalisation)

Definition at line 228 of file AMIInterpolationI.H.

Referenced by cyclicACMIPolyPatch::resetAMI(), and AMIWeights::writeWeightFields().

Here is the caller graph for this function:

◆ tgtWeightsSum() [2/2]

Foam::scalarField & tgtWeightsSum ( )
inline

Return access to normalisation factor of target patch weights (i.e. the sum before normalisation)

Definition at line 234 of file AMIInterpolationI.H.

◆ tgtMap()

const Foam::mapDistribute & tgtMap ( ) const
inline

Target map - valid only if singlePatchProc=-1. This gets target data into a form to be consumed by srcAddress, srcWeights.

Definition at line 240 of file AMIInterpolationI.H.

Referenced by mappedPatchFieldBase< scalar >::distribute().

Here is the caller graph for this function:

◆ hasTgtMap()

const Foam::mapDistribute * hasTgtMap ( ) const
inlinenoexcept

Pointer to the target map (if distributed). Can be checked as a bool.

Definition at line 247 of file AMIInterpolationI.H.

◆ calculate()

bool calculate ( const primitivePatch srcPatch,
const primitivePatch tgtPatch,
const autoPtr< searchableSurface > &  surfPtr = nullptr 
)
virtual

Update addressing, weights and (optional) centroids.

Reimplemented in faceAreaWeightAMI, advancingFrontAMI, faceAreaWeightAMI2D, and nearestFaceAMI.

Definition at line 946 of file AMIInterpolation.C.

References addProfiling, DebugInfo, Foam::endl(), Foam::indent(), Foam::Info, UPstream::msgType(), UPstream::myProcNo(), refPtr< T >::New(), Foam::nl, PrimitivePatch< FaceList, PointField >::points(), and Foam::returnReduce().

Referenced by nearestFaceAMI::calculate(), and advancingFrontAMI::calculate().

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

◆ reset()

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.

Definition at line 1064 of file AMIInterpolation.C.

References DebugInFunction, Foam::endl(), forAll, and Foam::sum().

Referenced by mappedPatchBase::AMI().

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

◆ append()

void append ( const primitivePatch srcPatch,
const primitivePatch tgtPatch 
)

Append additional addressing and weights.

Definition at line 1104 of file AMIInterpolation.C.

References addProfiling, UList< T >::begin(), forAll, Foam::max(), List< T >::push_back(), and UList< T >::size().

Here is the call graph for this function:

◆ normaliseWeights() [2/2]

void normaliseWeights ( const bool  conformal,
const bool  output 
)

Normalise the weights.

Definition at line 1295 of file AMIInterpolation.C.

References Foam::output().

Here is the call graph for this function:

◆ weightedSum() [1/2]

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 
)
static

Weighted sum of contributions.

Definition at line 29 of file AMIInterpolationTemplates.C.

References fld, and forAll.

◆ weightedSum() [2/2]

void weightedSum ( const bool  interpolateToSource,
const UList< Type > &  fld,
List< Type > &  result,
const UList< Type > &  defaultValues 
) const

Weighted sum of contributions.

Definition at line 78 of file AMIInterpolationTemplates.C.

References fld, and Foam::weightedSum().

Here is the call graph for this function:

◆ interpolateToSource() [1/9]

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.

Definition at line 168 of file AMIInterpolationTemplates.C.

References Foam::abort(), addProfiling, mapDistributeBase::comm(), mapDistributeBase::constructSize(), mapDistribute::distribute(), Foam::FatalError, FatalErrorInFunction, fld, Foam::nl, List< T >::resize_nocopy(), List< T >::setSize(), UList< T >::size(), and Foam::weightedSum().

Referenced by regionModel::mapRegionPatchField(), and regionModel::mapRegionPatchInternalField().

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

◆ interpolateToTarget() [1/9]

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.

Definition at line 101 of file AMIInterpolationTemplates.C.

References Foam::abort(), addProfiling, mapDistributeBase::comm(), mapDistributeBase::constructSize(), mapDistribute::distribute(), Foam::FatalError, FatalErrorInFunction, fld, Foam::nl, List< T >::resize_nocopy(), List< T >::setSize(), UList< T >::size(), and Foam::weightedSum().

Here is the call graph for this function:

◆ interpolateToSource() [2/9]

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.

◆ interpolateToSource() [3/9]

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.

◆ interpolateToTarget() [2/9]

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.

◆ interpolateToTarget() [3/9]

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.

◆ interpolateToSource() [4/9]

tmp<Field<Type> > interpolateToSource ( const Field< Type > &  fld,
const UList< Type > &  defaultValues = UList< Type >::null() 
) const

Interpolate from target to source.

◆ interpolateToSource() [5/9]

tmp<Field<Type> > interpolateToSource ( const tmp< Field< Type >> &  tFld,
const UList< Type > &  defaultValues = UList< Type >::null() 
) const

Interpolate from target tmp field.

◆ interpolateToTarget() [4/9]

tmp<Field<Type> > interpolateToTarget ( const Field< Type > &  fld,
const UList< Type > &  defaultValues = UList< Type >::null() 
) const

Interpolate from source to target.

◆ interpolateToTarget() [5/9]

tmp<Field<Type> > interpolateToTarget ( const tmp< Field< Type >> &  tFld,
const UList< Type > &  defaultValues = UList< Type >::null() 
) const

Interpolate from source tmp field.

◆ srcPointFace()

Foam::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.

Definition at line 1329 of file AMIInterpolation.C.

References PointHit< PointType >::distance(), PointHit< PointType >::eligibleMiss(), f(), PointHit< PointType >::hit(), n, PointHit< PointType >::point(), PrimitivePatch< FaceList, PointField >::points(), and PointHit< PointType >::setDistance().

Here is the call graph for this function:

◆ tgtPointFace()

Foam::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.

Definition at line 1378 of file AMIInterpolation.C.

References PointHit< PointType >::distance(), PointHit< PointType >::eligibleMiss(), f(), PointHit< PointType >::hit(), n, PointHit< PointType >::point(), PrimitivePatch< FaceList, PointField >::points(), and PointHit< PointType >::setDistance().

Here is the call graph for this function:

◆ checkSymmetricWeights()

bool checkSymmetricWeights ( const bool  log) const

Check if src addresses are present in tgt addresses and viceversa.

Definition at line 1426 of file AMIInterpolation.C.

References Foam::endl(), forAll, found, Log, Foam::nl, and UPstream::parRun().

Here is the call graph for this function:

◆ writeFaceConnectivity()

void writeFaceConnectivity ( const primitivePatch srcPatch,
const primitivePatch tgtPatch,
const labelListList srcAddress 
) const

Write face connectivity as OBJ file.

Definition at line 1490 of file AMIInterpolation.C.

References Foam::endl(), PrimitivePatch< FaceList, PointField >::faceCentres(), forAll, UPstream::myProcNo(), Foam::name(), os(), and Foam::meshTools::writeOBJ().

Here is the call graph for this function:

◆ write()

void write ( Ostream os) const
virtual

Write AMI as a dictionary.

Reimplemented in advancingFrontAMI, faceAreaWeightAMI, faceAreaWeightAMI2D, and nearestFaceAMI.

Definition at line 1521 of file AMIInterpolation.C.

References os(), Foam::type(), and Ostream::writeEntry().

Referenced by nearestFaceAMI::write(), and advancingFrontAMI::write().

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

◆ writeData()

bool writeData ( Ostream os) const
virtual

Write AMI raw.

Definition at line 1542 of file AMIInterpolation.C.

References IOstream::good(), os(), and token::SPACE.

Referenced by cyclicACMIGAMGInterface::write(), and cyclicAMIGAMGInterface::write().

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

◆ upToDate() [3/3]

bool& upToDate ( )
inlinenoexcept

Non-const access to the up-to-date flag.

Deprecated:
Prefer the upToDate(bool) setter (JAN-2023)

Definition at line 905 of file AMIInterpolation.H.

References AMIInterpolation::upToDate_.

◆ interpolateToSource() [6/9]

Foam::tmp<Foam::Field<Type> > interpolateToSource ( const Field< Type > &  fld,
const CombineOp &  cop,
const UList< Type > &  defaultValues 
) const

Definition at line 235 of file AMIInterpolationTemplates.C.

References fld, Foam::New(), and Foam::Zero.

Here is the call graph for this function:

◆ interpolateToSource() [7/9]

Foam::tmp<Foam::Field<Type> > interpolateToSource ( const tmp< Field< Type >> &  tFld,
const CombineOp &  cop,
const UList< Type > &  defaultValues 
) const

Definition at line 257 of file AMIInterpolationTemplates.C.

◆ interpolateToTarget() [6/9]

Foam::tmp<Foam::Field<Type> > interpolateToTarget ( const Field< Type > &  fld,
const CombineOp &  cop,
const UList< Type > &  defaultValues 
) const

Definition at line 269 of file AMIInterpolationTemplates.C.

References fld, Foam::New(), and Foam::Zero.

Here is the call graph for this function:

◆ interpolateToTarget() [7/9]

Foam::tmp<Foam::Field<Type> > interpolateToTarget ( const tmp< Field< Type >> &  tFld,
const CombineOp &  cop,
const UList< Type > &  defaultValues 
) const

Definition at line 291 of file AMIInterpolationTemplates.C.

◆ interpolateToSource() [8/9]

Foam::tmp<Foam::Field<Type> > interpolateToSource ( const Field< Type > &  fld,
const UList< Type > &  defaultValues 
) const

Definition at line 303 of file AMIInterpolationTemplates.C.

References fld.

◆ interpolateToSource() [9/9]

Foam::tmp<Foam::Field<Type> > interpolateToSource ( const tmp< Field< Type >> &  tFld,
const UList< Type > &  defaultValues 
) const

Definition at line 314 of file AMIInterpolationTemplates.C.

◆ interpolateToTarget() [8/9]

Foam::tmp<Foam::Field<Type> > interpolateToTarget ( const Field< Type > &  fld,
const UList< Type > &  defaultValues 
) const

Definition at line 325 of file AMIInterpolationTemplates.C.

References fld.

◆ interpolateToTarget() [9/9]

Foam::tmp<Foam::Field<Type> > interpolateToTarget ( const tmp< Field< Type >> &  tFld,
const UList< Type > &  defaultValues 
) const

Definition at line 336 of file AMIInterpolationTemplates.C.

Member Data Documentation

◆ cacheIntersections_

bool cacheIntersections_ = false
static

Definition at line 76 of file AMIInterpolation.H.

◆ useLocalComm_

int useLocalComm_
static

Control use of local communicator for AMI communication.

localComm : 0 : all processors (backwards compatible) localComm : 1 : only processors with patch faces localComm : 2 : like 1 but always include master (for messages)

Definition at line 85 of file AMIInterpolation.H.

◆ requireMatch_

bool requireMatch_
protected

Flag to indicate that the two patches must be matched/an overlap exists between them.

Definition at line 101 of file AMIInterpolation.H.

Referenced by advancingFrontAMI::checkPatches().

◆ reverseTarget_

const bool reverseTarget_
protected

Flag to indicate that the two patches are co-directional and that the orientation of the target patch should be reversed.

Definition at line 107 of file AMIInterpolation.H.

◆ lowWeightCorrection_

const scalar lowWeightCorrection_
protected

Threshold weight below which interpolation is deactivated.

Definition at line 112 of file AMIInterpolation.H.

◆ singlePatchProc_

label singlePatchProc_
protected

Index of processor that holds all of both sides. The value is -1 for distributed cases.

Definition at line 118 of file AMIInterpolation.H.

Referenced by AMIInterpolation::AMIInterpolation().

◆ comm_

label comm_
protected

Communicator to use for parallel operations.

Definition at line 123 of file AMIInterpolation.H.

Referenced by AMIInterpolation::AMIInterpolation().

◆ geomComm_

autoPtr<UPstream::communicator> geomComm_
protected

Communicator to use for geometry calculations. Not valid (-1) on processors that do not have faces.

Definition at line 129 of file AMIInterpolation.H.

◆ srcMagSf_

scalarList srcMagSf_
protected

Source face areas.

Definition at line 137 of file AMIInterpolation.H.

◆ srcAddress_

labelListList srcAddress_
protected

Addresses of target faces per source face.

Definition at line 142 of file AMIInterpolation.H.

◆ srcWeights_

scalarListList srcWeights_
protected

Weights of target faces per source face.

Definition at line 147 of file AMIInterpolation.H.

◆ srcWeightsSum_

scalarField srcWeightsSum_
protected

Sum of weights of target faces per source face.

Definition at line 152 of file AMIInterpolation.H.

◆ srcCentroids_

pointListList srcCentroids_
protected

Centroid of target faces per source face.

Definition at line 157 of file AMIInterpolation.H.

◆ srcPatchPts_

pointField srcPatchPts_
protected

Source patch points if input points are manipulated, e.g. projected.

Definition at line 163 of file AMIInterpolation.H.

◆ tsrcPatch0_

refPtr<primitivePatch> tsrcPatch0_
protected

Source patch using manipulated input points.

Definition at line 168 of file AMIInterpolation.H.

Referenced by advancingFrontAMI::srcPatch(), and AMIInterpolation::srcPatch0().

◆ srcMapPtr_

autoPtr<mapDistribute> srcMapPtr_
protected

Source map pointer - parallel running only.

Definition at line 173 of file AMIInterpolation.H.

Referenced by AMIInterpolation::AMIInterpolation().

◆ tgtMagSf_

scalarList tgtMagSf_
protected

Target face areas.

Definition at line 182 of file AMIInterpolation.H.

◆ tgtAddress_

labelListList tgtAddress_
protected

Addresses of source faces per target face.

Definition at line 187 of file AMIInterpolation.H.

◆ tgtWeights_

scalarListList tgtWeights_
protected

Weights of source faces per target face.

Definition at line 192 of file AMIInterpolation.H.

◆ tgtWeightsSum_

scalarField tgtWeightsSum_
protected

Sum of weights of source faces per target face.

Definition at line 197 of file AMIInterpolation.H.

◆ tgtCentroids_

pointListList tgtCentroids_
protected

Centroid of source faces per target face.

Definition at line 202 of file AMIInterpolation.H.

◆ tgtPatchPts_

pointField tgtPatchPts_
protected

Target patch points if input points are manipulated, e.g. projected.

Definition at line 208 of file AMIInterpolation.H.

◆ ttgtPatch0_

refPtr<primitivePatch> ttgtPatch0_
protected

Target patch using manipulated input points.

Definition at line 213 of file AMIInterpolation.H.

◆ tgtMapPtr_

autoPtr<mapDistribute> tgtMapPtr_
protected

Target map pointer - parallel running only.

Definition at line 218 of file AMIInterpolation.H.

Referenced by AMIInterpolation::AMIInterpolation().

◆ upToDate_

bool upToDate_
protected

Up-to-date flag.

Definition at line 223 of file AMIInterpolation.H.

Referenced by AMIInterpolation::upToDate().


The documentation for this class was generated from the following files: