--- /dev/null
+Improved: The apply_all_indicators_to_manifold flag in GridIn::read_ucd()
+lets the indicators be used for cells as manifold id as well.
+<br>
+(Daniel Arndt, 2019/03/16)
* manifold_id for the same cell. Yet it is possible to use
* the flag apply_all_indicators_to_manifolds to decide if
* the indicators in the file refer to manifolds (flag set to true)
- * or boundaries (flag set to false).
+ * or boundaries (flag set to false). If the flag is set, the
+ * indicators are used for cells as manifold id, too.
*/
void
read_ucd(std::istream &in,
Assert(material_id < numbers::invalid_material_id,
ExcIndexRange(material_id, 0, numbers::invalid_material_id));
+ if (apply_all_indicators_to_manifolds)
+ cells.back().manifold_id =
+ static_cast<types::manifold_id>(material_id);
cells.back().material_id =
static_cast<types::material_id>(material_id);
--- /dev/null
+// ---------------------------------------------------------------------
+//
+// Copyright (C) 2019 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.md at
+// the top level directory of deal.II.
+//
+// ---------------------------------------------------------------------
+
+// Test that cell manifold ids are also set for the
+// "apply_all_indicators_to_manifolds" option in GridIn::read_ucd
+
+#include <deal.II/dofs/dof_handler.h>
+
+#include <deal.II/grid/grid_generator.h>
+#include <deal.II/grid/grid_in.h>
+#include <deal.II/grid/grid_out.h>
+#include <deal.II/grid/manifold_lib.h>
+#include <deal.II/grid/tria.h>
+#include <deal.II/grid/tria_accessor.h>
+#include <deal.II/grid/tria_iterator.h>
+
+#include <sstream>
+#include <string>
+
+#include "../tests.h"
+
+template <int dim, int spacedim>
+void
+test(const std::string &filename)
+{
+ std::ifstream tmp_in(filename);
+ Triangulation<dim, spacedim> tria;
+ GridIn<dim, spacedim> gi;
+ gi.attach_triangulation(tria);
+ gi.read_ucd(tmp_in, true);
+ deallog << "Testing dim=" << dim << " spacedim=" << spacedim << std::endl;
+ for (const auto &cell : tria.active_cell_iterators())
+ {
+ deallog << "cell->manifold_id: " << cell->manifold_id() << std::endl;
+ if (dim > 1)
+ for (unsigned int face_no = 0;
+ face_no < GeometryInfo<dim>::faces_per_cell;
+ ++face_no)
+ deallog << "cell->face(" << face_no
+ << ")->manifold_id: " << cell->face(face_no)->manifold_id()
+ << std::endl;
+ if (dim > 1)
+ for (unsigned int line_no = 0;
+ line_no < GeometryInfo<dim>::lines_per_cell;
+ ++line_no)
+ deallog << "cell->line(" << line_no
+ << ")->manifold_id: " << cell->line(line_no)->manifold_id()
+ << std::endl;
+ }
+ deallog << std::endl;
+}
+
+int
+main()
+{
+ initlog();
+ deallog.get_file_stream() << std::setprecision(2);
+
+ test<1, 1>(SOURCE_DIR "/grid_in_ucd_02_grids/grid_1.inp");
+ test<1, 2>(SOURCE_DIR "/grid_in_ucd_02_grids/grid_1.inp");
+ test<1, 3>(SOURCE_DIR "/grid_in_ucd_02_grids/grid_1.inp");
+ test<2, 2>(SOURCE_DIR "/grid_in_ucd_02_grids/grid_2.inp");
+ test<2, 3>(SOURCE_DIR "/grid_in_ucd_02_grids/grid_2.inp");
+ test<3, 3>(SOURCE_DIR "/grid_in_ucd_02_grids/grid_3.inp");
+}
--- /dev/null
+
+DEAL::Testing dim=1 spacedim=1
+DEAL::cell->manifold_id: 99
+DEAL::
+DEAL::Testing dim=1 spacedim=2
+DEAL::cell->manifold_id: 99
+DEAL::
+DEAL::Testing dim=1 spacedim=3
+DEAL::cell->manifold_id: 99
+DEAL::
+DEAL::Testing dim=2 spacedim=2
+DEAL::cell->manifold_id: 99
+DEAL::cell->face(0)->manifold_id: 100
+DEAL::cell->face(1)->manifold_id: 100
+DEAL::cell->face(2)->manifold_id: 100
+DEAL::cell->face(3)->manifold_id: 100
+DEAL::cell->line(0)->manifold_id: 100
+DEAL::cell->line(1)->manifold_id: 100
+DEAL::cell->line(2)->manifold_id: 100
+DEAL::cell->line(3)->manifold_id: 100
+DEAL::
+DEAL::Testing dim=2 spacedim=3
+DEAL::cell->manifold_id: 99
+DEAL::cell->face(0)->manifold_id: 100
+DEAL::cell->face(1)->manifold_id: 100
+DEAL::cell->face(2)->manifold_id: 100
+DEAL::cell->face(3)->manifold_id: 100
+DEAL::cell->line(0)->manifold_id: 100
+DEAL::cell->line(1)->manifold_id: 100
+DEAL::cell->line(2)->manifold_id: 100
+DEAL::cell->line(3)->manifold_id: 100
+DEAL::
+DEAL::Testing dim=3 spacedim=3
+DEAL::cell->manifold_id: 99
+DEAL::cell->face(0)->manifold_id: 100
+DEAL::cell->face(1)->manifold_id: 100
+DEAL::cell->face(2)->manifold_id: 100
+DEAL::cell->face(3)->manifold_id: 100
+DEAL::cell->face(4)->manifold_id: 100
+DEAL::cell->face(5)->manifold_id: 100
+DEAL::cell->line(0)->manifold_id: 101
+DEAL::cell->line(1)->manifold_id: 101
+DEAL::cell->line(2)->manifold_id: 101
+DEAL::cell->line(3)->manifold_id: 101
+DEAL::cell->line(4)->manifold_id: 101
+DEAL::cell->line(5)->manifold_id: 101
+DEAL::cell->line(6)->manifold_id: 101
+DEAL::cell->line(7)->manifold_id: 101
+DEAL::cell->line(8)->manifold_id: 101
+DEAL::cell->line(9)->manifold_id: 101
+DEAL::cell->line(10)->manifold_id: 101
+DEAL::cell->line(11)->manifold_id: 101
+DEAL::
--- /dev/null
+2 1 0 0 0
+1 0 0 0
+2 1 0 0
+1 99 line 1 2
--- /dev/null
+4 5 0 0 0
+1 0 0 0
+2 1 0 0
+3 0 1 0
+4 1 1 0
+1 99 quad 1 2 4 3
+2 100 line 1 2
+3 100 line 2 4
+4 100 line 4 3
+5 100 line 3 1
+
--- /dev/null
+8 19 0 0 0
+1 0 0 0
+2 1 0 0
+3 0 1 0
+4 1 1 0
+5 0 0 1
+6 1 0 1
+7 0 1 1
+8 1 1 1
+1 99 hex 1 2 6 5 3 4 8 7
+2 100 quad 1 2 4 3
+3 100 quad 5 6 8 7
+4 100 quad 1 2 6 5
+5 100 quad 3 4 8 7
+6 100 quad 1 3 7 5
+7 100 quad 2 4 8 6
+8 101 line 1 2
+9 101 line 2 4
+10 101 line 4 3
+11 101 line 3 1
+12 101 line 5 6
+13 101 line 6 8
+14 101 line 8 7
+15 101 line 7 5
+16 101 line 1 5
+17 101 line 2 6
+18 101 line 3 7
+19 101 line 4 8
+
std::ifstream input_file(SOURCE_DIR "/grids/circle-grid.inp");
Assert(dim == 2, ExcInternalError());
- grid_in.read_ucd(input_file, true);
+ grid_in.read_ucd(input_file);
GridTools::copy_boundary_to_manifold_id(triangulation);
static const SphericalManifold<dim> boundary;