00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef _QUASI_STATIC_INTEGRATOR_H_
00021 #define _QUASI_STATIC_INTEGRATOR_H_
00022
00023 #include "integrator.h"
00024 #include "mbsim/functions/function.h"
00025 #include<mbsim/dynamic_system_solver.h>
00026
00027 namespace MBSimIntegrator {
00028
00034 class hgFun : public MBSim::Function<fmatvec::Vec(fmatvec::Vec)> {
00035 public:
00039 hgFun(MBSim::DynamicSystemSolver* sys_) :
00040 sys(sys_), t(0) {
00041 }
00042
00046 virtual ~hgFun() {
00047 }
00048 ;
00049
00050
00051 fmatvec::Vec operator()(const fmatvec::Vec& qla);
00052
00053 void setT(double t) {
00054 this->t = t;
00055 }
00056
00057
00058
00059 private:
00060
00061 MBSim::DynamicSystemSolver* sys;
00062 double t;
00063
00064 };
00065
00071 class jacFun : public MBSim::Function<fmatvec::SqrMat(fmatvec::Vec)> {
00072 public:
00076 jacFun(MBSim::DynamicSystemSolver* sys_, double t_, fmatvec::Vec& z_) :
00077 sys(sys_), t(t_), z(z_) {
00078 }
00079
00083 virtual ~jacFun() {
00084 }
00085 ;
00086
00087
00088 fmatvec::SqrMat operator()(const fmatvec::Vec& q);
00089
00090
00091 private:
00092
00093 MBSim::DynamicSystemSolver* sys;
00094 double t;
00095 fmatvec::Vec z;
00096
00097 };
00103 class QuasiStaticIntegrator : public Integrator {
00104 public:
00108 QuasiStaticIntegrator();
00109
00113 virtual ~QuasiStaticIntegrator() {
00114 }
00115
00116 void preIntegrate(MBSim::DynamicSystemSolver& system);
00117 void subIntegrate(MBSim::DynamicSystemSolver& system, double tStop);
00118 void postIntegrate(MBSim::DynamicSystemSolver& system);
00119
00120
00121 virtual void integrate(MBSim::DynamicSystemSolver& system);
00122 virtual void initializeUsingXML(xercesc::DOMElement *element);
00123
00124
00125
00126 void setStepSize(double dt_) {
00127 dt = dt_;
00128 }
00129 void setgTolerance(double tolerance_) {
00130 gTol = tolerance_;
00131 }
00132 void sethTolerance(double tolerance_) {
00133 hTol = tolerance_;
00134 }
00135 void setmaxExtraPolate(int value) {
00136 maxExtraPolate = value;
00137 }
00138 void setextraPolateAfter(int value) {
00139 extraPolateAfter = value;
00140 }
00141 void setupdateJacobianEvery(int value) {
00142 updateJacobianEvery = value;
00143 }
00144
00145
00146 private:
00150 double dt;
00151
00155 double t, tPlot;
00156
00160 double gTol;
00161
00165 double hTol;
00166
00170 int iter, step, integrationSteps, maxIter, sumIter;
00171
00175 int maxExtraPolate;
00176
00180 int extraPolateAfter;
00181
00185 int updateJacobianEvery;
00186
00190 double s0, time;
00191
00195 int stepPlot;
00196
00200 fmatvec::Vec z, q, u, x;
00201
00205 std::ofstream integPlot;
00206 };
00207
00208 }
00209
00210 #endif
00211