00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef _INTEGRATOR_H_
00021 #define _INTEGRATOR_H_
00022
00023 #include <fmatvec/fmatvec.h>
00024 #include <fmatvec/atom.h>
00025 #include <mbxmlutilshelper/dom.h>
00026 #include <mbsim/mbsim_event.h>
00027 #include <string>
00028 #include <iostream>
00029
00030 namespace MBSim {
00031
00032 const MBXMLUtils::NamespaceURI MBSIMINT("http://mbsim.berlios.de/MBSimIntegrator");
00033
00034 class DynamicSystemSolver;
00035
00041 class Integrator : public fmatvec::Atom {
00042 public:
00046 Integrator();
00047
00051 virtual ~Integrator() {};
00052
00053
00054 void setStartTime(double tStart_) { tStart=tStart_; }
00055 void setEndTime(double tEnd_) { tEnd = tEnd_; }
00056 void setPlotStepSize(double dtPlot_) { dtPlot = dtPlot_; }
00057 void setInitialState(const fmatvec::Vec &z0_) { z0 = z0_; }
00058 void setWarnLevel(int level) { warnLevel = level; }
00059 void setOutput(bool flag) { output = flag; }
00060 double getStartTime() const { return tStart; }
00061 double getEndTime() const { return tEnd; }
00062 double getPlotStepSize() const { return dtPlot; }
00063 const fmatvec::Vec& getInitialState() const { return z0; }
00064 int getWarnLevel() const { return warnLevel; }
00065 bool getOutput() const { return output; }
00066
00067
00068
00074 virtual void integrate(DynamicSystemSolver& system) = 0;
00075
00081 void debugInit();
00082
00083 virtual void preIntegrate(DynamicSystemSolver& system) { throw MBSimError("preIntegrate is not defined"); }
00084 virtual void subIntegrate(DynamicSystemSolver& system, double tStop) { throw MBSimError("subIntegrate is not defined"); }
00085 virtual void postIntegrate(DynamicSystemSolver& system) { throw MBSimError("postIntegrate is not defined"); }
00086
00091 virtual void initializeUsingXML(xercesc::DOMElement *element);
00092 virtual xercesc::DOMElement* writeXMLFile(xercesc::DOMNode *element);
00093
00094 static Integrator* readXMLFile(const std::string &filename);
00095 void writeXMLFile(const std::string &name);
00096 void writeXMLFile() { writeXMLFile(getType()); }
00097
00098
00099
00103 virtual std::string getType() const { return "Integrator"; }
00104
00105 protected:
00109 static DynamicSystemSolver* system;
00110
00114 double tStart, tEnd, dtPlot;
00115
00119 fmatvec::Vec z0;
00120
00124 int warnLevel;
00125
00129 bool output;
00130
00134 std::string name;
00135
00136 };
00137
00138 }
00139
00140 #endif
00141