Loading...
Searching...
No Matches
AMICache Class Reference

Provides caching of weights and addressing to AMIInterpolation. More...

#include <AMICache.H>

Public Member Functions

 TypeName ("AMICache")
 AMICache (const bool toSource=true)
 Null constructor.
 AMICache (const dictionary &dict, const bool toSource=true)
 Construct from dictionary.
 AMICache (const AMICache &cache)
 Construct as copy.
 AMICache (const AMICache &cache, const AMIInterpolation &fineAMI, const labelList &sourceRestrictAddressing, const labelList &targetRestrictAddressing)
 Construct from agglomeration of AMIInterpolation. Agglomeration passed in as new coarse size and addressing from fine from coarse.
 AMICache (Istream &is)
 Construct from stream.
virtual ~AMICache ()=default
 Destructor.
constexpr bool active () const noexcept
 Return true if cache is active.
void setSize (const label size) noexcept
 Set the cache size; also deactivates the cache if size <= 0.
constexpr label size () const noexcept
 Return cache size.
constexpr bool complete () const noexcept
 Return true if cache is complete.
constexpr label index0 () const noexcept
 Return cache lower bound index.
constexpr label index1 () const noexcept
 Return cache upper bound index.
constexpr label weight () const noexcept
 Return cache interpolation weight.
const List< scalar > & theta () const noexcept
 Return list of cached rotation angles.
const List< labelListList > & cachedSrcAddress () const noexcept
 Return List of source addresses.
const List< scalarListList > & cachedSrcWeights () const noexcept
 Return List of source weights.
const List< scalarField > & cachedSrcWeightsSum () const noexcept
 Return List of source weights sums.
const List< autoPtr< mapDistribute > > & cachedSrcMapPtr () const noexcept
 Return List of source parallel maps.
const List< labelListList > & cachedTgtAddress () const noexcept
 Return List of target addresses.
const List< scalarListList > & cachedTgtWeights () const noexcept
 Return List of target weights.
const List< scalarField > & cachedTgtWeightsSum () const noexcept
 Return List of target weights sums.
const List< autoPtr< mapDistribute > > & cachedTgtMapPtr () const noexcept
 Return List of target parallel maps.
template<class Type, class EvalFunction>
bool apply (List< Type > &result, const EvalFunction &eval) const
 Apply cached evaluation based on user supplied evaluation function.
constexpr bool applyLower () const noexcept
 Flag that lower bound is applicable.
constexpr bool applyUpper () const noexcept
 Flag that upper bound is applicable.
constexpr bool applyInterpolate () const noexcept
 Flag that interpolation is applicable.
constexpr bool setDirection (bool toSource) const noexcept
 Set the interpolation direction.
bool restoreCache (const point &globalPoint)
 Restore AMI weights and addressing from the cache.
void addToCache (const AMIInterpolation &ami, const point &globalPoint)
 Add AMI weights and addressing to the cache.
void checkBounds (const label index) const
 Check cache index is within bounds.
bool validIndex (const label bini) const
 Return true of the cache index is set for bini.
label thetaIndex (const scalar theta) const noexcept
 Return bin index for angle theta.
const labelListListcSrcAddress0 () const
const scalarListListcSrcWeights0 () const
const scalarFieldcSrcWeightsSum0 () const
const autoPtr< mapDistribute > & cSrcMapPtr0 () const
const labelListListcSrcAddress1 () const
const scalarListListcSrcWeights1 () const
const scalarFieldcSrcWeightsSum1 () const
const autoPtr< mapDistribute > & cSrcMapPtr1 () const
const labelListListcTgtAddress0 () const
const scalarListListcTgtWeights0 () const
const scalarFieldcTgtWeightsSum0 () const
const autoPtr< mapDistribute > & cTgtMapPtr0 () const
const labelListListcTgtAddress1 () const
const scalarListListcTgtWeights1 () const
const scalarFieldcTgtWeightsSum1 () const
const autoPtr< mapDistribute > & cTgtMapPtr1 () const
const labelListListcSrcAddress (const label index) const
const scalarListListcSrcWeights (const label index) const
const scalarFieldcSrcWeightsSum (const label index) const
const autoPtr< mapDistribute > & cSrcMapPtr (const label index) const
const labelListListcTgtAddress (const label index) const
const scalarListListcTgtWeights (const label index) const
const scalarFieldcTgtWeightsSum (const label index) const
const autoPtr< mapDistribute > & cTgtMapPtr (const label index) const
void write (Ostream &os) const
 Write AMI as a dictionary.
bool writeData (Ostream &os) const
 Write AMI raw.

Static Public Attributes

static scalar cacheThetaTolerance_ = 1e-8
 Tolerance used when caching the AMI to identify e.g. if the current rotation angle has already been captured.

Detailed Description

Provides caching of weights and addressing to AMIInterpolation.

Source files
See also
Foam::AMIInterpolation.H

Definition at line 53 of file AMICache.H.

Constructor & Destructor Documentation

◆ AMICache() [1/5]

AMICache ( const bool toSource = true)

Null constructor.

Definition at line 102 of file AMICache.C.

References Foam::Zero.

Referenced by AMICache(), AMICache(), and TypeName().

Here is the caller graph for this function:

◆ AMICache() [2/5]

AMICache ( const dictionary & dict,
const bool toSource = true )

Construct from dictionary.

Definition at line 64 of file AMICache.C.

References dict, and Foam::Zero.

◆ AMICache() [3/5]

AMICache ( const AMICache & cache)

Construct as copy.

Definition at line 127 of file AMICache.C.

References AMICache(), forAll, and size().

Here is the call graph for this function:

◆ AMICache() [4/5]

AMICache ( const AMICache & cache,
const AMIInterpolation & fineAMI,
const labelList & sourceRestrictAddressing,
const labelList & targetRestrictAddressing )

Construct from agglomeration of AMIInterpolation. Agglomeration passed in as new coarse size and addressing from fine from coarse.

Definition at line 167 of file AMICache.C.

References AMICache(), and AMIInterpolation::comm().

Here is the call graph for this function:

◆ AMICache() [5/5]

AMICache ( Istream & is)

Construct from stream.

Definition at line 264 of file AMICache.C.

References forAll, Foam::readBool(), Foam::readLabel(), and PackedList< Width >::size().

Here is the call graph for this function:

◆ ~AMICache()

virtual ~AMICache ( )
virtualdefault

Destructor.

Member Function Documentation

◆ TypeName()

TypeName ( "AMICache" )

References AMICache(), and dict.

Here is the call graph for this function:

◆ active()

bool active ( ) const
inlineconstexprnoexcept

Return true if cache is active.

Definition at line 235 of file AMICache.H.

References Foam::noexcept.

Referenced by addToCache().

Here is the caller graph for this function:

◆ setSize()

void setSize ( const label size)
inlinenoexcept

Set the cache size; also deactivates the cache if size <= 0.

Definition at line 240 of file AMICache.H.

References size().

Here is the call graph for this function:

◆ size()

label size ( ) const
inlineconstexprnoexcept

Return cache size.

Definition at line 248 of file AMICache.H.

References Foam::noexcept.

Referenced by AMICache(), and setSize().

Here is the caller graph for this function:

◆ complete()

bool complete ( ) const
inlineconstexprnoexcept

Return true if cache is complete.

Definition at line 253 of file AMICache.H.

References Foam::noexcept.

◆ index0()

label index0 ( ) const
inlineconstexprnoexcept

Return cache lower bound index.

Definition at line 258 of file AMICache.H.

References Foam::noexcept.

◆ index1()

label index1 ( ) const
inlineconstexprnoexcept

Return cache upper bound index.

Definition at line 263 of file AMICache.H.

References Foam::noexcept.

◆ weight()

label weight ( ) const
inlineconstexprnoexcept

Return cache interpolation weight.

Definition at line 268 of file AMICache.H.

References Foam::noexcept.

◆ theta()

const List< scalar > & theta ( ) const
inlinenoexcept

Return list of cached rotation angles.

Definition at line 273 of file AMICache.H.

References Foam::noexcept.

Referenced by addToCache(), restoreCache(), and thetaIndex().

Here is the caller graph for this function:

◆ cachedSrcAddress()

const List< labelListList > & cachedSrcAddress ( ) const
inlinenoexcept

Return List of source addresses.

Definition at line 278 of file AMICache.H.

References Foam::noexcept.

◆ cachedSrcWeights()

const List< scalarListList > & cachedSrcWeights ( ) const
inlinenoexcept

Return List of source weights.

Definition at line 286 of file AMICache.H.

References Foam::noexcept.

◆ cachedSrcWeightsSum()

const List< scalarField > & cachedSrcWeightsSum ( ) const
inlinenoexcept

Return List of source weights sums.

Definition at line 294 of file AMICache.H.

References Foam::noexcept.

◆ cachedSrcMapPtr()

const List< autoPtr< mapDistribute > > & cachedSrcMapPtr ( ) const
inlinenoexcept

Return List of source parallel maps.

Definition at line 302 of file AMICache.H.

References Foam::noexcept.

◆ cachedTgtAddress()

const List< labelListList > & cachedTgtAddress ( ) const
inlinenoexcept

Return List of target addresses.

Definition at line 310 of file AMICache.H.

References Foam::noexcept.

◆ cachedTgtWeights()

const List< scalarListList > & cachedTgtWeights ( ) const
inlinenoexcept

Return List of target weights.

Definition at line 318 of file AMICache.H.

References Foam::noexcept.

◆ cachedTgtWeightsSum()

const List< scalarField > & cachedTgtWeightsSum ( ) const
inlinenoexcept

Return List of target weights sums.

Definition at line 326 of file AMICache.H.

References Foam::noexcept.

◆ cachedTgtMapPtr()

const List< autoPtr< mapDistribute > > & cachedTgtMapPtr ( ) const
inlinenoexcept

Return List of target parallel maps.

Definition at line 334 of file AMICache.H.

References Foam::noexcept.

◆ apply()

template<class Type, class EvalFunction>
bool apply ( List< Type > & result,
const EvalFunction & eval ) const

Apply cached evaluation based on user supplied evaluation function.

◆ applyLower()

bool applyLower ( ) const
inlineconstexprnoexcept

Flag that lower bound is applicable.

Definition at line 348 of file AMICache.H.

References Foam::noexcept.

◆ applyUpper()

bool applyUpper ( ) const
inlineconstexprnoexcept

Flag that upper bound is applicable.

Definition at line 356 of file AMICache.H.

References Foam::noexcept.

◆ applyInterpolate()

bool applyInterpolate ( ) const
inlineconstexprnoexcept

Flag that interpolation is applicable.

Definition at line 364 of file AMICache.H.

References Foam::noexcept.

◆ setDirection()

bool setDirection ( bool toSource) const
inlineconstexprnoexcept

Set the interpolation direction.

Definition at line 372 of file AMICache.H.

◆ restoreCache()

bool restoreCache ( const point & globalPoint)

Restore AMI weights and addressing from the cache.

Definition at line 418 of file AMICache.C.

References cacheThetaTolerance_, DebugInfo, DebugPout, Foam::endl(), forAll, Foam::labelMax, UList< T >::last(), Foam::mag(), Foam::nl, DynamicList< T, SizeMin >::push_back(), UList< T >::size(), theta(), thetaIndex(), Foam::constant::mathematical::twoPi(), and validIndex().

Here is the call graph for this function:

◆ addToCache()

◆ checkBounds()

void checkBounds ( const label index) const
inline

Check cache index is within bounds.

Definition at line 395 of file AMICache.H.

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

Here is the call graph for this function:

◆ validIndex()

bool validIndex ( const label bini) const
inline

Return true of the cache index is set for bini.

Definition at line 408 of file AMICache.H.

References Foam::constant::mathematical::twoPi().

Referenced by addToCache(), and restoreCache().

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

◆ thetaIndex()

label thetaIndex ( const scalar theta) const
inlinenoexcept

Return bin index for angle theta.

Definition at line 417 of file AMICache.H.

References cacheThetaTolerance_, theta(), and Foam::constant::mathematical::twoPi().

Referenced by addToCache(), and restoreCache().

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

◆ cSrcAddress0()

const labelListList & cSrcAddress0 ( ) const
inline

Definition at line 461 of file AMICache.H.

◆ cSrcWeights0()

const scalarListList & cSrcWeights0 ( ) const
inline

Definition at line 461 of file AMICache.H.

◆ cSrcWeightsSum0()

const scalarField & cSrcWeightsSum0 ( ) const
inline

Definition at line 461 of file AMICache.H.

◆ cSrcMapPtr0()

const autoPtr< mapDistribute > & cSrcMapPtr0 ( ) const
inline

Definition at line 461 of file AMICache.H.

◆ cSrcAddress1()

const labelListList & cSrcAddress1 ( ) const
inline

Definition at line 462 of file AMICache.H.

References defineMethods01.

◆ cSrcWeights1()

const scalarListList & cSrcWeights1 ( ) const
inline

Definition at line 462 of file AMICache.H.

◆ cSrcWeightsSum1()

const scalarField & cSrcWeightsSum1 ( ) const
inline

Definition at line 462 of file AMICache.H.

◆ cSrcMapPtr1()

const autoPtr< mapDistribute > & cSrcMapPtr1 ( ) const
inline

Definition at line 462 of file AMICache.H.

◆ cTgtAddress0()

const labelListList & cTgtAddress0 ( ) const
inline

Definition at line 463 of file AMICache.H.

References defineMethods01.

◆ cTgtWeights0()

const scalarListList & cTgtWeights0 ( ) const
inline

Definition at line 463 of file AMICache.H.

◆ cTgtWeightsSum0()

const scalarField & cTgtWeightsSum0 ( ) const
inline

Definition at line 463 of file AMICache.H.

◆ cTgtMapPtr0()

const autoPtr< mapDistribute > & cTgtMapPtr0 ( ) const
inline

Definition at line 463 of file AMICache.H.

◆ cTgtAddress1()

const labelListList & cTgtAddress1 ( ) const
inline

Definition at line 464 of file AMICache.H.

References defineMethods01.

◆ cTgtWeights1()

const scalarListList & cTgtWeights1 ( ) const
inline

Definition at line 464 of file AMICache.H.

◆ cTgtWeightsSum1()

const scalarField & cTgtWeightsSum1 ( ) const
inline

Definition at line 464 of file AMICache.H.

◆ cTgtMapPtr1()

const autoPtr< mapDistribute > & cTgtMapPtr1 ( ) const
inline

Definition at line 464 of file AMICache.H.

◆ cSrcAddress()

const labelListList & cSrcAddress ( const label index) const
inline

Definition at line 501 of file AMICache.H.

◆ cSrcWeights()

const scalarListList & cSrcWeights ( const label index) const
inline

Definition at line 501 of file AMICache.H.

◆ cSrcWeightsSum()

const scalarField & cSrcWeightsSum ( const label index) const
inline

Definition at line 501 of file AMICache.H.

◆ cSrcMapPtr()

const autoPtr< mapDistribute > & cSrcMapPtr ( const label index) const
inline

Definition at line 501 of file AMICache.H.

◆ cTgtAddress()

const labelListList & cTgtAddress ( const label index) const
inline

Definition at line 502 of file AMICache.H.

References defineMethodsIndex, os(), write(), and writeData().

Here is the call graph for this function:

◆ cTgtWeights()

const scalarListList & cTgtWeights ( const label index) const
inline

Definition at line 502 of file AMICache.H.

◆ cTgtWeightsSum()

const scalarField & cTgtWeightsSum ( const label index) const
inline

Definition at line 502 of file AMICache.H.

◆ cTgtMapPtr()

const autoPtr< mapDistribute > & cTgtMapPtr ( const label index) const
inline

Definition at line 502 of file AMICache.H.

◆ write()

void write ( Ostream & os) const

Write AMI as a dictionary.

Definition at line 604 of file AMICache.C.

References os().

Referenced by cTgtAddress().

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

◆ writeData()

bool writeData ( Ostream & os) const

Write AMI raw.

Definition at line 617 of file AMICache.C.

References forAll, os(), bitSet::set(), PackedList< Width >::size(), and token::SPACE.

Referenced by cTgtAddress().

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

Member Data Documentation

◆ cacheThetaTolerance_

Foam::scalar cacheThetaTolerance_ = 1e-8
static

Tolerance used when caching the AMI to identify e.g. if the current rotation angle has already been captured.

Definition at line 63 of file AMICache.H.

Referenced by restoreCache(), and thetaIndex().


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