1 // ---------------------------------------------------------------------
3 // Copyright (C) 2020 by the deal.II authors
5 // This file is part of the deal.II library.
7 // The deal.II library is free software; you can use it, redistribute
8 // it, and/or modify it under the terms of the GNU Lesser General
9 // Public License as published by the Free Software Foundation; either
10 // version 2.1 of the License, or (at your option) any later version.
11 // The full text of the license can be found in the file LICENSE.md at
12 // the top level directory of deal.II.
14 // ---------------------------------------------------------------------
17 // Distribute Simplex::FE_Wedge on a DoFHandler.
19 #include <deal.II/dofs/dof_handler.h>
21 #include <deal.II/grid/grid_out.h>
22 #include <deal.II/grid/tria.h>
24 #include <deal.II/simplex/fe_lib.h>
28 using namespace dealii;
34 const int spacedim = 3;
36 std::vector<Point<spacedim>> vertices;
37 std::vector<CellData<dim>> cells;
40 vertices.emplace_back(0.0, 0.0, 0.0);
41 vertices.emplace_back(1.0, 0.0, 0.0);
42 vertices.emplace_back(0.0, 1.0, 0.0);
43 vertices.emplace_back(0.0, 0.0, 1.0);
44 vertices.emplace_back(1.0, 0.0, 1.0);
45 vertices.emplace_back(0.0, 1.0, 1.0);
49 cell.vertices = {0, 1, 2, 3, 4, 5};
50 cells.push_back(cell);
53 vertices.emplace_back(0.0, 0.0, 0.0);
54 vertices.emplace_back(1.0, 0.0, 0.0);
55 vertices.emplace_back(0.0, 1.0, 0.0);
56 vertices.emplace_back(1.0, 1.0, 0.0);
57 vertices.emplace_back(0.0, 0.0, 1.0);
58 vertices.emplace_back(1.0, 0.0, 1.0);
59 vertices.emplace_back(0.0, 1.0, 1.0);
60 vertices.emplace_back(1.0, 1.0, 1.0);
64 cell.vertices = {0, 1, 2, 4, 5, 6};
65 cells.push_back(cell);
69 cell.vertices = {2, 1, 3, 6, 5, 7};
70 cells.push_back(cell);
74 Triangulation<dim, spacedim> tria;
75 tria.create_triangulation(vertices, cells, SubCellData());
78 std::ofstream out("mesh.vtk");
79 grid_out.write_vtk(tria, out);
81 Simplex::FE_WedgeP<dim, spacedim> fe(2);
83 DoFHandler<dim, spacedim> dof_handler(tria);
84 dof_handler.distribute_dofs(fe);
86 deallog << dof_handler.n_dofs() << std::endl;
88 std::vector<types::global_dof_index> dof_indices;
89 for (const auto &cell : dof_handler.active_cell_iterators())
91 for (const auto face : cell->face_indices())
94 dof_indices.resize(face <= 1 ? 3 : 4);
96 dof_indices.resize(fe.n_dofs_per_face(face));
98 cell->face(face)->get_dof_indices(dof_indices);
100 for (const auto i : dof_indices)
102 deallog << std::endl;
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