oomph::TrilinosMLPreconditioner Class Reference

#include <trilinos_preconditioners.h>

+ Inheritance diagram for oomph::TrilinosMLPreconditioner:

Public Member Functions

 TrilinosMLPreconditioner ()
 
virtual ~TrilinosMLPreconditioner ()
 Destructor empty – clean up is done in base class. More...
 
 TrilinosMLPreconditioner (const TrilinosMLPreconditioner &)=delete
 Broken copy constructor. More...
 
void set_NSSA_default_values ()
 Broken assignment operator. More...
 
void set_DD_default_values ()
 
void set_DDML_default_values ()
 
void set_SA_default_values ()
 
void set_max_levels (int max_levels)
 Function to set maximum number of levels. More...
 
void set_n_cycles (int n_cycles)
 Function to set the number of cycles used. More...
 
void set_smoother_damping (double smoother_damping)
 Function to set Smoother_damping. More...
 
void set_smoother_sweeps (int smoother_sweeps)
 Function to set Smoother_sweeps. More...
 
void set_smoother_jacobi ()
 Function to set smoother type to "Jacobi". More...
 
void set_smoother_gauss_seidel ()
 Function to set smoother type to "symmetric Gauss-Seidel". More...
 
void set_output (int output)
 Function to set output - controls level of information output by ML. More...
 
- Public Member Functions inherited from oomph::TrilinosPreconditionerBase
 TrilinosPreconditionerBase ()
 Constructor. More...
 
virtual ~TrilinosPreconditionerBase ()
 Destructor. More...
 
void clean_up_memory ()
 deletes the preconditioner, matrices and maps More...
 
 TrilinosPreconditionerBase (const TrilinosPreconditionerBase &)=delete
 Broken copy constructor. More...
 
void setup ()
 Broken assignment operator. More...
 
void setup (Epetra_CrsMatrix *epetra_matrix_pt)
 
void preconditioner_solve (const DoubleVector &r, DoubleVector &z)
 applies the preconditioner More...
 
Epetra_Operator *& epetra_operator_pt ()
 
Epetra_Operatorepetra_operator_pt () const
 
- Public Member Functions inherited from oomph::Preconditioner
 Preconditioner ()
 Constructor. More...
 
 Preconditioner (const Preconditioner &)=delete
 Broken copy constructor. More...
 
void operator= (const Preconditioner &)=delete
 Broken assignment operator. More...
 
virtual ~Preconditioner ()
 Destructor (empty) More...
 
virtual void preconditioner_solve_transpose (const DoubleVector &r, DoubleVector &z)
 
void setup (DoubleMatrixBase *matrix_pt)
 
void setup (const Problem *problem_pt, DoubleMatrixBase *matrix_pt)
 
void enable_silent_preconditioner_setup ()
 Set up the block preconditioner quietly! More...
 
void disable_silent_preconditioner_setup ()
 Be verbose in the block preconditioner setup. More...
 
virtual DoubleMatrixBasematrix_pt () const
 Get function for matrix pointer. More...
 
virtual void set_matrix_pt (DoubleMatrixBase *matrix_pt)
 Set the matrix pointer. More...
 
virtual const OomphCommunicatorcomm_pt () const
 Get function for comm pointer. More...
 
virtual void set_comm_pt (const OomphCommunicator *const comm_pt)
 Set the communicator pointer. More...
 
double setup_time () const
 Returns the time to setup the preconditioner. More...
 
virtual void turn_into_subsidiary_block_preconditioner (BlockPreconditioner< CRDoubleMatrix > *master_block_prec_pt, const Vector< unsigned > &doftype_in_master_preconditioner_coarse)
 
virtual void turn_into_subsidiary_block_preconditioner (BlockPreconditioner< CRDoubleMatrix > *master_block_prec_pt, const Vector< unsigned > &doftype_in_master_preconditioner_coarse, const Vector< Vector< unsigned >> &doftype_coarsen_map_coarse)
 
- Public Member Functions inherited from oomph::DistributableLinearAlgebraObject
 DistributableLinearAlgebraObject ()
 Default constructor - create a distribution. More...
 
 DistributableLinearAlgebraObject (const DistributableLinearAlgebraObject &matrix)=delete
 Broken copy constructor. More...
 
void operator= (const DistributableLinearAlgebraObject &)=delete
 Broken assignment operator. More...
 
virtual ~DistributableLinearAlgebraObject ()
 Destructor. More...
 
LinearAlgebraDistributiondistribution_pt () const
 access to the LinearAlgebraDistribution More...
 
unsigned nrow () const
 access function to the number of global rows. More...
 
unsigned nrow_local () const
 access function for the num of local rows on this processor. More...
 
unsigned nrow_local (const unsigned &p) const
 access function for the num of local rows on this processor. More...
 
unsigned first_row () const
 access function for the first row on this processor More...
 
unsigned first_row (const unsigned &p) const
 access function for the first row on this processor More...
 
bool distributed () const
 distribution is serial or distributed More...
 
bool distribution_built () const
 
void build_distribution (const LinearAlgebraDistribution *const dist_pt)
 
void build_distribution (const LinearAlgebraDistribution &dist)
 

Static Public Attributes

static int Default_n_cycles = 1
 
- Static Public Attributes inherited from oomph::TrilinosPreconditionerBase
static double Cumulative_preconditioner_solve_time = 0.0
 

Protected Member Functions

void setup_trilinos_preconditioner (Epetra_CrsMatrix *epetra_matrix_pt)
 
- Protected Member Functions inherited from oomph::DistributableLinearAlgebraObject
void clear_distribution ()
 

Protected Attributes

Teuchos::ParameterList ML_parameters
 
- Protected Attributes inherited from oomph::TrilinosPreconditionerBase
Epetra_OperatorEpetra_preconditioner_pt
 
Epetra_CrsMatrix * Epetra_matrix_pt
 
- Protected Attributes inherited from oomph::Preconditioner
bool Silent_preconditioner_setup
 Boolean to indicate whether or not the build should be done silently. More...
 
std::ostream * Stream_pt
 Pointer to the output stream – defaults to std::cout. More...
 

Detailed Description

An interface to the Trilinos ML class - provides a function to construct a serial ML object, and functions to modify some of the ML paramaters.

Constructor & Destructor Documentation

◆ TrilinosMLPreconditioner() [1/2]

oomph::TrilinosMLPreconditioner::TrilinosMLPreconditioner ( )
inline

Constructor. Build with Smooth Aggretation (SA) default settings, but our own default number of V cycles (initialised to 1 to replicate TrilinosML's own behaviour).

158  {
159  // set default values
160  ML_Epetra::SetDefaults("SA", ML_parameters);
161 
162  // Set number of MG cycles performed in preconditioner
163  ML_parameters.set("cycle applications", Default_n_cycles);
164  }
static int Default_n_cycles
Definition: trilinos_preconditioners.h:250
Teuchos::ParameterList ML_parameters
Definition: trilinos_preconditioners.h:258

References Default_n_cycles, and ML_parameters.

◆ ~TrilinosMLPreconditioner()

virtual oomph::TrilinosMLPreconditioner::~TrilinosMLPreconditioner ( )
inlinevirtual

Destructor empty – clean up is done in base class.

167 {}

◆ TrilinosMLPreconditioner() [2/2]

oomph::TrilinosMLPreconditioner::TrilinosMLPreconditioner ( const TrilinosMLPreconditioner )
delete

Broken copy constructor.

Member Function Documentation

◆ set_DD_default_values()

void oomph::TrilinosMLPreconditioner::set_DD_default_values ( )
inline

Set control flags to values for classical smoothed aggregation- based 2-level domain decomposition

186  {
187  ML_Epetra::SetDefaults("DD", ML_parameters);
188  }

References ML_parameters.

◆ set_DDML_default_values()

void oomph::TrilinosMLPreconditioner::set_DDML_default_values ( )
inline

Set control flags to values 3-level algebraic domain decomposition

194  {
195  ML_Epetra::SetDefaults("DD-ML", ML_parameters);
196  }

References ML_parameters.

◆ set_max_levels()

void oomph::TrilinosMLPreconditioner::set_max_levels ( int  max_levels)
inline

Function to set maximum number of levels.

207  {
208  ML_parameters.set("max levels", max_levels);
209  }

References ML_parameters.

◆ set_n_cycles()

void oomph::TrilinosMLPreconditioner::set_n_cycles ( int  n_cycles)
inline

Function to set the number of cycles used.

213  {
214  ML_parameters.set("cycle applications", n_cycles);
215  }

References ML_parameters.

◆ set_NSSA_default_values()

void oomph::TrilinosMLPreconditioner::set_NSSA_default_values ( )
inline

Broken assignment operator.

Set control flags to values for Petrov-Galerkin preconditioning - for non symmetric systems

178  {
179  ML_Epetra::SetDefaults("NSSA", ML_parameters);
180  }

References ML_parameters.

Referenced by main().

◆ set_output()

void oomph::TrilinosMLPreconditioner::set_output ( int  output)
inline

Function to set output - controls level of information output by ML.

243  {
244  ML_parameters.set("output", output);
245  }
void output(std::ostream &outfile)
Output with default number of plot points.
Definition: gen_axisym_advection_diffusion_elements.h:161

References ML_parameters, and oomph::output().

◆ set_SA_default_values()

void oomph::TrilinosMLPreconditioner::set_SA_default_values ( )
inline

Set control flags to values for classical smoothed aggregation preconditioning

201  {
202  ML_Epetra::SetDefaults("SA", ML_parameters);
203  }

References ML_parameters.

Referenced by main().

◆ set_smoother_damping()

void oomph::TrilinosMLPreconditioner::set_smoother_damping ( double  smoother_damping)
inline

Function to set Smoother_damping.

219  {
220  ML_parameters.set("smoother: damping factor", smoother_damping);
221  }

References ML_parameters.

◆ set_smoother_gauss_seidel()

void oomph::TrilinosMLPreconditioner::set_smoother_gauss_seidel ( )
inline

Function to set smoother type to "symmetric Gauss-Seidel".

237  {
238  ML_parameters.set("smoother: type", "symmetric Gauss-Seidel");
239  }

References ML_parameters.

◆ set_smoother_jacobi()

void oomph::TrilinosMLPreconditioner::set_smoother_jacobi ( )
inline

Function to set smoother type to "Jacobi".

231  {
232  ML_parameters.set("smoother: type", "Jacobi");
233  }

References ML_parameters.

◆ set_smoother_sweeps()

void oomph::TrilinosMLPreconditioner::set_smoother_sweeps ( int  smoother_sweeps)
inline

Function to set Smoother_sweeps.

225  {
226  ML_parameters.set("smoother: sweeps", smoother_sweeps);
227  }

References ML_parameters.

◆ setup_trilinos_preconditioner()

void oomph::TrilinosMLPreconditioner::setup_trilinos_preconditioner ( Epetra_CrsMatrix *  epetra_matrix_pt)
protectedvirtual

Function to set up the ML preconditioner. It is assumed Trilinos_matrix_pt points to a suitable matrix.

Implements oomph::TrilinosPreconditionerBase.

198  {
199  // doc setup time
200  oomph_info << "Setting up TrilinosML, ";
201  double t_start = TimingHelpers::timer();
202 
203 
204  // create the preconditioner
205  Epetra_preconditioner_pt = new ML_Epetra::MultiLevelPreconditioner(
206  *epetra_matrix_pt, ML_parameters, true);
207 
208  // doc setup time
209  oomph_info << "time for setup [s] : " << TimingHelpers::timer() - t_start
210  << std::endl;
211 
212  // oomph_info << "In here\n";
213  // ML_Epetra::MultiLevelPreconditioner* tmp_pt=0;
214  // tmp_pt=dynamic_cast<ML_Epetra::MultiLevelPreconditioner*>(
215  // Epetra_preconditioner_pt);
216  // if (tmp_pt!=0)
217  // {
218  // oomph_info << "Doing test\n";
219  // ML_parameters.print(*(oomph_info.stream_pt()));
220  // oomph_info.stream_pt()->flush();
221  // // tmp_pt->TestSmoothers();
222  // oomph_info << "Done test\n";
223  // }
224  }
Epetra_Operator * Epetra_preconditioner_pt
Definition: trilinos_preconditioners.h:138
double timer()
returns the time in seconds after some point in past
Definition: oomph_utilities.cc:1295
OomphInfo oomph_info
Definition: oomph_definitions.cc:319

References oomph::TrilinosPreconditionerBase::Epetra_preconditioner_pt, ML_parameters, oomph::oomph_info, and oomph::TimingHelpers::timer().

Member Data Documentation

◆ Default_n_cycles

int oomph::TrilinosMLPreconditioner::Default_n_cycles = 1
static

Default number of V cycles (one to be consistent with previous default) (It's an int because Trilinos wants it to be!)

//////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////// (Static) default number of V cycles (one to be consistent with previous default). (It's an int because Trilinos wants it to be!)

Referenced by TrilinosMLPreconditioner().

◆ ML_parameters


The documentation for this class was generated from the following files: