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 _ONEDINTEGRATOR_H_ 00012 #define _ONEDINTEGRATOR_H_ 00013 00014 #include "RealVect.H" 00015 #include "ProblemDomain.H" 00016 #include "IndexTM.H" 00017 #include "EB_TYPEDEFS.H" 00018 00019 #include "Notation.H" 00020 #include "GeometryService.H" 00021 #include "IndexedMoments.H" 00022 #include "NamespaceHeader.H" 00023 00024 ///base class for integration 00025 class BaseOneDFunc 00026 { 00027 public: 00028 BaseOneDFunc() 00029 {; } 00030 00031 virtual ~BaseOneDFunc() 00032 {; } 00033 00034 virtual Real value(const Real& location) const = 0; 00035 }; 00036 00037 /// 00038 /** 00039 Gives an approximation to the numerical integral of a function over a region 00040 */ 00041 class OneDIntegrator 00042 { 00043 00044 public: 00045 00046 /// Default constructor 00047 OneDIntegrator() 00048 { 00049 } 00050 00051 /// Default destructor 00052 virtual ~OneDIntegrator() 00053 { 00054 } 00055 00056 /// 00057 /** 00058 integrate the function over the region dividing the 00059 by dividing up the region of integration into 00060 bits of fixed size = size/num_bits (midpoint rule) 00061 */ 00062 Real integral(const RefCountedPtr<BaseOneDFunc>& a_func, 00063 const Real & a_xstart, 00064 const Real & a_xend, 00065 const int & a_num_bits 00066 ) const; 00067 00068 }; 00069 00070 #include "NamespaceFooter.H" 00071 00072 #endif