From 9eb6140d3a60d1b93dd6c62e11c174a992155ad7 Mon Sep 17 00:00:00 2001 From: Wolfgang Bangerth Date: Mon, 13 May 2024 15:38:02 -0600 Subject: [PATCH] Remove Quadrature(unsigned int) from the public interface. --- include/deal.II/base/quadrature.h | 24 +++++++++++++++++------- source/base/quadrature.cc | 12 ++++++++++++ 2 files changed, 29 insertions(+), 7 deletions(-) diff --git a/include/deal.II/base/quadrature.h b/include/deal.II/base/quadrature.h index d71f739850..c680be4c5f 100644 --- a/include/deal.II/base/quadrature.h +++ b/include/deal.II/base/quadrature.h @@ -130,14 +130,9 @@ public: using SubQuadrature = Quadrature; /** - * Constructor. - * - * This constructor is marked as explicit to avoid involuntary accidents - * like in hp::QCollection@ q_collection(3) where - * hp::QCollection@ q_collection(QGauss@(3)) was - * meant. + * Default constructor. */ - explicit Quadrature(const unsigned int n_quadrature_points = 0); + Quadrature(); /** * Build this quadrature formula as the tensor product of a formula in a @@ -336,6 +331,21 @@ public: get_tensor_basis() const; protected: + /** + * Constructor. + * + * This constructor is marked as explicit to avoid involuntary accidents + * like in hp::QCollection@ q_collection(3) where + * hp::QCollection@ q_collection(QGauss@(3)) was + * meant. Nonetheless, it is easy to accidentally write + * @code + * Quadrature quadrature(3); + * @endcode + * where QGauss was meant. As a consequence, this constructor is `protected` + * and so only available to derived classes initializing their base class. + */ + explicit Quadrature(const unsigned int n_quadrature_points); + /** * List of quadrature points. To be filled by the constructors of derived * classes. diff --git a/source/base/quadrature.cc b/source/base/quadrature.cc index 0aade1577d..d39f88611e 100644 --- a/source/base/quadrature.cc +++ b/source/base/quadrature.cc @@ -27,6 +27,11 @@ DEAL_II_NAMESPACE_OPEN #ifndef DOXYGEN +template <> +Quadrature<0>::Quadrature() + : is_tensor_product_flag(false) +{} + template <> Quadrature<0>::Quadrature(const unsigned int n_q) : quadrature_points(n_q) @@ -37,6 +42,13 @@ Quadrature<0>::Quadrature(const unsigned int n_q) +template +Quadrature::Quadrature() + : is_tensor_product_flag(dim == 1) +{} + + + template Quadrature::Quadrature(const unsigned int n_q) : quadrature_points(n_q, Point()) -- 2.39.5