From 5ec0d1f84008121d40ab5d65625be1d6fcf58df4 Mon Sep 17 00:00:00 2001 From: Wolfgang Bangerth Date: Mon, 27 Dec 2021 21:30:11 -0700 Subject: [PATCH] Add some assertions. --- source/grid/grid_generator.cc | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/source/grid/grid_generator.cc b/source/grid/grid_generator.cc index 1625a626b6..6ead87183d 100644 --- a/source/grid/grid_generator.cc +++ b/source/grid/grid_generator.cc @@ -7808,6 +7808,7 @@ namespace GridGenerator vertices.push_back(cell.vertex(v)); } + AssertIndexRange(v, local_vertex_indices.size()); local_vertex_indices[v] = old_to_new_vertex_indices[v_global]; } @@ -7824,6 +7825,8 @@ namespace GridGenerator cell.face(f)->center(/*respect_manifold*/ true)); } + AssertIndexRange(cell.n_vertices() + f, + local_vertex_indices.size()); local_vertex_indices[cell.n_vertices() + f] = face_to_new_vertex_indices[f_global]; } @@ -7831,6 +7834,8 @@ namespace GridGenerator // (iii) create new midpoint vertex locations for each cell if (dim == 2) { + AssertIndexRange(cell.n_vertices() + cell.n_faces(), + local_vertex_indices.size()); local_vertex_indices[cell.n_vertices() + cell.n_faces()] = vertices.size(); vertices.push_back(cell.center(/*respect_manifold*/ true)); @@ -7862,6 +7867,8 @@ namespace GridGenerator CellData cell_data(index_vertices.size()); for (unsigned int i = 0; i < index_vertices.size(); ++i) { + AssertIndexRange(index_vertices[i], + local_vertex_indices.size()); cell_data.vertices[i] = local_vertex_indices[index_vertices[i]]; cell_data.material_id = @@ -7879,6 +7886,8 @@ namespace GridGenerator boundary_line.manifold_id = manifold_id; for (unsigned int i = 0; i < index_vertices.size(); ++i) { + AssertIndexRange(index_vertices[i], + local_vertex_indices.size()); boundary_line.vertices[i] = local_vertex_indices[index_vertices[i]]; } @@ -7892,6 +7901,8 @@ namespace GridGenerator boundary_quad.manifold_id = manifold_id; for (unsigned int i = 0; i < index_vertices.size(); ++i) { + AssertIndexRange(index_vertices[i], + local_vertex_indices.size()); boundary_quad.vertices[i] = local_vertex_indices[index_vertices[i]]; } @@ -7904,6 +7915,8 @@ namespace GridGenerator boundary_line.manifold_id = manifold_id; for (unsigned int i = 0; i < index_vertices.size(); ++i) { + AssertIndexRange(index_vertices[i], + local_vertex_indices.size()); boundary_line.vertices[i] = local_vertex_indices[index_vertices[i]]; } @@ -7988,7 +8001,6 @@ namespace GridGenerator vertex_ids_for_boundary_edges_3d[f]) add_cell(1, edge_vertices, bid, mid); } - else Assert(false, ExcNotImplemented()); } -- 2.39.5