00001 #ifdef CH_LANG_CC 00002 /* 00003 * _______ __ 00004 * / ___/ / ___ __ _ / / ___ 00005 * / /__/ _ \/ _ \/ V \/ _ \/ _ \ 00006 * \___/_//_/\___/_/_/_/_.__/\___/ 00007 * Please refer to Copyright.txt, in Chombo's root directory. 00008 */ 00009 #endif 00010 00011 #ifndef _EBNORMALIZEBYVOLUMEFRACTION_H_ 00012 #define _EBNORMALIZEBYVOLUMEFRACTION_H_ 00013 00014 #include "EBCellFAB.H" 00015 #include "LevelData.H" 00016 #include "EBLevelGrid.H" 00017 #include "AggStencil.H" 00018 #include "NamespaceHeader.H" 00019 00020 /// 00021 /** 00022 * This class represents an operation that takes a volume-fraction-weighted 00023 * quantity kappa*Q (where kappa is the volume fraction) and computes Q 00024 * from it by normalizing it w.r.t. the volume fractions of cells within a 00025 * monotone path radius. The radius may either be specified explicitly or 00026 * computed from a given EBLevelGrid. 00027 */ 00028 class EBNormalizeByVolumeFraction 00029 { 00030 public: 00031 00032 /// 00033 /** Construct an EBNormalizeByVolumeFraction object associated with the 00034 * associated with the given EBLevelGrid. 00035 * \param EBLevelGrid The level grid for which data can be normalized 00036 * by the resulting object. 00037 wacky interface is for backward compatibility 00038 if data is null, define is not called. 00039 */ 00040 EBNormalizeByVolumeFraction(const EBLevelGrid & a_eblg, 00041 const LevelData<EBCellFAB> * a_data = NULL, 00042 const int a_radius = 1) 00043 { 00044 CH_assert(a_radius > 0); 00045 m_eblg = a_eblg; 00046 m_radius = a_radius; 00047 m_isDefined = false; 00048 if(a_data != NULL) 00049 { 00050 define(*a_data); 00051 } 00052 } 00053 00054 00055 ///define all the ste3ncils 00056 void define(const LevelData<EBCellFAB>& a_data); 00057 00058 00059 /** Destructor. */ 00060 ~EBNormalizeByVolumeFraction() 00061 { 00062 } 00063 00064 /** Compute the normalized quantity corresponding to the given 00065 * volume-fraction-weighted quantity by volume-averaging that quantity 00066 * over every monotone path radius for each cell in the level. 00067 * \param a_Q A volume-fraction-weighted quantity to be normalized. 00068 * \param a_compInterval An interval representing the range of components 00069 * to be normalized by this operation. 00070 */ 00071 void operator()(LevelData<EBCellFAB>& a_Q, 00072 const Interval& a_compInterval); 00073 00074 /** Compute the normalized quantity corresponding to the given 00075 * volume-fraction-weighted quantity by volume-averaging that quantity 00076 * over every monotone path radius for each cell in the level. This 00077 * version of the correction normalizes all components of \a a_Q. 00078 * \param a_Q A volume-fraction-weighted quantity to be normalized. 00079 */ 00080 void operator()(LevelData<EBCellFAB>& a_Q); 00081 00082 void normalize(LevelData<EBCellFAB>& a_Q, 00083 const Interval& a_compInterval) 00084 { 00085 (*this)(a_Q, a_compInterval); 00086 } 00087 00088 void normalize(LevelData<EBCellFAB>& a_Q) 00089 { 00090 (*this)(a_Q); 00091 } 00092 protected: 00093 00094 void getLocalStencil(VoFStencil & a_stencil, 00095 const VolIndex & a_vof, 00096 const DataIndex & a_dit); 00097 00098 EBNormalizeByVolumeFraction(); 00099 EBNormalizeByVolumeFraction(const EBNormalizeByVolumeFraction&); 00100 EBNormalizeByVolumeFraction& operator=(const EBNormalizeByVolumeFraction&); 00101 00102 private: 00103 bool m_isDefined; 00104 int m_radius; 00105 LayoutData<RefCountedPtr<AggStencil<EBCellFAB, EBCellFAB> > > m_stencil; 00106 EBLevelGrid m_eblg; 00107 }; 00108 00109 #include "NamespaceFooter.H" 00110 #endif