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

Class to interface a LevelData<FArrayBox> with SUNDIALS. More...

#include <SimpleAdaptor.H>

Inheritance diagram for SimpleAdaptor:
Inheritance graph
[legend]

Public Member Functions

 SimpleAdaptor ()
 
virtual ~SimpleAdaptor ()
 
void define (LevelData< FArrayBox > *lvlData, bool ownData)
 
LevelData< FArrayBox > * getData ()
 
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 l1Norm ()
 
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 void exchange ()
 
virtual void print ()
 
virtual void printFile (FILE *outfile)
 
virtual void printFileHDF (const char *filename)
 
virtual bool copyTo (ChomboSundialsAdaptor &a)
 
virtual ChomboSundialsAdaptornewAdaptor ()
 
- Public Member Functions inherited from ChomboSundialsAdaptor
 ChomboSundialsAdaptor ()
 
virtual ~ChomboSundialsAdaptor ()
 

Private Attributes

LevelData< FArrayBox > * m_data = NULL
 Pointer to LevelData<FArrayBox> data this wraps. More...
 
DisjointBoxLayout m_dp
 DisjointBoxLayout of the LevelData<FArrayBox> More...
 
int m_nComp
 Number of components in the LevelData<FArrayBox> More...
 
IntVect m_ghost
 Number of ghost cells in the LevelData<FArrayBox> More...
 
bool m_ownData = false
 If true, will call delete in destructor. More...
 

Detailed Description

Class to interface a LevelData<FArrayBox> with SUNDIALS.

This class implements all the required NVector methods for SUNDIALS to call on a LevelData<FArrayBox>, works in parallel. Output available using HDF5.

Calling context must allocate memory in the LevelData, and then set the public Data member variable and others. This will call delete* on Data in the destructor.

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

◆ SimpleAdaptor()

SimpleAdaptor::SimpleAdaptor ( )
inline

Constructor

Referenced by newAdaptor().

◆ ~SimpleAdaptor()

virtual SimpleAdaptor::~SimpleAdaptor ( )
inlinevirtual

Destructor - calls delete on Data pointer.

References define(), m_data, and m_ownData.

Member Function Documentation

◆ define()

void SimpleAdaptor::define ( LevelData< FArrayBox > *  lvlData,
bool  ownData 
)

Define from an existing LevelData<FArrayBox>.

  • lvlData: pointers to the LevelData<FArrayBox>
  • ownData: (true) delete pointer in destructor

Referenced by ~SimpleAdaptor().

◆ getData()

LevelData<FArrayBox>* SimpleAdaptor::getData ( )
inline

Get the LevelData<FArrayBox> data pointer.

References m_data.

◆ getOwnData()

bool SimpleAdaptor::getOwnData ( )
inline

◆ linearSum()

virtual void SimpleAdaptor::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 SimpleAdaptor::setConst ( Real  c)
virtual

SUNDIALS operation - sets this instance's data to c

Implements ChomboSundialsAdaptor.

Referenced by getOwnData().

◆ prod()

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

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

Implements ChomboSundialsAdaptor.

Referenced by getOwnData().

◆ div()

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

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

Implements ChomboSundialsAdaptor.

Referenced by getOwnData().

◆ scale()

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

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

Implements ChomboSundialsAdaptor.

Referenced by getOwnData().

◆ abs()

virtual void SimpleAdaptor::abs ( ChomboSundialsAdaptor ax)
virtual

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

Implements ChomboSundialsAdaptor.

Referenced by getOwnData().

◆ inv()

virtual void SimpleAdaptor::inv ( ChomboSundialsAdaptor ax)
virtual

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

Implements ChomboSundialsAdaptor.

Referenced by getOwnData().

◆ addConst()

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

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

Implements ChomboSundialsAdaptor.

Referenced by getOwnData().

◆ dotProd()

virtual Real SimpleAdaptor::dotProd ( ChomboSundialsAdaptor ax)
virtual

SUNDIALS operation - returns MPI-sum dot product sum(data^T * input) across all MPI ranks

Implements ChomboSundialsAdaptor.

Referenced by getOwnData().

◆ maxNorm()

virtual Real SimpleAdaptor::maxNorm ( )
virtual

SUNDIALS operation - returns MPI-reduce across all MPI ranks' data max norm

Implements ChomboSundialsAdaptor.

Referenced by getOwnData().

◆ wRMSNorm()

virtual Real SimpleAdaptor::wRMSNorm ( ChomboSundialsAdaptor aw)
virtual

SUNDIALS operation - returns MPI-reduce across all ranks' data weighted RMS (root mean square) norm

Implements ChomboSundialsAdaptor.

Referenced by getOwnData().

◆ wRMSNormMask()

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

SUNDIALS operation - not implemented, Aborts

Implements ChomboSundialsAdaptor.

Referenced by getOwnData().

◆ min()

virtual Real SimpleAdaptor::min ( )
virtual

SUNDIALS operation - returns MPI-reduce across all ranks' data min

Implements ChomboSundialsAdaptor.

Referenced by getOwnData().

◆ l1Norm()

virtual Real SimpleAdaptor::l1Norm ( )
virtual

SUNDIALS operation - returns MPI-reduce L1 norm (sum abs values)

Implements ChomboSundialsAdaptor.

Referenced by getOwnData().

◆ wL2Norm()

virtual Real SimpleAdaptor::wL2Norm ( ChomboSundialsAdaptor aw)
virtual

SUNDIALS operation - not implemented, Aborts

Implements ChomboSundialsAdaptor.

Referenced by getOwnData().

◆ compare()

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

SUNDIALS operation - not implemented, Aborts

Implements ChomboSundialsAdaptor.

Referenced by getOwnData().

◆ invTest()

virtual bool SimpleAdaptor::invTest ( ChomboSundialsAdaptor ax)
virtual

SUNDIALS operation - not implemented, Aborts

Implements ChomboSundialsAdaptor.

Referenced by getOwnData().

◆ constrMask()

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

SUNDIALS operation - not implemented, Aborts

Implements ChomboSundialsAdaptor.

Referenced by getOwnData().

◆ minQuotient()

virtual Real SimpleAdaptor::minQuotient ( ChomboSundialsAdaptor adenom)
virtual

SUNDIALS operation - not implemented, Aborts

Implements ChomboSundialsAdaptor.

Referenced by getOwnData().

◆ getLength()

virtual unsigned long SimpleAdaptor::getLength ( )
virtual

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

Implements ChomboSundialsAdaptor.

Referenced by getOwnData().

◆ exchange()

virtual void SimpleAdaptor::exchange ( void  )
inlinevirtual

◆ print()

virtual void SimpleAdaptor::print ( )
virtual

Calls dumpLDFPar - careful, very verbose

Implements ChomboSundialsAdaptor.

Referenced by exchange().

◆ printFile()

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

SUNDIALS operation - not implemented, Aborts

Implements ChomboSundialsAdaptor.

Referenced by exchange().

◆ printFileHDF()

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

Calls writeLevelname to produce HDF5 output

Referenced by exchange().

◆ copyTo()

virtual bool SimpleAdaptor::copyTo ( ChomboSundialsAdaptor a)
inlinevirtual

Uses MPI to copy values from this to arg, only if DBLs are the same. Returns true if the copy was succesful, false otherwise.

Implements ChomboSundialsAdaptor.

References LevelData< T >::copyTo(), LevelData< T >::disjointBoxLayout(), and m_data.

◆ newAdaptor()

virtual ChomboSundialsAdaptor* SimpleAdaptor::newAdaptor ( )
inlinevirtual

Factory, creates a clone of this and allocates new data (not copied).

Implements ChomboSundialsAdaptor.

References LevelData< T >::define(), m_data, m_dp, m_ghost, m_nComp, m_ownData, and SimpleAdaptor().

Member Data Documentation

◆ m_data

LevelData<FArrayBox>* SimpleAdaptor::m_data = NULL
private

Pointer to LevelData<FArrayBox> data this wraps.

Referenced by copyTo(), exchange(), getData(), newAdaptor(), and ~SimpleAdaptor().

◆ m_dp

DisjointBoxLayout SimpleAdaptor::m_dp
private

DisjointBoxLayout of the LevelData<FArrayBox>

Referenced by newAdaptor().

◆ m_nComp

int SimpleAdaptor::m_nComp
private

Number of components in the LevelData<FArrayBox>

Referenced by newAdaptor().

◆ m_ghost

IntVect SimpleAdaptor::m_ghost
private

Number of ghost cells in the LevelData<FArrayBox>

Referenced by newAdaptor().

◆ m_ownData

bool SimpleAdaptor::m_ownData = false
private

If true, will call delete in destructor.

Referenced by getOwnData(), newAdaptor(), and ~SimpleAdaptor().


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