Hermes2D  2.0
mixins2d.cpp
1 // This file is part of Hermes2D.
2 //
3 // Hermes2D is free software; you can redistribute it and/or modify
4 // it under the terms of the GNU General Public License as published by
5 // the Free Software Foundation; either version 2 of the License, or
6 // (at your option) any later version.
7 //
8 // Hermes is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 // GNU General Public License for more details.
12 //
13 // You should have received a copy of the GNU General Public License
14 // along with Hermes; if not, see <http://www.gnu.prg/licenses/>.
15 #include "mixins2d.h"
16 
17 namespace Hermes
18 {
19  namespace Hermes2D
20  {
21  namespace Mixins
22  {
23  template<typename Scalar>
24  const Space<Scalar>* SettableSpaces<Scalar>::get_space(int n) const
25  {
26  return this->get_spaces()[n];
27  }
28 
29  void StateQueryable::check() const
30  {
31  if(!this->isOkay())
32  {
33  std::stringstream ss;
34  ss << "The instance of " << this->getClassName() << " is not OK.";
35  throw Hermes::Exceptions::Exception(ss.str().c_str());
36  }
37  }
38 
39  XMLParsing::XMLParsing() : validate(false)
40  {
41  }
42 
43  void XMLParsing::set_validation(bool to_set)
44  {
45  this->validate = to_set;
46  }
47 
48  template<typename Scalar>
49  MatrixRhsOutput<Scalar>::MatrixRhsOutput() : output_matrixOn(false), output_matrixIterations(-1), matrixFilename("Matrix_"),
50  matrixVarname("A"), matrixFormat(Hermes::Algebra::DF_MATLAB_SPARSE), matrix_number_format("%lf"), output_rhsOn(false), output_rhsIterations(-1),
51  RhsFilename("Rhs_"), RhsVarname("b"), RhsFormat(Hermes::Algebra::DF_MATLAB_SPARSE), rhs_number_format("%lf")
52  {
53  }
54  template<typename Scalar>
55  void MatrixRhsOutput<Scalar>::output_matrix(int firstIterations)
56  {
57  output_matrixOn = true;
58  this->output_matrixIterations = firstIterations;
59  }
60  template<typename Scalar>
62  {
63  this->matrixFilename = name;
64  }
65 
66  template<typename Scalar>
68  {
69  this->print_matrix_zero_values = to_set;
70  }
71 
72  template<typename Scalar>
74  {
75  this->matrixVarname = name;
76  }
77  template<typename Scalar>
79  {
80  this->matrixFormat = format;
81  }
82  template<typename Scalar>
84  {
85  this->matrix_number_format = number_format;
86  }
87 
88  template<typename Scalar>
89  void MatrixRhsOutput<Scalar>::output_rhs(int firstIterations)
90  {
91  this->output_rhsOn = true;
92  this->output_rhsIterations = firstIterations;
93  }
94  template<typename Scalar>
96  {
97  this->RhsFilename = name;
98  }
99  template<typename Scalar>
101  {
102  this->RhsVarname = name;
103  }
104  template<typename Scalar>
106  {
107  this->RhsFormat = format;
108  }
109  template<typename Scalar>
111  {
112  this->rhs_number_format = number_format;
113  }
114 
115  template HERMES_API class SettableSpaces<double>;
116  template HERMES_API class SettableSpaces<std::complex<double> >;
117  template HERMES_API class MatrixRhsOutput<double>;
118  template HERMES_API class MatrixRhsOutput<std::complex<double> >;
119  }
120  }
121 }