1 /*! \file secOrd_op_initData.h 2 \brief Providing initial data for the experiment 3 4 Revision history 5 -------------------------------------------------- 6 7 Revised by Christian Power June 2016 8 Revised by Christian Power April 2016 9 Originally written by Christian Power 10 (power22c@gmail.com) Januar 2016 11 12 Idea 13 -------------------------------------------------- 14 15 Wrapper class for the dune function class. 16 17 \author Christian Power 18 \date 7. June 2016 19 \copyright Copyright (c) 2016 Christian Power. All rights reserved. 20 */ 21 22 #ifndef SECORD_OP_INITDATA_H 23 #define SECORD_OP_INITDATA_H 24 25 #include <memory> 26 #include "esfem_fwd.h" 27 28 namespace Esfem{ 29 namespace SecOrd_op{ 30 //! Initial data for scalar ESFEM experiments 31 class Init_data{ 32 public: 33 //! Constructor for an analytic given initial function 34 /*! \post Grid_and_time must outlive this object. */ 35 Init_data(const Grid::Grid_and_time&, const Growth); 36 //! Constructor for an random initial function 37 Init_data(const Io::Parameter&, const Growth); 38 //! Required for the pointer to implementation technique. 39 ~Init_data(); 40 41 //! Lagrange interpolation 42 void interpolate(Grid::Scal_FEfun&) const; 43 private: 44 struct Data; 45 //! Pointer to data members 46 std::unique_ptr<Data> d_ptr; 47 }; 48 49 //! Scalar valued initial data 50 struct sIdata{ 51 //! Stationary sphere eigen functions 52 /*! A factory function. \f$e^{-6t}(xy, yz, xz)\f$ are eigen functions 53 for the Laplace operator on the sphere. 54 \post Grid and time outlive this object. */ 55 static sIdata* new_1ssef(const Grid::Grid_and_time&); 56 //! \copydoc new_1ssef() 57 static sIdata* new_2ssef(const Grid::Grid_and_time&); 58 //! \copydoc new_1ssef() 59 static sIdata* new_3ssef(const Grid::Grid_and_time&); 60 //! Virtual copy constructor 61 virtual sIdata* clone() =0; 62 //! Abstract base class 63 virtual ~sIdata(){} 64 //! Lagrange interpolation 65 virtual void interpolate(Grid::Scal_FEfun&) const =0; 66 }; 67 //! Vector valued initial data 68 class vIdata{ 69 public: 70 //! Stationary sphere eigen functions 71 /*! A factory function. \f$e^{-6t}(xy, yz, xz)\f$ are eigen functions 72 for the Laplace operator on the sphere. 73 \post Grid and time outlive this object. */ 74 static vIdata* new_ssef(const Grid::Grid_and_time&); 75 //! Exact sphere solution of mean curvature flow 76 /*! A factory function. For \f$S^n_{R_0} \subset \R^{n+1}\f$ 77 with initial radius of \f$R_0>0\f$, the radius of the exact solution 78 is given via 79 \f[ 80 R(t)= \sqrt{R^2_0 - 2nt},\quad t\in 81 \left(-\infty, \frac{R^2_0}{2n}\right) 82 \f]*/ 83 static vIdata* new_sms(const Grid::Grid_and_time&); 84 //! For Brusselator_scheme::eoc_sls() 85 static vIdata* new_sls(const Grid::Grid_and_time&); 86 //! Exact velocity for Brusselator_scheme::eoc_sls() 87 static vIdata* new_v_sls(const Grid::Grid_and_time&); 88 //! For Brusselator_scheme::sd() 89 static vIdata* new_sd(const Grid::Grid_and_time&); 90 //! Virtual copy constructor 91 virtual vIdata* clone() =0; 92 //! Abstract base class 93 virtual ~vIdata(){} 94 //! Lagrange interpolation 95 virtual void interpolate(Grid::Vec_FEfun&) const =0; 96 }; 97 98 //! Analytically given velocity 99 class Exact_velocity{ 100 public: 101 //! Fetch time provider 102 /*! \post Gird_and_time must outlive this object. 103 \todo Change constructor so that it also reads parameter. 104 */ 105 Exact_velocity(const Grid::Grid_and_time&); 106 //! Required for the pointer to implementation technique 107 ~Exact_velocity(); 108 109 //! Lagrange interpolation 110 void interpolate(Grid::Vec_FEfun&) const; 111 private: 112 struct Data; 113 //! Pointer to data members 114 std::unique_ptr<Data> d_ptr; 115 }; 116 } 117 } 118 119 #endif // SECORD_OP_INITDATA_H