ode-toolbox

ODE integration tools
git clone https://git.0xfab.ch/ode-toolbox.git
Log | Files | Refs | README | LICENSE

KernelBase.h (984B)


      1 /* File:   KernelBase.h */
      2 /* Date:   Fri Feb 12 13:08:27 2016 */
      3 /* Author: Fabian Wermelinger */
      4 /* Tag:    Kernel base class.  Required for the computation of the
      5  *         right-hand-side in the timestepper and defines what happens when
      6  *         writing data. */
      7 /* Copyright 2016 ETH Zurich. All Rights Reserved. */
      8 #ifndef KERNELBASE_H_OTQSHL94
      9 #define KERNELBASE_H_OTQSHL94
     10 
     11 #ifdef _FLOAT_PRECISION_
     12 using Real = float;
     13 #else
     14 using Real = double;
     15 #endif
     16 
     17 template <typename Tinput, typename Trhs=Tinput>
     18 class KernelBase
     19 {
     20     KernelBase(KernelBase const& c) = delete;
     21     KernelBase& operator=(KernelBase const& c) = delete;
     22 
     23 public:
     24     KernelBase() = default;
     25     virtual ~KernelBase() = default;
     26 
     27     virtual void compute(const Tinput& U, Trhs& rhs, const Real t=0.0, void const* const data=nullptr) = 0;
     28     virtual void write(const size_t step, const Real t, const Real dt, const Tinput& U, const void * const data=nullptr) = 0;
     29 };
     30 
     31 #endif /* KERNELBASE_H_OTQSHL94 */