Anasazi  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
Davidson.h
1 // @HEADER
2 // *****************************************************************************
3 // Anasazi: Block Eigensolvers Package
4 //
5 // Copyright 2004 NTESS and the Anasazi contributors.
6 // SPDX-License-Identifier: BSD-3-Clause
7 // *****************************************************************************
8 // @HEADER
9 
10 // This software is a result of the research described in the report
11 //
12 // "A comparison of algorithms for modal analysis in the absence
13 // of a sparse direct method", P. Arbenz, R. Lehoucq, and U. Hetmaniuk,
14 // Sandia National Laboratories, Technical report SAND2003-1028J.
15 //
16 // It is based on the Epetra, AztecOO, and ML packages defined in the Trilinos
17 // framework ( http://trilinos.org/ ).
18 
19 #ifndef DAVIDSON_H
20 #define DAVIDSON_H
21 
22 #include "Epetra_ConfigDefs.h"
23 
24 #include "Epetra_BLAS.h"
25 #include "Epetra_Comm.h"
26 #include "Epetra_Operator.h"
27 #include "Epetra_Time.h"
28 
29 #include "CheckingTools.h"
30 #include "FortranRoutines.h"
31 #include "ModalAnalysisSolver.h"
32 #include "MyMemory.h"
33 #include "ModalTools.h"
34 #include "SortingTools.h"
35 
36 class Davidson : public ModalAnalysisSolver {
37 
38  private:
39 
40  const CheckingTools myVerify;
41  const Epetra_BLAS callBLAS;
42  const FortranRoutines callFortran;
43  ModalTools modalTool;
44  const SortingTools mySort;
45 
46  const Epetra_Comm &MyComm;
47  const Epetra_Operator *K;
48  const Epetra_Operator *M;
49  const Epetra_Operator *Prec;
50  const Epetra_Time MyWatch;
51 
52  double tolEigenSolve;
53  int maxIterEigenSolve;
54 
55  int blockSize;
56  int numBlock;
57 
58  double *normWeight;
59 
60  int verbose;
61 
62  int historyCount;
63  double *resHistory;
64 
65  int maxSpaceSize;
66  int sumSpaceSize;
67  int *spaceSizeHistory;
68 
69  double memRequested;
70  double highMem;
71 
72  int massOp;
73  int numRestart;
74  int outerIter;
75  int precOp;
76  int residual;
77  int stifOp;
78 
79  double timeLocalProj;
80  double timeLocalSolve;
81  double timeLocalUpdate;
82  double timeMassOp;
83  double timeNorm;
84  double timeOrtho;
85  double timeOuterLoop;
86  double timePostProce;
87  double timePrecOp;
88  double timeResidual;
89  double timeRestart;
90  double timeStifOp;
91 
92  // Private functions
93  void accuracyCheck(const Epetra_MultiVector *X, const Epetra_MultiVector *MX,
94  const Epetra_MultiVector *Q) const;
95 
96  // Don't define these functions
97  Davidson(const Davidson &ref);
98  Davidson& operator=(const Davidson &ref);
99 
100  public:
101 
102  Davidson(const Epetra_Comm &_Comm, const Epetra_Operator *KK,
103  const Epetra_Operator *PP, int _blk, int _numBlk,
104  double _tol = 1.0e-08, int _maxIter = 100, int _verb = 0);
105 
106  Davidson(const Epetra_Comm &_Comm, const Epetra_Operator *KK,
107  const Epetra_Operator *MM, const Epetra_Operator *PP, int _blk, int _numBlk,
108  double _tol = 1.0e-08, int _maxIter = 100, int _verb = 0, double *_weight = 0);
109 
110  ~Davidson();
111 
112  int solve(int numEigen, Epetra_MultiVector &Q, double *lambda);
113 
114  int reSolve(int numEigen, Epetra_MultiVector &Q, double *lambda, int startingEV = 0);
115 
116  int minimumSpaceDimension(int nev) const;
117 
118  void initializeCounters();
119 
120  void algorithmInfo() const;
121  void historyInfo() const;
122  void memoryInfo() const;
123  void operationInfo() const;
124  void timeInfo() const;
125 
126 };
127 
128 #endif