00001 #ifdef CH_LANG_CC
00002
00003
00004
00005
00006
00007
00008
00009 #endif
00010
00011 #ifndef _SMOOTHABSOLUTEVALUE_H_
00012 #define _SMOOTHABSOLUTEVALUE_H_
00013
00014 #include "MayDay.H"
00015 #include "RealVect.H"
00016 #include "IntVect.H"
00017 #include "BaseIF.H"
00018
00019 #include "NamespaceHeader.H"
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031 class SmoothAbsoluteValue
00032 {
00033 public:
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050 static void setKnownFunction(int a_whichfunc)
00051 {
00052 s_knownFunc = a_whichfunc;
00053 }
00054
00055
00056 SmoothAbsoluteValue(const BaseIF* a_f,
00057 const BaseIF* a_g,
00058 const Real & a_delta)
00059 {
00060 m_f = a_f;
00061 m_g = a_g;
00062 m_d = a_delta;
00063 m_pi = 4.*atan(1.0);
00064 }
00065
00066
00067 virtual ~SmoothAbsoluteValue()
00068 {; }
00069
00070
00071 virtual Real smoothAbsFMinusG(const IntVect& a_deriv,
00072 const RealVect& a_point) const;
00073
00074
00075
00076
00077
00078
00079 void getWCase(int & a_case,
00080 Real & a_wval,
00081 const RealVect & a_point)const;
00082
00083 protected:
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098 virtual Real valueAem(const RealVect& a_point) const;
00099
00100
00101 virtual Real firstDerivAem(const IntVect& a_deriv,
00102 const RealVect& a_point) const;
00103
00104
00105 virtual Real secondDerivAem(const IntVect& a_deriv,
00106 const RealVect& a_point) const;
00107
00108
00109 virtual Real thirdDerivAem(const IntVect& a_deriv,
00110 const RealVect& a_point) const;
00111
00112
00113 virtual Real fourthDerivAem(const IntVect& a_deriv,
00114 const RealVect& a_point) const;
00115
00116
00117 bool isBogus(const Real& a_number) const;
00118
00119
00120 void checkAgainstKnown(const Real & a_myAnswer,
00121 const IntVect & a_deriv,
00122 const RealVect & a_point) const;
00123
00124
00125
00126 const BaseIF* m_f;
00127 const BaseIF* m_g;
00128
00129 Real m_d;
00130
00131
00132 Real m_pi;
00133
00134 static int s_knownFunc;
00135 private:
00136
00137 SmoothAbsoluteValue(const SmoothAbsoluteValue& a_inputIF)
00138 {
00139 MayDay::Abort("SmoothAbsoluteValue doesn't allow copy construction");
00140 }
00141
00142 SmoothAbsoluteValue()
00143 {
00144 MayDay::Abort("SmoothAbsoluteValue uses strong construction");
00145 }
00146
00147 void operator=(const SmoothAbsoluteValue& a_inputIF)
00148 {
00149 MayDay::Abort("SmoothAbsoluteValue doesn't allow assignment");
00150 }
00151 };
00152
00153
00154
00155
00156
00157
00158
00159
00160
00161
00162
00163
00164 class OffsetSphereExact
00165 {
00166 public:
00167 OffsetSphereExact(const Real & a_delta,
00168 const Real & a_pi)
00169 {
00170 m_d = a_delta;
00171 m_pi = a_pi;
00172 }
00173
00174 ~OffsetSphereExact()
00175 {
00176 }
00177
00178
00179 Real value(const IntVect& a_deriv,
00180 const RealVect& a_point) const;
00181
00182
00183
00184 Real valueAem(const RealVect& a_point) const;
00185
00186
00187
00188 Real firstDerivAem(const IntVect& a_deriv,
00189 const RealVect& a_point) const;
00190
00191
00192
00193 Real secondDerivAem(const IntVect& a_deriv,
00194 const RealVect& a_point) const;
00195
00196
00197
00198 Real thirdDerivAem(const IntVect& a_deriv,
00199 const RealVect& a_point) const;
00200
00201
00202
00203 Real fourthDerivAem(const IntVect& a_deriv,
00204 const RealVect& a_point) const;
00205 private:
00206 void getXYIXIY(int & a_ix, int& a_iy,
00207 Real& a_x, Real& a_y,
00208 const int & a_xderivVal,
00209 const IntVect& a_deriv,
00210 const RealVect& a_point) const;
00211
00212 OffsetSphereExact()
00213 {
00214 MayDay::Error("this uses strong construction");
00215 }
00216
00217 Real m_d;
00218 Real m_pi;
00219
00220 };
00221
00222
00223
00224
00225
00226
00227
00228
00229
00230
00231
00232
00233
00234
00235
00236 class DoubleSphereExact
00237 {
00238 public:
00239 DoubleSphereExact(const Real & a_delta,
00240 const Real & a_pi)
00241 {
00242 m_d = a_delta;
00243 m_pi = a_pi;
00244 }
00245
00246 ~DoubleSphereExact()
00247 {
00248 }
00249
00250
00251 Real value(const IntVect& a_deriv,
00252 const RealVect& a_point) const;
00253
00254
00255
00256 Real valueAem(const RealVect& a_point) const;
00257
00258
00259
00260 Real firstDerivAem(const IntVect& a_deriv,
00261 const RealVect& a_point) const;
00262
00263
00264
00265 Real secondDerivAem(const IntVect& a_deriv,
00266 const RealVect& a_point) const;
00267
00268
00269
00270 Real thirdDerivAem(const IntVect& a_deriv,
00271 const RealVect& a_point) const;
00272
00273
00274
00275 Real fourthDerivAem(const IntVect& a_deriv,
00276 const RealVect& a_point) const;
00277 private:
00278 DoubleSphereExact()
00279 {
00280 MayDay::Error("this uses strong construction");
00281 }
00282
00283 Real m_d;
00284 Real m_pi;
00285
00286 };
00287
00288
00289
00290
00291
00292
00293
00294
00295
00296
00297
00298
00299
00300 class DoubleRampExact
00301 {
00302 public:
00303 DoubleRampExact(const Real & a_delta,
00304 const Real & a_pi)
00305 {
00306 m_d = a_delta;
00307 m_pi = a_pi;
00308 }
00309
00310 ~DoubleRampExact()
00311 {
00312 }
00313
00314
00315 Real value(const IntVect& a_deriv,
00316 const RealVect& a_point) const;
00317
00318
00319
00320 Real valueAem(const RealVect& a_point) const;
00321
00322
00323
00324 Real firstDerivAem(const IntVect& a_deriv,
00325 const RealVect& a_point) const;
00326
00327
00328
00329 Real secondDerivAem(const IntVect& a_deriv,
00330 const RealVect& a_point) const;
00331
00332
00333
00334 Real thirdDerivAem(const IntVect& a_deriv,
00335 const RealVect& a_point) const;
00336
00337
00338
00339 Real fourthDerivAem(const IntVect& a_deriv,
00340 const RealVect& a_point) const;
00341 private:
00342
00343 DoubleRampExact()
00344 {
00345 MayDay::Error("this uses strong construction");
00346 }
00347
00348 Real m_d;
00349 Real m_pi;
00350
00351 };
00352 #include "NamespaceFooter.H"
00353 #endif