Anasazi  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
LOBPCG.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 LOBPCG_H
20 #define LOBPCG_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 LOBPCG : 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 
57  double *normWeight;
58 
59  int verbose;
60 
61  int historyCount;
62  double *resHistory;
63 
64  double memRequested;
65  double highMem;
66 
67  int massOp;
68  int numRestart;
69  int outerIter;
70  int precOp;
71  int residual;
72  int stifOp;
73 
74  double timeLocalProj;
75  double timeLocalSolve;
76  double timeLocalUpdate;
77  double timeMassOp;
78  double timeNorm;
79  double timeOrtho;
80  double timeOuterLoop;
81  double timePostProce;
82  double timePrecOp;
83  double timeResidual;
84  double timeRestart;
85  double timeStifOp;
86 
87  // Private functions
88  void accuracyCheck(const Epetra_MultiVector *X, const Epetra_MultiVector *MX,
89  const Epetra_MultiVector *R, const Epetra_MultiVector *Q,
90  const Epetra_MultiVector *H, const Epetra_MultiVector *P) const;
91 
92  // Don't define these functions
93  LOBPCG(const LOBPCG &ref);
94  LOBPCG& operator=(const LOBPCG &ref);
95 
96  public:
97 
98  LOBPCG(const Epetra_Comm &_Comm, const Epetra_Operator *KK,
99  const Epetra_Operator *PP, int _blk,
100  double _tol = 1.0e-08, int _maxIter = 100, int _verb = 0);
101 
102  LOBPCG(const Epetra_Comm &_Comm, const Epetra_Operator *KK,
103  const Epetra_Operator *MM, const Epetra_Operator *PP, int _blk,
104  double _tol = 1.0e-08, int _maxIter = 100, int _verb = 0, double *_weight = 0);
105 
106  ~LOBPCG();
107 
108  int solve(int numEigen, Epetra_MultiVector &Q, double *lambda)
109  { return LOBPCG::reSolve(numEigen, Q, lambda); }
110 
111  int reSolve(int numEigen, Epetra_MultiVector &Q, double *lambda, int startingEV = 0);
112 
113  int minimumSpaceDimension(int nev) const { return nev+blockSize; }
114 
115  void initializeCounters();
116 
117  void algorithmInfo() const;
118  void historyInfo() const;
119  void memoryInfo() const;
120  void operationInfo() const;
121  void timeInfo() const;
122 
123 };
124 
125 #endif