31 #ifndef OOMPH_PRECONDITION_HEADER 32 #define OOMPH_PRECONDITION_HEADER 37 #include <oomph-lib-config.h> 48 template<
typename MATRIX>
class BlockPreconditioner;
110 Setup_time = setup_time_finish - setup_time_start;
124 virtual void setup() = 0;
135 std::ostringstream error_msg;
136 error_msg <<
"Matrix pointer is null.";
138 OOMPH_CURRENT_FUNCTION,
139 OOMPH_EXCEPTION_LOCATION);
156 std::ostringstream error_msg;
158 <<
"Tried to access a null communicator pointer. This might mean you are\n" 159 <<
"trying to use it in a non-parallel case. Or it might mean you haven't\n" 160 <<
"set it properly.";
162 OOMPH_CURRENT_FUNCTION,
163 OOMPH_EXCEPTION_LOCATION);
246 if (dist_matrix_pt != 0)
269 std::ostringstream error_message_stream;
271 <<
"The r vector must have the same distribution as the preconditioner. " 272 <<
"(this is the same as the matrix passed to setup())";
273 throw OomphLibError(error_message_stream.str(), OOMPH_CURRENT_FUNCTION,
274 OOMPH_EXCEPTION_LOCATION);
280 std::ostringstream error_message_stream;
282 <<
"The z vector distribution has been setup; it must have the " 283 <<
"same distribution as the r vector (and preconditioner).";
284 throw OomphLibError(error_message_stream.str(), OOMPH_CURRENT_FUNCTION,
285 OOMPH_EXCEPTION_LOCATION);
virtual DoubleMatrixBase * matrix_pt() const
Get function for matrix pointer.
virtual void set_matrix_pt(DoubleMatrixBase *matrix_pt)
Set the matrix pointer.
void setup(const Problem *problem_pt, DoubleMatrixBase *matrix_pt)
Compatability layer for old preconditioners where problem pointers were needed. The problem pointer i...
void broken_copy(const std::string &class_name)
Issue error message and terminate execution.
virtual void preconditioner_solve(const DoubleVector &r, DoubleVector &z)
Apply the preconditioner. This method should apply the preconditioner operator to the vector r and re...
The Identity Preconditioner.
virtual void preconditioner_solve(const DoubleVector &r, DoubleVector &z)=0
Apply the preconditioner. Pure virtual generic interface function. This method should apply the preco...
const OomphCommunicator * Comm_pt
Storage for a pointer to the communicator. Null if the preconditioner should not be distributed...
DoubleMatrixBase * Matrix_pt
Storage for a pointer to the matrix.
void operator=(const Preconditioner &)
Broken assignment operator.
IdentityPreconditioner(const IdentityPreconditioner &)
Broken copy constructor.
void obsolete()
Output warning message.
OomphCommunicator * communicator_pt() const
const access to the communicator pointer
virtual void turn_into_subsidiary_block_preconditioner(BlockPreconditioner< CRDoubleMatrix > *master_block_prec_pt, const Vector< unsigned > &doftype_in_master_preconditioner_coarse)
virtual ~IdentityPreconditioner()
Destructor (empty)
void operator=(const IdentityPreconditioner &)
Broken assignment operator.
double Setup_time
The time it takes to set up this preconditioner.
Describes the distribution of a distributable linear algebra type object. Typically this is a contain...
Base class for any linear algebra object that is distributable. Just contains storage for the LinearA...
virtual ~Preconditioner()
Destructor (empty)
virtual void setup()
setup method - just sets the distribution
Preconditioner()
Constructor.
double timer()
returns the time in seconds after some point in past
void setup(DoubleMatrixBase *matrix_pt)
Setup the preconditioner: store the matrix pointer and the communicator pointer then call preconditio...
virtual void set_comm_pt(const OomphCommunicator *const comm_pt)
Set the communicator pointer.
Preconditioner base class. Gives an interface to call all other preconditioners through and stores th...
void broken_assign(const std::string &class_name)
Issue error message and terminate execution.
virtual unsigned long nrow() const =0
Return the number of rows of the matrix.
void build_distribution(const LinearAlgebraDistribution *const dist_pt)
setup the distribution of this distributable linear algebra object
virtual const OomphCommunicator * comm_pt() const
Get function for comm pointer.
virtual void setup()=0
Setup the preconditioner. Pure virtual generic interface 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*)
virtual void clean_up_memory()
Clean up memory (empty). Generic interface function.
Abstract base class for matrices of doubles – adds abstract interfaces for solving, LU decomposition and multiplication by vectors.
LinearAlgebraDistribution * distribution_pt() const
access to the LinearAlgebraDistribution
Preconditioner(const Preconditioner &)
Broken copy constructor.
double setup_time() const
Returns the time to setup the preconditioner.
An oomph-lib wrapper to the MPI_Comm communicator object. Just contains an MPI_Comm object (which is ...