Debian Codegraph @

packages/trilinoscouplings/src/ml/NonlinML/nlnml_coarselevelnoxinterface.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 nlnml_finelevelnoxinterface.H
16 *
17 * \class NLNML_finelevelnoxinterface
18 *
19 * \brief class NLNML_coarselevelnoxinterface used by the nonlinear preconditioner
20 *
21 * \date Last update do Doxygen: 31-Mar-05
22 *
23 */
24 #include "ml_common.h"
25 #include "ml_include.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 #ifndef NLNML_COARSELEVELNOXINTERFACE_H
30 #define NLNML_COARSELEVELNOXINTERFACE_H
31
32 #include <iostream>
33
34 // Epetra headers
35 #include "Epetra_Vector.h"
36 #include "Epetra_Operator.h"
37 #include "Epetra_RowMatrix.h"
38 #include "Epetra_CrsMatrix.h"
39 #include "Epetra_CrsGraph.h"
40 #include "Epetra_Comm.h"
41 #include "Epetra_SerialComm.h"
42 #ifdef ML_MPI
43 #include "Epetra_MpiComm.h"
44 #endif
45 #include "Epetra_Map.h"
46 #include "Epetra_Export.h"
47 #include "Epetra_Import.h"
48
49 // NOX headers
50 #include "NOX_Epetra_Interface_Jacobian.H"
51 #include "NOX_Epetra_Interface_Required.H"
52 #include "NOX_Epetra_Interface_Preconditioner.H"
53
54 #include "Teuchos_RefCountPtr.hpp"
55
56 // ML-headers
57 #include "ml_epetra_utils.h"
58 #include "ml_epetra.h"
59 #include "ml_epetra_operator.h"
60 #include "ml_MultiLevelOperator.h"
61
62 // own headers
63 #include "nlnml_finelevelnoxinterface.H"
64
65 // forward declarations
66 class Epetra_CrsMatrix;
67
68 using namespace Teuchos;
69 namespace NLNML
70 {
71
72
73 class NLNML_CoarseLevelNoxInterface : public virtual NOX::Epetra::Interface::Required
74 {
75 public:
76
77 NLNML_CoarseLevelNoxInterface(
78 RefCountPtr<NLNML::NLNML_FineLevelNoxInterface> finterface,
79 int level,int outlevel,
80 RefCountPtr< std::vector< RefCountPtr<Epetra_CrsMatrix> > > P,
81 const Epetra_BlockMap& this_bmap,
82 int maxlevel);
83 void recreate();
84
85 virtual ~NLNML_CoarseLevelNoxInterface();
86
87 virtual bool computeF(const Epetra_Vector& x, Epetra_Vector& F,
88 const FillType fillFlag);
89
90 Epetra_Vector* restrict_fine_to_this(const Epetra_Vector& xfine);
91 Epetra_Vector* prolong_this_to_fine(const Epetra_Vector& xcoarse);
92 Epetra_Vector* restrict_to_next_coarser_level(Epetra_Vector* thisvec, int current, int next);
93 Epetra_Vector* prolong_to_this_level(Epetra_Vector* coarsevec, int current, int next);
94
95 void setP();
96
97 bool setModifiedSystem(bool flag, Epetra_Vector* fbar, Epetra_Vector* fxbar)
98 { isFASmodfied_ = flag; fbar_ = fbar; fxbar_ = fxbar; return true; }
99
100 bool isFAS() { return isFASmodfied_; }
101
102 void ApplyAllConstraints(Epetra_Vector& gradient);
103
104 int Level() { return level_; }
105
106 void BlockMap();
107
108 bool resetnumcallscomputeF() { nFcalls_=0; return true;}
109
110 private:
111 NLNML_CoarseLevelNoxInterface(NLNML_CoarseLevelNoxInterface& old);
112 NLNML_CoarseLevelNoxInterface operator = (const NLNML_CoarseLevelNoxInterface& old);
113
114 inline int Output() const { return outputlevel_; }
115 inline int Level() const { return level_; }
116
117 protected:
118
119 int level_;
120 int maxlevel_;
121 int outputlevel_;
122 bool isFASmodfied_;
123 int nFcalls_;
124 RefCountPtr<NLNML::NLNML_FineLevelNoxInterface> fineinterface_;
125 RefCountPtr< std::vector< RefCountPtr<Epetra_CrsMatrix> > > P_;
126 RefCountPtr<Epetra_BlockMap> this_bmap_;
127 std::vector<RefCountPtr<Epetra_Vector> > wvec_;
128 Epetra_Vector* fbar_;
129 Epetra_Vector* fxbar_;
130 }; // class NLNML_CoarseLevelNoxInterface
131 } // namespace NLNML
132 #endif
133 #endif