for (const auto &cell : tria.active_cell_iterators())
{
- for (auto f : GeometryInfo<dim>::face_indices())
+ for (auto f : cell->face_indices())
{
typename Triangulation<dim, spacedim>::face_iterator face =
cell->face(f);
{
out << cell->active_cell_index() + 1 << ' ' << elm_type << ' '
<< cell->material_id() << ' ' << cell->subdomain_id() << ' '
- << GeometryInfo<dim>::vertices_per_cell << ' ';
+ << cell->n_vertices() << ' ';
// Vertex numbering follows UCD conventions.
for (; cell != end; ++cell)
{
DataOutBase::Patch<dim, spacedim> patch;
- patch.n_subdivisions = 1;
- patch.data.reinit(5, GeometryInfo<dim>::vertices_per_cell);
+ patch.reference_cell_type = cell->reference_cell_type();
+ patch.n_subdivisions = 1;
+ patch.data.reinit(5, cell->n_vertices());
- for (const unsigned int v : GeometryInfo<dim>::vertex_indices())
+ for (const unsigned int v : cell->vertex_indices())
{
patch.vertices[v] = cell->vertex(v);
patch.data(0, v) = cell->level();
case 2:
{
for (const auto &cell : tria.active_cell_iterators())
- for (unsigned int line_no = 0;
- line_no < GeometryInfo<dim>::lines_per_cell;
- ++line_no)
+ for (const auto &line_no : cell->line_indices())
{
typename dealii::Triangulation<dim, spacedim>::line_iterator
line = cell->line(line_no);
for (const auto &cell : tria.active_cell_iterators())
- for (unsigned int line_no = 0;
- line_no < GeometryInfo<dim>::lines_per_cell;
- ++line_no)
+ for (const auto &line_no : cell->line_indices())
{
typename dealii::Triangulation<dim, spacedim>::line_iterator
line = cell->line(line_no);
// doing this multiply
std::set<unsigned int> treated_vertices;
for (const auto &cell : tria.active_cell_iterators())
- for (const unsigned int vertex :
- GeometryInfo<dim>::vertex_indices())
- if (treated_vertices.find(cell->vertex_index(vertex)) ==
+ for (const auto &vertex_no : cell->vertex_indices())
+ if (treated_vertices.find(cell->vertex_index(vertex_no)) ==
treated_vertices.end())
{
- treated_vertices.insert(cell->vertex_index(vertex));
+ treated_vertices.insert(cell->vertex_index(vertex_no));
- out << (cell->vertex(vertex)(0) - offset(0)) * scale << ' '
- << (cell->vertex(vertex)(1) - offset(1)) * scale << " m"
- << '\n'
+ out << (cell->vertex(vertex_no)(0) - offset(0)) * scale << ' '
+ << (cell->vertex(vertex_no)(1) - offset(1)) * scale
+ << " m" << '\n'
<< "[ [(Helvetica) 10.0 0.0 true true ("
- << cell->vertex_index(vertex) << ")] "
+ << cell->vertex_index(vertex_no) << ")] "
<< "] -6 MCshow" << '\n';
}
}
--- /dev/null
+// ---------------------------------------------------------------------
+//
+// Copyright (C) 2020 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.
+//
+// ---------------------------------------------------------------------
+
+
+// Write a file in the EPS format with (linear) triangular and tetrahedral
+// elements created by the GMSH program.
+
+#include <deal.II/grid/grid_in.h>
+#include <deal.II/grid/grid_out.h>
+#include <deal.II/grid/tria.h>
+
+#include <fstream>
+
+#include "../tests.h"
+
+template <int dim, int spacedim>
+void
+check_file(const std::string &file_name)
+{
+ Triangulation<dim, spacedim> tria;
+
+ GridIn<dim, spacedim> grid_in;
+ grid_in.attach_triangulation(tria);
+ std::ifstream input_file(file_name);
+ grid_in.read_vtk(input_file);
+
+ GridOut grid_out;
+#if false
+ std::ofstream out("mesh-" + std::to_string(spacedim) + ".eps");
+ grid_out.write_eps(tria, out);
+#else
+ grid_out.write_eps(tria, deallog.get_file_stream());
+#endif
+
+ deallog << "OK!" << std::endl;
+}
+
+
+int
+main()
+{
+ initlog();
+ // TRIANGULAR ELEMENTS
+ // dim = spacedim = 2
+ deallog.push("triangluar_elements_dim2_spacedim2: ");
+ check_file<2, 2>(std::string(SOURCE_DIR "/grid_in_vtk/tri.vtk"));
+ deallog.pop();
+
+ // TETRAHEDRAL ELEMENTS
+ // dim = spacedim = 3
+ deallog.push("tetrahedral_elements_dim3_spacedim3: ");
+ check_file<3, 3>(std::string(SOURCE_DIR "/grid_in_vtk/tet.vtk"));
+ deallog.pop();
+}
--- /dev/null
+
+%!PS-Adobe-2.0 EPSF-1.2
+%%Title: deal.II Output
+%%Creator: the deal.II library
+
+%%BoundingBox: 0 0 301 301
+/m {moveto} bind def
+/x {lineto stroke} bind def
+/b {0 0 0 setrgbcolor} def
+/r {1 0 0 setrgbcolor} def
+%%EndProlog
+
+0.500000 setlinewidth
+b 0.00000 0.00000 m 300.000 0.00000 x
+b 300.000 0.00000 m 150.000 150.000 x
+b 150.000 150.000 m 0.00000 0.00000 x
+b 0.00000 300.000 m 0.00000 0.00000 x
+b 150.000 150.000 m 0.00000 0.00000 x
+b 150.000 150.000 m 0.00000 300.000 x
+b 300.000 0.00000 m 300.000 300.000 x
+b 300.000 300.000 m 150.000 150.000 x
+b 300.000 0.00000 m 150.000 150.000 x
+b 300.000 300.000 m 0.00000 300.000 x
+b 150.000 150.000 m 0.00000 300.000 x
+b 300.000 300.000 m 150.000 150.000 x
+showpage
+DEAL:triangluar_elements_dim2_spacedim2: ::OK!
+%!PS-Adobe-2.0 EPSF-1.2
+%%Title: deal.II Output
+%%Creator: the deal.II library
+
+%%BoundingBox: 0 0 301 341
+/m {moveto} bind def
+/x {lineto stroke} bind def
+/b {0 0 0 setrgbcolor} def
+/r {1 0 0 setrgbcolor} def
+%%EndProlog
+
+0.500000 setlinewidth
+b 150.000 265.192 m 95.0962 122.548 x
+b 95.0962 122.548 m 204.904 217.644 x
+b 204.904 217.644 m 150.000 265.192 x
+b 150.000 265.192 m 245.096 142.644 x
+b 95.0962 122.548 m 245.096 142.644 x
+b 204.904 217.644 m 245.096 142.644 x
+b 95.0962 122.548 m 245.096 142.644 x
+b 95.0962 122.548 m 204.904 217.644 x
+b 204.904 217.644 m 245.096 142.644 x
+b 245.096 142.644 m 150.000 75.0000 x
+b 95.0962 122.548 m 150.000 75.0000 x
+b 204.904 217.644 m 150.000 75.0000 x
+b 204.904 217.644 m 54.9038 197.548 x
+b 54.9038 197.548 m 95.0962 122.548 x
+b 95.0962 122.548 m 204.904 217.644 x
+b 204.904 217.644 m 150.000 265.192 x
+b 54.9038 197.548 m 150.000 265.192 x
+b 150.000 265.192 m 95.0962 122.548 x
+b 204.904 217.644 m 54.9038 197.548 x
+b 95.0962 122.548 m 204.904 217.644 x
+b 54.9038 197.548 m 95.0962 122.548 x
+b 54.9038 197.548 m 150.000 75.0000 x
+b 204.904 217.644 m 150.000 75.0000 x
+b 95.0962 122.548 m 150.000 75.0000 x
+b 190.192 190.192 m 150.000 265.192 x
+b 150.000 265.192 m 300.000 285.289 x
+b 300.000 285.289 m 190.192 190.192 x
+b 190.192 190.192 m 245.096 142.644 x
+b 150.000 265.192 m 245.096 142.644 x
+b 300.000 285.289 m 245.096 142.644 x
+b 109.808 150.000 m 54.9038 197.548 x
+b 204.904 217.644 m 54.9038 197.548 x
+b 204.904 217.644 m 109.808 150.000 x
+b 109.808 150.000 m 109.808 340.192 x
+b 54.9038 197.548 m 109.808 340.192 x
+b 204.904 217.644 m 109.808 340.192 x
+b 0.00000 54.9038 m 54.9038 197.548 x
+b 54.9038 197.548 m 7.03853e-15 245.096 x
+b 7.03853e-15 245.096 m 0.00000 54.9038 x
+b 0.00000 54.9038 m 95.0962 122.548 x
+b 54.9038 197.548 m 95.0962 122.548 x
+b 7.03853e-15 245.096 m 95.0962 122.548 x
+b 54.9038 197.548 m 7.03853e-15 245.096 x
+b 54.9038 197.548 m 109.808 340.192 x
+b 109.808 340.192 m 7.03853e-15 245.096 x
+b 7.03853e-15 245.096 m 150.000 265.192 x
+b 54.9038 197.548 m 150.000 265.192 x
+b 109.808 340.192 m 150.000 265.192 x
+b 190.192 190.192 m 95.0962 122.548 x
+b 7.03853e-15 245.096 m 95.0962 122.548 x
+b 7.03853e-15 245.096 m 190.192 190.192 x
+b 190.192 190.192 m 150.000 265.192 x
+b 150.000 265.192 m 95.0962 122.548 x
+b 7.03853e-15 245.096 m 150.000 265.192 x
+b 190.192 190.192 m 245.096 142.644 x
+b 190.192 190.192 m 95.0962 122.548 x
+b 95.0962 122.548 m 245.096 142.644 x
+b 245.096 142.644 m 190.192 0.00000 x
+b 190.192 190.192 m 190.192 0.00000 x
+b 95.0962 122.548 m 190.192 0.00000 x
+b 204.904 217.644 m 109.808 340.192 x
+b 109.808 340.192 m 150.000 265.192 x
+b 204.904 217.644 m 150.000 265.192 x
+b 204.904 217.644 m 300.000 285.289 x
+b 109.808 340.192 m 300.000 285.289 x
+b 150.000 265.192 m 300.000 285.289 x
+b 204.904 217.644 m 245.096 142.644 x
+b 204.904 217.644 m 300.000 285.289 x
+b 300.000 285.289 m 245.096 142.644 x
+b 245.096 142.644 m 300.000 95.0962 x
+b 204.904 217.644 m 300.000 95.0962 x
+b 300.000 285.289 m 300.000 95.0962 x
+b 0.00000 54.9038 m 109.808 150.000 x
+b 109.808 150.000 m 54.9038 197.548 x
+b 0.00000 54.9038 m 54.9038 197.548 x
+b 0.00000 54.9038 m 150.000 75.0000 x
+b 109.808 150.000 m 150.000 75.0000 x
+b 54.9038 197.548 m 150.000 75.0000 x
+b 204.904 217.644 m 109.808 150.000 x
+b 109.808 150.000 m 300.000 95.0962 x
+b 204.904 217.644 m 300.000 95.0962 x
+b 204.904 217.644 m 150.000 75.0000 x
+b 109.808 150.000 m 150.000 75.0000 x
+b 300.000 95.0962 m 150.000 75.0000 x
+b 300.000 95.0962 m 150.000 75.0000 x
+b 245.096 142.644 m 300.000 95.0962 x
+b 245.096 142.644 m 150.000 75.0000 x
+b 150.000 75.0000 m 190.192 0.00000 x
+b 300.000 95.0962 m 190.192 0.00000 x
+b 245.096 142.644 m 190.192 0.00000 x
+b 95.0962 122.548 m 150.000 75.0000 x
+b 0.00000 54.9038 m 95.0962 122.548 x
+b 0.00000 54.9038 m 150.000 75.0000 x
+b 150.000 75.0000 m 190.192 0.00000 x
+b 95.0962 122.548 m 190.192 0.00000 x
+b 0.00000 54.9038 m 190.192 0.00000 x
+b 190.192 190.192 m 150.000 265.192 x
+b 190.192 190.192 m 95.0962 122.548 x
+b 150.000 265.192 m 95.0962 122.548 x
+b 150.000 265.192 m 245.096 142.644 x
+b 190.192 190.192 m 245.096 142.644 x
+b 95.0962 122.548 m 245.096 142.644 x
+b 204.904 217.644 m 54.9038 197.548 x
+b 204.904 217.644 m 109.808 340.192 x
+b 54.9038 197.548 m 109.808 340.192 x
+b 54.9038 197.548 m 150.000 265.192 x
+b 204.904 217.644 m 150.000 265.192 x
+b 109.808 340.192 m 150.000 265.192 x
+b 150.000 265.192 m 300.000 285.289 x
+b 204.904 217.644 m 150.000 265.192 x
+b 204.904 217.644 m 300.000 285.289 x
+b 300.000 285.289 m 245.096 142.644 x
+b 150.000 265.192 m 245.096 142.644 x
+b 204.904 217.644 m 245.096 142.644 x
+b 54.9038 197.548 m 7.03853e-15 245.096 x
+b 7.03853e-15 245.096 m 95.0962 122.548 x
+b 54.9038 197.548 m 95.0962 122.548 x
+b 54.9038 197.548 m 150.000 265.192 x
+b 7.03853e-15 245.096 m 150.000 265.192 x
+b 150.000 265.192 m 95.0962 122.548 x
+b 0.00000 54.9038 m 95.0962 122.548 x
+b 0.00000 54.9038 m 54.9038 197.548 x
+b 54.9038 197.548 m 95.0962 122.548 x
+b 95.0962 122.548 m 150.000 75.0000 x
+b 0.00000 54.9038 m 150.000 75.0000 x
+b 54.9038 197.548 m 150.000 75.0000 x
+b 204.904 217.644 m 54.9038 197.548 x
+b 109.808 150.000 m 54.9038 197.548 x
+b 204.904 217.644 m 109.808 150.000 x
+b 204.904 217.644 m 150.000 75.0000 x
+b 54.9038 197.548 m 150.000 75.0000 x
+b 109.808 150.000 m 150.000 75.0000 x
+b 245.096 142.644 m 300.000 95.0962 x
+b 204.904 217.644 m 245.096 142.644 x
+b 204.904 217.644 m 300.000 95.0962 x
+b 300.000 95.0962 m 150.000 75.0000 x
+b 245.096 142.644 m 150.000 75.0000 x
+b 204.904 217.644 m 150.000 75.0000 x
+b 245.096 142.644 m 150.000 75.0000 x
+b 95.0962 122.548 m 245.096 142.644 x
+b 95.0962 122.548 m 150.000 75.0000 x
+b 150.000 75.0000 m 190.192 0.00000 x
+b 245.096 142.644 m 190.192 0.00000 x
+b 95.0962 122.548 m 190.192 0.00000 x
+showpage
+DEAL:tetrahedral_elements_dim3_spacedim3: ::OK!