xc
ArpackSolver.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/ArpackSolver.h
29 //
30 // Written: Jun Peng
31 // Created: Feb. 11, 1999
32 // Revision: A
33 //
34 // Description: This file contains the class definition for
35 // ArpackSolver. It solves the ArpackSOE object by calling
36 // Arpack routines.
37 
38 
39 #ifndef ArpackSolver_h
40 #define ArpackSolver_h
41 
42 #include "solution/system_of_eqn/eigenSOE/EigenSolver.h"
43 #include "utility/matrix/Vector.h"
44 
45 namespace XC {
46 
47  class LinearSOE;
48  class ArpackSOE;
49 
51 //
56  {
57  private:
58  LinearSOE *theSOE;
59  ArpackSOE *theArpackSOE;
60  int numModesMax;
61  int numMode;
62  int size;
63  std::vector<double> eigenvalues;
64  std::vector<double> eigenvectors;
65  mutable Vector eigenV;
66 
67  double shift;
68  int ncv;
69  std::vector<double> v;
70  std::vector<double> workl;
71  std::vector<double> workd;
72  std::vector<double> resid;
73  int iparam[11];
74  int ipntr[11];
75  std::vector<int> select;
76 
77  void myMv(int n, double *v, double *result);
78  void myCopy(int n, double *v, double *result);
79  int getNCV(int n, int nev);
80  void seupd_error_msg(const int &);
81  void saupd_error_msg(const int &);
82 
83  protected:
84  friend class EigenSOE;
85  ArpackSolver(const int &nModes= 1);
86  virtual EigenSolver *getCopy(void) const;
87  bool setEigenSOE(EigenSOE *theSOE);
88  public:
89 
90  virtual int solve(void);
91  virtual int setSize(void);
92  const int &getSize(void) const;
93  virtual bool setEigenSOE(ArpackSOE &theSOE);
94 
95  virtual const Vector &getEigenvector(int mode) const;
96  virtual const double &getEigenvalue(int mode) const;
97 
98  double getRCond(const char &);
99 
100  int sendSelf(Communicator &);
101  int recvSelf(const Communicator &);
102  };
103 
104 inline EigenSolver *ArpackSolver::getCopy(void) const
105  { return new ArpackSolver(*this); }
106 } // end of XC namespace
107 
108 #endif
109 
110 
ArpackSolver(const int &nModes=1)
Constructor.
Definition: ArpackSolver.cpp:77
Float vector abstraction.
Definition: Vector.h:94
Base class for eigenproblem systems of equations.
Definition: EigenSOE.h:64
Communication parameters between processes.
Definition: Communicator.h:66
Linear system of equations.
Definition: LinearSOE.h:92
bool setEigenSOE(EigenSOE *theSOE)
Sets the eigenproblem to solve.
Definition: ArpackSolver.cpp:500
virtual const Vector & getEigenvector(int mode) const
Returns the autovector corresponding to the mode being passed as parameter.
Definition: ArpackSolver.cpp:521
Arpack solver for banded matrices.
Definition: ArpackSolver.h:55
Eigenvalue SOE solver.
Definition: EigenSolver.h:60
int recvSelf(const Communicator &)
Receive the object.
Definition: ArpackSolver.cpp:604
int sendSelf(Communicator &)
Send the object.
Definition: ArpackSolver.cpp:601
virtual int solve(void)
Solves the eigenproblem.
Definition: ArpackSolver.cpp:194
double getRCond(const char &)
Estimates the reciprocal of the condition number of a real general band matrix A, in either the 1-nor...
Definition: ArpackSolver.cpp:594
const int & getSize(void) const
Returns the eigenvectors dimension.
Definition: ArpackSolver.cpp:583
virtual int setSize(void)
Sets the system size.
Definition: ArpackSolver.cpp:572
Open source finite element program for structural analysis.
Definition: ContinuaReprComponent.h:35
Arpack++ based system of equations.
Definition: ArpackSOE.h:40
virtual const double & getEigenvalue(int mode) const
Return the eigenvalue corresponding to the mode being passed as parameter.
Definition: ArpackSolver.cpp:551