Debian Codegraph @

packages/trilinoscouplings/src/ml/NonlinML/ml_nox_ConstrainedMultiLevelOperator.H

raw
1 // @HEADER
2 // *****************************************************************************
3 // Trilinos: An Object-Oriented Solver Framework
4 //
5 // Copyright 2001-2024 NTESS and the Trilinos contributors.
6 // SPDX-License-Identifier: BSD-3-Clause
7 // *****************************************************************************
8 // @HEADER
9
10 /* ******************************************************************** */
11 /* See the file COPYRIGHT for a complete copyright notice, contact */
12 /* person and disclaimer. */
13 /* ******************************************************************** */
14 /*!
15 * \file ml_nox_preconditioner.H
16 *
17 * \class ML_Nox_Preconditioner
18 *
19 * \brief ML nonlinear preconditioner and solver
20 *
21 * \date Last update do Doxygen: 31-Mar-05
22 *
23 */
24 // ML-headers
25 #include "ml_common.h"
26 #include "TrilinosCouplings_config.h"
27
28 #if defined(HAVE_ML_NOX) && defined(HAVE_ML_EPETRA) && defined(HAVE_ML_AZTECOO) && defined(HAVE_ML_TEUCHOS) && defined(HAVE_ML_IFPACK) && defined(HAVE_ML_AMESOS) && defined(HAVE_ML_EPETRAEXT)
29
30 #ifndef ML_NOX_CONSTRAINEDMULTILEVELOPERATOR_H
31 #define ML_NOX_CONSTRAINEDMULTILEVELOPERATOR_H
32
33 #include <vector>
34
35 // epetra-headers
36 #include "Epetra_Map.h"
37 #include "Epetra_Vector.h"
38 #include "Epetra_MultiVector.h"
39 #include "Epetra_Operator.h"
40 #include "Epetra_CrsMatrix.h"
41 #include "Epetra_RowMatrix.h"
42 #include "Epetra_CrsGraph.h"
43 #include "Epetra_LinearProblem.h"
44 #include "Epetra_Object.h"
45 #include "Epetra_Comm.h"
46 #include "Epetra_SerialComm.h"
47 #ifdef ML_MPI
48 #include "Epetra_MpiComm.h"
49 #endif
50 #include "Epetra_SerialComm.h"
51
52 // NOX-headers
53 #include "NOX_Epetra_Interface.H"
54
55 // ML-headers
56 #include "ml_common.h"
57 #include "ml_include.h"
58 #include "ml_epetra_utils.h"
59 #include "ml_epetra.h"
60 #include "ml_epetra_operator.h"
61 #include "ml_MultiLevelOperator.h"
62 #include "ml_agg_VBMETIS.h"
63 // utils
64 #include "ml_nox_preconditioner_utils.H"
65 // this is the wrapper for the Epetra_CrsGraph used by ml in matrix-free method
66 // it is derived from Epetra_RowMatrix so the ml - Epetra_RowMatrix - wrapper will take it
67 #include "ml_Epetra_wrap_CrsGraph_as_RowMatrix.H"
68
69 // interface to user code on fine level
70 #include "ml_nox_fineinterface.H"
71
72 // interface to user code on coarse level
73 #include "ml_nox_coarseinterface.H"
74
75
76
77 // ---------- Forward Declarations ----------
78
79 //! ML_NOX: default namespace for all ML/NOX nonlinear methods
80 namespace ML_NOX
81 {
82 class ML_Nox_ConstrainedMultiLevelOperator : public virtual Epetra_Operator
83 {
84 public:
85
86
87
88 explicit ML_Nox_ConstrainedMultiLevelOperator(
89 ML_Epetra::MultiLevelOperator* ml_operator,
90 ML_NOX::Nox_CoarseProblem_Interface& coarseinterface);
91
92
93 virtual ~ML_Nox_ConstrainedMultiLevelOperator();
94
95
96 //! Returns the label of this class.
97 /*!
98 Returns the label of this class.
99 */
100 const char* Label() const {return(&(label_[0]));}
101
102 //! get Comm of this class
103 /*!
104 Derived from Epetra_Operator, returns ref to the Epetra_Comm of this class
105 */
106 const Epetra_Comm & Comm() const {return(comm_);}
107
108 //! Get fine level OperatorDomainMap.
109 /*!
110 Derived from Epetra_Operator, get fine level OperatorDomainMap.
111 */
112 const Epetra_Map & OperatorDomainMap() const {return ml_operator_->OperatorDomainMap();}
113
114 //! Get fine level OperatorRangeMap.
115 /*!
116 Derived from Epetra_Operator, get fine level OperatorRangeMap.
117 */
118 const Epetra_Map & OperatorRangeMap() const {return ml_operator_->OperatorRangeMap();}
119
120 //! ApplyInverse the preconditioner
121 /*!
122 ApplyInverse the preconditioner. Method is derived from Epetra_Operator.
123 \param X (In) : Epetra_MultiVector matching the fine level map of this
124 preconditioner
125 \param Y (Out) : Epetra_MultiVector containing the result on output
126 */
127 int ApplyInverse(const Epetra_MultiVector& X, Epetra_MultiVector& Y) const ;
128
129 //! Apply the preconditioner, not implemented.
130 /*!
131 Derived from Epetra_Operator, not implemented.
132 */
133 int Apply(const Epetra_MultiVector& X, Epetra_MultiVector& Y) const
134 { cout << "ML_Nox_ConstrainedMultiLevelOperator::Apply does not make sense for an ML-Multilevel Operator\n"
135 << "Use ApplyInverse\n";throw -1;return(-1);}
136
137 //! SetUseTranspose, not implemented.
138 /*!
139 Derived from Epetra_Operator, not implemented.
140 */
141 int SetUseTranspose(bool UseTranspose) { usetranspose_=UseTranspose; return 0;}
142
143 //! NormInf, not implemented.
144 /*!
145 Derived from Epetra_Operator, not implemented.
146 */
147 double NormInf() const {cout << "ML_Nox_ConstrainedMultiLevelOperator::NormInf not impl.\n";
148 throw -1;return(-1.0);}
149
150
151 //! UseTranspose, not implemented.
152 /*!
153 Derived from Epetra_Operator, not implemented.
154 */
155 bool UseTranspose() const {return usetranspose_;}
156
157 //! HasNormInf, not implemented.
158 /*!
159 Derived from Epetra_Operator, always returns false.
160 */
161 bool HasNormInf() const {return false;}
162
163 private:
164 // don't want copy-ctor and = operator
165 ML_Nox_ConstrainedMultiLevelOperator(ML_Nox_ConstrainedMultiLevelOperator& old);
166 ML_Nox_ConstrainedMultiLevelOperator operator = (const ML_Nox_ConstrainedMultiLevelOperator& old);
167
168 const char* label_; // the label of this class
169 bool usetranspose_;
170 const Epetra_Comm& comm_;
171 ML_NOX::Nox_CoarseProblem_Interface& coarseinterface_;
172 ML_Epetra::MultiLevelOperator* ml_operator_;
173
174 }; // class ML_Nox_ConstrainedMultiLevelOperator : public virtual Epetra_Operator
175 } // namespace ML_NOX
176
177
178 #endif // ML_NOX_CONSTRAINEDMULTILEVELOPERATOR_H
179 #endif // defined(HAVE_ML_NOX) && defined(HAVE_ML_EPETRA)