55 #ifdef OOMPH_HAS_TRILINOS
84 #ifdef OOMPH_HAS_TRILINOS
90 oomph_info <<
"Time to build epetra matrix [sec] : " << t_end - t_start
99 oomph_info <<
"Time to copy CRDoubleMatrix [sec] : " << t_end - t_start
115 std::ostringstream error_message_stream;
116 error_message_stream <<
"The distribution of the vector x must be setup";
118 OOMPH_CURRENT_FUNCTION,
119 OOMPH_EXCEPTION_LOCATION);
126 std::ostringstream error_message_stream;
128 <<
"The distribution of the x Vector is not the same as"
129 <<
" the column distribution.";
131 OOMPH_CURRENT_FUNCTION,
132 OOMPH_EXCEPTION_LOCATION);
141 std::ostringstream error_message_stream;
143 <<
"The y vector is setup and therefore must have the same "
144 <<
"distribution as the matrix used to set up the "
145 "MatrixVectorProduct";
147 OOMPH_CURRENT_FUNCTION,
148 OOMPH_EXCEPTION_LOCATION);
163 #ifdef OOMPH_HAS_TRILINOS
184 std::ostringstream error_message_stream;
185 error_message_stream <<
"The distribution of the vector x must be setup";
187 OOMPH_CURRENT_FUNCTION,
188 OOMPH_EXCEPTION_LOCATION);
193 std::ostringstream error_message_stream;
195 <<
"This class assumes that the y vector has a uniform "
196 <<
"distributed distribution.";
198 OOMPH_CURRENT_FUNCTION,
199 OOMPH_EXCEPTION_LOCATION);
206 std::ostringstream error_message_stream;
208 <<
"The y vector is setup and therefore must have the same "
209 <<
"distribution as the vector x";
211 OOMPH_CURRENT_FUNCTION,
212 OOMPH_EXCEPTION_LOCATION);
227 #ifdef OOMPH_HAS_TRILINOS
237 #ifdef OOMPH_HAS_TRILINOS
247 Epetra_Vector* epetra_x_pt =
252 Epetra_Vector* epetra_soln_pt =
257 int epetra_error_flag = 0;
264 if (epetra_error_flag != 0)
266 std::ostringstream error_message;
268 <<
"Epetra Matrix Vector Multiply Error : epetra_error_flag = "
269 << epetra_error_flag;
271 error_message.str(), OOMPH_CURRENT_FUNCTION, OOMPH_EXCEPTION_LOCATION);
280 delete epetra_soln_pt;
292 Epetra_Vector* epetra_x_pt =
297 Epetra_Vector* epetra_soln_pt =
302 int epetra_error_flag = 0;
309 if (epetra_error_flag != 0)
311 std::ostringstream error_message;
313 <<
"Epetra Matrix Vector Multiply Error : epetra_error_flag = "
314 << epetra_error_flag;
316 error_message.str(), OOMPH_CURRENT_FUNCTION, OOMPH_EXCEPTION_LOCATION);
325 delete epetra_soln_pt;
A class for compressed row matrices. This is a distributable object.
void multiply_transpose(const DoubleVector &x, DoubleVector &soln) const
Multiply the transposed matrix by the vector x: soln=A^T x.
unsigned long ncol() const
Return the number of columns of the matrix.
void multiply(const DoubleVector &x, DoubleVector &soln) const
Multiply the matrix by the vector x: soln=Ax.
LinearAlgebraDistribution * distribution_pt() const
access to the LinearAlgebraDistribution
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....
void build(const DoubleVector &old_vector)
Just copys the argument DoubleVector.
Describes the distribution of a distributable linear algebra type object. Typically this is a contain...
bool distributed() const
access function to the distributed - indicates whether the distribution is serial or distributed
OomphCommunicator * communicator_pt() const
const access to the communicator pointer
static bool mpi_has_been_initialised()
return true if MPI has been initialised
Epetra_CrsMatrix * Epetra_matrix_pt
The Epetra version of the matrix.
void trilinos_multiply_transpose_helper(const DoubleVector &x, DoubleVector &y) const
Helper function for multiply_transpose(...)
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.
void clean_up_memory()
clear the memory
CRDoubleMatrix * Oomph_matrix_pt
an oomph-lib matrix
void trilinos_multiply_helper(const DoubleVector &x, DoubleVector &y) const
Helper function for multiply(...)
LinearAlgebraDistribution * Column_distribution_pt
The distribution of: x if using multiply(...) or y if using multiply_transpose(......
void multiply(const DoubleVector &x, DoubleVector &y) const
Apply the operator to the vector x and return the result in the vector y.
bool Using_trilinos
boolean indicating whether we are using trilinos to perform matvec
unsigned Ncol
number of columns of the matrix
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...
An OomphLibError object which should be thrown when an run-time error is encountered....
double timer()
returns the time in seconds after some point in past
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...
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....
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....
//////////////////////////////////////////////////////////////////// ////////////////////////////////...
OomphInfo oomph_info
Single (global) instantiation of the OomphInfo object – this is used throughout the library as a "rep...