From 10c31bc61b497a0dca6cd4ff70937988ddda4f1d Mon Sep 17 00:00:00 2001 From: kronbichler Date: Sun, 28 Sep 2008 16:05:24 +0000 Subject: [PATCH] Added a copy constructor to the Trilinos sparse matrix class. git-svn-id: https://svn.dealii.org/trunk@17031 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/lac/include/lac/trilinos_sparse_matrix.h | 9 +++++++++ deal.II/lac/source/trilinos_sparse_matrix.cc | 11 +++++++++++ 2 files changed, 20 insertions(+) diff --git a/deal.II/lac/include/lac/trilinos_sparse_matrix.h b/deal.II/lac/include/lac/trilinos_sparse_matrix.h index 3ea0425fa3..9ecf706bdf 100755 --- a/deal.II/lac/include/lac/trilinos_sparse_matrix.h +++ b/deal.II/lac/include/lac/trilinos_sparse_matrix.h @@ -442,6 +442,15 @@ namespace TrilinosWrappers const Epetra_Map &InputColMap, const std::vector &n_entries_per_row); + /** + * Copy constructor. Sets the + * calling matrix to be the same + * as the input matrix, i.e., + * using the same sparsity + * pattern and entries. + */ + SparseMatrix (const SparseMatrix &InputMatrix); + /** * Destructor. Made virtual so * that one can use pointers to diff --git a/deal.II/lac/source/trilinos_sparse_matrix.cc b/deal.II/lac/source/trilinos_sparse_matrix.cc index 9e3ef01181..eeabeb3c0d 100755 --- a/deal.II/lac/source/trilinos_sparse_matrix.cc +++ b/deal.II/lac/source/trilinos_sparse_matrix.cc @@ -142,6 +142,17 @@ namespace TrilinosWrappers false))) {} + SparseMatrix::SparseMatrix (const SparseMatrix &InputMatrix) + : + Subscriptor(), + row_map (InputMatrix.row_map), + col_map (InputMatrix.col_map), + last_action (Zero), + compressed (true), + matrix (std::auto_ptr + (new Epetra_FECrsMatrix(*InputMatrix.matrix))) + {} + SparseMatrix::~SparseMatrix () -- 2.39.5