Anasazi Version of the Day
Loading...
Searching...
No Matches
AMGOperator.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 AMG_OPERATOR_H
20#define AMG_OPERATOR_H
21
22#include "Epetra_ConfigDefs.h"
23#include "AztecOO.h"
24
25#include "ml_include.h"
26#include "ml_epetra_operator.h"
27#include "ml_epetra_utils.h"
28#include "ml_agg_METIS.h"
29
30#include "Epetra_BLAS.h"
31#include "Epetra_Comm.h"
32#include "Epetra_LAPACK.h"
33#include "Epetra_Map.h"
34#include "Epetra_MultiVector.h"
35#include "Epetra_Operator.h"
36#include "Epetra_RowMatrix.h"
37
38#ifndef MACOSX
39#include "singularCoarse.h"
40#endif
41
42class AMGOperator : public virtual Epetra_Operator {
43
44 private:
45
46 const Epetra_Comm &MyComm;
47 const Epetra_BLAS callBLAS;
48 const Epetra_LAPACK callLAPACK;
49
50 const Epetra_Operator *K;
51 Epetra_Operator *Prec;
52
53 const Epetra_MultiVector *Q;
54 double *QtQ;
55
56 int numDofs;
57
58 bool leftProjection;
59 bool rightProjection;
60
61 ML *ml_handle;
62 ML_Aggregate *ml_agg;
63
64 int AMG_NLevels;
65
66 int coarseLocalSize;
67 int coarseGlobalSize;
68
69 double *ZcoarseTZcoarse;
70
71 int verbose;
72
73 void preProcess(int maxCoarseSize);
74 void setCoarseSolver_Cycle(int coarseSolver, int cycle);
75
76 // Don't define these functions
77 AMGOperator(const AMGOperator &ref);
78 AMGOperator& operator=(const AMGOperator &ref);
79
80 public:
81
82 AMGOperator(const Epetra_Comm& _Com, const Epetra_Operator *KK, int verb = 0,
83 int nLevel = 10, int smoother = 1, int param = 2,
84 int coarseSolver = -1, int cycle = 0,
85 int _numDofs = 1, const Epetra_MultiVector *Z = 0);
86
87 AMGOperator(const Epetra_Comm& _Com, const Epetra_Operator *KK, int verb = 0,
88 int nLevel = 10, int smoother = 1, int *param = 0,
89 int coarseSolver = -1, int cycle = 0,
90 int _numDofs = 1, const Epetra_MultiVector *Z = 0);
91
92 int SetUseLeftProjection(bool proj) { leftProjection = proj; return 0; }
93 int SetUseRightProjection(bool proj) { rightProjection = proj; return 0; }
94
95 ~AMGOperator();
96
97 char * Label() const { return "Epetra_Operator for AMG preconditioner"; };
98
99 bool UseTranspose() const { return (false); };
100 int SetUseTranspose(bool UseTranspose) { return 0; };
101
102 bool HasNormInf() const { return (false); };
103 double NormInf() const { return (-1.0); };
104
105 int Apply(const Epetra_MultiVector &X, Epetra_MultiVector &Y) const;
106 int ApplyInverse(const Epetra_MultiVector &X, Epetra_MultiVector &Y) const;
107
108 const Epetra_Comm& Comm() const { return MyComm; };
109
110 const Epetra_Map& OperatorDomainMap() const { return K->OperatorDomainMap(); };
111 const Epetra_Map& OperatorRangeMap() const { return K->OperatorRangeMap(); };
112
113 int getAMG_NLevels() const { return AMG_NLevels; };
114
115};
116
117#endif