00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef _EIGENANALYSIS_H_
00021 #define _EIGENANALYSIS_H_
00022
00023 #include "fmatvec/fmatvec.h"
00024 #include "fmatvec/function.h"
00025
00026 namespace MBSim {
00027
00028 class DynamicSystemSolver;
00029
00034 class Eigenanalysis {
00035
00036 class Residuum : public fmatvec::Function<fmatvec::Vec(fmatvec::Vec)> {
00037 public:
00038 Residuum(DynamicSystemSolver *sys_, double t_);
00039 fmatvec::Vec operator()(const fmatvec::Vec &z);
00040 private:
00041 DynamicSystemSolver *sys;
00042 double t;
00043 };
00044
00045 public:
00049 Eigenanalysis() : tStart(0), tEnd(1), dtPlot(1e-2), A(1), compEq(false), autoUpdate(false) {}
00050
00054 ~Eigenanalysis() {}
00055
00060 void analyse(DynamicSystemSolver& system);
00061
00066 void setInitialDeviation(const fmatvec::Vec &deltaz0_) { deltaz0 = deltaz0_; }
00067
00072 void setAmplitude(double A_) { A = A_; }
00073
00078 void setStartTime(double tStart_) { tStart=tStart_; }
00079
00084 void setEndTime(double tEnd_) { tEnd = tEnd_; }
00085
00090 void setPlotStepSize(double dtPlot_) { dtPlot = dtPlot_; }
00091
00096 void setInitialState(const fmatvec::Vec &z0) { zEq = z0; }
00097
00098
00103 void setDetermineEquilibriumState(bool eq) { compEq = eq; }
00104
00109 void setAutoUpdateAnalysis(bool update) { autoUpdate = update; }
00110
00115 const fmatvec::Vector<fmatvec::Ref, std::complex<double> >& getEigenvalues() const { return w; }
00116
00121 const fmatvec::SquareMatrix<fmatvec::Ref, std::complex<double> >& getEigenvectors() const { return V; }
00122
00127 const fmatvec::Vec& getEigenfrequencies() const { return freq; }
00128
00133 void setOutputFileName(const std::string &fileName_) { fileName = fileName_; }
00134
00139 void eigenmode(int i, DynamicSystemSolver& system);
00140
00145 void eigenmodes(DynamicSystemSolver& system);
00146
00151 void eigenmotion(DynamicSystemSolver& system);
00152
00153 protected:
00154
00155 static DynamicSystemSolver* system;
00156
00157 fmatvec::Vec z0, deltaz0, zEq;
00158 double tStart, tEnd, dtPlot, A;
00159 bool compEq, autoUpdate;
00160
00161 fmatvec::SquareMatrix<fmatvec::Ref, std::complex<double> > V;
00162 fmatvec::Vector<fmatvec::Ref, std::complex<double> > w;
00163 fmatvec::Vec freq;
00164 std::vector<std::pair<double,int> > f;
00165
00166 std::string fileName;
00167
00168 bool saveEigenanalyis(const std::string &fileName);
00169 bool loadEigenanalyis(const std::string &fileName);
00170 void computeEigenfrequencies();
00171 };
00172
00173 }
00174
00175 #endif