From 329cccd017599b5e6f4a40d8c266af5d1a86efdf Mon Sep 17 00:00:00 2001 From: kronbichler Date: Mon, 17 Feb 2014 12:57:17 +0000 Subject: [PATCH] Get rid of shared_ptr with weird deleter. Do it manually now. git-svn-id: https://svn.dealii.org/trunk@32498 0785d39b-7218-0410-832d-ea1e28bc413d --- .../deal.II/matrix_free/fe_evaluation.h | 54 ++++++++----------- 1 file changed, 21 insertions(+), 33 deletions(-) diff --git a/deal.II/include/deal.II/matrix_free/fe_evaluation.h b/deal.II/include/deal.II/matrix_free/fe_evaluation.h index 5b7a385109..92af89a2f7 100644 --- a/deal.II/include/deal.II/matrix_free/fe_evaluation.h +++ b/deal.II/include/deal.II/matrix_free/fe_evaluation.h @@ -88,6 +88,11 @@ public: * @name 1: General operations */ //@{ + /** + * Destructor. + */ + ~FEEvaluationBase(); + /** * Initializes the operation pointer to the current cell. Unlike the * FEValues::reinit function, where the information related to a particular @@ -636,9 +641,10 @@ protected: * Stores a reference to the unit cell data, i.e., values, gradients and * Hessians in 1D at the quadrature points that constitute the tensor * product. Also contained in matrix_info, but it simplifies code if we - * store a reference to it. + * store a reference to it. If initialized without MatrixFree object, this + * call actually initializes the evaluation. */ - std_cxx1x::shared_ptr > data; + const internal::MatrixFreeFunctions::ShapeInfo *data; /** * A pointer to the Cartesian Jacobian information of the present cell. Only @@ -1666,34 +1672,6 @@ public: #ifndef DOXYGEN -namespace internal -{ - namespace MatrixFreeFunctions - { - // a small class that gives control over the delete behavior of - // std::shared_ptr: we need to disable it when we initialize a pointer - // from another structure. - template - struct DummyDeleter - { - DummyDeleter (const bool do_delete = false) - : - do_delete(do_delete) - {} - - void operator () (CLASS *pointer) - { - if (do_delete) - delete pointer; - } - - const bool do_delete; - }; - } -} - - - /*----------------------- FEEvaluationBase ----------------------------------*/ template @@ -1717,9 +1695,7 @@ FEEvaluationBase mapping_info (&data_in.get_mapping_info()), data (&data_in.get_shape_info (fe_no_in, quad_no_in, active_fe_index, - active_quad_index), - internal::MatrixFreeFunctions::DummyDeleter - >(false)), + active_quad_index)), cartesian_data (0), jacobian (0), J_value (0), @@ -1808,6 +1784,18 @@ FEEvaluationBase +template +inline +FEEvaluationBase::~FEEvaluationBase() +{ + // delete memory held by data in case this structure was initialized without + // a MatrixFree object which could hold the data structure. + if (matrix_info == 0) + delete data; +} + + + template inline void -- 2.39.5