root/include/esfem_error.h

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

INCLUDED FROM


   1 /*! \file esfem_error.h
   2     \author Christian Power
   3     \date 20. March 2016
   4 
   5     \brief All error classes for namespace `Esfem`
   6 
   7      Revision history
   8      --------------------------------------------------
   9 
  10           Revised by Christian Power March 2016
  11           Originally written by Christian Power
  12                (power22c@gmail.com) March 2016
  13 
  14      Idea
  15      --------------------------------------------------
  16 
  17      Use the facilities provided in `dassert.h` to give very easy
  18      assertion checking.
  19 
  20          Created by Christian Power on 18.03.2016
  21          Copyright (c) 2016 Christian Power.  All rights reserved.
  22 
  23 */
  24 
  25 #ifndef ESFEM_ERROR_H
  26 #define ESFEM_ERROR_H 
  27 
  28 #include <stdexcept>
  29 #include "dassert.h"
  30 
  31 namespace Esfem{
  32   struct Parameter_error : std::runtime_error{
  33     explicit Parameter_error(const std::string& msg) 
  34       : std::runtime_error {"Esfem::Io::Parameter.\n" + msg}
  35     {}
  36   };
  37   /*!< \brief Used in io_parameter{,_impl}.{h,cpp} */
  38   struct SolutionDriven_error : std::runtime_error{
  39     explicit SolutionDriven_error(const std::string& msg)
  40       : std::runtime_error
  41     {"Esfem::SecOrd_op::Solution_driven.\n" + msg}
  42     {}
  43   };
  44   /*!< \brief Used in secOrd_op_solutionDriven{,_impl}.{h,cpp} */
  45   struct BrusselatorScheme_error : std::runtime_error{
  46     explicit BrusselatorScheme_error(const std::string& msg)
  47       : std::runtime_error
  48     {"Esfem::Brusselator_scheme.\n" + msg}
  49     {}
  50   };
  51   /*!< \brief Used in brusselator_algo{,_impl}.{h,cpp} */
  52   struct Grid_error : std::runtime_error{
  53     explicit Grid_error(const std::string& msg)
  54       : std::runtime_error
  55       {"Esfem::Grid::Grid_and_time.\n" + msg}
  56     {}
  57   };
  58   /*!< \brief Used in grid.h */
  59   //! Used for secOrd_op_rhs.h
  60   struct Rhs_error : std::runtime_error{
  61     //! Inherit constructor and prefix one line to `msg`
  62     explicit Rhs_error(const std::string& msg)
  63       :std::runtime_error {"Esfem::Rhs.\n" + msg}
  64     {}
  65   };
  66   //! Used for secOrd_op_initData.h
  67   struct InitData_error : std::runtime_error{
  68     //! Inherit constructor and prefix one line to `msg`
  69     explicit InitData_error(const std::string& msg)
  70       :std::runtime_error {"Esfem::InitData.\n" + msg}
  71     {}
  72   };
  73 }
  74 
  75 // ----------------------------------------------------------------------
  76 // Assert::dynamic specialization
  77 
  78 template<>
  79 inline void Assert::dynamic<false, Esfem::Parameter_error>
  80 (const bool, const std::string&){};
  81 template<>
  82 inline void Assert::dynamic<false, Esfem::SolutionDriven_error>
  83 (const bool, const std::string&){};
  84 template<>
  85 inline void Assert::dynamic<false, Esfem::BrusselatorScheme_error>
  86 (const bool, const std::string&){};
  87 template<>
  88 inline void Assert::dynamic<false, Esfem::Grid_error>
  89 (const bool, const std::string&){};
  90 template<>
  91 inline void Assert::dynamic<false, Esfem::Rhs_error>
  92 (const bool, const std::string&){};
  93 template<>
  94 inline void Assert::dynamic<false, Esfem::InitData_error>
  95 (const bool, const std::string&){};
  96 
  97 #endif // ESFEM_ERROR_H

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