#include <CoarseAverage.H>
This class replaces data at a coarse level of refinement with an average of data at a finer level of refinement, in areas where fine data is present. Coarse level data is not modified where fine level data is not present.
Public Types | |
enum | averageType { arithmetic = 0, harmonic, NUM_AVERAGE_TYPES } |
Public Member Functions | |
CoarseAverage () | |
~CoarseAverage () | |
CoarseAverage (const DisjointBoxLayout &a_fine_domain, int a_numcomps, int a_ref_ratio) | |
CoarseAverage (const DisjointBoxLayout &a_fine_domain, const DisjointBoxLayout &a_crse_domain, int a_numcomps, int a_ref_ratio) | |
void | define (const DisjointBoxLayout &a_fine_domain, int a_numcomps, int a_ref_ratio) |
void | define (const DisjointBoxLayout &a_fine_domain, const DisjointBoxLayout &a_crse_domain, int a_numcomps, int a_ref_ratio) |
bool | isDefined () const |
void | averageToCoarse (LevelData< FArrayBox > &a_coarse_data, const LevelData< FArrayBox > &a_fine_data) |
void | averageToCoarseHarmonic (LevelData< FArrayBox > &a_coarse_data, const LevelData< FArrayBox > &a_fine_data) |
similar to averageToCoarse, except does a harmonic average | |
Protected Member Functions | |
void | computeAverages (LevelData< FArrayBox > &a_coarse_data, const LevelData< FArrayBox > &a_fine_data, int a_averageType) |
void | averageGridData (BaseFab< Real > &a_coarse, const BaseFab< Real > &a_fine, int a_ref_ratio, int a_averageType) const |
Protected Attributes | |
bool | is_defined |
int | m_ref_ratio |
LevelData< FArrayBox > | m_coarsened_fine_data |
bool | m_is_copier_defined |
Copier | m_copier |
CoarseAverage::CoarseAverage | ( | ) |
Default constructor. User must subsequently call define().
CoarseAverage::~CoarseAverage | ( | ) |
Destructor.
CoarseAverage::CoarseAverage | ( | const DisjointBoxLayout & | a_fine_domain, | |
int | a_numcomps, | |||
int | a_ref_ratio | |||
) |
Defining constructor. Constructs a valid object. Equivalent to default construction followed by define().
{ Arguments:}\ a_fine_domain (not modified): the fine level domain.\ a_numcomps (not modified): the number of components.\ a_ref_ratio (not modified): the refinement ratio.\
CoarseAverage::CoarseAverage | ( | const DisjointBoxLayout & | a_fine_domain, | |
const DisjointBoxLayout & | a_crse_domain, | |||
int | a_numcomps, | |||
int | a_ref_ratio | |||
) |
Defining constructor. Constructs a valid object. Equivalent to default construction followed by define(). This version takes the coarser level as well, results in a faster averaging operation, since Copier can be pre-constructed.
{ Arguments:}\ a_fine_domain (not modified): the fine level domain.\ a_crse_domain (not modified): the crse level domain.\ a_numcomps (not modified): the number of components.\ a_ref_ratio (not modified): the refinement ratio.\
void CoarseAverage::define | ( | const DisjointBoxLayout & | a_fine_domain, | |
int | a_numcomps, | |||
int | a_ref_ratio | |||
) |
Defines this object. Existing information is overriden.
{ Arguments:}\ a_fine_domain (not modified): the fine level domain.\ a_numcomps (not modified): the number of components.\ a_ref_ratio (not modified): the refinement ratio.\
{ This:}\ ---This object is modified.---
void CoarseAverage::define | ( | const DisjointBoxLayout & | a_fine_domain, | |
const DisjointBoxLayout & | a_crse_domain, | |||
int | a_numcomps, | |||
int | a_ref_ratio | |||
) |
Defines this object. Existing information is overriden. This version takes the coarser-level grids as well, which allows for a faster averaging operation, since the Copier can be pre-defined
{ Arguments:}\ a_fine_domain (not modified): the fine level domain.\ a_crse_domain (not modified): the coarse level domain.\ a_numcomps (not modified): the number of components.\ a_ref_ratio (not modified): the refinement ratio.\
{ This:}\ ---This object is modified.---
bool CoarseAverage::isDefined | ( | ) | const |
Returns true if this object was created with the defining constructor or if define() has been called.
{ This:}\ This object is not modified.
void CoarseAverage::averageToCoarse | ( | LevelData< FArrayBox > & | a_coarse_data, | |
const LevelData< FArrayBox > & | a_fine_data | |||
) |
Replaces a_coarse_data with the average of a_fine_data within the coarsening of the domain of the fine level. Elsewhere, the coarse data is unchanged. It is an error to call if not this->isDefined(). The domain of a_fine_data should be the same as the fine domain specified in the most recent call to define(). It is expected that the coarse and fine level's domains are properly nested. Both a_coarse_data and a_fine_data should have the same number of components specified in the most recent call to define().
{ Arguments:}\ a_coarse_data (modified): coarse data. \ a_fine_data (not modified): fine data. \
{ This:}\ Well, it's complicated. As far as the user is concerned, this object is not modified. See the design document if you care for details.
void CoarseAverage::averageToCoarseHarmonic | ( | LevelData< FArrayBox > & | a_coarse_data, | |
const LevelData< FArrayBox > & | a_fine_data | |||
) |
similar to averageToCoarse, except does a harmonic average
void CoarseAverage::computeAverages | ( | LevelData< FArrayBox > & | a_coarse_data, | |
const LevelData< FArrayBox > & | a_fine_data, | |||
int | a_averageType | |||
) | [protected] |
utility function called by both averageToCoarse and averageToCoarseHarmonic (to avoid code duplication)
void CoarseAverage::averageGridData | ( | BaseFab< Real > & | a_coarse, | |
const BaseFab< Real > & | a_fine, | |||
int | a_ref_ratio, | |||
int | a_averageType | |||
) | const [protected] |
bool CoarseAverage::is_defined [protected] |
int CoarseAverage::m_ref_ratio [protected] |
LevelData<FArrayBox> CoarseAverage::m_coarsened_fine_data [protected] |
bool CoarseAverage::m_is_copier_defined [protected] |
Copier CoarseAverage::m_copier [protected] |