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 <mbsim/solver.h>
00028 #include <string>
00029 #include <iostream>
00030
00031 namespace MBSimIntegrator {
00032
00033 const MBXMLUtils::NamespaceURI MBSIMINT("http://mbsim.berlios.de/MBSimIntegrator");
00034
00040 class Integrator : public MBSim::Solver {
00041 public:
00045 Integrator();
00046
00050 virtual ~Integrator() {};
00051
00052
00053 void setStartTime(double tStart_) { tStart=tStart_; }
00054 void setEndTime(double tEnd_) { tEnd = tEnd_; }
00055 void setPlotStepSize(double dtPlot_) { dtPlot = dtPlot_; }
00056 void setInitialState(const fmatvec::Vec &z0_) { z0 = z0_; }
00057 void setWarnLevel(int level) { warnLevel = level; }
00058 void setOutput(bool flag) { output = flag; }
00059 double getStartTime() const { return tStart; }
00060 double getEndTime() const { return tEnd; }
00061 double getPlotStepSize() const { return dtPlot; }
00062 const fmatvec::Vec& getInitialState() const { return z0; }
00063 int getWarnLevel() const { return warnLevel; }
00064 bool getOutput() const { return output; }
00065
00066
00067 void execute(MBSim::DynamicSystemSolver& system) { integrate(system); }
00068
00069
00075 virtual void integrate(MBSim::DynamicSystemSolver& system) = 0;
00076
00082 void debugInit();
00083
00084 virtual void preIntegrate(MBSim::DynamicSystemSolver& system) { throw MBSim::MBSimError("preIntegrate is not defined"); }
00085 virtual void subIntegrate(MBSim::DynamicSystemSolver& system, double tStop) { throw MBSim::MBSimError("subIntegrate is not defined"); }
00086 virtual void postIntegrate(MBSim::DynamicSystemSolver& system) { throw MBSim::MBSimError("postIntegrate is not defined"); }
00087
00092 virtual void initializeUsingXML(xercesc::DOMElement *element);
00093 virtual xercesc::DOMElement* writeXMLFile(xercesc::DOMNode *element);
00094
00095 static Integrator* readXMLFile(const std::string &filename);
00096 void writeXMLFile(const std::string &name);
00097 void writeXMLFile() { writeXMLFile(getType()); }
00098
00099
00100
00104 virtual std::string getType() const { return "Integrator"; }
00105
00106 protected:
00110 double tStart, tEnd, dtPlot;
00111
00115 fmatvec::Vec z0;
00116
00120 int warnLevel;
00121
00125 bool output;
00126
00130 std::string name;
00131
00132 };
00133
00134 }
00135
00136 #endif
00137