68 std::ostringstream error_message;
69 error_message <<
"Preconditioners require a square matrix. " 73 OOMPH_CURRENT_FUNCTION,
74 OOMPH_EXCEPTION_LOCATION);
83 if (cr_matrix_pt == 0)
86 OOMPH_CURRENT_FUNCTION,
87 OOMPH_EXCEPTION_LOCATION);
116 std::ostringstream error_message;
117 error_message <<
"TrilinosSolver only work with " 118 <<
"DistributedCRDoubleMatrix matrices" << std::endl;
120 OOMPH_CURRENT_FUNCTION,
121 OOMPH_EXCEPTION_LOCATION);
145 std::ostringstream error_message;
146 error_message <<
"preconditioner_solve requires that solver data has " 147 <<
"been set up" << std::endl;
149 OOMPH_CURRENT_FUNCTION,
150 OOMPH_EXCEPTION_LOCATION);
155 std::ostringstream error_message;
156 error_message <<
"The rhs vector and the matrix must have the same " 157 <<
"distribution.\n";
159 OOMPH_CURRENT_FUNCTION,
160 OOMPH_EXCEPTION_LOCATION);
165 Epetra_Vector* epetra_r_pt =
169 Epetra_Vector* epetra_z_pt =
220 new ML_Epetra::MultiLevelPreconditioner(*epetra_matrix_pt,
259 Teuchos::ParameterList ifpack_parameters;
260 ifpack_parameters.set(
"fact: level-of-fill", ILU_fill_level);
261 ifpack_parameters.set(
"fact: ilut level-of-fill", ILUT_fill_level);
262 ifpack_parameters.set(
"fact: absolute threshold", Absolute_threshold);
263 ifpack_parameters.set(
"fact: relative threshold", Relative_threshold);
266 Ifpack ifpack_factory;
267 Ifpack_Preconditioner* tmp_pt= ifpack_factory.Create(Preconditioner_type,
271 tmp_pt->SetParameters(ifpack_parameters);
272 tmp_pt->Initialize();
virtual DoubleMatrixBase * matrix_pt() const
Get function for matrix pointer.
void setup_trilinos_preconditioner(Epetra_CrsMatrix *epetra_matrix_pt)
Function to set up the ML preconditioner. It is assumed Trilinos_matrix_pt points to a suitable matri...
void setup()
Broken assignment operator.
static double Cumulative_preconditioner_solve_time
Static double that accumulates the preconditioner solve time of all instantiations of this class...
Epetra_CrsMatrix * Epetra_matrix_pt
Pointer used to store the epetra matrix - only used when this preconditioner is setup using the oomph...
Epetra_CrsMatrix * create_distributed_epetra_matrix(const CRDoubleMatrix *oomph_matrix_pt, const LinearAlgebraDistribution *dist_pt)
create an Epetra_CrsMatrix from an oomph-lib CRDoubleMatrix. If oomph_matrix_pt is NOT distributed (i...
static int Default_n_cycles
Default number of V cycles (one to be consistent with previous default) (It's an int because Trilinos...
void build(const DoubleVector &old_vector)
Just copys the argument DoubleVector.
void preconditioner_solve(const DoubleVector &r, DoubleVector &z)
applies the preconditioner
Epetra_Operator * Epetra_preconditioner_pt
The preconditioner which will be set up using function setup_trilinos_preconditioner(...)
double timer()
returns the time in seconds after some point in past
void clean_up_memory()
deletes the preconditioner, matrices and maps
unsigned nrow() const
access function to the number of global rows.
virtual unsigned long nrow() const =0
Return the number of rows of the matrix.
Epetra_Vector * create_distributed_epetra_vector(const DoubleVector &oomph_vec)
create an Epetra_Vector from an oomph-lib DoubleVector. If oomph_vec is NOT distributed (i...
void build_distribution(const LinearAlgebraDistribution *const dist_pt)
setup the distribution of this distributable linear algebra object
void setup_trilinos_preconditioner(Epetra_CrsMatrix *epetra_matrix_pt)
Function to set up an IFPACK preconditioner. It is assumed Trilinos_matrix_pt points to a suitable ma...
A vector in the mathematical sense, initially developed for linear algebra type applications. If MPI then this vector can be distributed - its distribution is described by the LinearAlgebraDistribution object at Distribution_pt. Data is stored in a C-style pointer vector (double*)
void copy_to_oomphlib_vector(const Epetra_Vector *epetra_vec_pt, DoubleVector &oomph_vec)
Helper function to copy the contents of a Trilinos vector to an oomph-lib distributed vector...
A class for compressed row matrices. This is a distributable object.
LinearAlgebraDistribution * distribution_pt() const
access to the LinearAlgebraDistribution
virtual unsigned long ncol() const =0
Return the number of columns of the matrix.
virtual void setup_trilinos_preconditioner(Epetra_CrsMatrix *epetra_matrix_pt)=0
Function to set up a specific Trilinos preconditioner. This is called by setup(...).