Teko  Version of the Day
Teko_MLPreconditionerFactory.hpp
1 #ifndef __Teko_MLPrecondtionerFactory_hpp__
2 #define __Teko_MLPrecondtionerFactory_hpp__
3 
4 #include "Teko_BlockPreconditionerFactory.hpp"
5 
6 #include "ml_include.h"
7 #include "ml_operator.h"
8 
9 namespace ML_Epetra {
10  class MultiLevelPreconditioner;
11 }
12 
13 namespace Teko {
14 
17 public:
19 
21  Teuchos::RCP<ML_Epetra::MultiLevelPreconditioner>
22  constructMLPreconditioner(const Teuchos::ParameterList & mainList,
23  const std::vector<Teuchos::RCP<const Teuchos::ParameterList> > & coarseningParams);
24 
25  // Set functions
27 
29  void setMLComm(ML_Comm * comm);
30 
32  void setMLOperator(ML_Operator * op);
33 
35  void setIsFilled(bool value);
36 
38  void setAggregationMatrices(const std::vector<Epetra_RowMatrix *> & diags);
39 
40  // Get functions
42 
44  bool isFilled() const;
45 
46 protected:
47  static void cleanup_ML_Comm(ML_Comm * mlComm);
48  static void cleanup_ML_Operator(ML_Operator * mlComm);
49 
50  bool isFilled_;
51  Teuchos::RCP<ML_Comm> mlComm_; // note that this has to be properly clean up!
52  Teuchos::RCP<ML_Operator> mlOp_; // note that this has to be properly clean up!
53 
54  std::vector<Epetra_RowMatrix*> diagonalOps_; // patterns for setting up aggregation
55  Teuchos::RCP<ML_Epetra::MultiLevelPreconditioner> mlPreconditioner_;
56 };
57 
62 public:
64 
68  virtual LinearOp buildPreconditionerOperator(BlockedLinearOp & blo,BlockPreconditionerState & state) const;
69 
73  virtual Teuchos::RCP<PreconditionerState> buildPreconditionerState() const;
74 
78  void initializeFromParameterList(const Teuchos::ParameterList & settings);
79 
80 protected:
81 
87  void fillMLPreconditionerState(const BlockedLinearOp & blo,MLPreconditionerState & mlState) const;
88 
89  int blockRowCount_;
90  std::vector<Teuchos::RCP<const Teuchos::ParameterList> > coarseningParams_;
91  Teuchos::ParameterList mainParams_;
92 };
93 
94 } // end namespace Teko
95 
96 #endif
Teko::MLPreconditionerState::setMLComm
void setMLComm(ML_Comm *comm)
set ML Comm pointer...it will be automatically cleaned up
Definition: Teko_MLPreconditionerFactory.cpp:20
Teko::MLPreconditionerState::setAggregationMatrices
void setAggregationMatrices(const std::vector< Epetra_RowMatrix * > &diags)
Set matrices to build multigrid hierarcy from.
Definition: Teko_MLPreconditionerFactory.cpp:50
Teko::MLPreconditionerState::setIsFilled
void setIsFilled(bool value)
Set if ML internals been constructed yet.
Definition: Teko_MLPreconditionerFactory.cpp:30
Teko::MLPreconditionerFactory::buildPreconditionerOperator
virtual LinearOp buildPreconditionerOperator(BlockedLinearOp &blo, BlockPreconditionerState &state) const
Function that is called to build the preconditioner for the linear operator that is passed in.
Definition: Teko_MLPreconditionerFactory.cpp:77
Teko::MLPreconditionerFactory::initializeFromParameterList
void initializeFromParameterList(const Teuchos::ParameterList &settings)
This function builds the internals of the preconditioner factory from a parameter list.
Definition: Teko_MLPreconditionerFactory.cpp:152
Teko::MLPreconditionerState::isFilled
bool isFilled() const
Has this object been filled yet.
Definition: Teko_MLPreconditionerFactory.cpp:35
Teko::MLPreconditionerFactory::buildPreconditionerState
virtual Teuchos::RCP< PreconditionerState > buildPreconditionerState() const
Function that permits the construction of an arbitrary PreconditionerState object.
Definition: Teko_MLPreconditionerFactory.cpp:92
Teko::MLPreconditionerState::constructMLPreconditioner
Teuchos::RCP< ML_Epetra::MultiLevelPreconditioner > constructMLPreconditioner(const Teuchos::ParameterList &mainList, const std::vector< Teuchos::RCP< const Teuchos::ParameterList > > &coarseningParams)
Build an ML preconditioner object using the set of coarsening parameters.
Definition: Teko_MLPreconditionerFactory.cpp:56
Teko::MLPreconditionerState
Contains operator internals need for ML.
Definition: Teko_MLPreconditionerFactory.hpp:16
Teko::MLPreconditionerFactory
Class that constructs and returns an ML preconditioner object that is capable of doing block smoothin...
Definition: Teko_MLPreconditionerFactory.hpp:61
Teko::MLPreconditionerState::setMLOperator
void setMLOperator(ML_Operator *op)
set ML Operator pointer...it will be automatically cleaned up
Definition: Teko_MLPreconditionerFactory.cpp:25
Teko::MLPreconditionerFactory::fillMLPreconditionerState
void fillMLPreconditionerState(const BlockedLinearOp &blo, MLPreconditionerState &mlState) const
Fills an ML preconditioner state object.
Definition: Teko_MLPreconditionerFactory.cpp:97
Teko::BlockPreconditionerState
An implementation of a state object for block preconditioners.
Definition: Teko_BlockPreconditionerFactory.hpp:80
Teko::BlockPreconditionerFactory
Abstract class which block preconditioner factories in Teko should be based on.
Definition: Teko_BlockPreconditionerFactory.hpp:98