* Collection of manifold objects. We store only objects, which are not of
* type FlatManifold.
*/
- std::map<types::manifold_id, SmartPointer<const Manifold<dim,spacedim>, Triangulation<dim, spacedim> > > manifold;
-
+ std::map<types::manifold_id, std::unique_ptr<const Manifold<dim,spacedim> > > manifold;
/**
* Flag indicating whether anisotropic refinement took place.
Assert(m_number < numbers::invalid_manifold_id,
ExcIndexRange(m_number,0,numbers::invalid_manifold_id));
- manifold[m_number] = &manifold_object;
+ manifold[m_number] = manifold_object.clone();
}
{
//look, if there is a manifold stored at
//manifold_id number.
- typename std::map<types::manifold_id, SmartPointer<const Manifold<dim,spacedim>, Triangulation<dim, spacedim> > >::const_iterator it
- = manifold.find(m_number);
+ const auto it = manifold.find(m_number);
if (it != manifold.end())
{
if (dim > 1)
faces = std_cxx14::make_unique<internal::TriangulationImplementation::TriaFaces<dim>> (*other_tria.faces);
- typename std::map<types::manifold_id,
- SmartPointer<const Manifold<dim,spacedim>, Triangulation<dim, spacedim> > >::const_iterator
- bdry_iterator = other_tria.manifold.begin();
+ auto bdry_iterator = other_tria.manifold.begin();
for (; bdry_iterator != other_tria.manifold.end() ; ++bdry_iterator)
- manifold[bdry_iterator->first] = bdry_iterator->second;
+ manifold[bdry_iterator->first] = bdry_iterator->second->clone();
levels.reserve (other_tria.levels.size());
--- /dev/null
+// ---------------------------------------------------------------------
+//
+// Copyright (C) 2018 by the deal.II authors
+//
+// This file is part of the deal.II library.
+//
+// The deal.II library is free software; you can use it, redistribute
+// it, and/or modify it under the terms of the GNU Lesser General
+// Public License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+// The full text of the license can be found in the file LICENSE at
+// the top level of the deal.II distribution.
+//
+// ---------------------------------------------------------------------
+
+// Check that now it is possible to build a mesh and a manifold in the
+// "wrong" order.
+
+#include "../tests.h"
+
+#include <deal.II/base/utilities.h>
+#include <deal.II/grid/manifold_lib.h>
+#include <deal.II/grid/grid_generator.h>
+#include <deal.II/grid/grid_tools.h>
+#include <deal.II/grid/grid_out.h>
+
+int main()
+{
+ initlog();
+
+ // We intentionally create the tria before the manifold, to make sure
+ // that now it is possible to do so, since manifold is cloned internally
+ // in the Triangulation
+
+ Triangulation<2> tria;
+
+ Point<2> center(1.0, 2.0);
+ const SphericalManifold<2,2> manifold(center);
+
+ GridGenerator::hyper_ball(tria, center);
+ GridTools::copy_boundary_to_manifold_id(tria);
+
+ tria.set_manifold(0, manifold);
+ tria.refine_global(1);
+
+ GridOut go;
+ go.write_msh(tria, deallog.get_file_stream());
+}
--- /dev/null
+
+$NOD
+25
+1 0.292893 1.29289 0
+2 1.70711 1.29289 0
+3 0.707107 1.70711 0
+4 1.29289 1.70711 0
+5 0.707107 2.29289 0
+6 1.29289 2.29289 0
+7 0.292893 2.70711 0
+8 1.70711 2.70711 0
+9 1.00000 1.00000 0
+10 0.500000 1.50000 0
+11 1.11022e-16 2.00000 0
+12 1.50000 1.50000 0
+13 2.00000 2.00000 0
+14 1.00000 1.70711 0
+15 0.707107 2.00000 0
+16 1.29289 2.00000 0
+17 1.00000 2.29289 0
+18 0.500000 2.50000 0
+19 1.00000 3.00000 0
+20 1.50000 2.50000 0
+21 1.00000 1.35355 0
+22 0.353553 2.00000 0
+23 1.00000 2.00000 0
+24 1.64645 2.00000 0
+25 1.00000 2.64645 0
+$ENDNOD
+$ELM
+20
+1 3 0 0 4 1 9 21 10
+2 3 0 0 4 9 2 12 21
+3 3 0 0 4 10 21 14 3
+4 3 0 0 4 21 12 4 14
+5 3 0 0 4 1 10 22 11
+6 3 0 0 4 10 3 15 22
+7 3 0 0 4 11 22 18 7
+8 3 0 0 4 22 15 5 18
+9 3 0 0 4 3 14 23 15
+10 3 0 0 4 14 4 16 23
+11 3 0 0 4 15 23 17 5
+12 3 0 0 4 23 16 6 17
+13 3 0 0 4 2 13 24 12
+14 3 0 0 4 13 8 20 24
+15 3 0 0 4 12 24 16 4
+16 3 0 0 4 24 20 6 16
+17 3 0 0 4 7 18 25 19
+18 3 0 0 4 18 5 17 25
+19 3 0 0 4 19 25 20 8
+20 3 0 0 4 25 17 6 20
+$ENDELM