From: David Wells Date: Sat, 29 Aug 2020 23:16:29 +0000 (-0400) Subject: Wrap some more calls to delete with unique_ptr. X-Git-Tag: v9.3.0-rc1~1150^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b0d8b782af99d0f3f69960461190c0329d31ea86;p=dealii.git Wrap some more calls to delete with unique_ptr. --- diff --git a/source/fe/fe_abf.cc b/source/fe/fe_abf.cc index 0b11c719cf..c520643813 100644 --- a/source/fe/fe_abf.cc +++ b/source/fe/fe_abf.cc @@ -177,7 +177,7 @@ FE_ABF::initialize_support_points(const unsigned int deg) // These might be required when the faces contribution is computed // Therefore they will be initialized at this point. - std::vector *> polynomials_abf(dim); + std::array>, dim> polynomials_abf; // Generate x_1^{i} x_2^{r+1} ... for (unsigned int dd = 0; dd < dim; ++dd) @@ -187,7 +187,7 @@ FE_ABF::initialize_support_points(const unsigned int deg) poly[d].push_back(Polynomials::Monomial(deg + 1)); poly[dd] = Polynomials::Monomial::generate_complete_basis(deg); - polynomials_abf[dd] = new AnisotropicPolynomials(poly); + polynomials_abf[dd] = std::make_unique>(poly); } // Number of the point being entered @@ -253,7 +253,7 @@ FE_ABF::initialize_support_points(const unsigned int deg) // space D_xi Q_k if (deg > 0) { - std::vector *> polynomials(dim); + std::array>, dim> polynomials; for (unsigned int dd = 0; dd < dim; ++dd) { @@ -262,7 +262,7 @@ FE_ABF::initialize_support_points(const unsigned int deg) poly[d] = Polynomials::Legendre::generate_complete_basis(deg); poly[dd] = Polynomials::Legendre::generate_complete_basis(deg - 1); - polynomials[dd] = new AnisotropicPolynomials(poly); + polynomials[dd] = std::make_unique>(poly); } interior_weights.reinit( @@ -276,9 +276,6 @@ FE_ABF::initialize_support_points(const unsigned int deg) cell_quadrature.weight(k) * polynomials[d]->compute_value(i, cell_quadrature.point(k)); } - - for (unsigned int d = 0; d < dim; ++d) - delete polynomials[d]; } @@ -311,9 +308,6 @@ FE_ABF::initialize_support_points(const unsigned int deg) } } - for (unsigned int d = 0; d < dim; ++d) - delete polynomials_abf[d]; - Assert(current == this->generalized_support_points.size(), ExcInternalError()); } @@ -421,7 +415,7 @@ FE_ABF::initialize_restriction() // Create Legendre basis for the // space D_xi Q_k. Here, we cannot // use the shape functions - std::vector *> polynomials(dim); + std::array>, dim> polynomials; for (unsigned int dd = 0; dd < dim; ++dd) { std::vector>> poly(dim); @@ -429,7 +423,7 @@ FE_ABF::initialize_restriction() poly[d] = Polynomials::Legendre::generate_complete_basis(rt_order); poly[dd] = Polynomials::Legendre::generate_complete_basis(rt_order - 1); - polynomials[dd] = new AnisotropicPolynomials(poly); + polynomials[dd] = std::make_unique>(poly); } // TODO: the implementation makes the assumption that all faces have the @@ -475,9 +469,6 @@ FE_ABF::initialize_restriction() polynomials[d]->compute_value(i_weight, q_sub.point(k)); } } - - for (unsigned int d = 0; d < dim; ++d) - delete polynomials[d]; } diff --git a/source/grid/grid_out.cc b/source/grid/grid_out.cc index 2462f1ab7d..c7beaca144 100644 --- a/source/grid/grid_out.cc +++ b/source/grid/grid_out.cc @@ -4131,8 +4131,8 @@ namespace internal // If we need to plot curved lines then generate a quadrature formula to // place points via the mapping - Quadrature * q_projector = nullptr; - std::vector> boundary_points; + std::unique_ptr> q_projector; + std::vector> boundary_points; if (mapping != nullptr) { boundary_points.resize(n_points); @@ -4146,7 +4146,7 @@ namespace internal // tensor product of points, only one copy QIterated quadrature(quadrature1d, 1); - q_projector = new Quadrature( + q_projector = std::make_unique>( QProjector::project_to_all_faces(quadrature)); } @@ -4304,10 +4304,6 @@ namespace internal } } - if (q_projector != nullptr) - delete q_projector; - - // make sure everything now gets to disk out.flush();