xc
EigenSolver.h
1 // -*-c++-*-
2 //----------------------------------------------------------------------------
3 // XC program; finite element analysis code
4 // for structural analysis and design.
5 //
6 // Copyright (C) Luis C. Pérez Tato
7 //
8 // This program derives from OpenSees <http://opensees.berkeley.edu>
9 // developed by the «Pacific earthquake engineering research center».
10 //
11 // Except for the restrictions that may arise from the copyright
12 // of the original program (see copyright_opensees.txt)
13 // XC is free software: you can redistribute it and/or modify
14 // it under the terms of the GNU General Public License as published by
15 // the Free Software Foundation, either version 3 of the License, or
16 // (at your option) any later version.
17 //
18 // This software is distributed in the hope that it will be useful, but
19 // WITHOUT ANY WARRANTY; without even the implied warranty of
20 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 // GNU General Public License for more details.
22 //
23 //
24 // You should have received a copy of the GNU General Public License
25 // along with this program.
26 // If not, see <http://www.gnu.org/licenses/>.
27 //----------------------------------------------------------------------------
28 // File: ~/system_of_eqn/eigenSOE/EigenSolver.C
29 //
30 // Written: Jun Peng
31 // Created: Sat Feb. 6, 1999
32 // Revision: A
33 //
34 // Description: This file contains the class definition of EigenSOE.
35 // EigenSOE is a subclass of Solver.
36 // This is an abstract base class and thus no objects of it's type
37 // can be instantiated. Instances of EigenSolver are used to solve
38 // a EigenSOE. (perform eigen analysis)
39 //
40 // This class is inherited from the base class of Solver
41 // which was created by fmk (Frank).
42 
43 
44 #ifndef EigenSolver_h
45 #define EigenSolver_h
46 
47 #include <solution/system_of_eqn/Solver.h>
48 
49 namespace XC {
50 class EigenSOE;
51 class Vector;
52 
56 //
58 //
60 class EigenSolver: public Solver
61  {
62  protected:
63  int numModes;
64  bool generalized;
65  bool findSmallest;
66  friend class EigenSOE;
67  virtual EigenSolver *getCopy(void) const= 0;
68  virtual bool setEigenSOE(EigenSOE *theSOE) = 0;
69  EigenSolver(const int &classTag, const int &nModes= 0);
70  std::string getWhich(const bool &shiftInvertMode= true) const;
71  public:
72  virtual ~EigenSolver(void)
73  {}
74 
75  virtual int solve(void) =0;
76  virtual int solve(int numModes);
77 
78  const int &getNumModes(void) const
79  { return numModes; }
80  bool getFindSmallest(void) const
81  { return findSmallest; }
82  void setFindSmallest(const bool &b)
83  { findSmallest= b; }
84  virtual const Vector &getEigenvector(int mode) const = 0;
85  Vector getNormalizedEigenvector(int mode) const;
86  Matrix getEigenvectors(void) const;
88  virtual const double &getEigenvalue(int mode) const= 0;
89  double getAngularFrequency(int mode) const;
90  double getPeriod(int mode) const;
91  double getFrequency(int mode) const;
92  Vector getEigenvalues(void) const;
93  Vector getAngularFrequencies(void) const;
94  Vector getPeriods(void) const;
95  Vector getFrequencies(void) const;
96 
97  virtual int setSize(void)= 0;
98  virtual const int &getSize(void) const= 0;
99  };
100 } // end of XC namespace
101 
102 #endif
Vector getPeriods(void) const
Returns a vector with the computed periods for each mode.
Definition: EigenSolver.cpp:118
Float vector abstraction.
Definition: Vector.h:94
double getFrequency(int mode) const
Return the frequency for the i-th mode.
Definition: EigenSolver.cpp:93
Solver for a system of equations.
Definition: Solver.h:84
Base class for eigenproblem systems of equations.
Definition: EigenSOE.h:64
double getPeriod(int mode) const
Returns the period for the i-th mode.
Definition: EigenSolver.cpp:89
Vector getFrequencies(void) const
Returns a vector with the computed frequencies for each mode.
Definition: EigenSolver.cpp:129
int numModes
number of eigenvalues to compute.
Definition: EigenSolver.h:63
Eigenvalue SOE solver.
Definition: EigenSolver.h:60
Vector getAngularFrequencies(void) const
Returns a vector with the computed angular frequencies for each mode.
Definition: EigenSolver.cpp:107
Matrix getEigenvectors(void) const
Returns a matrix of eigenvectors disposed in columns.
Definition: EigenSolver.cpp:144
Matrix getNormalizedEigenvectors(void) const
Returns a matrix with the normalized eigenvectors disposed in columns (infinity norm).
Definition: EigenSolver.cpp:159
virtual int solve(void)=0
Causes the solver to compute the solution of the system of equations.
std::string getWhich(const bool &shiftInvertMode=true) const
Return a string identified which eigen values to compute; LM: compute the largest eigenvalues...
Definition: EigenSolver.cpp:57
bool generalized
if true, generalized eigenvalue problem otherwise standard eigenvalue problem.
Definition: EigenSolver.h:64
Open source finite element program for structural analysis.
Definition: ContinuaReprComponent.h:35
Vector getEigenvalues(void) const
Returns a vector con los eigenvalues calculados.
Definition: EigenSolver.cpp:97
Matrix of floats.
Definition: Matrix.h:111
Vector getNormalizedEigenvector(int mode) const
Returns the autovector of the i-th mode normalized so the maximal component is 1 (infinity norm)...
Definition: EigenSolver.cpp:140
double getAngularFrequency(int mode) const
Return the angular frequency for the i-th mode.
Definition: EigenSolver.cpp:85
EigenSolver(const int &classTag, const int &nModes=0)
Constructor.
Definition: EigenSolver.cpp:50
bool findSmallest
if true find the smallest eigenvalues.
Definition: EigenSolver.h:65