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
00018 #include "Notation.H"
00019 #include "GeometryService.H"
00020
00021 #include "NamespaceHeader.H"
00022
00024
00030 class BaseIF
00031 {
00032
00033 public:
00034
00036 BaseIF()
00037 {
00038 }
00039
00041 virtual ~BaseIF()
00042 {
00043 }
00044
00046
00051 virtual Real value(const RealVect& a_point) const = 0;
00052
00053
00054 virtual bool fastIntersection(const Box& a_region,
00055 const ProblemDomain& a_domain,
00056 const RealVect& a_origin,
00057 const Real& a_dx) const
00058 {
00059 RealVect low, high;
00060 corners(a_region, a_origin, a_dx, low, high);
00061 return fastIntersection(low, high);
00062 }
00063
00064 virtual bool fastIntersection(const RealVect& a_low,
00065 const RealVect& a_high) const
00066 {return false;}
00067
00068 virtual GeometryService::InOut InsideOutside(const Box& a_region,
00069 const ProblemDomain& a_domain,
00070 const RealVect& a_origin,
00071 const Real& a_dx) const
00072 {
00073 RealVect low, high;
00074 corners(a_region, a_origin, a_dx, low, high);
00075 return InsideOutside(low, high);
00076 }
00077
00078 virtual GeometryService::InOut InsideOutside(const RealVect& a_low,
00079 const RealVect& a_high) const
00080
00081 {
00082 MayDay::Error("This class has not implemented a fastIntersection operation");
00083 return GeometryService::Irregular;
00084 }
00086
00089 virtual Real value(const IndexTM<Real,GLOBALDIM>& a_point) const
00090 {
00091 MayDay::Abort("'value' called with 'IndexTM' not implemented in BaseIF");
00092 Real retval = LARGEREALVAL;
00093 return retval;
00094 };
00095
00097
00100 virtual IndexTM<Real,GLOBALDIM> grad(const IndexTM<Real,GLOBALDIM>& a_point) const
00101 {
00102 MayDay::Abort("'grad' not implemented in BaseIF");
00103 return IndexTM<Real,GLOBALDIM>();
00104 };
00105
00107
00113 virtual IndexTM<Real,GLOBALDIM> normal(const IndexTM<Real,GLOBALDIM>& a_point) const
00114 {
00115 MayDay::Abort("'normal' not implemented in BaseIF");
00116 return IndexTM<Real,GLOBALDIM>();
00117 };
00118
00120
00123 virtual Vector<IndexTM <Real,GLOBALDIM> > gradGrad(const IndexTM<Real,GLOBALDIM>& a_point) const
00124 {
00125 MayDay::Abort("'gradGrad' not implemented in BaseIF");
00126 return Vector<IndexTM <Real,GLOBALDIM> >();
00127 };
00128
00130
00133 virtual Vector<IndexTM <Real,GLOBALDIM> > gradNormal(const IndexTM<Real,GLOBALDIM>& a_point) const
00134 {
00135 MayDay::Abort("'gradNormal' not implemented in BaseIF");
00136 return Vector<IndexTM <Real,GLOBALDIM> >();
00137 };
00138
00140
00144 virtual BaseIF* newImplicitFunction() const = 0;
00145
00146
00147 static void corners(const Box& a_region, const RealVect& a_origin, const Real& a_dx,
00148 RealVect& a_lo, RealVect& a_hi)
00149 {
00150 a_lo = a_origin + RealVect(a_region.smallEnd())*a_dx;
00151 a_hi = a_origin + RealVect(a_region.bigEnd()+IntVect::Unit)*a_dx;
00152 }
00153 };
00154
00155 #include "NamespaceFooter.H"
00156
00157 #endif