MathTL
|
00001 // -*- c++ -*- 00002 00003 // +--------------------------------------------------------------------+ 00004 // | This file is part of MathTL - the Mathematical Template Library | 00005 // | | 00006 // | Copyright (c) 2002-2009 | 00007 // | Thorsten Raasch, Manuel Werner | 00008 // +--------------------------------------------------------------------+ 00009 00010 #ifndef _MATHTL_BVP_H 00011 #define _MATHTL_BVP_H 00012 00013 #include <geometry/point.h> 00014 #include <geometry/atlas.h> 00015 #include <algebra/matrix.h> 00016 #include <utils/array1d.h> 00017 #include <utils/fixed_array1d.h> 00018 #include <utils/function.h> 00019 00020 namespace MathTL 00021 { 00032 template <unsigned int DIM> 00033 class TwoPointBVP 00034 { 00035 public: 00039 virtual ~TwoPointBVP(); 00040 00044 virtual void apply_A(const Point<DIM>& v, Point<DIM>& result) const = 0; 00045 00049 virtual void apply_B(const Point<DIM>& v, Point<DIM>& result) const = 0; 00050 00054 virtual void apply_f(const double t, const Point<DIM>& v, Point<DIM>& result) const = 0; 00055 }; 00056 00071 template <unsigned int DIM> 00072 class EllipticBVP 00073 { 00074 public: 00078 EllipticBVP(const Function<DIM>* a, 00079 const Function<DIM>* q, 00080 const Function<DIM>* f); 00081 00085 virtual ~EllipticBVP() {} 00086 00090 virtual const double a(const Point<DIM>& x) const 00091 { 00092 return a_->value(x); 00093 } 00094 00098 virtual const double q(const Point<DIM>& x) const 00099 { 00100 return q_->value(x); 00101 } 00102 00107 virtual const bool constant_coefficients() const = 0; 00108 00112 virtual const double f(const Point<DIM>& x) const 00113 { 00114 return f_->value(x); 00115 } 00116 00120 void set_f(const Function<DIM>* f); 00121 00122 protected: 00124 const Function<DIM>* a_; 00125 00127 const Function<DIM>* q_; 00128 00130 const Function<DIM>* f_; 00131 }; 00132 00137 template <unsigned int DIM> 00138 class PoissonBVP 00139 : public EllipticBVP<DIM> 00140 { 00141 public: 00145 PoissonBVP(const Function<DIM>* f); 00146 00150 const double a(const Point<DIM>& x) const { return 1.0; } 00151 00155 const double q(const Point<DIM>& x) const { return 0.0; } 00156 00160 const bool constant_coefficients() const { return true; } 00161 }; 00162 00169 template <unsigned int DIM> 00170 class IdentityBVP 00171 : public EllipticBVP<DIM> 00172 { 00173 public: 00177 IdentityBVP(const Function<DIM>* f); 00178 00182 const double a(const Point<DIM>& x) const { return 0.0; } 00183 00187 const double q(const Point<DIM>& x) const { return 1.0; } 00188 00192 const bool constant_coefficients() const { return true; } 00193 }; 00194 00195 00196 00211 template <unsigned int DIM> 00212 class BiharmonicBVP 00213 { 00214 public: 00218 BiharmonicBVP(const Function<DIM>* f); 00219 00223 virtual ~BiharmonicBVP() {} 00224 00234 const bool constant_coefficients() const; 00235 00239 const double f(const Point<DIM>& x) const 00240 { 00241 return f_->value(x); 00242 } 00243 00247 void set_f(const Function<DIM>* f); 00248 00249 protected: 00250 00252 const Function<DIM>* f_; 00253 }; 00254 00255 00256 } 00257 00258 #include <numerics/bvp.cpp> 00259 00260 #endif