mbsim  4.0.0
MBSim Kernel
eigenanalyzer.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 _EIGENANALYZER_H_
21 #define _EIGENANALYZER_H_
22 
23 #include "fmatvec/fmatvec.h"
24 #include "mbsim/functions/function.h"
25 #include "mbsim/solver.h"
26 
27 namespace MBSim {
28 
33  class Eigenanalyzer : public MBSim::Solver {
34 
35  public:
36 
37  enum Task { eigenmodes, eigenmotion, unknown };
38 
42  Eigenanalyzer() : tStart(0), tEnd(1), dtPlot(1e-2), A(1), loops(5), plotsPerLoop(100), task(eigenmodes) { }
43 
47  void execute();
48 
53  void setInitialDeviation(const fmatvec::Vec &deltaz0_) { deltaz0 <<= deltaz0_; }
54 
59  void setAmplitude(double A_) { A = A_; }
60 
66 
71  void setLoops(double loops_) { loops = loops_; }
72 
77  void setStartTime(double tStart_) { tStart=tStart_; }
78 
83  void setEndTime(double tEnd_) { tEnd = tEnd_; }
84 
89  void setPlotStepSize(double dtPlot_) { dtPlot = dtPlot_; }
90 
95  void setInitialState(const fmatvec::Vec &z0) { zEq <<= z0; }
96 
97  void setTask(Task task_) { task = task_; }
98 
99  const fmatvec::Vec& getInitialState() const { return zEq; }
100 
106 
112 
118 
119  void initializeUsingXML(xercesc::DOMElement *element);
120 
121  protected:
122 
123  fmatvec::Vec zEq, deltaz0;
124  fmatvec::SqrMat A_;
125  double tStart, tEnd, dtPlot, A;
126  int loops, plotsPerLoop;
127  Task task;
128 
131  std::vector<std::pair<double,int>> f;
133 
134  void saveEigenanalyis();
135 
136  void computeEigenvalues();
137  void computeEigenmodes();
138  void computeEigenmotion();
139  };
140 
141 }
142 
143 #endif
void setLoops(double loops_)
Set the number of loops for animation of each mode.
Definition: eigenanalyzer.h:71
solver-interface for dynamic systems
Definition: solver.h:38
Eigenanalyzer for dynamic systems.
Definition: eigenanalyzer.h:33
void setEndTime(double tEnd_)
Set the end time for the analysis.
Definition: eigenanalyzer.h:83
fmatvec::Vec getEigenfrequencies() const
Get the eigenfrequencies.
Definition: eigenanalyzer.cc:57
const fmatvec::Vector< fmatvec::Ref, std::complex< double > > & getEigenvalues() const
Get the eigenvalues.
Definition: eigenanalyzer.h:105
void setPlotStepSize(double dtPlot_)
Set the plot step size for the analysis.
Definition: eigenanalyzer.h:89
const fmatvec::SquareMatrix< fmatvec::Ref, std::complex< double > > & getEigenvectors() const
Get the eigenvectors.
Definition: eigenanalyzer.h:111
void setInitialDeviation(const fmatvec::Vec &deltaz0_)
Set the initial deviation of the equilibrium.
Definition: eigenanalyzer.h:53
void setModeAmplitudeTable(const fmatvec::Matrix< fmatvec::General, fmatvec::Var, fmatvec::Fixed< 2 >, double > &MA_)
Set the amplitude per mode for animation.
Definition: eigenanalyzer.h:65
void setStartTime(double tStart_)
Set the start time for the analysis.
Definition: eigenanalyzer.h:77
void execute()
Perform an eigenanalysis of the system.
Definition: eigenanalyzer.cc:51
Eigenanalyzer()
Standard constructor.
Definition: eigenanalyzer.h:42
void setInitialState(const fmatvec::Vec &z0)
Set the initital state for the analysis.
Definition: eigenanalyzer.h:95
void setAmplitude(double A_)
Set the amplitude of all modes for animation.
Definition: eigenanalyzer.h:59
namespace MBSim
Definition: eigenanalyzer.cc:47