00001 #ifdef CH_LANG_CC
00002
00003
00004
00005
00006
00007
00008
00009 #endif
00010
00011 #ifndef _BASEIF_H_
00012 #define _BASEIF_H_
00013
00014 #include "RealVect.H"
00015 #include "ProblemDomain.H"
00016 #include "IndexTM.H"
00017 #include "EB_TYPEDEFS.H"
00018 #include "VolIndex.H"
00019 #include "FaceIndex.H"
00020 #include "Notation.H"
00021 #include "GeometryService.H"
00022 #include "IndexedMoments.H"
00023 #include "NamespaceHeader.H"
00024
00025
00026
00027
00028
00029
00030
00031
00032 class BaseIF
00033 {
00034
00035 public:
00036
00037
00038 BaseIF()
00039 {
00040 }
00041
00042
00043 virtual ~BaseIF()
00044 {
00045 }
00046
00047
00048 virtual IndMomSpaceDim getExactVolumeMoments(const VolIndex & a_vof,
00049 const Real & a_dx) const
00050 {
00051 IndMomSpaceDim retval;
00052 retval.setToZero();
00053 MayDay::Error("not implemented");
00054 return retval;
00055 }
00056
00057
00058
00059 virtual IndMomSpaceDim getExactEBMoments(const VolIndex & a_vof,
00060 const Real & a_dx) const
00061 {
00062 IndMomSpaceDim retval;
00063 retval.setToZero();
00064 MayDay::Error("not implemented");
00065 return retval;
00066 }
00067
00068
00069
00070 virtual IndMomSpaceDim getExactEBNormalMoments(const VolIndex & a_vof,
00071 const Real & a_dx,
00072 const int & a_ni) const
00073 {
00074 IndMomSpaceDim retval;
00075 retval.setToZero();
00076 MayDay::Error("not implemented");
00077 return retval;
00078 }
00079
00080
00081 virtual IndMomSpaceDim getExactEBNormalPartialDerivs(const VolIndex & a_vof,
00082 const Real & a_dx,
00083 const int & a_ni) const
00084 {
00085 IndMomSpaceDim retval;
00086 retval.setToZero();
00087 MayDay::Error("not implemented");
00088 return retval;
00089 }
00090
00091
00092 virtual IndMomSDMinOne getExactFaceMoments(const FaceIndex & a_face,
00093 const Real & a_dx) const
00094 {
00095 IndMomSDMinOne retval;
00096 retval.setToZero();
00097 MayDay::Error("not implemented");
00098 return retval;
00099 }
00100
00101
00102
00103
00104
00105
00106
00107
00108
00109 virtual Real value(const RealVect& a_point) const = 0;
00110
00111
00112 virtual Real derivative(const IntVect& a_deriv,
00113 const RealVect& a_point) const
00114 {
00115 MayDay::Error("not implemented");
00116 return 0.;
00117 }
00118
00119 virtual Real value(const IndexTM<int,GLOBALDIM> & a_partialDerivative,
00120 const IndexTM<Real,GLOBALDIM>& a_point) const
00121 {
00122 Real retval= 0;
00123 if (a_partialDerivative == IndexTM<int,GLOBALDIM>::Zero)
00124 {
00125 retval = value(a_point);
00126 }
00127 else
00128 {
00129 retval = derivative(a_partialDerivative, a_point);
00130 }
00131 return retval;
00132 }
00133
00134
00135 virtual Real value(const IntVect & a_deriv,
00136 const RealVect & a_point) const
00137 {
00138 IndexTM<int,GLOBALDIM> deriv;
00139 IndexTM<Real,GLOBALDIM> point;
00140 for(int idir = 0; idir < SpaceDim; idir ++)
00141 {
00142 deriv[idir] = a_deriv[idir];
00143 point[idir] = a_point[idir];
00144 }
00145 return value(deriv, point);
00146 }
00147
00148 virtual bool fastIntersection(const Box& a_region,
00149 const ProblemDomain& a_domain,
00150 const RealVect& a_origin,
00151 const Real& a_dx) const
00152 {
00153 RealVect low, high;
00154 corners(a_region, a_origin, a_dx, low, high);
00155 return fastIntersection(low, high);
00156 }
00157
00158 virtual bool fastIntersection(const RealVect& a_low,
00159 const RealVect& a_high) const
00160 {return false;}
00161
00162 virtual GeometryService::InOut InsideOutside(const Box& a_region,
00163 const ProblemDomain& a_domain,
00164 const RealVect& a_origin,
00165 const Real& a_dx) const
00166 {
00167 RealVect low, high;
00168 corners(a_region, a_origin, a_dx, low, high);
00169 return InsideOutside(low, high);
00170 }
00171
00172 virtual GeometryService::InOut InsideOutside(const RealVect& a_low,
00173 const RealVect& a_high) const
00174
00175 {
00176 MayDay::Abort("This class has not implemented a fastIntersection operation");
00177 return GeometryService::Irregular;
00178 }
00179
00180
00181
00182
00183
00184 virtual Real value(const IndexTM<Real,GLOBALDIM>& a_point) const
00185 {
00186 CH_assert(GLOBALDIM==SpaceDim);
00187 RealVect rvpoint;
00188 for(int idir = 0; idir < SpaceDim; idir++)
00189 {
00190 rvpoint[idir] = a_point[idir];
00191 }
00192 return value(rvpoint);
00193 };
00194
00195
00196
00197
00198
00199 virtual Real derivative(const IndexTM< int,GLOBALDIM>& a_deriv,
00200 const IndexTM<Real,GLOBALDIM>& a_point
00201 ) const
00202 {
00203 CH_assert(GLOBALDIM==SpaceDim);
00204 RealVect rvpoint;
00205 IntVect ivderiv;
00206 for(int idir = 0; idir < SpaceDim; idir++)
00207 {
00208 rvpoint[idir] = a_point[idir];
00209 ivderiv[idir] = a_deriv[idir];
00210 }
00211 return derivative(ivderiv, rvpoint);
00212 };
00213
00214
00215
00216
00217
00218 virtual BaseIF* newImplicitFunction() const = 0;
00219
00220 virtual void print(ostream& out) const
00221 {
00222 MayDay::Abort("Print function not implemented");
00223 };
00224
00225
00226
00227
00228
00229
00230
00231
00232
00233
00234 virtual void makeGrids( const ProblemDomain& a_domain,
00235 DisjointBoxLayout& a_grids,
00236 const int& a_maxGridSize,
00237 const int& a_maxIrregGridSize )
00238 {
00239
00240 }
00241
00242 static void corners(const Box& a_region, const RealVect& a_origin, const Real& a_dx,
00243 RealVect& a_lo, RealVect& a_hi)
00244 {
00245 a_lo = a_origin + RealVect(a_region.smallEnd())*a_dx;
00246 a_hi = a_origin + RealVect(a_region.bigEnd()+IntVect::Unit)*a_dx;
00247 }
00248
00249
00250
00251
00252
00253
00254
00255
00256
00257
00258
00259 virtual void boxLayoutChanged(const DisjointBoxLayout & a_newBoxLayout,
00260 const RealVect & a_dx)
00261 {
00262 }
00263 };
00264
00265 #include "NamespaceFooter.H"
00266
00267 #endif