Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

GenMGInterpImplem.H

Go to the documentation of this file.
00001 /* _______              __
00002   / ___/ /  ___  __ _  / /  ___
00003  / /__/ _ \/ _ \/  ' \/ _ \/ _ \
00004  \___/_//_/\___/_/_/_/_.__/\___/ 
00005 */
00006 //
00007 // This software is copyright (C) by the Lawrence Berkeley
00008 // National Laboratory.  Permission is granted to reproduce
00009 // this software for non-commercial purposes provided that
00010 // this notice is left intact.
00011 // 
00012 // It is acknowledged that the U.S. Government has rights to
00013 // this software under Contract DE-AC03-765F00098 between
00014 // the U.S.  Department of Energy and the University of
00015 // California.
00016 //
00017 // This software is provided as a professional and academic
00018 // contribution for joint exchange. Thus it is experimental,
00019 // is provided ``as is'', with no warranties of any kind
00020 // whatsoever, no support, no promise of updates, or printed
00021 // documentation. By using this software, you acknowledge
00022 // that the Lawrence Berkeley National Laboratory and
00023 // Regents of the University of California shall have no
00024 // liability with respect to the infringement of other
00025 // copyrights by any part of this software.
00026 //
00027 
00028 #ifndef _GENMGINTERPIMPLEM_H_
00029 #define _GENMGINTERPIMPLEM_H_
00030 
00031 #include "DisjointBoxLayout.H"
00032 #include "LevelData.H"
00033 #include "REAL.H"
00034 #include "DataIterator.H"
00035 
00036 #include "GenLevelMGF_F.H"
00037 
00038 template <class T>
00039 GenMGInterp<T>::GenMGInterp()
00040 :m_isDefined(false)
00041 {
00042 }
00043 
00044 template <class T>
00045 GenMGInterp<T>::GenMGInterp(const DisjointBoxLayout& a_fineDomain,
00046                             int                      a_numcomps,
00047                             int                      a_refRatio,
00048                             const Box&               a_problemDomain)
00049 :m_isDefined(false)
00050 {
00051   ProblemDomain finePhysdomain(a_problemDomain);
00052   define(a_fineDomain, a_numcomps, a_refRatio, finePhysdomain);
00053 }
00054 
00055 template <class T>
00056 GenMGInterp<T>::GenMGInterp(const DisjointBoxLayout& a_fineDomain,
00057                             int                      a_numcomps,
00058                             int                      a_refRatio,
00059                             const ProblemDomain&     a_problemDomain)
00060 :m_isDefined(false)
00061 {
00062   define(a_fineDomain, a_numcomps, a_refRatio, a_problemDomain);
00063 }
00064 
00065 template <class T>
00066 GenMGInterp<T>::~GenMGInterp()
00067 {
00068 }
00069 
00070 template <class T>
00071 bool GenMGInterp<T>::isDefined() const
00072 {
00073   return m_isDefined;
00074 }
00075 
00076 template <class T>
00077 void GenMGInterp<T>::define(const DisjointBoxLayout& a_fineDomain,
00078                             int                      a_numcomps,
00079                             int                      a_refRatio,
00080                             const Box&               a_problemDomain)
00081 {
00082   ProblemDomain physdomain(a_problemDomain);
00083   define(a_fineDomain, a_numcomps, a_refRatio, physdomain);
00084 }
00085 
00086 template <class T>
00087 void GenMGInterp<T>::define(const DisjointBoxLayout& a_fineDomain,
00088                             int                      a_numcomps,
00089                             int                      a_refRatio,
00090                             const ProblemDomain&     a_problemDomain)
00091 {
00092   m_refRatio = a_refRatio;
00093   m_problemDomain = a_problemDomain;
00094   m_grids = a_fineDomain;
00095 
00096 // create the work array 
00097   DisjointBoxLayout coarsenedFineDomain;
00098   coarsen(coarsenedFineDomain, 
00099           a_fineDomain, 
00100           m_refRatio);
00101   m_coarsenedFineData.define(coarsenedFineDomain, 
00102                              a_numcomps, 
00103                              IntVect::TheZeroVector());
00104 
00105   m_isDefined = true;
00106 }
00107 
00108 // interpolate from coarse level to fine level
00109 template <class T>
00110 void GenMGInterp<T>::interpToFine(T&       a_fineData,
00111                                   const T& a_coarseData)
00112 {
00113   assert(m_isDefined);
00114 
00115   a_coarseData.copyTo(a_coarseData.interval(),
00116                       m_coarsenedFineData,
00117                       m_coarsenedFineData.interval());
00118 
00119 #if FIXIT
00120   DataIterator dit = m_grids.dataIterator();
00121   for (dit.begin(); dit.ok(); ++dit)
00122   {
00123     T& fine = a_fineData[dit()];
00124     const T& coarsenedFine = m_coarsenedFineData[dit()];
00125     Box crseBox = coarsenedFine.box();
00126     Box fineBox = m_grids.get(dit());
00127     fineBox.coarsen(m_refRatio);
00128 
00129     assert(fineBox == crseBox);
00130 
00131     Box nrefbox(IntVect::TheZeroVector(), 
00132                 (m_refRatio-1)*IntVect::TheUnitVector());
00133     FORT_GENINTERPMG(CHF_FRA(fine),
00134                      CHF_FRA(coarsenedFine),
00135                      CHF_BOX(crseBox),
00136                      CHF_CONST_INT(m_refRatio),
00137                      CHF_BOX(nrefbox));
00138   }
00139 #endif
00140 }
00141 
00142 #endif

Generated on Wed Apr 16 14:31:05 2003 for EBChombo by doxygen1.2.16