]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Modified TensorProductManifold class
authorStefano Dominici <sfndmn@gmail.com>
Thu, 18 Oct 2018 15:03:36 +0000 (17:03 +0200)
committerStefano Dominici <sfndmn@gmail.com>
Fri, 19 Oct 2018 08:04:41 +0000 (10:04 +0200)
The data members are copies of the constructor parameters and are stored
in shared_ptr objects. The constructor converts the unique_ptr objects from clone() method called on the constructor arguments into shared_ptr().

include/deal.II/grid/tensor_product_manifold.h

index 2c847d6099ef6e786e9b8297490baa3d83bf4924..73c65611325ec3a46b7027b6019de13121ec27fc 100644 (file)
@@ -119,24 +119,10 @@ public:
   push_forward_gradient(const Point<chartdim> &chart_point) const override;
 
 private:
-  SmartPointer<const ChartManifold<dim_A, spacedim_A, chartdim_A>,
-               TensorProductManifold<dim,
-                                     dim_A,
-                                     spacedim_A,
-                                     chartdim_A,
-                                     dim_B,
-                                     spacedim_B,
-                                     chartdim_B>>
+  std::shared_ptr<const ChartManifold<dim_A, spacedim_A, chartdim_A>>
     manifold_A;
 
-  SmartPointer<const ChartManifold<dim_B, spacedim_B, chartdim_B>,
-               TensorProductManifold<dim,
-                                     dim_A,
-                                     spacedim_A,
-                                     chartdim_A,
-                                     dim_B,
-                                     spacedim_B,
-                                     chartdim_B>>
+  std::shared_ptr<const ChartManifold<dim_B, spacedim_B, chartdim_B>>
     manifold_B;
 };
 
@@ -210,9 +196,18 @@ TensorProductManifold<dim,
       internal::TensorProductManifoldImplementation::concat(
         manifold_A.get_periodicity(),
         manifold_B.get_periodicity()))
-  , manifold_A(&manifold_A)
-  , manifold_B(&manifold_B)
-{}
+{
+  std::shared_ptr<Manifold<dim_A, spacedim_A>> tmpA(
+    std::move(manifold_A.clone()));
+  std::shared_ptr<Manifold<dim_B, spacedim_B>> tmpB(
+    std::move(manifold_B.clone()));
+  this->manifold_A =
+    std::static_pointer_cast<ChartManifold<dim_A, spacedim_A, chartdim_A>>(
+      tmpA);
+  this->manifold_B =
+    std::static_pointer_cast<ChartManifold<dim_B, spacedim_B, chartdim_B>>(
+      tmpB);
+}
 
 template <int dim,
           int dim_A,

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.