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

Ancillae.H

Go to the documentation of this file.
00001 
00002 // various simple functions useful for a variety of purposes
00003 
00004 #ifndef _ANCILLAE_H_
00005 #define _ANCILLAE_H_
00006 
00007 #include "REAL.H"
00008 #include "Vector.H"
00009 #include "List.H"
00010 #include "LevelData.H"
00011 #include "FArrayBox.H"
00012 #include "Interval.H"
00013 #include "LayoutIterator.H"
00014 #include "LGintegrator.H"
00015 #include "CONSTANTS_C.H"
00016 
00017 
00019 Real globalAverage(const LevelData<FArrayBox>& a_levFab,
00020                    const int                   a_indx = 0,
00021                    const bool                  a_perVol = true);
00022 
00024 Real globalMax(Real a_localVal);
00025 
00027 Real globalMin(Real a_localVal);
00028 
00030 Real levelMax(const LevelData<FArrayBox>& a_levFab, 
00031               const int a_comp);
00032 
00034 Real levelMin(const LevelData<FArrayBox>& a_levFab, 
00035               const int a_comp);
00036 
00038 inline void resetToZero(LevelData<FArrayBox>& a_lev);
00039 
00041 template <class T>
00042 inline void setToVal(LevelData<BaseFab<T> >& a_lev, const T& a_val);
00043 
00045 inline void offset(LevelData<FArrayBox>& a_lev, const Real& a_offset);
00046 
00048 inline void rescale(LevelData<FArrayBox>& a_lev, const Real& a_factor);
00049 
00051 void computeDeltaU(const LevelData<FArrayBox>& a_UNew,
00052                    const LevelData<FArrayBox>& a_UOld);
00053 
00055 void computePlotVars(LevelData<FArrayBox>&       a_UPlot,
00056                      const LevelData<FArrayBox>& a_UNew);
00057 
00058 // returns total mass of particles in a list;
00059 //inline Real massPartList(const List<Particle >& a_partList);
00060 
00061 // returns mass of a particle on this level;
00062 //inline Real levParticleMass(const LevelData<PBinFab >& a_levDM);
00063 
00065 void bufferBoxes(DisjointBoxLayout&       a_bufferGrids,
00066                  const DisjointBoxLayout& a_grids,
00067                  const DisjointBoxLayout& a_crseGrids,
00068                  const int                a_bufferSize,
00069                  const int                a_refRatio);
00070 
00072 void interpolateInTime(LevelData<FArrayBox>&       a_phi,
00073                        const LevelData<FArrayBox>& a_phiNew,
00074                        const LevelData<FArrayBox>& a_phiOld,
00075                        const Real&                 a_time,
00076                        const Real&                 a_tNew,
00077                        const Real&                 a_tOld,
00078                        const Real&                 a_dt,
00079                        const Interval&     a_srcInterval=Interval(0,0),
00080                        const Interval&     a_dstInterval=Interval(0,0),
00081                        const IntVect&      a_ghost      =IntVect::Zero);
00082 
00084 inline void resetToZero(LevelData<FArrayBox>& a_lev)
00085 {
00086   for (DataIterator di = a_lev.dataIterator(); di.ok(); ++di) {
00087     a_lev[di].setVal(zero);
00088   }
00089 }
00090 
00091 
00093 template<class T>
00094 inline void setToVal(LevelData<BaseFab<T> >& a_lev, const T& a_val)
00095 {
00096   for (DataIterator dit = a_lev.dataIterator(); dit.ok(); ++dit) {
00097     a_lev[dit()].setVal(a_val);
00098   }
00099 }
00100 
00102 inline void offset(LevelData<FArrayBox>& a_lev, const Real& a_offset)
00103 {
00104   for (DataIterator dit = a_lev.dataIterator(); dit.ok(); ++dit) {
00105     a_lev[dit()] -= a_offset;
00106   }
00107 }
00108 
00110 inline void rescale(LevelData<FArrayBox>& a_lev, const Real& a_factor)
00111 {
00112   for (DataIterator dit = a_lev.dataIterator(); dit.ok(); ++dit) {
00113     a_lev[dit()] *= a_factor;
00114   }
00115 }
00116 
00117 
00118 #endif

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