flexiblesusy is hosted by Hepforge, IPPP Durham
FlexibleSUSY
model.hpp
Go to the documentation of this file.
1// ====================================================================
2// This file is part of FlexibleSUSY.
3//
4// FlexibleSUSY is free software: you can redistribute it and/or modify
5// it under the terms of the GNU General Public License as published
6// by the Free Software Foundation, either version 3 of the License,
7// or (at your option) any later version.
8//
9// FlexibleSUSY is distributed in the hope that it will be useful, but
10// WITHOUT ANY WARRANTY; without even the implied warranty of
11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12// General Public License for more details.
13//
14// You should have received a copy of the GNU General Public License
15// along with FlexibleSUSY. If not, see
16// <http://www.gnu.org/licenses/>.
17// ====================================================================
18
19#ifndef MODEL_H
20#define MODEL_H
21
22#include <string>
23#include <iosfwd>
24#include <typeinfo>
25
26namespace flexiblesusy {
27
28class Model {
29public:
30 virtual ~Model() = default;
31 virtual void calculate_spectrum() = 0;
32 virtual void clear_problems() = 0;
33 virtual std::string name() const = 0;
34 virtual void print(std::ostream&) const = 0;
35 virtual void run_to(double, double eps = -1.0) = 0;
36 virtual void set_precision(double) = 0;
37
38 void print() const;
39};
40
41template <class TargetModel, class InputModel>
42TargetModel cast_model(InputModel abstract_model)
43{
44#ifdef ENABLE_DEBUG
45 TargetModel tmp = dynamic_cast<TargetModel>(abstract_model);
46 if (!tmp) {
47 FATAL("model " << abstract_model << " is not of type "
48 << typeid(TargetModel).name());
49 }
50 return tmp;
51#else
52 return static_cast<TargetModel>(abstract_model);
53#endif
54}
55
56} // namespace flexiblesusy
57
58#endif
virtual void clear_problems()=0
virtual std::string name() const =0
virtual void print(std::ostream &) const =0
virtual void calculate_spectrum()=0
virtual void run_to(double, double eps=-1.0)=0
virtual void set_precision(double)=0
void print() const
Definition: model.cpp:24
virtual ~Model()=default
#define FATAL(msg)
Definition: logger.hpp:67
TargetModel cast_model(InputModel abstract_model)
Definition: model.hpp:42