Chombo + EB + MF  3.2
CoarseAverageCodim.H
Go to the documentation of this file.
1 #ifdef CH_LANG_CC
2 /*
3  * _______ __
4  * / ___/ / ___ __ _ / / ___
5  * / /__/ _ \/ _ \/ V \/ _ \/ _ \
6  * \___/_//_/\___/_/_/_/_.__/\___/
7  * Please refer to Copyright.txt, in Chombo's root directory.
8  */
9 #endif
10 
11 #ifndef _COARSEAVERAGECODIM_H_
12 #define _COARSEAVERAGECODIM_H_
13 
14 #include "CodimBox.H"
15 #include "LevelData.H"
16 #include "NamespaceHeader.H"
17 
18 
19 /*******************************************************************************
20  */
21 /// Replaces coarse-level data with averaged fine-level data on the
22 /// codimensions of a box
23 /** This class is similar to CoarseAverage
24  *
25  ******************************************************************************/
26 
28 {
29 
30 public:
31 
32  /// Default constructor
34 
35  /// Full constructor
36  CoarseAverageCodim(const DisjointBoxLayout& a_fineGrids,
37  const int a_codim,
38  const int a_nComp,
39  const int a_nRef);
40 
41  /// Destructor
43 
44  /// Defines the object
45  void define(const DisjointBoxLayout& a_fineGrids,
46  const int a_codim,
47  const int a_nComp,
48  const int a_nRef);
49 
50  /// Has define been called?
51  bool isDefined() const;
52 
53  /// Averages fine-level data to internal coarse representation of fine grid
54  void average(const LevelData<CodimBox<FArrayBox> >& a_fineData);
55 
56  /// Harmonic averaging of fine data to coarse representation of fine grid
57  void averageHarmonic(const LevelData<CodimBox<FArrayBox> >& a_fineData);
58 
59  /// Summation of fine data to internal coarse representation of fine grid
60  void sum(const LevelData<CodimBox<FArrayBox> >& a_fineData,
61  const int a_refFactor = 1);
62 
63  /// Obtain averaged results by copying to the destination
64  void copyTo(LevelData<CodimBox<FArrayBox> >& a_coarseData);
65 
66  /// Averages fine-level data to coarse level
67  void averageToCoarse(LevelData<CodimBox<FArrayBox> >& a_coarseData,
68  const LevelData<CodimBox<FArrayBox> >& a_fineData);
69 
70  /// Averages fine-level data to coarse level using harmonic averaging
72  const LevelData<CodimBox<FArrayBox> >& a_fineData);
73 
74 protected:
75 
77  {
80  };
81 
83  ///< Work array for coarsening of fine
84  ///< data, same "shape" as fine data
85 
88  int m_nRef;
89 
90  /// Utility function to completely determine averages.
91  void computeAverages(LevelData<CodimBox<FArrayBox> >& a_coarseData,
92  const LevelData<CodimBox<FArrayBox> >& a_fineData,
93  const AverageType a_averageType);
94 
95  /// Utility for averaging fine-level data to internal coarse representation of
96  /// fine grid
97  void average(const LevelData<CodimBox<FArrayBox> >& a_fineData,
98  const AverageType a_averageType,
99  const int a_refFactor);
100 
101  /// Averages entire single grid data from fine->coarse
102  void averageGridData(CodimBox<FArrayBox>& a_coarsenedFine,
103  const CodimBox<FArrayBox>& a_fine,
104  const AverageType a_averageType,
105  const int a_refFactor) const;
106 
107 };
108 
109 
110 /*******************************************************************************
111  *
112  * Class CoarseAverageCodim: inline member definitions
113  *
114  ******************************************************************************/
115 
116 /*--------------------------------------------------------------------*/
117 /// Has define been called?
118 /*--------------------------------------------------------------------*/
119 
120 inline bool
122 {
123  return m_isDefined;
124 }
125 
126 #include "NamespaceFooter.H"
127 #endif
void average(const LevelData< CodimBox< FArrayBox > > &a_fineData)
Averages fine-level data to internal coarse representation of fine grid.
bool m_isDefined
Definition: CoarseAverageCodim.H:86
Definition: CoarseAverageCodim.H:79
void averageToCoarseHarmonic(LevelData< CodimBox< FArrayBox > > &a_coarseData, const LevelData< CodimBox< FArrayBox > > &a_fineData)
Averages fine-level data to coarse level using harmonic averaging.
void averageToCoarse(LevelData< CodimBox< FArrayBox > > &a_coarseData, const LevelData< CodimBox< FArrayBox > > &a_fineData)
Averages fine-level data to coarse level.
~CoarseAverageCodim()
Destructor.
bool isDefined() const
Has define been called?
Definition: CoarseAverageCodim.H:121
void averageHarmonic(const LevelData< CodimBox< FArrayBox > > &a_fineData)
Harmonic averaging of fine data to coarse representation of fine grid.
Definition: CoarseAverageCodim.H:27
new code
Definition: BoxLayoutData.H:170
CoarseAverageCodim()
Default constructor.
void copyTo(LevelData< CodimBox< FArrayBox > > &a_coarseData)
Obtain averaged results by copying to the destination.
A BoxLayout that has a concept of disjointedness.
Definition: DisjointBoxLayout.H:30
void define(const DisjointBoxLayout &a_fineGrids, const int a_codim, const int a_nComp, const int a_nRef)
Defines the object.
bool m_isAveraged
Definition: CoarseAverageCodim.H:87
void sum(const LevelData< CodimBox< FArrayBox > > &a_fineData, const int a_refFactor=1)
Summation of fine data to internal coarse representation of fine grid.
An FArrayBox container for storage on the codimensions of a box.
Definition: CodimBox.H:65
int m_nRef
Definition: CoarseAverageCodim.H:88
void averageGridData(CodimBox< FArrayBox > &a_coarsenedFine, const CodimBox< FArrayBox > &a_fine, const AverageType a_averageType, const int a_refFactor) const
Averages entire single grid data from fine->coarse.
LevelData< CodimBox< FArrayBox > > m_coarsenedFineData
Definition: CoarseAverageCodim.H:82
void computeAverages(LevelData< CodimBox< FArrayBox > > &a_coarseData, const LevelData< CodimBox< FArrayBox > > &a_fineData, const AverageType a_averageType)
Utility function to completely determine averages.
AverageType
Definition: CoarseAverageCodim.H:76
Definition: CoarseAverageCodim.H:78