Advanced Multi-Physics (AMP)
On-Line Documentation
TrilinosMLSolver.h
Go to the documentation of this file.
1#ifndef included_AMP_TrilinosMLSolver
2#define included_AMP_TrilinosMLSolver
3
4#include "AMP/solvers/SolverStrategy.h"
5#include "AMP/solvers/SolverStrategyParameters.h"
6#include "AMP/solvers/trilinos/ml/MLoptions.h"
7
9#include "Teuchos_ParameterList.hpp"
11
12
13// Forward declare Trilinos classes
14typedef struct ML_Struct ML;
15typedef struct ML_Aggregate_Struct ML_Aggregate;
16namespace ML_Epetra {
17class MultiLevelPreconditioner;
18}
19
20
21// Forward declare EpetraMatrix
22namespace AMP::LinearAlgebra {
23class ManagedEpetraMatrix;
24}
25
26namespace AMP::Solver {
27
28
30
31
39{
40
41public:
46
125 explicit TrilinosMLSolver( std::shared_ptr<TrilinosMLSolverParameters> parameters );
126
131
132 std::string type() const override { return "TrilinosMLSolver"; }
133
135 static std::unique_ptr<SolverStrategy>
136 createSolver( std::shared_ptr<SolverStrategyParameters> solverStrategyParameters )
137 {
138 return std::make_unique<TrilinosMLSolver>( solverStrategyParameters );
139 }
140
146 void apply( std::shared_ptr<const AMP::LinearAlgebra::Vector> f,
147 std::shared_ptr<AMP::LinearAlgebra::Vector> u ) override;
148
152 inline std::shared_ptr<ML_Epetra::MultiLevelPreconditioner> getMLSolver( void )
153 {
154 return d_mlSolver;
155 }
156
167 void initialize( std::shared_ptr<const SolverStrategyParameters> parameters ) override;
168
173 void registerOperator( std::shared_ptr<AMP::Operator::Operator> op ) override;
174
180 void resetOperator( std::shared_ptr<const AMP::Operator::OperatorParameters> params ) override;
181
190 void reset( std::shared_ptr<SolverStrategyParameters> params ) override;
191
192protected:
193 void reSolveWithLU( std::shared_ptr<const AMP::LinearAlgebra::Vector> f,
194 std::shared_ptr<AMP::LinearAlgebra::Vector> u );
195
196 void getFromInput( std::shared_ptr<AMP::Database> db );
197
199
200 void buildML();
201
202 void computeCoordinates( std::shared_ptr<AMP::Operator::Operator> op );
203 void computeNullSpace( std::shared_ptr<AMP::Operator::Operator> op );
204
205private:
209
211
214
215 std::shared_ptr<MLoptions> d_mlOptions;
216
217 std::shared_ptr<ML_Epetra::MultiLevelPreconditioner> d_mlSolver;
218 std::shared_ptr<AMP::LinearAlgebra::ManagedEpetraMatrix> d_matrix;
219 Teuchos::ParameterList d_MLParameterList;
220
221 std::vector<double> d_x_values;
222 std::vector<double> d_y_values;
223 std::vector<double> d_z_values;
224 std::vector<double> d_null_space;
225};
226
227} // namespace AMP::Solver
228
229#endif
struct ML_Aggregate_Struct ML_Aggregate
typedefDISABLE_WARNINGS ENABLE_WARNINGS struct ML_Struct ML
Provides C++ wrapper around MPI routines.
Definition AMP_MPI.h:63
std::shared_ptr< AMP::Solver::SolverStrategy > shared_ptr
std::shared_ptr< AMP::LinearAlgebra::ManagedEpetraMatrix > d_matrix
std::vector< double > d_z_values
void registerOperator(std::shared_ptr< AMP::Operator::Operator > op) override
std::vector< double > d_x_values
std::vector< double > d_y_values
void initialize(std::shared_ptr< const SolverStrategyParameters > parameters) override
std::shared_ptr< ML_Epetra::MultiLevelPreconditioner > d_mlSolver
void resetOperator(std::shared_ptr< const AMP::Operator::OperatorParameters > params) override
void apply(std::shared_ptr< const AMP::LinearAlgebra::Vector > f, std::shared_ptr< AMP::LinearAlgebra::Vector > u) override
static std::unique_ptr< SolverStrategy > createSolver(std::shared_ptr< SolverStrategyParameters > solverStrategyParameters)
static create routine that is used by SolverFactory
std::shared_ptr< ML_Epetra::MultiLevelPreconditioner > getMLSolver(void)
Teuchos::ParameterList d_MLParameterList
TrilinosMLSolver(std::shared_ptr< TrilinosMLSolverParameters > parameters)
void computeCoordinates(std::shared_ptr< AMP::Operator::Operator > op)
void computeNullSpace(std::shared_ptr< AMP::Operator::Operator > op)
std::shared_ptr< MLoptions > d_mlOptions
std::string type() const override
Return the name of the solver.
std::vector< double > d_null_space
void reSolveWithLU(std::shared_ptr< const AMP::LinearAlgebra::Vector > f, std::shared_ptr< AMP::LinearAlgebra::Vector > u)
void getFromInput(std::shared_ptr< AMP::Database > db)
void reset(std::shared_ptr< SolverStrategyParameters > params) override
#define DISABLE_WARNINGS
Re-enable warnings.
#define ENABLE_WARNINGS
Suppress all warnings.
SolverStrategyParameters TrilinosMLSolverParameters



Advanced Multi-Physics (AMP)
Oak Ridge National Laboratory
Idaho National Laboratory
Los Alamos National Laboratory
This page automatically produced from the
source code by doxygen
Last updated: Tue Mar 10 2026 13:06:41.
Comments on this page