Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Class Members | File Members

TensorCFInterp.H

Go to the documentation of this file.
00001 /*   _______              __
00002     / ___/ /  ___  __ _  / /  ___
00003    / /__/ _ \/ _ \/  V \/ _ \/ _ \
00004    \___/_//_/\___/_/_/_/_.__/\___/
00005 */
00006 // CHOMBO Copyright (c) 2000-2004, The Regents of the University of
00007 // California, through Lawrence Berkeley National Laboratory (subject to
00008 // receipt of any required approvals from U.S. Dept. of Energy).  All
00009 // rights reserved.
00010 //
00011 // Redistribution and use in source and binary forms, with or without
00012 // modification, are permitted provided that the following conditions are met:
00013 //
00014 // (1) Redistributions of source code must retain the above copyright
00015 // notice, this list of conditions and the following disclaimer.
00016 // (2) Redistributions in binary form must reproduce the above copyright
00017 // notice, this list of conditions and the following disclaimer in the
00018 // documentation and/or other materials provided with the distribution.
00019 // (3) Neither the name of Lawrence Berkeley National Laboratory, U.S.
00020 // Dept. of Energy nor the names of its contributors may be used to endorse
00021 // or promote products derived from this software without specific prior
00022 // written permission.
00023 //
00024 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
00025 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
00026 // TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
00027 // PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
00028 // OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
00029 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
00030 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
00031 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
00032 // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
00033 // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
00034 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00035 //
00036 // You are under no obligation whatsoever to provide any bug fixes,
00037 // patches, or upgrades to the features, functionality or performance of
00038 // the source code ("Enhancements") to anyone; however, if you choose to
00039 // make your Enhancements available either publicly, or directly to
00040 // Lawrence Berkeley National Laboratory, without imposing a separate
00041 // written license agreement for such Enhancements, then you hereby grant
00042 // the following license: a non-exclusive, royalty-free perpetual license
00043 // to install, use, modify, prepare derivative works, incorporate into
00044 // other computer software, distribute, and sublicense such Enhancements or
00045 // derivative works thereof, in binary and source code form.
00046 //
00047 // TRADEMARKS. Product and company names mentioned herein may be the
00048 // trademarks of their respective owners.  Any rights not expressly granted
00049 // herein are reserved.
00050 //
00051 
00052 #ifndef _TENSORCFINTERP_H_
00053 #define _TENSORCFINTERP_H_
00054 
00055 #include <iostream>
00056 #include <math.h>
00057 #include "SPACE.H"
00058 #include <stdlib.h>
00059 #include "REAL.H"
00060 #include "IntVect.H"
00061 #include "Box.H"
00062 #include "BaseFab.H"
00063 #include "DisjointBoxLayout.H"
00064 #include "LevelData.H"
00065 #include "FArrayBox.H"
00066 #include "QuadCFStencil.H"
00067 #include "ProblemDomain.H"
00068 #include "TensorFineStencilSet.H"
00069 
00071 
00076 class TensorCFInterp
00077 {
00078 public:
00079 
00081 
00083 
00088   TensorCFInterp(
00089                const DisjointBoxLayout& a_fineBoxes,
00090                const DisjointBoxLayout* a_coarBoxes,
00091                Real  a_dxFine, 
00092                int a_refRatio,
00093                int a_nComp,
00094                const Box& a_domf);
00095 
00097 
00102   TensorCFInterp(
00103                const DisjointBoxLayout& a_fineBoxes,
00104                const DisjointBoxLayout* a_coarBoxes,
00105                Real  a_dxFine, 
00106                int a_refRatio,
00107                int a_nComp,
00108                const ProblemDomain& a_domf);
00109 
00111 
00115   void define(
00116               const DisjointBoxLayout& a_fineBoxes,
00117               const DisjointBoxLayout* a_coarBoxes,
00118               Real  a_dxFine, 
00119               int a_refRatio,
00120               int a_nComp,
00121               const Box& a_domf);
00122 
00124 
00128   void define(
00129               const DisjointBoxLayout& a_fineBoxes,
00130               const DisjointBoxLayout* a_coarBoxes,
00131               Real  a_dxFine, 
00132               int a_refRatio,
00133               int a_nComp,
00134               const ProblemDomain& a_domf);
00135 
00136 
00138 
00141   TensorCFInterp();
00142 
00144   ~TensorCFInterp();
00145 
00147 
00150   void clear();
00151 
00153 
00156   void coarseFineInterp(
00157                         LevelData<FArrayBox>& a_phif,
00158                         LevelData<FArrayBox>& a_tanGradf,
00159                         const LevelData<FArrayBox>& a_phic
00160                         );
00161 
00163 
00168   void coarseFineInterpH(
00169                          LevelData<FArrayBox>& a_phif,
00170                          LevelData<FArrayBox>& a_tanGradf
00171                          );
00172 
00174 
00177   bool isDefined() const;
00178 
00179 
00180 protected:
00181   //boxes for coarse buffers
00182   BoxLayout m_loCoarBoxes[SpaceDim];
00183   BoxLayout m_hiCoarBoxes[SpaceDim];
00184 
00185   //fake level identifier.  
00186   int m_level;
00187 
00188   //number of components
00189   int m_nComp;
00190 
00191   //refinement ratio between levels
00192   int m_refRatio;
00193 
00194   //mesh spacing at fine level
00195   Real m_dxFine;
00196 
00197   // problem domain at fine level
00198   ProblemDomain m_probDomain;
00199 
00200   //cfstencils on low-side faces
00201   //lives on fine input grid layout
00202   LayoutData<QuadCFStencil> m_loQCFS[SpaceDim];
00203 
00204   //cfstencils on high-side faces
00205   //lives on fine input grid layout
00206   LayoutData<QuadCFStencil> m_hiQCFS[SpaceDim];
00207 
00208 
00210   LayoutData<TensorFineStencilSet> m_loFineStencilSets[SpaceDim];
00211 
00213   LayoutData<TensorFineStencilSet> m_hiFineStencilSets[SpaceDim];
00214 
00215 
00216   //buffer for coarse data at low edges of fine grids 
00217   BoxLayoutData<FArrayBox> m_hiCoarBuffer[SpaceDim];
00218 
00219   // copiers to copy data from inputCoarLayout to m_hiCoarBuffer
00220   Copier m_hiCoarCopiers[SpaceDim];
00221 
00222   //buffer for coarse data at high edges of fine grids 
00223   BoxLayoutData<FArrayBox> m_loCoarBuffer[SpaceDim];
00224 
00225   // copiers to copy data from inputCoarLayout to m_loCoarBuffer
00226   Copier m_loCoarCopiers[SpaceDim];
00227 
00228   DisjointBoxLayout m_inputFineLayout;
00229   DisjointBoxLayout m_inputCoarLayout;
00231   bool m_isDefined;
00232 
00233 protected:
00234 
00235   /* Coarse / Fine interpolation operator.
00236      using one sided differencing
00237      only at a particular face
00238   */
00239   void coarseFineInterp(BaseFab<Real> & a_phif,
00240                         BaseFab<Real> & a_tanGradStar,
00241                         const BaseFab<Real> & a_phic,
00242                         const QuadCFStencil& a_qcfs,
00243                         const Side::LoHiSide a_hiorlo,
00244                         const int a_idir,
00245                         const Interval& a_variables) const;
00246 
00247   //get extended phi (lives next to interpivs)
00248   void getPhiStar(BaseFab<Real> & a_phistar, 
00249                   BaseFab<Real> & a_tanGradStar,
00250                   const BaseFab<Real> & a_phic,
00251                   const QuadCFStencil& a_qcfs,
00252                   const Side::LoHiSide a_hiorlo,
00253                   const int a_idir,
00254                   const Interval& a_variables) const;
00255 
00256   //interpolate over correct intvectset
00257   void interpOnIVS(BaseFab<Real> & a_phif,
00258                    const BaseFab<Real> & a_phiStar, 
00259                    const QuadCFStencil& a_qcfs,
00260                    const Side::LoHiSide a_hiorlo,
00261                    const int a_idir,
00262                    const Interval& a_variables) const;
00263 
00264   // compute tangential gradients
00265   void computeTanGrad(BaseFab<Real>& a_tanGradf,
00266                       const BaseFab<Real>& a_phiFine,
00267                       const BaseFab<Real>& a_tanGradStar,
00268                       const TensorFineStencilSet& a_fineStencils,
00269                       const QuadCFStencil& a_qcfs,
00270                       const Side::LoHiSide& a_hiorlo,
00271                       const int a_idir,
00272                       const Interval& a_variables) const;
00273 };
00274 
00275 #endif

Generated on Wed Oct 5 13:52:09 2005 for Chombo&AMRSelfGravity by  doxygen 1.4.1