mbsim  4.0.0
MBSim Kernel
solver.h
1 /* Copyright (C) 2004-2014 MBSim Development Team
2  *
3  * This library is free software; you can redistribute it and/or
4  * modify it under the terms of the GNU Lesser General Public
5  * License as published by the Free Software Foundation; either
6  * version 2.1 of the License, or (at your option) any later version.
7  *
8  * This library 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 GNU
11  * Lesser General Public License for more details.
12  *
13  * You should have received a copy of the GNU Lesser General Public
14  * License along with this library; if not, write to the Free Software
15  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16  *
17  * Contact: martin.o.foerg@googlemail.com
18  */
19 
20 #ifndef _SOLVER_H_
21 #define _SOLVER_H_
22 
23 #include <fmatvec/fmatvec.h>
24 #include <fmatvec/atom.h>
25 #include <mbsim/namespace.h>
26 #include <mbsim/mbsim_event.h>
27 #include <string>
28 #include <iostream>
29 
30 namespace MBSim {
31 
32  class DynamicSystemSolver;
33 
38  class Solver : virtual public fmatvec::Atom {
39  public:
43  Solver() { }
44 
48  ~Solver() override = default;
49 
50 #ifndef SWIG
51  [[noreturn]]
52 #endif
53  void throwError(const std::string &msg) const {
54  throw MBSimError(this, msg);
55  }
56 
57  /* INTERFACE FOR DERIVED CLASSES */
61  virtual void execute() = 0;
62 
63  virtual void initializeUsingXML(xercesc::DOMElement *element) {
64  // set the XML location of this element which can be used, later, by exceptions.
66  }
67 
68  virtual const fmatvec::Vec& getInitialState() const = 0;
69 
70  void setSystem(DynamicSystemSolver *s) { system=s; }
71  MBSim::DynamicSystemSolver* getSystem() { return system; }
72 
73 #ifndef SWIG
74  const MBXMLUtils::DOMEvalException& getDOMEvalError() const { return domEvalError; };
75 #endif
76 
77  protected:
82 
83 #ifndef SWIG
86 #endif
87  };
88 
89 }
90 
91 #endif /* _SOLVER_H_ */
solver-interface for dynamic systems
Definition: solver.h:38
solver interface for modelling and simulation of dynamic systems
Definition: dynamic_system_solver.h:56
~Solver() override=default
destructor
MBSim::DynamicSystemSolver * system
dynamic system
Definition: solver.h:74
MBXMLUtils::DOMEvalException domEvalError
Special XML helper variable.
Definition: solver.h:85
std::ostream & msg(MsgType type) const
Solver()
constructor
Definition: solver.h:43
basic error class for mbsim
Definition: mbsim_event.h:39
virtual void execute()=0
start solving the dynamic system set by setSystem.
namespace MBSim
Definition: eigenanalyzer.cc:47