root/src/secOrd_op_rhs.cpp

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

DEFINITIONS

This source file includes following definitions.
  1. assemble_and_addScaled_to
  2. assemble_and_addScaled_to
  3. new_sdp_u
  4. new_sls
  5. new_sd

   1 /*! \file secOrd_op_rhs.cpp
   2     \brief Implementing `secOrd_op_rhs.h`
   3 
   4      Revision history
   5      --------------------------------------------------
   6 
   7           Revised by Christian Power April 2016
   8           Originally written by Christian Power
   9                (power22c@gmail.com) January 2016
  10 
  11      Idea
  12      --------------------------------------------------
  13 
  14      Implementation of classes `Rhs` and `Vec_rhs`.
  15 
  16      \author Christian Power
  17      \date 23. April 2016
  18      \copyright Copyright (c) 2016 Christian Power. All rights reserved.
  19  */
  20 
  21 #include <config.h>
  22 #include "secOrd_op_rhs.h"
  23 #include "secOrd_op_rhs_impl.h"
  24 
  25 using Esfem::SecOrd_op::Rhs;
  26 using Esfem::SecOrd_op::Vec_rhs;
  27 using Esfem::SecOrd_op::sRhs;
  28 using Esfem::SecOrd_op::vRhs;
  29 //! Dune scalar valued finite element function
  30 using FE_function = Esfem::Grid::Scal_FEfun::Dune_FEfun;
  31 //! Dune vector valued finite element function
  32 using Vec_FE_function = Esfem::Grid::Vec_FEfun::Dune_FEfun;
  33 
  34 // ----------------------------------------------------------------------
  35 // Implementation of Rhs
  36 
  37 Rhs::Rhs(const Grid::Grid_and_time& gt, const Growth type)
  38   :d_ptr {std::make_unique<Data>(gt, type)}
  39 {}
  40 Rhs::~Rhs() = default;
  41 void Rhs::assemble_and_addScaled_to(Grid::Scal_FEfun& fef){
  42   assemble_RHS(d_ptr -> rhs, d_ptr -> load_vector);
  43   FE_function& dune_fef = fef;
  44   dune_fef.axpy(d_ptr -> tp.deltaT(), d_ptr -> load_vector); 
  45 }
  46 
  47 // ----------------------------------------------------------------------
  48 // Implementation of Vec_rhs
  49 
  50 Vec_rhs::Vec_rhs(const Grid::Grid_and_time& gt)
  51   :d_ptr {std::make_unique<Data>(gt)}
  52 {}
  53 Vec_rhs::~Vec_rhs() = default;
  54 void Vec_rhs::assemble_and_addScaled_to(Grid::Vec_FEfun& vfef){
  55   assemble_RHS(d_ptr -> rhs, d_ptr -> load_vector);
  56   Vec_FE_function& dune_vfef = vfef;
  57   dune_vfef.axpy(d_ptr -> tp.deltaT(), d_ptr -> load_vector);
  58 }
  59 
  60 // ----------------------------------------------------------------------
  61 // sRhs
  62 
  63 sRhs* sRhs::new_sdp_u(Grid::Grid_and_time& gt){
  64   return new Impl::sdp_u_rhs {gt};
  65 }
  66 
  67 // ----------------------------------------------------------------------
  68 // vRhs
  69 
  70 vRhs* vRhs::new_sls(Grid::Grid_and_time& gt){
  71   return new Impl::sls_rhs {gt};
  72 }
  73 vRhs* vRhs::new_sd(Grid::Grid_and_time& gt){
  74   return new Impl::sd_rhs {gt};
  75 }
  76 
  77 // ----------------------------------------------------------------------
  78 // Implementation of Rhs::Data and Vec_rhs::Data
  79 
  80 Rhs::Data::Data(const Grid::Grid_and_time& gt, const Growth type)
  81   :tp {gt.time_provider()}, rhs {tp, type},
  82    load_vector {"load_vector", gt.fe_space()}
  83 {}
  84 
  85 Vec_rhs::Data::Data(const Grid::Grid_and_time& gt)
  86   :tp {gt.time_provider()}, rhs {tp},
  87    load_vector {"vec_load_vector", gt.vec_fe_space()}
  88 {}

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