Anasazi  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
KnyazevLOBPCG.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 KNYAZEV_LOBPCG_H
20 #define KNYAZEV_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 KnyazevLOBPCG : 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 timeOuterLoop;
80  double timePostProce;
81  double timePrecOp;
82  double timeResidual;
83  double timeStifOp;
84 
85  // Private functions
86  void accuracyCheck(const Epetra_MultiVector *X, const Epetra_MultiVector *MX,
87  const Epetra_MultiVector *R) const;
88 
89  // Don't define these functions
90  KnyazevLOBPCG(const KnyazevLOBPCG &ref);
91  KnyazevLOBPCG& operator=(const KnyazevLOBPCG &ref);
92 
93  public:
94 
95  KnyazevLOBPCG(const Epetra_Comm &_Comm, const Epetra_Operator *KK,
96  const Epetra_Operator *PP,
97  double _tol = 1.0e-08, int _maxIter = 100, int _verb = 0);
98 
99  KnyazevLOBPCG(const Epetra_Comm &_Comm, const Epetra_Operator *KK,
100  const Epetra_Operator *MM, const Epetra_Operator *PP,
101  double _tol = 1.0e-08, int _maxIter = 100, int _verb = 0, double *_weight = 0);
102 
103  ~KnyazevLOBPCG();
104 
105  int solve(int numEigen, Epetra_MultiVector &Q, double *lambda);
106 
107  int reSolve(int numEigen, Epetra_MultiVector &Q, double *lambda, int startingEV = 0);
108 
109  int minimumSpaceDimension(int nev) const { return nev; }
110 
111  void initializeCounters();
112 
113  void algorithmInfo() const;
114  void historyInfo() const;
115  void memoryInfo() const;
116  void operationInfo() const;
117  void timeInfo() const;
118 
119 };
120 
121 #endif