Chombo + EB  3.2
Public Member Functions | Public Attributes | List of all members
AmrAdaptor Class Reference

Data holder for AMR hierarchy data to interact with SUNDIALS. More...

#include <AmrAdaptor.H>

Inheritance diagram for AmrAdaptor:
Inheritance graph
[legend]

Public Member Functions

 AmrAdaptor ()
 
virtual ~AmrAdaptor ()
 
virtual ChomboSundialsAdaptornewAdaptor ()
 
void define (Vector< LevelData< FArrayBox > *> amrData, Vector< int > refRatio, int finestLevel, bool ownData)
 
Vector< LevelData< FArrayBox > * > getData ()
 
Vector< int > getRefRatio ()
 
size_t getFinestLevel ()
 
bool getOwnData ()
 
virtual void linearSum (ChomboSundialsAdaptor &x, ChomboSundialsAdaptor &y, Real a, Real b)
 
virtual void setConst (Real c)
 
virtual void prod (ChomboSundialsAdaptor &ax, ChomboSundialsAdaptor &ay)
 
virtual void div (ChomboSundialsAdaptor &ax, ChomboSundialsAdaptor &ay)
 
virtual void scale (ChomboSundialsAdaptor &ax, Real c)
 
virtual void abs (ChomboSundialsAdaptor &ax)
 
virtual void inv (ChomboSundialsAdaptor &ax)
 
virtual void addConst (ChomboSundialsAdaptor &ax, Real b)
 
virtual Real dotProd (ChomboSundialsAdaptor &ax)
 
virtual Real maxNorm ()
 
virtual Real wRMSNorm (ChomboSundialsAdaptor &aw)
 
virtual Real wRMSNormMask (ChomboSundialsAdaptor &aw, ChomboSundialsAdaptor &aid)
 
virtual Real min ()
 
virtual Real wL2Norm (ChomboSundialsAdaptor &aw)
 
virtual void compare (ChomboSundialsAdaptor &ax, Real b)
 
virtual bool invTest (ChomboSundialsAdaptor &ax)
 
virtual bool constrMask (ChomboSundialsAdaptor &ac, ChomboSundialsAdaptor &am)
 
virtual Real minQuotient (ChomboSundialsAdaptor &adenom)
 
virtual unsigned long getLength ()
 
virtual Real l1Norm ()
 
virtual void print ()
 
virtual void printFile (FILE *outfile)
 
virtual void printFileHDF (const char *filename)
 
virtual bool copyTo (ChomboSundialsAdaptor &a)
 
virtual void exchange ()
 
- Public Member Functions inherited from ChomboSundialsAdaptor
 ChomboSundialsAdaptor ()
 
virtual ~ChomboSundialsAdaptor ()
 

Public Attributes

Vector< LevelData< FArrayBox > * > m_amrData
 Pointers to AMR hierarchy data. More...
 
Vector< int > m_refRatio
 AMR hierarchy refinement ratios between levels More...
 
size_t m_finestLevel
 finest active AMR level More...
 
Vector< LevelData< FArrayBox > * > m_amrMask
 AMR mask, 1 for uncovered values, 0 for covered values More...
 
unsigned long m_length = -1
 Cached nvector length, sum of all unmasked values, across all ranks. More...
 
int m_comp = -1
 Number of components in the LevelData<FArrayBox>'s. More...
 
bool m_ownData = false
 If true, will call delete in destructor. More...
 

Detailed Description

Data holder for AMR hierarchy data to interact with SUNDIALS.

This class supports most of the operations needed by SUNDIALS nvector, mapped onto an AMR hierarchy of LevelData<FArrayBox>. It works in parallel and serial, and uses masks to make sure covered cells on coarse levels don't contribute to calculations needed by SUNDIALS. It is dumb, in that if any of the AMR hierarchy is regridded or redefined, this must be redefined as well.

Note that many of the SUNDIALS NVector operations allow the object itself to be passed for an in-place update, check each function.

Constructor & Destructor Documentation

◆ AmrAdaptor()

AmrAdaptor::AmrAdaptor ( )
inline

Constructor.

◆ ~AmrAdaptor()

virtual AmrAdaptor::~AmrAdaptor ( )
inlinevirtual

Member Function Documentation

◆ newAdaptor()

virtual ChomboSundialsAdaptor* AmrAdaptor::newAdaptor ( )
virtual

Factory.

Implements ChomboSundialsAdaptor.

Referenced by ~AmrAdaptor().

◆ define()

void AmrAdaptor::define ( Vector< LevelData< FArrayBox > *>  amrData,
Vector< int >  refRatio,
int  finestLevel,
bool  ownData 
)

Define from an existing AMR hierarchy.

  • amrData: vector of pointers to all the LevelData<FArrayBox> in the hierarchy
  • refRatio: vector of integer refinement ratios between levels
  • finestLevel: finest active AMR level (may not be using all available levels)
  • ownData: (true) delete pointers in destructor

Redefines and calculates masks. Calls delete on amrData and masks pointers in destructor.

Referenced by ~AmrAdaptor().

◆ getData()

Vector<LevelData<FArrayBox>*> AmrAdaptor::getData ( )
inline

Get the AMR data pointers.

References m_amrData.

◆ getRefRatio()

Vector<int> AmrAdaptor::getRefRatio ( )
inline

Get the refinement ratios.

References m_refRatio.

◆ getFinestLevel()

size_t AmrAdaptor::getFinestLevel ( )
inline

Get the finest active AMR level

References m_finestLevel.

◆ getOwnData()

bool AmrAdaptor::getOwnData ( )
inline

◆ linearSum()

virtual void AmrAdaptor::linearSum ( ChomboSundialsAdaptor x,
ChomboSundialsAdaptor y,
Real  a,
Real  b 
)
virtual

SUNDIALS operation - calculates a*x+b*y and puts in this instance's data

Implements ChomboSundialsAdaptor.

Referenced by getOwnData().

◆ setConst()

virtual void AmrAdaptor::setConst ( Real  c)
virtual

SUNDIALS operation - sets this instance's data to c

Implements ChomboSundialsAdaptor.

Referenced by getOwnData().

◆ prod()

virtual void AmrAdaptor::prod ( ChomboSundialsAdaptor ax,
ChomboSundialsAdaptor ay 
)
virtual

SUNDIALS operation - sets this instance's data to x*y

Implements ChomboSundialsAdaptor.

Referenced by getOwnData().

◆ div()

virtual void AmrAdaptor::div ( ChomboSundialsAdaptor ax,
ChomboSundialsAdaptor ay 
)
virtual

SUNDIALS operation - sets this instance's data to x/y

Implements ChomboSundialsAdaptor.

Referenced by getOwnData().

◆ scale()

virtual void AmrAdaptor::scale ( ChomboSundialsAdaptor ax,
Real  c 
)
virtual

SUNDIALS operation - sets this instance's data to c*x

Implements ChomboSundialsAdaptor.

Referenced by getOwnData().

◆ abs()

virtual void AmrAdaptor::abs ( ChomboSundialsAdaptor ax)
virtual

SUNDIALS operation - sets this instance's data to abs(x)

Implements ChomboSundialsAdaptor.

Referenced by getOwnData().

◆ inv()

virtual void AmrAdaptor::inv ( ChomboSundialsAdaptor ax)
virtual

SUNDIALS operation - sets this instance's data to 1/x

Implements ChomboSundialsAdaptor.

Referenced by getOwnData().

◆ addConst()

virtual void AmrAdaptor::addConst ( ChomboSundialsAdaptor ax,
Real  b 
)
virtual

SUNDIALS operation - sets this instance's data to x+b

Implements ChomboSundialsAdaptor.

Referenced by getOwnData().

◆ dotProd()

virtual Real AmrAdaptor::dotProd ( ChomboSundialsAdaptor ax)
virtual

SUNDIALS operation - returns MPI-sum dot product across all ranks, sum(data^T * input), masked for covered cells

Implements ChomboSundialsAdaptor.

Referenced by getOwnData().

◆ maxNorm()

virtual Real AmrAdaptor::maxNorm ( )
virtual

SUNDIALS operation - returns MPI-reduce across all ranks' data max norm, masked for covered cells

Implements ChomboSundialsAdaptor.

Referenced by getOwnData().

◆ wRMSNorm()

virtual Real AmrAdaptor::wRMSNorm ( ChomboSundialsAdaptor aw)
virtual

SUNDIALS operation - returns MPI-reduce across all ranks' data weighted RMS (root mean square) norm, masked for covered cells

Implements ChomboSundialsAdaptor.

Referenced by getOwnData().

◆ wRMSNormMask()

virtual Real AmrAdaptor::wRMSNormMask ( ChomboSundialsAdaptor aw,
ChomboSundialsAdaptor aid 
)
virtual

SUNDIALS operation - not implemented, Aborts

Implements ChomboSundialsAdaptor.

Referenced by getOwnData().

◆ min()

virtual Real AmrAdaptor::min ( )
virtual

SUNDIALS operation - returns MPI-reduce across all ranks' data min, masked for covered cells

Implements ChomboSundialsAdaptor.

Referenced by getOwnData().

◆ wL2Norm()

virtual Real AmrAdaptor::wL2Norm ( ChomboSundialsAdaptor aw)
virtual

SUNDIALS operation - not implemented, Aborts

Implements ChomboSundialsAdaptor.

Referenced by getOwnData().

◆ compare()

virtual void AmrAdaptor::compare ( ChomboSundialsAdaptor ax,
Real  b 
)
virtual

SUNDIALS operation - not implemented, Aborts

Implements ChomboSundialsAdaptor.

Referenced by getOwnData().

◆ invTest()

virtual bool AmrAdaptor::invTest ( ChomboSundialsAdaptor ax)
virtual

SUNDIALS operation - not implemented, Aborts

Implements ChomboSundialsAdaptor.

Referenced by getOwnData().

◆ constrMask()

virtual bool AmrAdaptor::constrMask ( ChomboSundialsAdaptor ac,
ChomboSundialsAdaptor am 
)
virtual

SUNDIALS operation - not implemented, Aborts

Implements ChomboSundialsAdaptor.

Referenced by getOwnData().

◆ minQuotient()

virtual Real AmrAdaptor::minQuotient ( ChomboSundialsAdaptor adenom)
virtual

SUNDIALS operation - not implemented, Aborts

Implements ChomboSundialsAdaptor.

Referenced by getOwnData().

◆ getLength()

virtual unsigned long AmrAdaptor::getLength ( )
virtual

SUNDIALS operation - returns the total number of uncovered AMR cells multiplied by the number of components

Implements ChomboSundialsAdaptor.

Referenced by getOwnData().

◆ l1Norm()

virtual Real AmrAdaptor::l1Norm ( )
virtual

SUNDIALS operation - returns MPI-reduce across all ranks' data L1 norm (sum abs values), no dx or refinement ratio, masked for covered cells

Implements ChomboSundialsAdaptor.

Referenced by getOwnData().

◆ print()

virtual void AmrAdaptor::print ( )
virtual

Not implemented, Aborts

Implements ChomboSundialsAdaptor.

Referenced by getOwnData().

◆ printFile()

virtual void AmrAdaptor::printFile ( FILE *  outfile)
virtual

Not implemented, Aborts

Implements ChomboSundialsAdaptor.

Referenced by getOwnData().

◆ printFileHDF()

virtual void AmrAdaptor::printFileHDF ( const char *  filename)
virtual

Not implemented, Aborts

Referenced by getOwnData().

◆ copyTo()

virtual bool AmrAdaptor::copyTo ( ChomboSundialsAdaptor a)
virtual

Not implemented, Aborts

Implements ChomboSundialsAdaptor.

Referenced by getOwnData().

◆ exchange()

virtual void AmrAdaptor::exchange ( )
virtual

Not implemented, Aborts

Implements ChomboSundialsAdaptor.

Referenced by getOwnData().

Member Data Documentation

◆ m_amrData

Vector<LevelData<FArrayBox>*> AmrAdaptor::m_amrData

Pointers to AMR hierarchy data.

Referenced by getData(), and ~AmrAdaptor().

◆ m_refRatio

Vector<int> AmrAdaptor::m_refRatio

AMR hierarchy refinement ratios between levels

Referenced by getRefRatio().

◆ m_finestLevel

size_t AmrAdaptor::m_finestLevel

finest active AMR level

Referenced by getFinestLevel().

◆ m_amrMask

Vector<LevelData<FArrayBox>*> AmrAdaptor::m_amrMask

AMR mask, 1 for uncovered values, 0 for covered values

Referenced by ~AmrAdaptor().

◆ m_length

unsigned long AmrAdaptor::m_length = -1

Cached nvector length, sum of all unmasked values, across all ranks.

◆ m_comp

int AmrAdaptor::m_comp = -1

Number of components in the LevelData<FArrayBox>'s.

◆ m_ownData

bool AmrAdaptor::m_ownData = false

If true, will call delete in destructor.

Referenced by getOwnData(), and ~AmrAdaptor().


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