alfeld_split_of_simplex_mesh(const Triangulation<dim, spacedim> &in_tria,
Triangulation<dim, spacedim> &out_tria)
{
- Assert(dim == 2, ExcNotImplemented());
-
Triangulation<dim, spacedim> temp_tria;
if (in_tria.n_global_levels() > 1)
{
vertex_ids_for_boundary_faces_2d = {
{{{{{0, 1}}}}, {{{{1, 2}}}}, {{{{2, 0}}}}}};
+ // Three tetrahedra connecting to barycenter with vertex index 4:
+ static const ndarray<unsigned int, 4, 4> table_3D_cell = {
+ {{{0, 1, 2, 4}}, {{1, 0, 3, 4}}, {{0, 2, 3, 4}}, {{2, 1, 3, 4}}}};
+
+ // Boundary-faces 3d:
+ // Each face of the original simplex is defined by the following vertices:
+ static const ndarray<unsigned int, 4, 2, 3>
+ vertex_ids_for_boundary_faces_3d = {
+ {{{{{0, 1, 2}}}}, {{{{1, 0, 3}}}}, {{{{0, 2, 3}}}}, {{{{2, 1, 3}}}}}};
+
+ // Boundary-lines 3d:
+ // Each line/edge of the original simplex is defined by the following
+ // vertices:
+ static const ndarray<unsigned int, 6, 2, 2>
+ vertex_ids_for_boundary_lines_3d = {{{{{{0, 1}}}},
+ {{{{1, 2}}}},
+ {{{{2, 0}}}},
+ {{{{0, 3}}}},
+ {{{{1, 3}}}},
+ {{{{2, 3}}}}}};
+
std::vector<Point<spacedim>> vertices;
std::vector<CellData<dim>> cells;
SubCellData subcell_data;
// temporary array storing the global indices of each cell entity in the
// sequence: vertices, edges/faces, cell
- std::array<unsigned int, 4> local_vertex_indices;
+ std::array<unsigned int, (dim == 3) ? 5 : 4> local_vertex_indices;
// (i) copy the existing vertex locations
Point<spacedim> barycenter;
}
// (ii) barycenter:
- local_vertex_indices[3] = vertices.size();
- vertices.push_back(barycenter / 3.);
+ local_vertex_indices[local_vertex_indices.size() - 1] = vertices.size();
+ vertices.push_back(barycenter / static_cast<double>(dim + 1));
// helper function for creating cells and subcells
const auto add_cell = [&](const unsigned int struct_dim,
};
const auto material_id_cell = cell->material_id();
+ const auto manifold_id_cell = cell->manifold_id();
// create cells one by one
if (dim == 2)
{
- // get cell-manifold id from current quad cell
- const auto manifold_id_cell = cell->manifold_id();
-
for (const auto &cell_vertices : table_2D_cell)
add_cell(dim, cell_vertices, material_id_cell, manifold_id_cell);
}
+ else if (dim == 3)
+ {
+ for (const auto &cell_vertices : table_3D_cell)
+ add_cell(dim, cell_vertices, material_id_cell, manifold_id_cell);
+ }
else
DEAL_II_NOT_IMPLEMENTED();
vertex_ids_for_boundary_faces_2d[f])
add_cell(1, face_vertices, bid, mid);
}
+ else if (dim == 3)
+ {
+ for (const auto &face_vertices :
+ vertex_ids_for_boundary_faces_3d[f])
+ add_cell(2, face_vertices, bid, mid);
+ }
else
DEAL_II_NOT_IMPLEMENTED();
}
+
+ // In 3D we need to treat boundary lines separately.
+ if (dim == 3)
+ {
+ for (const auto l : cell->line_indices())
+ {
+ const auto bid = cell->line(l)->boundary_id();
+ const auto mid = cell->line(l)->manifold_id();
+
+ for (const auto &line_vertices :
+ vertex_ids_for_boundary_lines_3d[l])
+ add_cell(1, line_vertices, bid, mid);
+ }
+ }
}
out_tria.clear();
LOOKUP_TABLE default
-1 -1 -1 -1 -1 -1 -1 -1
DEAL:2d::OK!
+# vtk DataFile Version 3.0
+Triangulation generated with deal.II
+ASCII
+DATASET UNSTRUCTURED_GRID
+POINTS 67 double
+0.00000 0.00000 0.00000
+0.500000 0.00000 0.00000
+0.00000 0.500000 0.00000
+0.00000 0.00000 0.500000
+0.125000 0.125000 0.125000
+0.500000 0.500000 0.00000
+0.500000 0.500000 0.500000
+0.375000 0.375000 0.125000
+0.500000 0.00000 0.500000
+0.375000 0.125000 0.375000
+0.00000 0.500000 0.500000
+0.125000 0.375000 0.375000
+0.250000 0.250000 0.250000
+1.00000 0.00000 0.00000
+1.00000 0.500000 0.00000
+1.00000 0.00000 0.500000
+0.875000 0.125000 0.125000
+0.625000 0.375000 0.125000
+0.625000 0.125000 0.375000
+1.00000 0.500000 0.500000
+0.875000 0.375000 0.375000
+0.750000 0.250000 0.250000
+0.500000 1.00000 0.00000
+0.375000 0.625000 0.125000
+0.00000 1.00000 0.00000
+0.00000 1.00000 0.500000
+0.125000 0.875000 0.125000
+0.125000 0.625000 0.375000
+0.500000 1.00000 0.500000
+0.375000 0.875000 0.375000
+0.250000 0.750000 0.250000
+0.625000 0.625000 0.125000
+1.00000 1.00000 0.00000
+1.00000 1.00000 0.500000
+0.875000 0.875000 0.125000
+0.875000 0.625000 0.375000
+0.625000 0.875000 0.375000
+0.750000 0.750000 0.250000
+0.500000 0.00000 1.00000
+0.375000 0.125000 0.625000
+0.00000 0.500000 1.00000
+0.125000 0.375000 0.625000
+0.00000 0.00000 1.00000
+0.125000 0.125000 0.875000
+0.500000 0.500000 1.00000
+0.375000 0.375000 0.875000
+0.250000 0.250000 0.750000
+0.625000 0.125000 0.625000
+1.00000 0.500000 1.00000
+0.875000 0.375000 0.625000
+1.00000 0.00000 1.00000
+0.875000 0.125000 0.875000
+0.625000 0.375000 0.875000
+0.750000 0.250000 0.750000
+0.125000 0.625000 0.625000
+0.500000 1.00000 1.00000
+0.375000 0.875000 0.625000
+0.375000 0.625000 0.875000
+0.00000 1.00000 1.00000
+0.125000 0.875000 0.875000
+0.250000 0.750000 0.750000
+0.875000 0.625000 0.625000
+0.625000 0.875000 0.625000
+0.625000 0.625000 0.875000
+1.00000 1.00000 1.00000
+0.875000 0.875000 0.875000
+0.750000 0.750000 0.750000
+
+CELLS 200 960
+4 0 1 2 4
+4 1 0 3 4
+4 0 2 3 4
+4 2 1 3 4
+4 2 1 5 7
+4 1 2 6 7
+4 2 5 6 7
+4 5 1 6 7
+4 1 3 8 9
+4 3 1 6 9
+4 1 8 6 9
+4 8 3 6 9
+4 2 3 6 11
+4 3 2 10 11
+4 2 6 10 11
+4 6 3 10 11
+4 1 2 3 12
+4 2 1 6 12
+4 1 3 6 12
+4 3 2 6 12
+4 1 13 14 16
+4 13 1 15 16
+4 1 14 15 16
+4 14 13 15 16
+4 1 14 5 17
+4 14 1 6 17
+4 1 5 6 17
+4 5 14 6 17
+4 1 8 15 18
+4 8 1 6 18
+4 1 15 6 18
+4 15 8 6 18
+4 14 15 19 20
+4 15 14 6 20
+4 14 19 6 20
+4 19 15 6 20
+4 1 14 6 21
+4 14 1 15 21
+4 1 6 15 21
+4 6 14 15 21
+4 2 5 22 23
+4 5 2 6 23
+4 2 22 6 23
+4 22 5 6 23
+4 2 22 24 26
+4 22 2 25 26
+4 2 24 25 26
+4 24 22 25 26
+4 2 10 6 27
+4 10 2 25 27
+4 2 6 25 27
+4 6 10 25 27
+4 22 6 28 29
+4 6 22 25 29
+4 22 28 25 29
+4 28 6 25 29
+4 2 22 25 30
+4 22 2 6 30
+4 2 25 6 30
+4 25 22 6 30
+4 5 14 22 31
+4 14 5 6 31
+4 5 22 6 31
+4 22 14 6 31
+4 22 14 32 34
+4 14 22 33 34
+4 22 32 33 34
+4 32 14 33 34
+4 14 6 19 35
+4 6 14 33 35
+4 14 19 33 35
+4 19 6 33 35
+4 22 6 33 36
+4 6 22 28 36
+4 22 33 28 36
+4 33 6 28 36
+4 14 22 6 37
+4 22 14 33 37
+4 14 6 33 37
+4 6 22 33 37
+4 3 8 6 39
+4 8 3 38 39
+4 3 6 38 39
+4 6 8 38 39
+4 3 6 10 41
+4 6 3 40 41
+4 3 10 40 41
+4 10 6 40 41
+4 3 42 38 43
+4 42 3 40 43
+4 3 38 40 43
+4 38 42 40 43
+4 6 38 44 45
+4 38 6 40 45
+4 6 44 40 45
+4 44 38 40 45
+4 3 6 40 46
+4 6 3 38 46
+4 3 40 38 46
+4 40 6 38 46
+4 8 15 6 47
+4 15 8 38 47
+4 8 6 38 47
+4 6 15 38 47
+4 6 15 19 49
+4 15 6 48 49
+4 6 19 48 49
+4 19 15 48 49
+4 15 38 50 51
+4 38 15 48 51
+4 15 50 48 51
+4 50 38 48 51
+4 6 38 48 52
+4 38 6 44 52
+4 6 48 44 52
+4 48 38 44 52
+4 15 6 38 53
+4 6 15 48 53
+4 15 38 48 53
+4 38 6 48 53
+4 10 6 25 54
+4 6 10 40 54
+4 10 25 40 54
+4 25 6 40 54
+4 25 6 28 56
+4 6 25 55 56
+4 25 28 55 56
+4 28 6 55 56
+4 6 40 44 57
+4 40 6 55 57
+4 6 44 55 57
+4 44 40 55 57
+4 25 40 55 59
+4 40 25 58 59
+4 25 55 58 59
+4 55 40 58 59
+4 6 25 40 60
+4 25 6 55 60
+4 6 40 55 60
+4 40 25 55 60
+4 6 19 33 61
+4 19 6 48 61
+4 6 33 48 61
+4 33 19 48 61
+4 6 33 28 62
+4 33 6 55 62
+4 6 28 55 62
+4 28 33 55 62
+4 6 44 48 63
+4 44 6 55 63
+4 6 48 55 63
+4 48 44 55 63
+4 33 48 64 65
+4 48 33 55 65
+4 33 64 55 65
+4 64 48 55 65
+4 6 33 55 66
+4 33 6 48 66
+4 6 55 48 66
+4 55 33 48 66
+3 1 0 3
+3 0 1 2
+3 2 1 5
+3 13 1 15
+3 1 13 14
+3 1 3 8
+3 8 3 38
+3 3 42 38
+3 2 5 22
+3 1 8 15
+3 15 8 38
+3 14 13 15
+3 1 14 5
+3 5 14 22
+3 14 15 19
+3 22 14 32
+3 32 14 33
+3 19 15 48
+3 14 19 33
+3 33 19 48
+3 2 22 24
+3 24 22 25
+3 22 33 28
+3 25 55 58
+3 22 28 25
+3 25 28 55
+3 22 32 33
+3 28 33 55
+3 33 48 64
+3 15 38 50
+3 44 38 40
+3 50 38 48
+3 38 42 40
+3 44 40 55
+3 48 38 44
+3 48 44 55
+3 64 48 55
+3 15 50 48
+3 55 40 58
+3 33 64 55
+
+CELL_TYPES 200
+10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10
+5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5
+
+
+CELL_DATA 200
+SCALARS MaterialID int 1
+LOOKUP_TABLE default
+0 0 0 0 1 1 1 1 2 2 2 2 3 3 3 3 4 4 4 4 5 5 5 5 6 6 6 6 7 7 7 7 8 8 8 8 9 9 9 9 10 10 10 10 11 11 11 11 12 12 12 12 13 13 13 13 14 14 14 14 15 15 15 15 16 16 16 16 17 17 17 17 18 18 18 18 19 19 19 19 20 20 20 20 21 21 21 21 22 22 22 22 23 23 23 23 24 24 24 24 25 25 25 25 26 26 26 26 27 27 27 27 28 28 28 28 29 29 29 29 30 30 30 30 31 31 31 31 32 32 32 32 33 33 33 33 34 34 34 34 35 35 35 35 36 36 36 36 37 37 37 37 38 38 38 38 39 39 39 39
+2 4 4 2 4 2 2 2 4 2 2 1 4 4 1 4 1 1 1 1 4 3 3 3 3 3 3 3 1 2 5 5 5 5 5 5 5 1 5 3
+
+
+SCALARS ManifoldID int 1
+LOOKUP_TABLE default
+-1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1
+-1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1
+
+# vtk DataFile Version 3.0
+Triangulation generated with deal.II
+ASCII
+DATASET UNSTRUCTURED_GRID
+POINTS 67 double
+0.00000 0.00000 0.00000
+0.500000 0.00000 0.00000
+0.00000 0.500000 0.00000
+0.00000 0.00000 0.500000
+0.125000 0.125000 0.125000
+0.500000 0.500000 0.00000
+0.500000 0.500000 0.500000
+0.375000 0.375000 0.125000
+0.500000 0.00000 0.500000
+0.375000 0.125000 0.375000
+0.00000 0.500000 0.500000
+0.125000 0.375000 0.375000
+0.250000 0.250000 0.250000
+1.00000 0.00000 0.00000
+1.00000 0.500000 0.00000
+1.00000 0.00000 0.500000
+0.875000 0.125000 0.125000
+0.625000 0.375000 0.125000
+0.625000 0.125000 0.375000
+1.00000 0.500000 0.500000
+0.875000 0.375000 0.375000
+0.750000 0.250000 0.250000
+0.500000 1.00000 0.00000
+0.375000 0.625000 0.125000
+0.00000 1.00000 0.00000
+0.00000 1.00000 0.500000
+0.125000 0.875000 0.125000
+0.125000 0.625000 0.375000
+0.500000 1.00000 0.500000
+0.375000 0.875000 0.375000
+0.250000 0.750000 0.250000
+0.625000 0.625000 0.125000
+1.00000 1.00000 0.00000
+1.00000 1.00000 0.500000
+0.875000 0.875000 0.125000
+0.875000 0.625000 0.375000
+0.625000 0.875000 0.375000
+0.750000 0.750000 0.250000
+0.500000 0.00000 1.00000
+0.375000 0.125000 0.625000
+0.00000 0.500000 1.00000
+0.125000 0.375000 0.625000
+0.00000 0.00000 1.00000
+0.125000 0.125000 0.875000
+0.500000 0.500000 1.00000
+0.375000 0.375000 0.875000
+0.250000 0.250000 0.750000
+0.625000 0.125000 0.625000
+1.00000 0.500000 1.00000
+0.875000 0.375000 0.625000
+1.00000 0.00000 1.00000
+0.875000 0.125000 0.875000
+0.625000 0.375000 0.875000
+0.750000 0.250000 0.750000
+0.125000 0.625000 0.625000
+0.500000 1.00000 1.00000
+0.375000 0.875000 0.625000
+0.375000 0.625000 0.875000
+0.00000 1.00000 1.00000
+0.125000 0.875000 0.875000
+0.250000 0.750000 0.750000
+0.875000 0.625000 0.625000
+0.625000 0.875000 0.625000
+0.625000 0.625000 0.875000
+1.00000 1.00000 1.00000
+0.875000 0.875000 0.875000
+0.750000 0.750000 0.750000
+
+CELLS 48 192
+3 1 0 3
+3 0 1 2
+3 2 1 5
+3 13 1 15
+3 1 13 14
+3 0 2 3
+3 3 2 10
+3 10 2 25
+3 1 3 8
+3 8 3 38
+3 42 3 40
+3 3 42 38
+3 2 5 22
+3 1 8 15
+3 15 8 38
+3 3 10 40
+3 14 13 15
+3 1 14 5
+3 5 14 22
+3 14 15 19
+3 22 14 32
+3 32 14 33
+3 19 15 48
+3 14 19 33
+3 33 19 48
+3 2 22 24
+3 24 22 25
+3 22 33 28
+3 2 24 25
+3 10 25 40
+3 40 25 58
+3 25 55 58
+3 22 28 25
+3 25 28 55
+3 22 32 33
+3 28 33 55
+3 33 48 64
+3 15 38 50
+3 44 38 40
+3 50 38 48
+3 38 42 40
+3 44 40 55
+3 48 38 44
+3 48 44 55
+3 64 48 55
+3 15 50 48
+3 55 40 58
+3 33 64 55
+
+CELL_TYPES 48
+5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5
+
+
+CELL_DATA 48
+SCALARS MaterialID int 1
+LOOKUP_TABLE default
+2 4 4 2 4 0 0 0 2 2 0 2 4 2 2 0 1 4 4 1 4 1 1 1 1 4 3 3 0 0 0 3 3 3 3 3 1 2 5 5 5 5 5 5 5 1 5 3
+
+
+SCALARS ManifoldID int 1
+LOOKUP_TABLE default
+-1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1
+DEAL:3d::OK!