Skip to content

Commit

Permalink
Merge pull request #16565 from masterleinad/template_tpetra_vector_me…
Browse files Browse the repository at this point in the history
…mory_space

Template TrilinosWrappers::Vector on memory space
  • Loading branch information
bangerth committed Jan 31, 2024
2 parents 30eddc1 + 0c40265 commit ccaed39
Show file tree
Hide file tree
Showing 5 changed files with 254 additions and 224 deletions.
2 changes: 1 addition & 1 deletion include/deal.II/base/template_constraints.h
Original file line number Diff line number Diff line change
Expand Up @@ -668,7 +668,7 @@ namespace LinearAlgebra
# ifdef DEAL_II_TRILINOS_WITH_TPETRA
namespace TpetraWrappers
{
template <typename Number>
template <typename Number, typename MemorySpace>
class Vector;

template <typename Number, typename MemorySpace>
Expand Down
12 changes: 8 additions & 4 deletions include/deal.II/lac/trilinos_tpetra_sparse_matrix.h
Original file line number Diff line number Diff line change
Expand Up @@ -464,7 +464,8 @@ namespace LinearAlgebra
* of the matrix.
*/
void
vmult(Vector<Number> &dst, const Vector<Number> &src) const;
vmult(Vector<Number, MemorySpace> &dst,
const Vector<Number, MemorySpace> &src) const;

/*
* Matrix-vector multiplication: let <i>dst = M<sup>T</sup>*src</i> with
Expand All @@ -474,7 +475,8 @@ namespace LinearAlgebra
* Source and destination must not be the same vector.
*/
void
Tvmult(Vector<Number> &dst, const Vector<Number> &src) const;
Tvmult(Vector<Number, MemorySpace> &dst,
const Vector<Number, MemorySpace> &src) const;

/**
* Adding matrix-vector multiplication. Add <i>M*src</i> on <i>dst</i>
Expand All @@ -483,7 +485,8 @@ namespace LinearAlgebra
* Source and destination must not be the same vector.
*/
void
vmult_add(Vector<Number> &dst, const Vector<Number> &src) const;
vmult_add(Vector<Number, MemorySpace> &dst,
const Vector<Number, MemorySpace> &src) const;


/**
Expand All @@ -494,7 +497,8 @@ namespace LinearAlgebra
* Source and destination must not be the same vector.
*/
void
Tvmult_add(Vector<Number> &dst, const Vector<Number> &src) const;
Tvmult_add(Vector<Number, MemorySpace> &dst,
const Vector<Number, MemorySpace> &src) const;
/** @} */

/**
Expand Down
18 changes: 10 additions & 8 deletions include/deal.II/lac/trilinos_tpetra_sparse_matrix.templates.h
Original file line number Diff line number Diff line change
Expand Up @@ -585,8 +585,9 @@ namespace LinearAlgebra

template <typename Number, typename MemorySpace>
void
SparseMatrix<Number, MemorySpace>::vmult(Vector<Number> &dst,
const Vector<Number> &src) const
SparseMatrix<Number, MemorySpace>::vmult(
Vector<Number, MemorySpace> &dst,
const Vector<Number, MemorySpace> &src) const
{
Assert(&src != &dst, ExcSourceEqualsDestination());
Assert(matrix->isFillComplete(), ExcMatrixNotCompressed());
Expand All @@ -601,8 +602,9 @@ namespace LinearAlgebra

template <typename Number, typename MemorySpace>
void
SparseMatrix<Number, MemorySpace>::Tvmult(Vector<Number> &dst,
const Vector<Number> &src) const
SparseMatrix<Number, MemorySpace>::Tvmult(
Vector<Number, MemorySpace> &dst,
const Vector<Number, MemorySpace> &src) const
{
Assert(&src != &dst, ExcSourceEqualsDestination());
Assert(matrix->isFillComplete(), ExcMatrixNotCompressed());
Expand All @@ -620,8 +622,8 @@ namespace LinearAlgebra
template <typename Number, typename MemorySpace>
void
SparseMatrix<Number, MemorySpace>::vmult_add(
Vector<Number> &dst,
const Vector<Number> &src) const
Vector<Number, MemorySpace> &dst,
const Vector<Number, MemorySpace> &src) const
{
Assert(&src != &dst, ExcSourceEqualsDestination());
Assert(matrix->isFillComplete(), ExcMatrixNotCompressed());
Expand All @@ -641,8 +643,8 @@ namespace LinearAlgebra
template <typename Number, typename MemorySpace>
void
SparseMatrix<Number, MemorySpace>::Tvmult_add(
Vector<Number> &dst,
const Vector<Number> &src) const
Vector<Number, MemorySpace> &dst,
const Vector<Number, MemorySpace> &src) const
{
Assert(&src != &dst, ExcSourceEqualsDestination());
Assert(matrix->isFillComplete(), ExcMatrixNotCompressed());
Expand Down

0 comments on commit ccaed39

Please sign in to comment.