From: kronbichler Date: Sun, 28 Sep 2008 16:05:24 +0000 (+0000) Subject: Added a copy constructor to the Trilinos sparse matrix class. X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=10c31bc61b497a0dca6cd4ff70937988ddda4f1d;p=dealii-svn.git Added a copy constructor to the Trilinos sparse matrix class. git-svn-id: https://svn.dealii.org/trunk@17031 0785d39b-7218-0410-832d-ea1e28bc413d --- 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 ()