00001 #ifdef CH_LANG_CC
00002
00003
00004
00005
00006
00007
00008
00009 #endif
00010
00011 #ifndef _TENSORCFINTERP_H_
00012 #define _TENSORCFINTERP_H_
00013
00014 #include <iostream>
00015 #include <math.h>
00016 #include "SPACE.H"
00017 #include <stdlib.h>
00018 #include "REAL.H"
00019 #include "IntVect.H"
00020 #include "Box.H"
00021 #include "BaseFab.H"
00022 #include "DisjointBoxLayout.H"
00023 #include "LevelData.H"
00024 #include "FArrayBox.H"
00025 #include "QuadCFStencil.H"
00026 #include "ProblemDomain.H"
00027 #include "TensorFineStencilSet.H"
00028 #include "NamespaceHeader.H"
00029
00031
00036 class TensorCFInterp
00037 {
00038 public:
00039
00041
00043
00048 TensorCFInterp(
00049 const DisjointBoxLayout& a_fineBoxes,
00050 const DisjointBoxLayout* a_coarBoxes,
00051 Real a_dxFine,
00052 int a_refRatio,
00053 int a_nComp,
00054 const Box& a_domf);
00055
00057
00062 TensorCFInterp(
00063 const DisjointBoxLayout& a_fineBoxes,
00064 const DisjointBoxLayout* a_coarBoxes,
00065 Real a_dxFine,
00066 int a_refRatio,
00067 int a_nComp,
00068 const ProblemDomain& a_domf);
00069
00071
00075 void define(
00076 const DisjointBoxLayout& a_fineBoxes,
00077 const DisjointBoxLayout* a_coarBoxes,
00078 Real a_dxFine,
00079 int a_refRatio,
00080 int a_nComp,
00081 const Box& a_domf);
00082
00084
00088 void define(
00089 const DisjointBoxLayout& a_fineBoxes,
00090 const DisjointBoxLayout* a_coarBoxes,
00091 Real a_dxFine,
00092 int a_refRatio,
00093 int a_nComp,
00094 const ProblemDomain& a_domf);
00095
00096
00098
00101 TensorCFInterp();
00102
00104 ~TensorCFInterp();
00105
00107
00110 void clear();
00111
00113
00116 void coarseFineInterp(
00117 LevelData<FArrayBox>& a_phif,
00118 LevelData<FArrayBox>& a_gradf,
00119 const LevelData<FArrayBox>& a_phic
00120 );
00121
00123
00128 void coarseFineInterpH(
00129 LevelData<FArrayBox>& a_phif,
00130 LevelData<FArrayBox>& a_gradf
00131 );
00132
00134
00137 bool isDefined() const;
00138
00140
00142 static inline int gradIndex(int ivar, int gradDir)
00143 {return ivar*SpaceDim + gradDir;}
00144
00145 protected:
00146
00147 BoxLayout m_loCoarBoxes[SpaceDim];
00148 BoxLayout m_hiCoarBoxes[SpaceDim];
00149
00150
00151 int m_level;
00152
00153
00154 int m_nComp;
00155
00156
00157 int m_refRatio;
00158
00159
00160 Real m_dxFine;
00161
00162
00163 ProblemDomain m_probDomain;
00164
00165
00166
00167 LayoutData<QuadCFStencil> m_loQCFS[SpaceDim];
00168
00169
00170
00171 LayoutData<QuadCFStencil> m_hiQCFS[SpaceDim];
00172
00173
00175 LayoutData<TensorFineStencilSet> m_loFineStencilSets[SpaceDim];
00176
00178 LayoutData<TensorFineStencilSet> m_hiFineStencilSets[SpaceDim];
00179
00180
00181
00182 BoxLayoutData<FArrayBox> m_hiCoarBuffer[SpaceDim];
00183
00184
00185 Copier m_hiCoarCopiers[SpaceDim];
00186
00187
00188 BoxLayoutData<FArrayBox> m_loCoarBuffer[SpaceDim];
00189
00190
00191 Copier m_loCoarCopiers[SpaceDim];
00192
00193 DisjointBoxLayout m_inputFineLayout;
00194 DisjointBoxLayout m_inputCoarLayout;
00196 bool m_isDefined;
00197
00198 protected:
00199
00200
00201
00202
00203
00204 void coarseFineInterp(BaseFab<Real> & a_phif,
00205 BaseFab<Real> & a_gradf,
00206 BaseFab<Real> & a_tanGradStar,
00207 const BaseFab<Real> & a_phic,
00208 const QuadCFStencil& a_qcfs,
00209 const Side::LoHiSide a_hiorlo,
00210 const int a_idir,
00211 const Interval& a_variables) const;
00212
00213
00214 void getPhiStar(BaseFab<Real> & a_phistar,
00215 BaseFab<Real> & a_tanGradStar,
00216 const BaseFab<Real> & a_phic,
00217 const QuadCFStencil& a_qcfs,
00218 const Side::LoHiSide a_hiorlo,
00219 const int a_idir,
00220 const Interval& a_variables) const;
00221
00222
00223 void interpOnIVS(BaseFab<Real> & a_phif,
00224 BaseFab<Real> & a_gradf,
00225 const BaseFab<Real> & a_phiStar,
00226 const QuadCFStencil& a_qcfs,
00227 const Side::LoHiSide a_hiorlo,
00228 const int a_idir,
00229 const Interval& a_variables) const;
00230
00231
00232 void computeTanGrad(BaseFab<Real>& a_gradf,
00233 const BaseFab<Real>& a_phiFine,
00234 const BaseFab<Real>& a_tanGradStar,
00235 const TensorFineStencilSet& a_fineStencils,
00236 const QuadCFStencil& a_qcfs,
00237 const Side::LoHiSide& a_hiorlo,
00238 const int a_idir,
00239 const Interval& a_variables) const;
00240 };
00241
00242 #include "NamespaceFooter.H"
00243 #endif