From: Stefano Dominici Date: Sun, 21 Oct 2018 08:10:33 +0000 (+0200) Subject: Data members of TensorProductManifold converted to std::unique_ptr<...> X-Git-Tag: v9.1.0-rc1~605^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F7361%2Fhead;p=dealii.git Data members of TensorProductManifold converted to std::unique_ptr<...> Mimor modifications to: - Remove unnecessary parts. --- diff --git a/include/deal.II/grid/manifold_lib.h b/include/deal.II/grid/manifold_lib.h index a4498acaf3..f6da483202 100644 --- a/include/deal.II/grid/manifold_lib.h +++ b/include/deal.II/grid/manifold_lib.h @@ -73,11 +73,6 @@ public: */ PolarManifold(const Point center = Point()); - /** - * Virtual destructor - */ - virtual ~PolarManifold() = default; - /** * Make a clone of this Manifold object. */ @@ -404,10 +399,6 @@ public: const Point & point_on_axis, const double tolerance = 1e-10); - /** - * Virtual destructor. - */ - virtual ~CylindricalManifold() = default; /** * Make a clone of this Manifold object. */ @@ -507,7 +498,6 @@ public: const Tensor<1, chartdim> &periodicity = Tensor<1, chartdim>(), const double tolerance = 1e-10); - /** * Expressions constructor. Takes the expressions of the push_forward * function of spacedim components, and of the pull_back function of @p @@ -677,11 +667,6 @@ public: */ TorusManifold(const double R, const double r); - /** - * Virtual destructor - */ - virtual ~TorusManifold() = default; - /** * Make a clone of this Manifold object. */ diff --git a/include/deal.II/grid/tensor_product_manifold.h b/include/deal.II/grid/tensor_product_manifold.h index 73c6561132..5f371c3437 100644 --- a/include/deal.II/grid/tensor_product_manifold.h +++ b/include/deal.II/grid/tensor_product_manifold.h @@ -21,6 +21,7 @@ #include #include #include +#include #include @@ -89,11 +90,6 @@ public: const ChartManifold &manifold_A, const ChartManifold &manifold_B); - /** - * Virtual destructor - */ - virtual ~TensorProductManifold() = default; - /** * Clone this manifold. */ @@ -119,10 +115,10 @@ public: push_forward_gradient(const Point &chart_point) const override; private: - std::shared_ptr> + std::unique_ptr> manifold_A; - std::shared_ptr> + std::unique_ptr> manifold_B; }; @@ -196,18 +192,13 @@ TensorProductManifold> tmpA( - std::move(manifold_A.clone())); - std::shared_ptr> tmpB( - std::move(manifold_B.clone())); - this->manifold_A = - std::static_pointer_cast>( - tmpA); - this->manifold_B = - std::static_pointer_cast>( - tmpB); -} + , manifold_A(Utilities::dynamic_unique_cast< + ChartManifold, + Manifold>(manifold_A.clone())) + , manifold_B(Utilities::dynamic_unique_cast< + ChartManifold, + Manifold>(manifold_B.clone())) +{} template tria; GridGenerator::hyper_cube(tria); { - FunctionManifold<1, 1> F("x", "x"); - PolarManifold<2, 2> G(Point<2>(0.5, 0.5)); - TensorProductManifold<3, 2, 2, 2, 1, 1, 1> manifold(G, F); - tria.set_all_manifold_ids(0); - tria.set_manifold(0, manifold); + FunctionManifold<1, 1> F("x", "x"); + PolarManifold<2, 2> G(Point<2>(0.5, 0.5)); + try + { + TensorProductManifold<3, 2, 2, 2, 1, 1, 1> manifold(G, F); + tria.set_all_manifold_ids(0); + tria.set_manifold(0, manifold); + } + catch (std::bad_cast &e) + { + (void)e; + return false; + } } tria.refine_global(1); + return true; } @@ -46,7 +55,16 @@ test() int main() { - test(); + initlog(); + + if (test()) + { + deallog << "OK" << std::endl; + } + else + { + deallog << "FAILED" << std::endl; + } return 0; } diff --git a/tests/manifold/tensor_product_manifold_03.output b/tests/manifold/tensor_product_manifold_03.output index e69de29bb2..0fd8fc12f0 100644 --- a/tests/manifold/tensor_product_manifold_03.output +++ b/tests/manifold/tensor_product_manifold_03.output @@ -0,0 +1,2 @@ + +DEAL::OK