30 #ifndef OOMPH_TRILINOS_SOLVER_HEADER 31 #define OOMPH_TRILINOS_SOLVER_HEADER 59 bool use_epetra_values =
false)
108 std::ostringstream error_message;
109 error_message <<
"SetUseTranspose() is a pure virtual Epetra_Operator " 110 <<
"member that is not required for a Preconditioner" 114 OOMPH_CURRENT_FUNCTION,
115 OOMPH_EXCEPTION_LOCATION);
119 int Apply(
const Epetra_MultiVector &X, Epetra_MultiVector &Y)
const 121 std::ostringstream error_message;
122 error_message <<
"Apply() is a pure virtual Epetra_Operator member" 123 <<
"that is not required for a Preconditioner" << std::endl;
126 OOMPH_CURRENT_FUNCTION,
127 OOMPH_EXCEPTION_LOCATION);
137 Epetra_MultiVector &epetra_z)
const 144 epetra_r.ExtractView(&r_pt);
153 unsigned nrow_local =
155 for (
unsigned i = 0;
i < nrow_local;
i++)
157 oomph_r[
i] = r_pt[0][
i];
166 epetra_z.ExtractView(&z_pt);
183 unsigned nrow_local =
185 for (
unsigned i = 0;
i < nrow_local;
i++)
187 epetra_z.ReplaceMyValue(
i,0,oomph_z[
i]);
198 std::ostringstream error_message;
199 error_message <<
"NormInf() is a pure virtual Epetra_Operator member" 200 <<
"that is not required for a Preconditioner" << std::endl;
203 OOMPH_CURRENT_FUNCTION,
204 OOMPH_EXCEPTION_LOCATION);
216 std::ostringstream error_message;
217 error_message <<
"UseTranspose() is a pure virtual Epetra_Operator member " 218 <<
"that is not required for a Preconditioner" << std::endl;
221 OOMPH_CURRENT_FUNCTION,
222 OOMPH_EXCEPTION_LOCATION);
228 std::ostringstream error_message;
229 error_message <<
"HasNormInf() is a pure virtual Epetra_Operator member " 230 <<
"that is not required for a Preconditioner" << std::endl;
233 OOMPH_CURRENT_FUNCTION,
234 OOMPH_EXCEPTION_LOCATION);
238 const Epetra_Comm&
Comm()
const 304 Use_aztecoo_workaround_for_epetra_matrix_setup=
true;
307 AztecOO_solver_pt = 0;
310 Using_problem_based_solve =
false;
314 Assemble_serial_jacobian =
false;
317 If_oomphlib_preconditioner_use_epetra_values =
false;
321 Epetra_matrix_pt = 0;
322 Epetra_preconditioner_pt = 0;
329 Delete_matrix =
false;
340 if (Using_problem_based_solve)
342 delete Oomph_matrix_pt;
362 {Use_aztecoo_workaround_for_epetra_matrix_setup=
true;}
367 {Use_aztecoo_workaround_for_epetra_matrix_setup=
false;}
372 {
return Use_aztecoo_workaround_for_epetra_matrix_setup;}
378 delete AztecOO_solver_pt;
379 AztecOO_solver_pt = 0;
386 if (Epetra_preconditioner_pt != 0)
388 if (dynamic_cast<OomphLibPreconditionerEpetraOperator*>
389 (Epetra_preconditioner_pt) != 0)
391 delete Epetra_preconditioner_pt;
392 Epetra_preconditioner_pt = 0;
397 if (this->preconditioner_pt() != 0)
407 delete Epetra_matrix_pt;
408 Epetra_matrix_pt = 0;
436 Enable_resolve=
false;
490 void solve_using_AztecOO(Epetra_Vector* &rhs_pt, Epetra_Vector* &soln_pt);
Epetra_Map * Operator_map_pt
A pointer to an Epetra_Map object - describes distribution of the preconditioner, in this instance it...
double & tolerance()
Access function to Tolerance.
void broken_copy(const std::string &class_name)
Issue error message and terminate execution.
const Epetra_Comm & Comm() const
Returns the Epetra MPI_Comm object.
virtual void preconditioner_solve(const DoubleVector &r, DoubleVector &z)=0
Apply the preconditioner. Pure virtual generic interface function. This method should apply the preco...
double Jacobian_setup_time
Stores set up time for Jacobian.
double Linear_solver_solution_time
Stores time for the solution (excludes time to set up preconditioner)
double NormInf() const
Broken Epetra_Operator member - NormInf.
void disable_aztecoo_workaround_for_epetra_matrix_setup()
Disable workaround for creating of epetra matrix that respects aztecoo's ordering requirements...
double jacobian_setup_time()
Function to return Jacobian_setup_time;.
bool Delete_matrix
Trilinos copies matrix data from oomph-lib's own CRDoubleMatrix or DistributedCRDoubleMatrix to Trili...
Epetra_Operator * Epetra_preconditioner_pt
A pointer to the Epetra_Operator for the preconditioner. This is only used if the preconditioner NOT ...
unsigned Iterations
Stores number of iterations used.
Epetra_SerialComm Operator_comm
An Epetra Serial Comm object.
const char * Label() const
Epetra_Operator::Label - returns a string describing the operator.
OomphLibPreconditionerEpetraOperator(Preconditioner *preconditioner_pt, bool use_epetra_values=false)
Constructor - takes the pointer to the oomph-lib preconditioner and the distribution of the precondit...
OomphCommunicator * communicator_pt() const
const access to the communicator pointer
void enable_aztecoo_workaround_for_epetra_matrix_setup()
Enable workaround for creating of epetra matrix that respects aztecoo's ordering requirements.
bool If_oomphlib_preconditioner_use_epetra_values
static OomphCommunicator * communicator_pt()
access to the global oomph-lib communicator
void disable_assemble_serial_jacobian()
Unset the assembly of the serial jacobian.
Epetra_CrsMatrix * Epetra_matrix_pt
A pointer for the linear system matrix in Epetra_CrsMatrix format.
int ApplyInverse(const Epetra_MultiVector &epetra_r, Epetra_MultiVector &epetra_z) const
applies the oomph-lib preconditioner. Converts the Epetra vector applys the preconditioner by calling...
An interface to the Trilinos AztecOO classes allowing it to be used as an Oomph-lib LinearSolver...
An Epetra_Operator class for oomph-lib preconditioners. A helper class for TrilinosOomphLibPreconditi...
AztecOO_solver_types
Enumerated list to define which AztecOO solver is used.
The conjugate gradient method.
void clean_up_memory()
Clean up method - deletes the solver, the matrices and the preconditioner.
unsigned Solver_type
Defines which solver is set up - available types are defined in AztecOO_solver_types.
TrilinosAztecOOSolver(const TrilinosAztecOOSolver &)
Broken copy constructor.
bool HasNormInf() const
Broken Epetra_Operator member - HasNormInf.
void build(const DoubleVector &old_vector)
Just copys the argument DoubleVector.
~TrilinosAztecOOSolver()
Destructor - delete the solver and the matrices.
void disable_delete_matrix()
\ short Call if the matrix can not be deleted (default)
bool UseTranspose() const
Broken Epetra_Operator member - UseTranspose.
unsigned & max_iter()
Access function to Max_iter.
void enable_assemble_serial_jacobian()
Set the assembly of the serial jacobian when performing a problem-based solve.
unsigned & solver_type()
Access function to Solver_type.
const Epetra_Map & OperatorRangeMap() const
Epetra_Operator member - OperatorRangeMap.
std::string Preconditioner_label
a label for the preconditioner ( for Epetra_Operator::Label() )
void operator=(const TrilinosAztecOOSolver &)
Broken assignment operator.
unsigned nrow_local() const
access function for the num of local rows on this processor. If no MPI then Nrow is returned...
unsigned Max_iter
Max. # of Newton iterations.
bool Use_aztecoo_workaround_for_epetra_matrix_setup
Use workaround for creating of epetra matrix that respects aztecoo's ordering requirements.
DoubleMatrixBase * Oomph_matrix_pt
Oomph lib matrix pointer.
bool is_aztecoo_workaround_for_epetra_matrix_setup_enabled()
Is workaround for creating of epetra matrix that respects aztecoo's ordering requirements enabled...
Epetra_MpiComm Operator_comm
An Epetra MPI Comm object.
bool Using_problem_based_solve
Helper flag keeping track of whether we called the linear algebra or problem-based solve function...
Preconditioner base class. Gives an interface to call all other preconditioners through and stores th...
Preconditioner * Oomph_lib_preconditioner_pt
A pointer to the oomph-lib preconditioner.
void broken_assign(const std::string &class_name)
Issue error message and terminate execution.
void set_external_values(const LinearAlgebraDistribution *const &dist_pt, double *external_values, bool delete_external_values)
Allows are external data to be used by this vector. WARNING: The size of the external data must corre...
Epetra_Map * create_epetra_map(const LinearAlgebraDistribution *const dist)
create an Epetra_Map corresponding to the LinearAlgebraDistribution
AztecOO * AztecOO_solver_pt
Pointer to the AztecOO solver.
int SetUseTranspose(bool UseTranspose)
Broken Epetra_Operator member - SetUseTranspose.
std::string string(const unsigned &i)
Return the i-th string or "" if the relevant string hasn't been defined.
Problem * Problem_pt
A pointer to the underlying problem (NULL if MATRIX based solve) The problem_pt is stored here in a p...
unsigned iterations() const
Acess function to Iterations.
void disable_resolve()
Disable resolve function (overloads the LinearSolver disable_resolve function).
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*)
bool Assemble_serial_jacobian
If true, when performing a problem based solve a serial matrix will be requested from Problem::get_ja...
const Epetra_Map & OperatorDomainMap() const
Epetra_Operator member - OperatorDomainMap.
bool Use_epetra_values
Use the epetra data within the vectors passed to the oomph-lib preconditioner. If this is true none o...
virtual void clean_up_memory()
Clean up memory (empty). Generic interface function.
int Apply(const Epetra_MultiVector &X, Epetra_MultiVector &Y) const
Broken Epetra_Operator member - Apply.
Abstract base class for matrices of doubles – adds abstract interfaces for solving, LU decomposition and multiplication by vectors.
void enable_delete_matrix()
Call if the matrix can be deleted.
LinearAlgebraDistribution * distribution_pt() const
access to the LinearAlgebraDistribution
TrilinosAztecOOSolver()
Constructor.
Base class for all linear iterative solvers. This merely defines standard interfaces for linear itera...
double linear_solver_solution_time()
Function to return Linear_solver_solution_time.