61 #ifdef OOMPH_HAS_TRILINOS 89 #ifdef OOMPH_HAS_TRILINOS 95 oomph_info <<
"Time to build epetra matrix [sec] : " 96 << t_end - t_start << std::endl;
104 oomph_info <<
"Time to copy CRDoubleMatrix [sec] : " 105 << t_end - t_start << std::endl;
120 std::ostringstream error_message_stream;
122 <<
"The distribution of the vector x must be setup";
124 OOMPH_CURRENT_FUNCTION,
125 OOMPH_EXCEPTION_LOCATION);
132 std::ostringstream error_message_stream;
134 <<
"The distribution of the x Vector is not the same as" 135 <<
" the column distribution.";
137 OOMPH_CURRENT_FUNCTION,
138 OOMPH_EXCEPTION_LOCATION);
147 std::ostringstream error_message_stream;
149 <<
"The y vector is setup and therefore must have the same " 150 <<
"distribution as the matrix used to set up the MatrixVectorProduct";
152 OOMPH_CURRENT_FUNCTION,
153 OOMPH_EXCEPTION_LOCATION);
168 #ifdef OOMPH_HAS_TRILINOS 189 std::ostringstream error_message_stream;
191 <<
"The distribution of the vector x must be setup";
193 OOMPH_CURRENT_FUNCTION,
194 OOMPH_EXCEPTION_LOCATION);
199 std::ostringstream error_message_stream;
201 <<
"This class assumes that the y vector has a uniform " 202 <<
"distributed distribution.";
204 OOMPH_CURRENT_FUNCTION,
205 OOMPH_EXCEPTION_LOCATION);
212 std::ostringstream error_message_stream;
214 <<
"The y vector is setup and therefore must have the same " 215 <<
"distribution as the vector x";
217 OOMPH_CURRENT_FUNCTION,
218 OOMPH_EXCEPTION_LOCATION);
233 #ifdef OOMPH_HAS_TRILINOS 243 #ifdef OOMPH_HAS_TRILINOS 253 Epetra_Vector* epetra_x_pt =
258 Epetra_Vector* epetra_soln_pt =
263 int epetra_error_flag = 0;
271 if (epetra_error_flag != 0)
273 std::ostringstream error_message;
275 <<
"Epetra Matrix Vector Multiply Error : epetra_error_flag = " 276 << epetra_error_flag;
278 OOMPH_CURRENT_FUNCTION,
279 OOMPH_EXCEPTION_LOCATION);
288 delete epetra_soln_pt;
300 Epetra_Vector* epetra_x_pt =
305 Epetra_Vector* epetra_soln_pt =
310 int epetra_error_flag = 0;
318 if (epetra_error_flag != 0)
320 std::ostringstream error_message;
322 <<
"Epetra Matrix Vector Multiply Error : epetra_error_flag = " 323 << epetra_error_flag;
325 OOMPH_CURRENT_FUNCTION,
326 OOMPH_EXCEPTION_LOCATION);
335 delete epetra_soln_pt;
void multiply(const DoubleVector &x, DoubleVector &soln) const
Multiply the matrix by the vector x: soln=Ax.
unsigned Ncol
number of columns of the matrix
void multiply_transpose(const DoubleVector &x, DoubleVector &y) const
Apply the transpose of the operator to the vector x and return the result in the vector y...
OomphCommunicator * communicator_pt() const
const access to the communicator pointer
bool distributed() const
access function to the distributed - indicates whether the distribution is serial or distributed ...
LinearAlgebraDistribution * Column_distribution_pt
The distribution of: x if using multiply(...) or y if using multiply_transpose(...) where this is A x = y.
static bool mpi_has_been_initialised()
return true if MPI has been initialised
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...
Describes the distribution of a distributable linear algebra type object. Typically this is a contain...
void build(const DoubleVector &old_vector)
Just copys the argument DoubleVector.
unsigned long ncol() const
Return the number of columns of the matrix.
Epetra_CrsMatrix * Epetra_matrix_pt
The Epetra version of the matrix.
void multiply_transpose(const DoubleVector &x, DoubleVector &soln) const
Multiply the transposed matrix by the vector x: soln=A^T x.
void setup(CRDoubleMatrix *matrix_pt, const LinearAlgebraDistribution *col_dist_pt=0)
Setup the matrix vector product operator. WARNING: This class is wrapper to Trilinos Epetra matrix ve...
double timer()
returns the time in seconds after some point in past
bool Using_trilinos
boolean indicating whether we are using trilinos to perform matvec
void trilinos_multiply_helper(const DoubleVector &x, DoubleVector &y) const
Helper function for multiply(...)
void trilinos_multiply_transpose_helper(const DoubleVector &x, DoubleVector &y) const
Helper function for multiply_transpose(...)
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...
CRDoubleMatrix * Oomph_matrix_pt
an oomph-lib matrix
void build_distribution(const LinearAlgebraDistribution *const dist_pt)
setup the distribution of this distributable linear algebra object
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 multiply(const DoubleVector &x, DoubleVector &y) const
Apply the operator to the vector x and return the result in the vector y.
void clean_up_memory()
clear the memory
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