Anasazi  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
JDPCG.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 JACOBI_DAVIDSON_PCG_H
20 #define JACOBI_DAVIDSON_PCG_H
21 
22 #include "Epetra_ConfigDefs.h"
23 
24 #include "Epetra_BLAS.h"
25 #include "Epetra_Comm.h"
26 #include "Epetra_LAPACK.h"
27 #include "Epetra_Operator.h"
28 #include "Epetra_Time.h"
29 
30 #include "CheckingTools.h"
31 #include "FortranRoutines.h"
32 #include "ModalAnalysisSolver.h"
33 #include "MyMemory.h"
34 #include "ModalTools.h"
35 #include "SortingTools.h"
36 
37 class JDPCG : public ModalAnalysisSolver {
38 
39  private:
40 
41  const CheckingTools myVerify;
42  const Epetra_BLAS callBLAS;
43  const FortranRoutines callFortran;
44  const Epetra_LAPACK callLAPACK;
45  ModalTools modalTool;
46  const SortingTools mySort;
47 
48  const Epetra_Comm &MyComm;
49  const Epetra_Operator *K;
50  const Epetra_Operator *M;
51  const Epetra_Operator *Prec;
52  const Epetra_Time MyWatch;
53 
54  double tolEigenSolve;
55  int maxIterEigenSolve;
56 
57  int maxIterLinearSolve;
58 
59  int blockSize;
60  int numBlock;
61 
62  double *normWeight;
63 
64  int verbose;
65 
66  int historyCount;
67  double *resHistory;
68 
69  int maxSpaceSize;
70  int sumSpaceSize;
71  int *spaceSizeHistory;
72 
73  int maxIterPCG;
74  int sumIterPCG;
75  int *iterPCGHistory;
76 
77  double memRequested;
78  double highMem;
79 
80  int massOp;
81  int numCorrectionPrec;
82  int numCorrectionSolve;
83  int numPCGmassOp;
84  int numPCGstifOp;
85  int numRestart;
86  int outerIter;
87  int precOp;
88  int residual;
89  int stifOp;
90 
91  double timeBuildQtMPMQ;
92  double timeCorrectionPrec;
93  double timeCorrectionSolve;
94  double timeLocalProj;
95  double timeLocalSolve;
96  double timeLocalUpdate;
97  double timeMassOp;
98  double timeNorm;
99  double timeOrtho;
100  double timeOuterLoop;
101  double timePCGEigCheck;
102  double timePCGLoop;
103  double timePCGOpMult;
104  double timePCGPrec;
105  double timePostProce;
106  double timePrecOp;
107  double timeResidual;
108  double timeRestart;
109  double timeStifOp;
110 
111  // Private functions
112  void accuracyCheck(const Epetra_MultiVector *X, const Epetra_MultiVector *MX,
113  const Epetra_MultiVector *Q) const;
114 
115  // Don't define these functions
116  JDPCG(const JDPCG &ref);
117  JDPCG& operator=(const JDPCG &ref);
118 
119  protected:
120 
121  int jacobiPreconditioner(const Epetra_MultiVector &B, Epetra_MultiVector &PrecB,
122  const Epetra_MultiVector *U, const Epetra_MultiVector *Q,
123  double *invQtMPMQ, int ldQtMPMQ, double *PMQ, double *work, double *WS);
124  int jacobiPCG(Epetra_MultiVector &Rlin, Epetra_MultiVector &Y,
125  const Epetra_MultiVector *U, const Epetra_MultiVector *Q,
126  double eta, double tolCG, int iterMax,
127  double *invQtMPMQ, int ldQtMPMQ, double *PMQ,
128  double *work, double *workSpace,
129  const Epetra_Vector *vectWeight, const Epetra_MultiVector *orthoVec = 0);
130 
131  public:
132 
133  JDPCG(const Epetra_Comm &_Comm, const Epetra_Operator *KK,
134  const Epetra_Operator *MM, const Epetra_Operator *PP, int _blk, int _numBlk,
135  double _tol = 1.0e-08, int _maxIterES = 100, int _maxIterLS = 100, int _verb = 0,
136  double *_weight = 0);
137 
138  ~JDPCG();
139 
140  int solve(int numEigen, Epetra_MultiVector &Q, double *lambda);
141 
142  int reSolve(int numEigen, Epetra_MultiVector &Q, double *lambda, int startingEV = 0);
143 
144  int minimumSpaceDimension(int nev) const;
145 
146  void initializeCounters();
147 
148  void algorithmInfo() const;
149  void historyInfo() const;
150  void memoryInfo() const;
151  void operationInfo() const;
152  void timeInfo() const;
153 
154 };
155 
156 #endif