root/src/secOrd_op_initData.cpp

/* [<][>][^][v][top][bottom][index][help] */

DEFINITIONS

This source file includes following definitions.
  1. Init_data
  2. interpolate
  3. new_1ssef
  4. new_ssef
  5. new_sms
  6. new_sls
  7. new_v_sls
  8. new_sd
  9. interpolate

   1 /*! \file secOrd_op_initData.cpp
   2 
   3     \brief <Program Name>
   4 
   5      Revision history:
   6 
   7           Revised by Christian Power dd.mm.yyyy
   8           Originally written by Christian Power
   9                (power22c@gmail.com) Januar 2016
  10 
  11      Implementation details for secOrd_op_initData.h
  12      Created by Christian Power on 30.01.2016
  13      Copyright (c) 2016 Christian Power. All rights reserved.
  14  */
  15 
  16 #include <config.h>
  17 #include <dune/fem/operator/lagrangeinterpolation.hh>
  18 #include "secOrd_op_initData.h"
  19 #include "secOrd_op_initData_impl.h"
  20 #include "io_dof.h"
  21 #include "esfem_error.h"
  22 
  23 using namespace std;
  24 using Esfem::SecOrd_op::Init_data;
  25 using Esfem::SecOrd_op::sIdata;
  26 using Esfem::SecOrd_op::vIdata;
  27 using Esfem::SecOrd_op::Exact_velocity;
  28 
  29 // ----------------------------------------------------------------------
  30 // Init_data 
  31 
  32 Esfem::SecOrd_op::Init_data::
  33 Init_data(const Grid::Grid_and_time& gt, const Growth type) 
  34   :d_ptr {make_unique<Data>(gt, type)}
  35 {}
  36 
  37 Esfem::SecOrd_op::Init_data::Init_data(const Io::Parameter& p,
  38                                        const Growth type) 
  39   :d_ptr {make_unique<Data>(p, type)}
  40 {}
  41 
  42  Esfem::SecOrd_op::Init_data::~Init_data() = default;
  43 
  44 /*! \retval fef Interpolation of the exact solution or random given nodal values */
  45 void Esfem::SecOrd_op::Init_data::interpolate(Grid::Scal_FEfun& fef) const{
  46   using std::begin;
  47   using std::end;
  48   using FE_function = Esfem::Grid::Scal_FEfun::Dune_FEfun;
  49   
  50   const auto& eid_ptr = d_ptr -> eid_ptr;
  51   const auto& rid_ptr = d_ptr -> rid_ptr;
  52   // const auto& ofname = d_ptr -> dof_io_filename;
  53   
  54   if(eid_ptr)
  55     Dune::LagrangeInterpolation<FE_function>::
  56       interpolateFunction(*eid_ptr, fef);
  57   else if(rid_ptr){
  58     Dune::LagrangeInterpolation<FE_function>::
  59       interpolateFunction(*rid_ptr, fef);
  60     // Io::dof_to_file(begin(fef), end(fef), ofname);
  61   }
  62   else
  63     throw InitData_error {Assert::compose(__FILE__, __LINE__, "Null pointer")};
  64 }
  65 
  66 // ----------------------------------------------------------------------
  67 // sIdata
  68 
  69 sIdata* sIdata::new_1ssef(const Grid::Grid_and_time& gt){
  70   return new Impl::sphere_1EF {gt};
  71 }
  72 // sIdata* new_2ssef(const Grid::Grid_and_time&){
  73 //   return new Impl::sphere_2EF {gt};
  74 // }
  75 // sIdata* new_3ssef(const Grid::Grid_and_time&){
  76 //   return new Impl::sphere_3EF {gt};
  77 // }
  78 
  79 // ----------------------------------------------------------------------
  80 // vIdata
  81 
  82 vIdata* vIdata::new_ssef(const Grid::Grid_and_time& gt){
  83   return new Impl::sphere_eigenFun {gt};
  84 }
  85 
  86 vIdata* vIdata::new_sms(const Grid::Grid_and_time& gt){
  87   return new Impl::sphere_mcf_sol {gt};
  88 }
  89 
  90 vIdata* vIdata::new_sls(const Grid::Grid_and_time& gt){
  91   return new Impl::sls_iData {gt};
  92 }
  93 
  94 vIdata* vIdata::new_v_sls(const Grid::Grid_and_time& gt){
  95   return new Impl::sls_v_iData {gt};
  96 }
  97 
  98 vIdata* vIdata::new_sd(const Grid::Grid_and_time& gt){
  99   return new Impl::sd_iData {gt};
 100 }
 101 // ----------------------------------------------------------------------
 102 // Exact_velocity
 103 
 104 Exact_velocity::Exact_velocity(const Grid::Grid_and_time& gt)
 105   :d_ptr {std::make_unique<Data>(gt)}
 106 {}
 107 
 108 Exact_velocity::~Exact_velocity() = default;
 109 
 110 /*! \retval vfef Interpolation of the exact velocity */
 111 void Exact_velocity::interpolate(Grid::Vec_FEfun& vfef) const{
 112   using FE_function = Esfem::Grid::Vec_FEfun::Dune_FEfun;
 113   Dune::LagrangeInterpolation<FE_function>::
 114     interpolateFunction(d_ptr -> v_fun, vfef);
 115 }

/* [<][>][^][v][top][bottom][index][help] */