Geomi
Abstract_Step.hpp
1 #ifndef DEF_RKMK_ABSTRACT_STEP
2 #define DEF_RKMK_ABSTRACT_STEP
3 
4 #include <algorithm> // std::max
5 #include <iterator> // C style array copy
6 
7 
8 namespace RKMK {
9 namespace Abstract {
15 template <typename T_LIE_ALGEBRA,
16  int T_N_INTERNAL_STAGES,
17  typename T_M = double>
18 class Step
19 {
20 protected:
23  char m_type;
24 
25 public:
26  static const char TYPE_UNKNOWN = 0;
27  static const char TYPE_EXPLICIT = 1;
28  static const char TYPE_DIAGONAL_IMPLICIT = 2;
29 
30 public:
32  : m_problem(problem)
33  {
35  setType();
36  }
37 
39  { }
40 
41  bool
42  setCoeffs (std::vector<double> a, std::vector<double> b) const
43  { return m_internals->setCoeffs(a,b); }
44 
45  void
46  setData (T_M h_var, NOXVector<T_LIE_ALGEBRA::DOF> y0_var)
47  { m_internals->setData(h_var,y0_var); }
48 
49  void
50  setType ( )
51  {
52  int i,j;
53  bool tmp_isZero;
54  bool isExplicit = true;
55  bool isDIRK = true;
56 
57  for (i=0; i<T_N_INTERNAL_STAGES; i++) {
58  isExplicit &= isZero<double>(m_internals->a_coeffs(i,i));
59  for (j=i+1; j<T_N_INTERNAL_STAGES; j++) {
60  tmp_isZero = isZero<double>(m_internals->a_coeffs(i,j));
61  isExplicit &= tmp_isZero;
62  isDIRK &= tmp_isZero;
63  }
64  }
65 
66  if (isExplicit)
67  m_type = TYPE_EXPLICIT;
68  else if (isDIRK)
69  m_type = TYPE_DIAGONAL_IMPLICIT;
70  else
71  m_type = TYPE_UNKNOWN;
72  }
73 
74  const char
75  type ()
76  { return m_type; }
77 
78  virtual const NOXVector<T_LIE_ALGEBRA::DOF>
79  makeStep () = 0;
80 };
81 } // namespace Abstract
82 } // namespace RKMK
83 
84 #endif
Definition: Abstract_Problem.hpp:10
Definition: Abstract_Integrator.hpp:4
Definition: Abstract_Step.hpp:18
Definition: Abstract_NOXStep.hpp:9
Definition: StepInternals.hpp:11