From: Martin Kronbichler Date: Fri, 13 Jan 2017 17:47:02 +0000 (+0100) Subject: Add additional access method to the underlying shared ptr X-Git-Tag: v8.5.0-rc1~246^2~2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=77a3b871717c696eb3c0c425ba1e4a7503137478;p=dealii.git Add additional access method to the underlying shared ptr --- diff --git a/include/deal.II/matrix_free/operators.h b/include/deal.II/matrix_free/operators.h index 81eb0e137c..4e4d63e15c 100644 --- a/include/deal.II/matrix_free/operators.h +++ b/include/deal.II/matrix_free/operators.h @@ -159,6 +159,12 @@ namespace MatrixFreeOperators */ virtual void compute_diagonal () = 0; + /** + * Get read access to the MatrixFree object stored with this operator. + */ + std_cxx11::shared_ptr > + get_matrix_free () const; + /** * Get read access to the inverse diagonal of this operator. */ @@ -690,7 +696,6 @@ namespace MatrixFreeOperators Base::Base () : Subscriptor(), - data(NULL), have_interface_matrices(false) { } @@ -701,7 +706,7 @@ namespace MatrixFreeOperators typename Base::size_type Base::m () const { - Assert(data != NULL, + Assert(data.get() != NULL, ExcNotInitialized()); return data->get_vector_partitioner()->size(); } @@ -721,7 +726,7 @@ namespace MatrixFreeOperators void Base::clear () { - data = NULL; + data.reset(); inverse_diagonal_entries.reset(); } @@ -745,7 +750,7 @@ namespace MatrixFreeOperators void Base::initialize_dof_vector (LinearAlgebra::distributed::Vector &vec) const { - Assert(data != NULL, + Assert(data.get() != NULL, ExcNotInitialized()); if (!vec.partitioners_are_compatible(*data->get_dof_info(0).vector_partitioner)) data->initialize_dof_vector(vec); @@ -1010,6 +1015,15 @@ namespace MatrixFreeOperators + template + std_cxx11::shared_ptr > + Base::get_matrix_free() const + { + return data; + } + + + template const std_cxx11::shared_ptr > > & Base::get_matrix_diagonal_inverse() const @@ -1117,7 +1131,7 @@ namespace MatrixFreeOperators MassOperator:: compute_diagonal() { - Assert((Base::data != NULL), ExcNotInitialized()); + Assert((Base::data.get() != NULL), ExcNotInitialized()); this->inverse_diagonal_entries. reset(new DiagonalMatrix >()); @@ -1224,7 +1238,7 @@ namespace MatrixFreeOperators LaplaceOperator:: compute_diagonal() { - Assert((Base::data != NULL), ExcNotInitialized()); + Assert((Base::data.get() != NULL), ExcNotInitialized()); unsigned int dummy = 0; this->inverse_diagonal_entries.