From 0c8491a0dba2a29e5f03ee8a8fa244678904acee Mon Sep 17 00:00:00 2001 From: Alex Dutka <97711898+dutkalex@users.noreply.github.com> Date: Wed, 19 Nov 2025 15:23:26 +0100 Subject: [PATCH 01/21] make casts explicit --- src/t8_cmesh/t8_cmesh_readmshfile.cxx | 10 +++++----- .../t8_cmesh_vertex_conn_tree_to_vertex.hxx | 2 +- .../t8_cmesh_vertex_conn_vertex_to_tree.hxx | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/t8_cmesh/t8_cmesh_readmshfile.cxx b/src/t8_cmesh/t8_cmesh_readmshfile.cxx index a3ed420764..ab2be52d39 100644 --- a/src/t8_cmesh/t8_cmesh_readmshfile.cxx +++ b/src/t8_cmesh/t8_cmesh_readmshfile.cxx @@ -450,7 +450,7 @@ t8_msh_file_2_read_nodes (FILE *fp) return std::nullopt; } /* Fill the node with the entries in the file */ - retval = sscanf (line, "%li %lf %lf %lf", &index, &coords[0], &coords[1], &coords[2]); + retval = sscanf (line, "%li %lf %lf %lf", reinterpret_cast(&index), &coords[0], &coords[1], &coords[2]); if (retval != 4) { t8_global_errorf ("Error reading node file after node %li.\n", (long) last_index); free (line); @@ -461,7 +461,7 @@ t8_msh_file_2_read_nodes (FILE *fp) /* If second value is false then the node was already in the hash table. * This case should not occur. */ if (emplaced.second == false) { - t8_global_errorf ("Node %li defined more than once.\n", index); + t8_global_errorf ("Node %li defined more than once.\n", static_cast(index)); free (line); return std::nullopt; } @@ -741,7 +741,7 @@ t8_cmesh_msh_file_2_read_eles (t8_cmesh_t cmesh, FILE *fp, const t8_msh_node_tab for (int i_node = 0; i_node < num_nodes; i_node++) { const int t8_vertex_num = t8_msh_tree_vertex_to_t8_vertex_num[eclass][i_node]; T8_ASSERT (strcmp (line_modify, "\0")); - retval = sscanf (line_modify, "%li", &node_indices[t8_vertex_num]); + retval = sscanf (line_modify, "%li", reinterpret_cast(&node_indices[t8_vertex_num])); if (retval != 1) { t8_global_errorf ("Premature end of line while reading tree.\n"); t8_debugf ("The line is %s", line); @@ -754,7 +754,7 @@ t8_cmesh_msh_file_2_read_eles (t8_cmesh_t cmesh, FILE *fp, const t8_msh_node_tab Node.index = node_indices[t8_vertex_num]; const auto found_node = vertices.find (Node); if (found_node == vertices.end ()) { - t8_global_errorf ("Could not find Node %li.\n", node_indices[t8_vertex_num]); + t8_global_errorf ("Could not find Node %li.\n", static_cast(node_indices[t8_vertex_num])); free (line); t8_cmesh_destroy (&cmesh); return std::nullopt; @@ -1560,7 +1560,7 @@ t8_cmesh_msh_file_4_read_eles (t8_cmesh_t cmesh, FILE *fp, const t8_msh_node_tab for (int i_node = 0; i_node < num_nodes; i_node++) { const int t8_vertex_num = t8_msh_tree_vertex_to_t8_vertex_num[eclass][i_node]; T8_ASSERT (strcmp (line_modify, "\0")); - retval = sscanf (line_modify, "%li", &node_indices[t8_vertex_num]); + retval = sscanf (line_modify, "%li", reinterpret_cast(&node_indices[t8_vertex_num])); if (retval != 1) { t8_global_errorf ("Premature end of line while reading tree.\n"); t8_debugf ("The line is %s", line); diff --git a/src/t8_cmesh/t8_cmesh_vertex_connectivity/t8_cmesh_vertex_conn_tree_to_vertex.hxx b/src/t8_cmesh/t8_cmesh_vertex_connectivity/t8_cmesh_vertex_conn_tree_to_vertex.hxx index 7780ac21af..3c6726ba9d 100644 --- a/src/t8_cmesh/t8_cmesh_vertex_connectivity/t8_cmesh_vertex_conn_tree_to_vertex.hxx +++ b/src/t8_cmesh/t8_cmesh_vertex_connectivity/t8_cmesh_vertex_conn_tree_to_vertex.hxx @@ -112,7 +112,7 @@ class t8_cmesh_vertex_conn_tree_to_vertex { /* We copy the data directly, hence set data_persiss to 0 */ const int data_persists = 0; - t8_debugf ("Setting %i global vertices for global tree %li.\n", num_vertices, global_tree); + t8_debugf ("Setting %i global vertices for global tree %li.\n", num_vertices, static_cast(global_tree)); t8_cmesh_set_attribute_gloidx_array (cmesh, global_tree, t8_get_package_id (), T8_CMESH_GLOBAL_VERTICES_ATTRIBUTE_KEY, global_tree_vertices, num_vertices, data_persists); diff --git a/src/t8_cmesh/t8_cmesh_vertex_connectivity/t8_cmesh_vertex_conn_vertex_to_tree.hxx b/src/t8_cmesh/t8_cmesh_vertex_connectivity/t8_cmesh_vertex_conn_vertex_to_tree.hxx index 14a2f1c7a1..62fb5972cd 100644 --- a/src/t8_cmesh/t8_cmesh_vertex_connectivity/t8_cmesh_vertex_conn_vertex_to_tree.hxx +++ b/src/t8_cmesh/t8_cmesh_vertex_connectivity/t8_cmesh_vertex_conn_vertex_to_tree.hxx @@ -115,7 +115,7 @@ class t8_cmesh_vertex_conn_vertex_to_tree { try { return vertex_to_tree.at (global_vertex_id); } catch (const std::out_of_range& e) { - t8_errorf ("ERROR: Could not find vertex %li for cmesh.\n", global_vertex_id); + t8_errorf ("ERROR: Could not find vertex %li for cmesh.\n", static_cast(global_vertex_id)); SC_ABORTF ("Caught exception 'out of range': %s\n", e.what ()); } } From a4574a06b411541c013762b5449487267c5d1fe6 Mon Sep 17 00:00:00 2001 From: Alex Dutka <97711898+dutkalex@users.noreply.github.com> Date: Wed, 19 Nov 2025 15:23:52 +0100 Subject: [PATCH 02/21] annotate unused array --- src/t8_cmesh/t8_cmesh_readmshfile.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/t8_cmesh/t8_cmesh_readmshfile.cxx b/src/t8_cmesh/t8_cmesh_readmshfile.cxx index ab2be52d39..75bca45b50 100644 --- a/src/t8_cmesh/t8_cmesh_readmshfile.cxx +++ b/src/t8_cmesh/t8_cmesh_readmshfile.cxx @@ -76,7 +76,7 @@ const int t8_msh_tree_vertex_to_t8_vertex_num[T8_ECLASS_COUNT][8] = { /* translate the t8code vertex number to the .msh file vertex number. * See also http://gmsh.info/doc/texinfo/gmsh.html#Node-ordering */ -const int t8_vertex_to_msh_vertex_num[T8_ECLASS_COUNT][8] = { +[[maybe_unused]] const int t8_vertex_to_msh_vertex_num[T8_ECLASS_COUNT][8] = { { 0 }, /* VERTEX */ { 0, 1 }, /* LINE */ { 0, 1, 3, 2 }, /* QUAD */ From d6137814e700ab19bdc7484568861fb02996f589 Mon Sep 17 00:00:00 2001 From: Alex Dutka <97711898+dutkalex@users.noreply.github.com> Date: Wed, 19 Nov 2025 15:25:08 +0100 Subject: [PATCH 03/21] indent --- src/t8_cmesh/t8_cmesh_readmshfile.cxx | 10 +++++----- .../t8_cmesh_vertex_conn_tree_to_vertex.hxx | 2 +- .../t8_cmesh_vertex_conn_vertex_to_tree.hxx | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/t8_cmesh/t8_cmesh_readmshfile.cxx b/src/t8_cmesh/t8_cmesh_readmshfile.cxx index 75bca45b50..62be06b1c7 100644 --- a/src/t8_cmesh/t8_cmesh_readmshfile.cxx +++ b/src/t8_cmesh/t8_cmesh_readmshfile.cxx @@ -450,7 +450,7 @@ t8_msh_file_2_read_nodes (FILE *fp) return std::nullopt; } /* Fill the node with the entries in the file */ - retval = sscanf (line, "%li %lf %lf %lf", reinterpret_cast(&index), &coords[0], &coords[1], &coords[2]); + retval = sscanf (line, "%li %lf %lf %lf", reinterpret_cast (&index), &coords[0], &coords[1], &coords[2]); if (retval != 4) { t8_global_errorf ("Error reading node file after node %li.\n", (long) last_index); free (line); @@ -461,7 +461,7 @@ t8_msh_file_2_read_nodes (FILE *fp) /* If second value is false then the node was already in the hash table. * This case should not occur. */ if (emplaced.second == false) { - t8_global_errorf ("Node %li defined more than once.\n", static_cast(index)); + t8_global_errorf ("Node %li defined more than once.\n", static_cast (index)); free (line); return std::nullopt; } @@ -741,7 +741,7 @@ t8_cmesh_msh_file_2_read_eles (t8_cmesh_t cmesh, FILE *fp, const t8_msh_node_tab for (int i_node = 0; i_node < num_nodes; i_node++) { const int t8_vertex_num = t8_msh_tree_vertex_to_t8_vertex_num[eclass][i_node]; T8_ASSERT (strcmp (line_modify, "\0")); - retval = sscanf (line_modify, "%li", reinterpret_cast(&node_indices[t8_vertex_num])); + retval = sscanf (line_modify, "%li", reinterpret_cast (&node_indices[t8_vertex_num])); if (retval != 1) { t8_global_errorf ("Premature end of line while reading tree.\n"); t8_debugf ("The line is %s", line); @@ -754,7 +754,7 @@ t8_cmesh_msh_file_2_read_eles (t8_cmesh_t cmesh, FILE *fp, const t8_msh_node_tab Node.index = node_indices[t8_vertex_num]; const auto found_node = vertices.find (Node); if (found_node == vertices.end ()) { - t8_global_errorf ("Could not find Node %li.\n", static_cast(node_indices[t8_vertex_num])); + t8_global_errorf ("Could not find Node %li.\n", static_cast (node_indices[t8_vertex_num])); free (line); t8_cmesh_destroy (&cmesh); return std::nullopt; @@ -1560,7 +1560,7 @@ t8_cmesh_msh_file_4_read_eles (t8_cmesh_t cmesh, FILE *fp, const t8_msh_node_tab for (int i_node = 0; i_node < num_nodes; i_node++) { const int t8_vertex_num = t8_msh_tree_vertex_to_t8_vertex_num[eclass][i_node]; T8_ASSERT (strcmp (line_modify, "\0")); - retval = sscanf (line_modify, "%li", reinterpret_cast(&node_indices[t8_vertex_num])); + retval = sscanf (line_modify, "%li", reinterpret_cast (&node_indices[t8_vertex_num])); if (retval != 1) { t8_global_errorf ("Premature end of line while reading tree.\n"); t8_debugf ("The line is %s", line); diff --git a/src/t8_cmesh/t8_cmesh_vertex_connectivity/t8_cmesh_vertex_conn_tree_to_vertex.hxx b/src/t8_cmesh/t8_cmesh_vertex_connectivity/t8_cmesh_vertex_conn_tree_to_vertex.hxx index 3c6726ba9d..9278ffc23d 100644 --- a/src/t8_cmesh/t8_cmesh_vertex_connectivity/t8_cmesh_vertex_conn_tree_to_vertex.hxx +++ b/src/t8_cmesh/t8_cmesh_vertex_connectivity/t8_cmesh_vertex_conn_tree_to_vertex.hxx @@ -112,7 +112,7 @@ class t8_cmesh_vertex_conn_tree_to_vertex { /* We copy the data directly, hence set data_persiss to 0 */ const int data_persists = 0; - t8_debugf ("Setting %i global vertices for global tree %li.\n", num_vertices, static_cast(global_tree)); + t8_debugf ("Setting %i global vertices for global tree %li.\n", num_vertices, static_cast (global_tree)); t8_cmesh_set_attribute_gloidx_array (cmesh, global_tree, t8_get_package_id (), T8_CMESH_GLOBAL_VERTICES_ATTRIBUTE_KEY, global_tree_vertices, num_vertices, data_persists); diff --git a/src/t8_cmesh/t8_cmesh_vertex_connectivity/t8_cmesh_vertex_conn_vertex_to_tree.hxx b/src/t8_cmesh/t8_cmesh_vertex_connectivity/t8_cmesh_vertex_conn_vertex_to_tree.hxx index 62fb5972cd..2806d717b4 100644 --- a/src/t8_cmesh/t8_cmesh_vertex_connectivity/t8_cmesh_vertex_conn_vertex_to_tree.hxx +++ b/src/t8_cmesh/t8_cmesh_vertex_connectivity/t8_cmesh_vertex_conn_vertex_to_tree.hxx @@ -115,7 +115,7 @@ class t8_cmesh_vertex_conn_vertex_to_tree { try { return vertex_to_tree.at (global_vertex_id); } catch (const std::out_of_range& e) { - t8_errorf ("ERROR: Could not find vertex %li for cmesh.\n", static_cast(global_vertex_id)); + t8_errorf ("ERROR: Could not find vertex %li for cmesh.\n", static_cast (global_vertex_id)); SC_ABORTF ("Caught exception 'out of range': %s\n", e.what ()); } } From 5455b74a91db1066a2c9bb61c9c965ed256b0902 Mon Sep 17 00:00:00 2001 From: Alex Dutka <97711898+dutkalex@users.noreply.github.com> Date: Wed, 19 Nov 2025 15:47:54 +0100 Subject: [PATCH 04/21] fix broken conditionals --- benchmarks/t8_time_fractal.cxx | 2 +- example/remove/t8_example_gauss_blob.cxx | 6 +++--- example/remove/t8_example_spheres.cxx | 12 ++++++------ 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/benchmarks/t8_time_fractal.cxx b/benchmarks/t8_time_fractal.cxx index 46619290fc..d7d6893e62 100644 --- a/benchmarks/t8_time_fractal.cxx +++ b/benchmarks/t8_time_fractal.cxx @@ -455,7 +455,7 @@ main (int argc, char **argv) } else if (parsed >= 0 && level_initial >= 0 && level_initial < level_end && (iterative == 0 || iterative == 1) && (remove == 0 || remove == 1) && (output == 0 || output == 1) && coarse >= 0 && trees > 0 - && (eclass_int > 1 || eclass_int < 8) && runs > 0) { + && (eclass_int > 1 && eclass_int < 8) && runs > 0) { t8_construct_fractal (level_initial, level_end, iterative, remove, trees, (t8_eclass_t) eclass_int, output, coarse, runs); } diff --git a/example/remove/t8_example_gauss_blob.cxx b/example/remove/t8_example_gauss_blob.cxx index ffa95be8cb..693e83e27d 100644 --- a/example/remove/t8_example_gauss_blob.cxx +++ b/example/remove/t8_example_gauss_blob.cxx @@ -153,7 +153,7 @@ t8_construct_spheres (const int initial_level, const double radius_inner, const t8_3D_point midpoint ({ 0.5, 0.5, 0.5 }); - /* On each face of a cube, a sphere rises halfway in. + /* On each face of a cube, a sphere rises halfway in. * Its center is therefore the center of the corresponding surface. */ struct t8_adapt_data adapt_data = { remove_scope, radius_inner, radius_outer, midpoint }; @@ -190,7 +190,7 @@ main (int argc, char **argv) if (sreturnA > BUFSIZ || sreturnB > BUFSIZ) { /* The usage string or help message was truncated */ - /* Note: gcc >= 7.1 prints a warning if we + /* Note: gcc >= 7.1 prints a warning if we * do not check the return value of snprintf. */ t8_debugf ("Warning: Truncated usage string and help message to '%s' and '%s'\n", usage, help); } @@ -239,7 +239,7 @@ main (int argc, char **argv) sc_options_print_usage (t8_get_package_id (), SC_LP_ERROR, opt, NULL); } else if (parsed >= 0 && 0 <= initial_level && radius_inner <= radius_outer && radius_inner >= 0 - && (eclass_int > 3 || eclass_int < 8 || eclass_int == 0) && remove_scope >= 0 && remove_scope < 3) { + && (eclass_int > 3 && eclass_int < 8 || eclass_int == 0) && remove_scope >= 0 && remove_scope < 3) { t8_construct_spheres (initial_level, radius_inner, radius_outer, remove_scope, (t8_eclass_t) eclass_int, vtuname); } else { diff --git a/example/remove/t8_example_spheres.cxx b/example/remove/t8_example_spheres.cxx index b1911ef63f..38deaf26b5 100644 --- a/example/remove/t8_example_spheres.cxx +++ b/example/remove/t8_example_spheres.cxx @@ -81,14 +81,14 @@ t8_adapt_callback_remove (t8_forest_t forest, t8_forest_t forest_from, t8_locidx return 0; } -/** Create a cube in which 6 half-spheres are removed, each on one side, +/** Create a cube in which 6 half-spheres are removed, each on one side, * using geometric criteria. The surface of the spheres get refined. * \param [in] initial_level Initial level of the unit forest. * \param [in] radius_inner Radius of inner side of spheres shell. * \param [in] radius_outer Radius of outer side of spheres shell. - * \param [in] eclass Element class. If 0, use hypercube hybrid. + * \param [in] eclass Element class. If 0, use hypercube hybrid. * \param [in] vtuname Path for outputfiles. - * \note The difference of \ref radius_inner and \ref radius_outer defines + * \note The difference of \ref radius_inner and \ref radius_outer defines * the thickness of the refined surface of the spheres. */ static void @@ -107,7 +107,7 @@ t8_construct_spheres (const int initial_level, const double radius_inner, const cmesh = t8_cmesh_new_hypercube_hybrid (sc_MPI_COMM_WORLD, 0, 0); } - /* On each face of a cube, a sphere rises halfway in. + /* On each face of a cube, a sphere rises halfway in. * Its center is therefore the center of the corresponding surface. */ const int num_spheres = 6; std::vector midpoints @@ -144,7 +144,7 @@ main (int argc, char **argv) if (sreturnA > BUFSIZ || sreturnB > BUFSIZ) { /* The usage string or help message was truncated */ - /* Note: gcc >= 7.1 prints a warning if we + /* Note: gcc >= 7.1 prints a warning if we * do not check the return value of snprintf. */ t8_debugf ("Warning: Truncated usage string and help message to '%s' and '%s'\n", usage, help); } @@ -189,7 +189,7 @@ main (int argc, char **argv) sc_options_print_usage (t8_get_package_id (), SC_LP_ERROR, opt, NULL); } else if (parsed >= 0 && 0 <= initial_level && radius_inner <= radius_outer && radius_inner >= 0 - && (eclass_int > 1 || eclass_int < 8 || eclass_int == 0)) { + && (eclass_int > 1 && eclass_int < 8 || eclass_int == 0)) { t8_construct_spheres (initial_level, radius_inner, radius_outer, (t8_eclass_t) eclass_int, vtuname); } else { From 1460a6d54bb081d4651706dc2723770ceb1b6dd4 Mon Sep 17 00:00:00 2001 From: Alex Dutka <97711898+dutkalex@users.noreply.github.com> Date: Wed, 19 Nov 2025 15:48:34 +0100 Subject: [PATCH 05/21] annotate unused function --- .../t8_default/t8_default_vertex/t8_default_vertex.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/t8_schemes/t8_default/t8_default_vertex/t8_default_vertex.cxx b/src/t8_schemes/t8_default/t8_default_vertex/t8_default_vertex.cxx index a6b61c11b2..18460a5765 100644 --- a/src/t8_schemes/t8_default/t8_default_vertex/t8_default_vertex.cxx +++ b/src/t8_schemes/t8_default/t8_default_vertex/t8_default_vertex.cxx @@ -26,7 +26,7 @@ /** Print a vertex (unused static helper function for debugging) * \param [in] v vertex to be considered. */ -inline static void +[[maybe_unused]] inline static void t8_dvertex_debug_print (const t8_dvertex_t *v) { t8_debugf ("level: %i\n", v->level); From 973c57d8f1ac05465c258d431bf90d3ad2f101f9 Mon Sep 17 00:00:00 2001 From: Alex Dutka <97711898+dutkalex@users.noreply.github.com> Date: Wed, 19 Nov 2025 15:49:37 +0100 Subject: [PATCH 06/21] make casts explicit --- test/t8_cmesh/t8_gtest_cmesh_vertex_conn.cxx | 2 +- ...t8_gtest_cmesh_vertex_conn_tree_to_vertex.cxx | 8 ++++---- ...t8_gtest_cmesh_vertex_conn_vertex_to_tree.cxx | 16 ++++++++-------- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/test/t8_cmesh/t8_gtest_cmesh_vertex_conn.cxx b/test/t8_cmesh/t8_gtest_cmesh_vertex_conn.cxx index 813f7d123a..a7b2de107d 100644 --- a/test/t8_cmesh/t8_gtest_cmesh_vertex_conn.cxx +++ b/test/t8_cmesh/t8_gtest_cmesh_vertex_conn.cxx @@ -254,7 +254,7 @@ class t8_test_cmesh_vertex_conn_partitioned: public testing::Test { const int face_of_join_tree = 0; const int orientation = 0; // Join this tree with the next tree - t8_debugf ("Adding join %li %li [%i %i]\n", itree, join_with_tree, face_of_this_tree, face_of_join_tree); + t8_debugf ("Adding join %li %li [%i %i]\n", static_cast(itree), static_cast(join_with_tree), face_of_this_tree, face_of_join_tree); t8_cmesh_set_join (cmesh, itree, join_with_tree, face_of_this_tree, face_of_join_tree, orientation); // Set all vertices of this tree to the same single global index. t8_cmesh_set_global_vertices_of_tree (cmesh, itree, global_vertices_of_tree, testcase_num_vertices_per_tree); diff --git a/test/t8_cmesh/t8_gtest_cmesh_vertex_conn_tree_to_vertex.cxx b/test/t8_cmesh/t8_gtest_cmesh_vertex_conn_tree_to_vertex.cxx index a813539c2d..851a14e49a 100644 --- a/test/t8_cmesh/t8_gtest_cmesh_vertex_conn_tree_to_vertex.cxx +++ b/test/t8_cmesh/t8_gtest_cmesh_vertex_conn_tree_to_vertex.cxx @@ -85,7 +85,7 @@ class cmesh_vertex_conn_ttv_with_core_classes: public testing::TestWithParamdimension, - t8_cmesh_get_num_trees (committed_cmesh), num_local_trees); + static_cast(t8_cmesh_get_num_trees (committed_cmesh)), num_local_trees); for (t8_locidx_t itree = 0; itree < num_local_trees; ++itree) { const t8_eclass_t tree_class = t8_cmesh_get_tree_class (committed_cmesh, itree); @@ -163,7 +163,7 @@ class cmesh_vertex_conn_ttv_with_core_classes_temp: const t8_eclass_t tree_class = std::get<1> (GetParam ()); t8_cmesh_init (&cmesh); - t8_debugf ("Testing cmesh with %li trees of class %s\n", num_trees, t8_eclass_to_string[tree_class]); + t8_debugf ("Testing cmesh with %li trees of class %s\n", static_cast(num_trees), t8_eclass_to_string[tree_class]); for (t8_locidx_t itree = 0; itree < num_trees; ++itree) { /* Set this tree's class. */ @@ -281,7 +281,7 @@ class cmesh_vertex_conn_ttv_with_cmesh_functions: public testing::TestWithParam< const t8_locidx_t num_local_trees = t8_cmesh_get_num_local_trees (committed_cmesh); t8_debugf ("Starting test with cmesh of dim %i and %li global, %i local trees.\n", cmesh->dimension, - t8_cmesh_get_num_trees (committed_cmesh), num_local_trees); + static_cast(t8_cmesh_get_num_trees (committed_cmesh)), num_local_trees); for (t8_locidx_t itree = 0; itree < num_local_trees; ++itree) { const t8_eclass_t tree_class = t8_cmesh_get_tree_class (committed_cmesh, itree); @@ -351,7 +351,7 @@ class cmesh_vertex_conn_ttv_with_cmesh_functions_temp: const t8_eclass_t tree_class = std::get<1> (GetParam ()); t8_cmesh_init (&cmesh); - t8_debugf ("Testing cmesh with %li trees of class %s\n", num_trees, t8_eclass_to_string[tree_class]); + t8_debugf ("Testing cmesh with %li trees of class %s\n", static_cast(num_trees), t8_eclass_to_string[tree_class]); for (t8_locidx_t itree = 0; itree < num_trees; ++itree) { /* Set this tree's class. */ diff --git a/test/t8_cmesh/t8_gtest_cmesh_vertex_conn_vertex_to_tree.cxx b/test/t8_cmesh/t8_gtest_cmesh_vertex_conn_vertex_to_tree.cxx index 80c35f3301..1707fc057a 100644 --- a/test/t8_cmesh/t8_gtest_cmesh_vertex_conn_vertex_to_tree.cxx +++ b/test/t8_cmesh/t8_gtest_cmesh_vertex_conn_vertex_to_tree.cxx @@ -31,8 +31,8 @@ * We iterate over all cmeshes and for each case we * construct two global id lists. * 1. A single global vertex that maps to all local vertices. - * 2. Multiple global vertices in a non geometric/semi-random pattern. - * + * 2. Multiple global vertices in a non geometric/semi-random pattern. + * * We add the information to the list and then check whether * this information is maintained with the getter functions. */ @@ -68,7 +68,7 @@ class t8_test_cmesh_vertex_conn_vtt: public testing::TestWithParamdimension, - t8_cmesh_get_num_trees (cmesh), num_local_trees); + static_cast(t8_cmesh_get_num_trees (cmesh)), num_local_trees); /* look over all local trees */ for (t8_locidx_t itree = 0; itree < num_local_trees + num_ghost_trees; ++itree) { @@ -77,7 +77,7 @@ class t8_test_cmesh_vertex_conn_vtt: public testing::TestWithParam(global_vertex_id), itree, ivertex); vtt_all_to_one.add_vertex_to_tree (cmesh, global_vertex_id, itree, ivertex); /* We assign a arbitrary but computable global id to this vertex. * We compute the id to be (tree_index * vertex_index) mod num_local_trees + 1 */ @@ -160,8 +160,8 @@ TEST_P (t8_test_cmesh_vertex_conn_vtt, check_all_to_one) /* Check stored global ids for the case with multiple global ids. */ TEST_P (t8_test_cmesh_vertex_conn_vtt, check_multiple_ids) { - /* We need to check that each local tree/ghost and each vertex - * exists exactly once in the list. + /* We need to check that each local tree/ghost and each vertex + * exists exactly once in the list. * We do so by setting up an indicator array storing the * number of vertices for each tree and count down for each occurrence. * At the end the values must be zero. */ @@ -209,7 +209,7 @@ TEST_P (t8_test_cmesh_vertex_conn_vtt, check_multiple_ids) } } -/* TODO: Enable this test as soon as we can add attribute to +/* TODO: Enable this test as soon as we can add attribute to * derived cmeshes. */ /* Check stored global ids for the case with multiple global ids. */ TEST_P (t8_test_cmesh_vertex_conn_vtt, DISABLED_convert_to_ttv_and_back) @@ -218,7 +218,7 @@ TEST_P (t8_test_cmesh_vertex_conn_vtt, DISABLED_convert_to_ttv_and_back) t8_cmesh_init (&derived_cmesh_A); t8_cmesh_init (&derived_cmesh_B); /* The original cmesh must survive this test to be destroyed during TearDown and - * to be used in other tests. + * to be used in other tests. * Hence we need to ref it twice, once for each new cmesh. */ t8_cmesh_ref (cmesh); t8_cmesh_ref (cmesh); From 96fd88b565a9aca3decf8eb29e62cc9497d9b537 Mon Sep 17 00:00:00 2001 From: Alex Dutka <97711898+dutkalex@users.noreply.github.com> Date: Wed, 19 Nov 2025 15:50:22 +0100 Subject: [PATCH 07/21] remove unused local variable --- test/t8_forest_incomplete/t8_gtest_iterate_replace.cxx | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/test/t8_forest_incomplete/t8_gtest_iterate_replace.cxx b/test/t8_forest_incomplete/t8_gtest_iterate_replace.cxx index 2f9ce5e483..c690353dfe 100644 --- a/test/t8_forest_incomplete/t8_gtest_iterate_replace.cxx +++ b/test/t8_forest_incomplete/t8_gtest_iterate_replace.cxx @@ -71,7 +71,7 @@ struct t8_return_data int *callbacks; }; -/** Inside the callback of iterate_replace we compare \a refine +/** Inside the callback of iterate_replace we compare \a refine * with the according return value of the callback of forest_adapt. * If true, we check the parameter \a num_outgoing, \a first_outgoing * \a num_incoming and \a first_incoming for correctness. */ @@ -86,9 +86,7 @@ t8_forest_replace (t8_forest_t forest_old, t8_forest_t forest_new, t8_locidx_t w /* Local element index of the old and new forest. */ t8_locidx_t elidx_old = first_outgoing; - t8_locidx_t elidx_new = first_incoming; for (t8_locidx_t tidx = 0; tidx < which_tree; tidx++) { - elidx_new += t8_forest_get_tree_num_leaf_elements (forest_new, tidx); elidx_old += t8_forest_get_tree_num_leaf_elements (forest_old, tidx); } From 16917ed86d15faa9265a092bde2cef299ff5469e Mon Sep 17 00:00:00 2001 From: Alex Dutka <97711898+dutkalex@users.noreply.github.com> Date: Wed, 19 Nov 2025 15:51:01 +0100 Subject: [PATCH 08/21] cleaner raw array init --- tutorials/general/t8_step6_stencil.cxx | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/tutorials/general/t8_step6_stencil.cxx b/tutorials/general/t8_step6_stencil.cxx index 5d72306521..39d7def171 100644 --- a/tutorials/general/t8_step6_stencil.cxx +++ b/tutorials/general/t8_step6_stencil.cxx @@ -23,10 +23,10 @@ /* See also: https://github.com/DLR-AMR/t8code/wiki/Step-6-Computing-stencils * * This is step6 of the t8code tutorials using the C++ interface of t8code. - * In the following we will store data in the individual elements of our forest. - * To do this, we will create a uniform forest in 2D, which will get adapted, + * In the following we will store data in the individual elements of our forest. + * To do this, we will create a uniform forest in 2D, which will get adapted, * partitioned, balanced and create ghost elements all in one go. - * After adapting the forest we build a data array and gather data for + * After adapting the forest we build a data array and gather data for * the local elements. Next, we exchange the data values of the ghost elements and compute * various stencils resp. finite differences. Finally, vtu files are stored with three * custom data fields. @@ -147,7 +147,7 @@ t8_step6_create_element_data (t8_forest_t forest) t8_forest_element_centroid (forest, itree, element, edat->midpoint); /* Compute vertex coordinates. */ - double verts[4][3] = { 0 }; + double verts[4][3]{}; scheme->element_get_vertex_reference_coords (tree_class, element, 0, verts[0]); scheme->element_get_vertex_reference_coords (tree_class, element, 1, verts[1]); scheme->element_get_vertex_reference_coords (tree_class, element, 2, verts[2]); @@ -182,7 +182,7 @@ t8_step6_compute_stencil (t8_forest_t forest, struct data_per_element *element_d /* Get the scheme of the forest */ const t8_scheme *scheme = t8_forest_get_scheme (forest); - double stencil[3][3] = { 0 }; + double stencil[3][3]{}; double dx[3] = { 0 }; double dy[3] = { 0 }; @@ -299,7 +299,7 @@ t8_step6_exchange_ghost_data (t8_forest_t forest, struct data_per_element *data) } /* Write the forest as vtu and also write the element's volumes in the file. - * + * * t8code supports writing element based data to vtu as long as its stored * as doubles. Each of the data fields to write has to be provided in its own * array of length num_local_elements. From a52c56bc8a78020b4065623dc5eb94f57ba2e362 Mon Sep 17 00:00:00 2001 From: Alex Dutka <97711898+dutkalex@users.noreply.github.com> Date: Wed, 19 Nov 2025 15:51:58 +0100 Subject: [PATCH 09/21] annotate unused members --- test/t8_forest/t8_gtest_partition_data.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/t8_forest/t8_gtest_partition_data.cxx b/test/t8_forest/t8_gtest_partition_data.cxx index 53005d74f7..c3cda18d08 100644 --- a/test/t8_forest/t8_gtest_partition_data.cxx +++ b/test/t8_forest/t8_gtest_partition_data.cxx @@ -89,8 +89,8 @@ class t8_test_partition_data_t { }; private: - t8_locidx_t a; - char b; + [[maybe_unused]] t8_locidx_t a; + [[maybe_unused]] char b; t8_gloidx_t data { 0 }; }; From 14f87204d7150c09913b3b8b50be0a073793f351 Mon Sep 17 00:00:00 2001 From: Alex Dutka <97711898+dutkalex@users.noreply.github.com> Date: Wed, 19 Nov 2025 15:53:49 +0100 Subject: [PATCH 10/21] apply rule of zero --- test/t8_forest/t8_gtest_partition_data.cxx | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/test/t8_forest/t8_gtest_partition_data.cxx b/test/t8_forest/t8_gtest_partition_data.cxx index c3cda18d08..b628df9481 100644 --- a/test/t8_forest/t8_gtest_partition_data.cxx +++ b/test/t8_forest/t8_gtest_partition_data.cxx @@ -66,16 +66,6 @@ class t8_test_partition_data_t { return old; }; - t8_test_partition_data_t& - operator= (const t8_test_partition_data_t&) - = default; - t8_test_partition_data_t& - operator= (const t8_gloidx_t& value) - { - this->data = value; - return *this; - }; - explicit operator t8_gloidx_t () { From 7df58036a3e3e55a319663532f194d7d5d8865f9 Mon Sep 17 00:00:00 2001 From: Alex Dutka <97711898+dutkalex@users.noreply.github.com> Date: Wed, 19 Nov 2025 15:54:52 +0100 Subject: [PATCH 11/21] add missing braces --- example/remove/t8_example_gauss_blob.cxx | 2 +- example/remove/t8_example_spheres.cxx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/example/remove/t8_example_gauss_blob.cxx b/example/remove/t8_example_gauss_blob.cxx index 693e83e27d..fe19a60037 100644 --- a/example/remove/t8_example_gauss_blob.cxx +++ b/example/remove/t8_example_gauss_blob.cxx @@ -239,7 +239,7 @@ main (int argc, char **argv) sc_options_print_usage (t8_get_package_id (), SC_LP_ERROR, opt, NULL); } else if (parsed >= 0 && 0 <= initial_level && radius_inner <= radius_outer && radius_inner >= 0 - && (eclass_int > 3 && eclass_int < 8 || eclass_int == 0) && remove_scope >= 0 && remove_scope < 3) { + && ((eclass_int > 3 && eclass_int < 8) || eclass_int == 0) && remove_scope >= 0 && remove_scope < 3) { t8_construct_spheres (initial_level, radius_inner, radius_outer, remove_scope, (t8_eclass_t) eclass_int, vtuname); } else { diff --git a/example/remove/t8_example_spheres.cxx b/example/remove/t8_example_spheres.cxx index 38deaf26b5..c647c50769 100644 --- a/example/remove/t8_example_spheres.cxx +++ b/example/remove/t8_example_spheres.cxx @@ -189,7 +189,7 @@ main (int argc, char **argv) sc_options_print_usage (t8_get_package_id (), SC_LP_ERROR, opt, NULL); } else if (parsed >= 0 && 0 <= initial_level && radius_inner <= radius_outer && radius_inner >= 0 - && (eclass_int > 1 && eclass_int < 8 || eclass_int == 0)) { + && ((eclass_int > 1 && eclass_int < 8) || eclass_int == 0)) { t8_construct_spheres (initial_level, radius_inner, radius_outer, (t8_eclass_t) eclass_int, vtuname); } else { From de9ec8288774db4ff333d0a626e131c67aca9420 Mon Sep 17 00:00:00 2001 From: Alex Dutka <97711898+dutkalex@users.noreply.github.com> Date: Wed, 19 Nov 2025 15:55:52 +0100 Subject: [PATCH 12/21] indent --- test/t8_cmesh/t8_gtest_cmesh_vertex_conn.cxx | 3 ++- .../t8_gtest_cmesh_vertex_conn_tree_to_vertex.cxx | 10 ++++++---- .../t8_gtest_cmesh_vertex_conn_vertex_to_tree.cxx | 4 ++-- tutorials/general/t8_step6_stencil.cxx | 4 ++-- 4 files changed, 12 insertions(+), 9 deletions(-) diff --git a/test/t8_cmesh/t8_gtest_cmesh_vertex_conn.cxx b/test/t8_cmesh/t8_gtest_cmesh_vertex_conn.cxx index a7b2de107d..fb356d745f 100644 --- a/test/t8_cmesh/t8_gtest_cmesh_vertex_conn.cxx +++ b/test/t8_cmesh/t8_gtest_cmesh_vertex_conn.cxx @@ -254,7 +254,8 @@ class t8_test_cmesh_vertex_conn_partitioned: public testing::Test { const int face_of_join_tree = 0; const int orientation = 0; // Join this tree with the next tree - t8_debugf ("Adding join %li %li [%i %i]\n", static_cast(itree), static_cast(join_with_tree), face_of_this_tree, face_of_join_tree); + t8_debugf ("Adding join %li %li [%i %i]\n", static_cast (itree), static_cast (join_with_tree), + face_of_this_tree, face_of_join_tree); t8_cmesh_set_join (cmesh, itree, join_with_tree, face_of_this_tree, face_of_join_tree, orientation); // Set all vertices of this tree to the same single global index. t8_cmesh_set_global_vertices_of_tree (cmesh, itree, global_vertices_of_tree, testcase_num_vertices_per_tree); diff --git a/test/t8_cmesh/t8_gtest_cmesh_vertex_conn_tree_to_vertex.cxx b/test/t8_cmesh/t8_gtest_cmesh_vertex_conn_tree_to_vertex.cxx index 851a14e49a..37a4201a85 100644 --- a/test/t8_cmesh/t8_gtest_cmesh_vertex_conn_tree_to_vertex.cxx +++ b/test/t8_cmesh/t8_gtest_cmesh_vertex_conn_tree_to_vertex.cxx @@ -85,7 +85,7 @@ class cmesh_vertex_conn_ttv_with_core_classes: public testing::TestWithParamdimension, - static_cast(t8_cmesh_get_num_trees (committed_cmesh)), num_local_trees); + static_cast (t8_cmesh_get_num_trees (committed_cmesh)), num_local_trees); for (t8_locidx_t itree = 0; itree < num_local_trees; ++itree) { const t8_eclass_t tree_class = t8_cmesh_get_tree_class (committed_cmesh, itree); @@ -163,7 +163,8 @@ class cmesh_vertex_conn_ttv_with_core_classes_temp: const t8_eclass_t tree_class = std::get<1> (GetParam ()); t8_cmesh_init (&cmesh); - t8_debugf ("Testing cmesh with %li trees of class %s\n", static_cast(num_trees), t8_eclass_to_string[tree_class]); + t8_debugf ("Testing cmesh with %li trees of class %s\n", static_cast (num_trees), + t8_eclass_to_string[tree_class]); for (t8_locidx_t itree = 0; itree < num_trees; ++itree) { /* Set this tree's class. */ @@ -281,7 +282,7 @@ class cmesh_vertex_conn_ttv_with_cmesh_functions: public testing::TestWithParam< const t8_locidx_t num_local_trees = t8_cmesh_get_num_local_trees (committed_cmesh); t8_debugf ("Starting test with cmesh of dim %i and %li global, %i local trees.\n", cmesh->dimension, - static_cast(t8_cmesh_get_num_trees (committed_cmesh)), num_local_trees); + static_cast (t8_cmesh_get_num_trees (committed_cmesh)), num_local_trees); for (t8_locidx_t itree = 0; itree < num_local_trees; ++itree) { const t8_eclass_t tree_class = t8_cmesh_get_tree_class (committed_cmesh, itree); @@ -351,7 +352,8 @@ class cmesh_vertex_conn_ttv_with_cmesh_functions_temp: const t8_eclass_t tree_class = std::get<1> (GetParam ()); t8_cmesh_init (&cmesh); - t8_debugf ("Testing cmesh with %li trees of class %s\n", static_cast(num_trees), t8_eclass_to_string[tree_class]); + t8_debugf ("Testing cmesh with %li trees of class %s\n", static_cast (num_trees), + t8_eclass_to_string[tree_class]); for (t8_locidx_t itree = 0; itree < num_trees; ++itree) { /* Set this tree's class. */ diff --git a/test/t8_cmesh/t8_gtest_cmesh_vertex_conn_vertex_to_tree.cxx b/test/t8_cmesh/t8_gtest_cmesh_vertex_conn_vertex_to_tree.cxx index 1707fc057a..69d311004a 100644 --- a/test/t8_cmesh/t8_gtest_cmesh_vertex_conn_vertex_to_tree.cxx +++ b/test/t8_cmesh/t8_gtest_cmesh_vertex_conn_vertex_to_tree.cxx @@ -68,7 +68,7 @@ class t8_test_cmesh_vertex_conn_vtt: public testing::TestWithParamdimension, - static_cast(t8_cmesh_get_num_trees (cmesh)), num_local_trees); + static_cast (t8_cmesh_get_num_trees (cmesh)), num_local_trees); /* look over all local trees */ for (t8_locidx_t itree = 0; itree < num_local_trees + num_ghost_trees; ++itree) { @@ -77,7 +77,7 @@ class t8_test_cmesh_vertex_conn_vtt: public testing::TestWithParam(global_vertex_id), itree, ivertex); + t8_debugf ("Adding vertex %li to tree %i v %i\n", static_cast (global_vertex_id), itree, ivertex); vtt_all_to_one.add_vertex_to_tree (cmesh, global_vertex_id, itree, ivertex); /* We assign a arbitrary but computable global id to this vertex. * We compute the id to be (tree_index * vertex_index) mod num_local_trees + 1 */ diff --git a/tutorials/general/t8_step6_stencil.cxx b/tutorials/general/t8_step6_stencil.cxx index 39d7def171..2156762419 100644 --- a/tutorials/general/t8_step6_stencil.cxx +++ b/tutorials/general/t8_step6_stencil.cxx @@ -147,7 +147,7 @@ t8_step6_create_element_data (t8_forest_t forest) t8_forest_element_centroid (forest, itree, element, edat->midpoint); /* Compute vertex coordinates. */ - double verts[4][3]{}; + double verts[4][3] {}; scheme->element_get_vertex_reference_coords (tree_class, element, 0, verts[0]); scheme->element_get_vertex_reference_coords (tree_class, element, 1, verts[1]); scheme->element_get_vertex_reference_coords (tree_class, element, 2, verts[2]); @@ -182,7 +182,7 @@ t8_step6_compute_stencil (t8_forest_t forest, struct data_per_element *element_d /* Get the scheme of the forest */ const t8_scheme *scheme = t8_forest_get_scheme (forest); - double stencil[3][3]{}; + double stencil[3][3] {}; double dx[3] = { 0 }; double dy[3] = { 0 }; From 2a71e641d40063b99cd181af3d9ab5c0e8d29b99 Mon Sep 17 00:00:00 2001 From: Alex Dutka <97711898+dutkalex@users.noreply.github.com> Date: Tue, 25 Nov 2025 16:52:18 +0100 Subject: [PATCH 13/21] add format specifiers for t8gloidx_t and t8_locidx_t --- src/t8.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/t8.h b/src/t8.h index 2b20d618c9..c66923df56 100644 --- a/src/t8.h +++ b/src/t8.h @@ -29,6 +29,8 @@ #ifndef T8_H #define T8_H +#include + #include #if (defined(T8_ENABLE_MPI) && !defined(SC_ENABLE_MPI)) || (!defined(T8_ENABLE_MPI) && defined(SC_ENABLE_MPI)) #error "MPI configured differently in t8code and libsc" @@ -90,6 +92,8 @@ T8_EXTERN_C_BEGIN (); /** A type for processor-local indexing. */ typedef int32_t t8_locidx_t; +/** The format specifier for t8_locidx_t */ +#define T8_LOCIDX_FORMAT PRId32 /** The MPI Datatype of t8_locidx_t */ #define T8_MPI_LOCIDX sc_MPI_INT /** Macro to get the absolute value of a t8_locidx_t */ @@ -101,6 +105,8 @@ typedef int32_t t8_locidx_t; /** A type for global indexing that holds really big numbers. */ typedef int64_t t8_gloidx_t; +/** The format specifier for t8_gloidx_t */ +#define T8_GLOIDX_FORMAT PRId64 /** The MPI Datatype of t8_gloidx_t */ #define T8_MPI_GLOIDX sc_MPI_LONG_LONG_INT /** Macro to get the absolute value of a t8_gloidx_t */ From 181cfea94e0b00a82bee0372575389a6a169336d Mon Sep 17 00:00:00 2001 From: Alex Dutka <97711898+dutkalex@users.noreply.github.com> Date: Tue, 25 Nov 2025 17:54:16 +0100 Subject: [PATCH 14/21] add t8_linearidx_t too --- src/t8.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/t8.h b/src/t8.h index c66923df56..f8c3832d93 100644 --- a/src/t8.h +++ b/src/t8.h @@ -118,6 +118,8 @@ typedef int64_t t8_gloidx_t; /** A type for storing SFC indices */ typedef uint64_t t8_linearidx_t; +/** The format specifier for t8_linearidx_t */ +#define T8_LINEARIDX_FORMAT PRIu64 /** The MPI datatype of t8_linearidx_t */ #define T8_MPI_LINEARIDX sc_MPI_UNSIGNED_LONG_LONG From 021468c6c8201eba5ea36944f26b7ca58db9870e Mon Sep 17 00:00:00 2001 From: Alex Dutka <97711898+dutkalex@users.noreply.github.com> Date: Tue, 25 Nov 2025 17:59:43 +0100 Subject: [PATCH 15/21] get rid of static_casts for printing t8_{glo|loc|linear}idx_t values --- .../forest/netcdf/t8_write_forest_netcdf.cxx | 18 +++---- example/advect/t8_advection.cxx | 4 +- example/cmesh/t8_cmesh_hypercube_pad.cxx | 8 ++- example/remove/t8_example_empty_trees.cxx | 26 ++++----- src/t8_cmesh/t8_cmesh_partition.cxx | 6 +-- src/t8_cmesh/t8_cmesh_readmshfile.cxx | 4 +- .../t8_cmesh_vertex_conn_tree_to_vertex.hxx | 2 +- .../t8_cmesh_vertex_conn_vertex_to_tree.hxx | 2 +- src/t8_geometry/t8_geometry_handler.cxx | 8 +-- src/t8_vtk/t8_vtk_write_ASCII.cxx | 6 +-- .../t8_gtest_cmesh_set_partition_offsets.cxx | 18 +++---- test/t8_cmesh/t8_gtest_cmesh_vertex_conn.cxx | 2 +- ...gtest_cmesh_vertex_conn_tree_to_vertex.cxx | 12 ++--- ...gtest_cmesh_vertex_conn_vertex_to_tree.cxx | 6 +-- test/t8_schemes/t8_gtest_nca.cxx | 38 ++++++------- tutorials/general/t8_step1_coarsemesh.cxx | 8 +-- tutorials/general/t8_step2_uniform_forest.cxx | 12 ++--- tutorials/general/t8_step3_adapt_forest.cxx | 8 +-- tutorials/general/t8_tutorial_search.cxx | 54 +++++++++---------- 19 files changed, 120 insertions(+), 122 deletions(-) diff --git a/example/IO/forest/netcdf/t8_write_forest_netcdf.cxx b/example/IO/forest/netcdf/t8_write_forest_netcdf.cxx index 83531b6f8e..afcea6f446 100644 --- a/example/IO/forest/netcdf/t8_write_forest_netcdf.cxx +++ b/example/IO/forest/netcdf/t8_write_forest_netcdf.cxx @@ -60,7 +60,7 @@ struct t8_example_netcdf_adapt_data }; /** This functions describe an adapt_function, an adapt_function describes the refinement/coarsening rules for a forest -* \note If an element is inside a given radius from the midpoint of the hypercube, this element is refined. If a family of elements is outside a given radius from the midpoint of the hypercube, it is coarsened. +* \note If an element is inside a given radius from the midpoint of the hypercube, this element is refined. If a family of elements is outside a given radius from the midpoint of the hypercube, it is coarsened. * \note A detailed description of the adaption process is found in step 3 of the tutorial located in 't8code/example/tutorials'. */ int @@ -99,7 +99,7 @@ t8_example_netcdf_adapt_fn (t8_forest_t forest, t8_forest_t forest_from, t8_loci } } -/** This functions performs the adaption process of a forest and returns the adapted forest +/** This functions performs the adaption process of a forest and returns the adapted forest * \param [in] forest The forest which ought to be adapted * \param [out] forest_adapt The adapted forest * \note A detailed description of the adaption process is found in step 3 of the tutorial located in 't8code/example/tutorials'. @@ -122,7 +122,7 @@ t8_example_netcdf_adapt (t8_forest_t forest) return forest_adapt; } -/** Function that times the duration of writing out the netCDF File, given a specific variable storage and access pattern +/** Function that times the duration of writing out the netCDF File, given a specific variable storage and access pattern * \param [in] forest The forest to save in a netCDF file (using UGRID conventions). * \param [in] comm The MPI communicator to use. * \param [in] netcdf_var_storage_mode Choose if chunked or contiguous storage should be used (possible Options: NC_CONTIGUOUS, NC_CHUNKED). @@ -162,7 +162,7 @@ t8_example_time_netcdf_writing_operation ([[maybe_unused]] t8_forest_t forest, [ #endif } -/** Function that stores the given (uniform) forest in a netCDF-4 File using the different netCDF variable storage and mpi-access patterns (four files are going to be put out (each combination of {NC_CONTIGUOUS; NC_CHUNKED}x{NC_INDEPENDENT; NC_COLLECTIVE})). +/** Function that stores the given (uniform) forest in a netCDF-4 File using the different netCDF variable storage and mpi-access patterns (four files are going to be put out (each combination of {NC_CONTIGUOUS; NC_CHUNKED}x{NC_INDEPENDENT; NC_COLLECTIVE})). * \param [in] comm The MPI communicator to use. * \param [in] forest_refinement_level The refinement level of the forest. * \param [in] adapt_forest A flag whether an adapt step should be performed (=1) or not (=0). @@ -203,7 +203,7 @@ t8_example_compare_performance_netcdf_var_properties (sc_MPI_Comm comm, int fore forest = t8_example_netcdf_adapt (forest); } num_elements = t8_forest_get_local_num_leaf_elements (forest); - t8_productionf ("Number of process-local elements: %ld\n", static_cast (num_elements)); + t8_productionf ("Number of process-local elements: %" T8_GLOIDX_FORMAT "\n", num_elements); /* If additional data should be written to the netCDF file, the two variables are created in the following section */ if (with_additional_data) { @@ -243,8 +243,8 @@ t8_example_compare_performance_netcdf_var_properties (sc_MPI_Comm comm, int fore num_additional_vars = 2; } - t8_global_productionf ("The uniformly refined forest (refinement level = %d) has %ld global elements.\n", - forest_refinement_level, static_cast (t8_forest_get_global_num_leaf_elements (forest))); + t8_global_productionf ("The uniformly refined forest (refinement level = %d) has %" T8_GLOIDX_FORMAT " global elements.\n", + forest_refinement_level, t8_forest_get_global_num_leaf_elements (forest)); t8_global_productionf ( "The different netCDF variable storage patterns and mpi variable access patterns are getting tested/timed...\n"); @@ -308,7 +308,7 @@ t8_example_compare_performance_netcdf_var_properties (sc_MPI_Comm comm, int fore #endif } -/** An example functions that writes out a netCDF-4 File containing the information of the forest and some user-defined/random-value variables +/** An example functions that writes out a netCDF-4 File containing the information of the forest and some user-defined/random-value variables * \param [in] comm The MPI communicator to use. * \param [in] forest_refinement_level The initial refinement level of the forest. * \param [in] adapt_forest A flag whether an adapt step should be performed (=1) or not (=0). @@ -360,7 +360,7 @@ t8_example_netcdf_write_forest (sc_MPI_Comm comm, int forest_refinement_level, i /* Print out the number of local elements of each process */ num_elements = t8_forest_get_local_num_leaf_elements (forest); - t8_debugf ("[t8] Rank %d has %ld elements\n", mpirank, static_cast (num_elements)); + t8_debugf ("[t8] Rank %d has %" T8_GLOIDX_FORMAT " elements\n", mpirank, num_elements); /* *Example user-defined NetCDF variable* */ /* Currently, integer (32bit, 64bit) and double NetCDF variables are possible */ diff --git a/example/advect/t8_advection.cxx b/example/advect/t8_advection.cxx index a8e9646cee..db35b20db4 100644 --- a/example/advect/t8_advection.cxx +++ b/example/advect/t8_advection.cxx @@ -1249,8 +1249,8 @@ t8_advect_solve (t8_cmesh_t cmesh, t8_flow_function_3d_fn u, t8_example_level_se modulus = SC_MAX (1, time_steps / 10); for (problem->num_time_steps = 0; !done; problem->num_time_steps++, problem->t += problem->delta_t) { if (problem->num_time_steps % modulus == modulus - 1) { - t8_global_essentialf ("[advect] Step %i %li elems\n", problem->num_time_steps + 1, - static_cast (t8_forest_get_global_num_leaf_elements (problem->forest))); + t8_global_essentialf ("[advect] Step %i %" T8_GLOIDX_FORMAT " elems\n", problem->num_time_steps + 1, + t8_forest_get_global_num_leaf_elements (problem->forest)); } /* Time loop */ diff --git a/example/cmesh/t8_cmesh_hypercube_pad.cxx b/example/cmesh/t8_cmesh_hypercube_pad.cxx index d6f8fee46d..e72078984a 100644 --- a/example/cmesh/t8_cmesh_hypercube_pad.cxx +++ b/example/cmesh/t8_cmesh_hypercube_pad.cxx @@ -32,8 +32,6 @@ main (int argc, char **argv) { /* The prefix for our output files. */ const char prefix[BUFSIZ] = "t8_forest_hypercube_pad"; - t8_locidx_t local_num_trees; - t8_gloidx_t global_num_trees; const double boundary_coords[24] = { 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 1, 0, 0, 0, 1, 1, 0, 1, 0, 1, 1, 1, 1, 1 }; /* Initialize MPI. This has to happen before we initialize sc or t8code. */ @@ -49,11 +47,11 @@ main (int argc, char **argv) t8_cmesh_t cmesh = t8_cmesh_new_hypercube_pad (T8_ECLASS_HEX, sc_MPI_COMM_WORLD, boundary_coords, 3, 3, 3, true); /* Compute local and global number of trees. */ - local_num_trees = t8_cmesh_get_num_local_trees (cmesh); - global_num_trees = t8_cmesh_get_num_trees (cmesh); + t8_locidx_t local_num_trees = t8_cmesh_get_num_local_trees (cmesh); + t8_gloidx_t global_num_trees = t8_cmesh_get_num_trees (cmesh); t8_global_productionf (" [step1] Created coarse mesh.\n"); t8_global_productionf (" [step1] Local number of trees:\t%i\n", local_num_trees); - t8_global_productionf (" [step1] Global number of trees:\t%li\n", static_cast (global_num_trees)); + t8_global_productionf (" [step1] Global number of trees:\t%" T8_GLOIDX_FORMAT "\n", global_num_trees); const t8_scheme *scheme = t8_scheme_new_default (); t8_forest_t forest = t8_forest_new_uniform (cmesh, scheme, 0, 0, sc_MPI_COMM_WORLD); t8_forest_vtk_write_file (forest, prefix, 1, 1, 1, 1, 0, 0, NULL); diff --git a/example/remove/t8_example_empty_trees.cxx b/example/remove/t8_example_empty_trees.cxx index e2a95c3fd7..915a746385 100644 --- a/example/remove/t8_example_empty_trees.cxx +++ b/example/remove/t8_example_empty_trees.cxx @@ -76,21 +76,21 @@ t8_strip_of_quads (t8_gloidx_t num_trees, t8_gloidx_t empty_tree, const char **v t8_debugf ("Output to %s\n", vtuname_adapt.c_str ()); t8_productionf ("The initial uniform forest:\n" - "\tfirst_local_tree: %li\n" - "\tlast_local_tree: %li\n" - "\tlocal_num_trees: %i\n" - "\tglobal_num_trees: %li\n", - static_cast (forest->first_local_tree), static_cast (forest->last_local_tree), - t8_forest_get_num_local_trees (forest), static_cast (t8_forest_get_num_global_trees (forest))); + "\tfirst_local_tree: %" T8_GLOIDX_FORMAT "\n" + "\tlast_local_tree: %" T8_GLOIDX_FORMAT "\n" + "\tlocal_num_trees: %" T8_LOCIDX_FORMAT "\n" + "\tglobal_num_trees: %" T8_GLOIDX_FORMAT "\n", + forest->first_local_tree, forest->last_local_tree, + t8_forest_get_num_local_trees (forest), t8_forest_get_num_global_trees (forest)); t8_productionf ("The adapted forest with one empty tree:\n" - "\tfirst_local_tree: %li\n" - "\tlast_local_tree: %li\n" - "\tlocal_num_trees: %i\n" - "\tglobal_num_trees: %li\n", - static_cast (forest_adapt->first_local_tree), static_cast (forest_adapt->last_local_tree), + "\tfirst_local_tree: %" T8_GLOIDX_FORMAT "\n" + "\tlast_local_tree: %" T8_GLOIDX_FORMAT "\n" + "\tlocal_num_trees: %" T8_LOCIDX_FORMAT "\n" + "\tglobal_num_trees: %" T8_GLOIDX_FORMAT "\n", + forest_adapt->first_local_tree, forest_adapt->last_local_tree, t8_forest_get_num_local_trees (forest_adapt), - static_cast (t8_forest_get_num_global_trees (forest_adapt))); + t8_forest_get_num_global_trees (forest_adapt)); t8_forest_unref (&forest_adapt); t8_forest_unref (&forest); @@ -115,7 +115,7 @@ main (int argc, char **argv) if (sreturnA > BUFSIZ || sreturnB > BUFSIZ) { /* The usage string or help message was truncated */ - /* Note: gcc >= 7.1 prints a warning if we + /* Note: gcc >= 7.1 prints a warning if we * do not check the return value of snprintf. */ t8_debugf ("Warning: Truncated usage string and help message to '%s' and '%s'\n", usage, help); } diff --git a/src/t8_cmesh/t8_cmesh_partition.cxx b/src/t8_cmesh/t8_cmesh_partition.cxx index 4f9a88a173..cc3c728044 100644 --- a/src/t8_cmesh/t8_cmesh_partition.cxx +++ b/src/t8_cmesh/t8_cmesh_partition.cxx @@ -391,8 +391,8 @@ t8_cmesh_partition_sendrange (const t8_cmesh_t cmesh, const t8_cmesh_t cmesh_fro ret--; } - t8_debugf ("%s_first = %i, %s_last = %i, last_tree = %li\n", "send", *send_first, "send", *send_last, - static_cast (ret)); + t8_debugf ("%s_first = %i, %s_last = %i, last_tree = %" T8_GLOIDX_FORMAT "\n", "send", *send_first, "send", *send_last, + ret); T8_ASSERT (*send_first >= 0); //TODO:reactivate T8_ASSERT (*send_last >= 0); @@ -1613,7 +1613,7 @@ t8_cmesh_partition (t8_cmesh_t cmesh, sc_MPI_Comm comm) /* Done with local num and tree_offset */ /***************************************************/ t8_cmesh_partition_given (cmesh, cmesh->set_from, tree_offsets, comm); - /* Deactivate the active tree. Tree related data (such as vertices) might have been moved by the new partition and + /* Deactivate the active tree. Tree related data (such as vertices) might have been moved by the new partition and * has to be loaded again if needed. */ if (cmesh->geometry_handler != NULL) { cmesh->geometry_handler->deactivate_tree (); diff --git a/src/t8_cmesh/t8_cmesh_readmshfile.cxx b/src/t8_cmesh/t8_cmesh_readmshfile.cxx index 62be06b1c7..cd8e5de755 100644 --- a/src/t8_cmesh/t8_cmesh_readmshfile.cxx +++ b/src/t8_cmesh/t8_cmesh_readmshfile.cxx @@ -461,7 +461,7 @@ t8_msh_file_2_read_nodes (FILE *fp) /* If second value is false then the node was already in the hash table. * This case should not occur. */ if (emplaced.second == false) { - t8_global_errorf ("Node %li defined more than once.\n", static_cast (index)); + t8_global_errorf ("Node %" T8_GLOIDX_FORMAT " defined more than once.\n", index); free (line); return std::nullopt; } @@ -754,7 +754,7 @@ t8_cmesh_msh_file_2_read_eles (t8_cmesh_t cmesh, FILE *fp, const t8_msh_node_tab Node.index = node_indices[t8_vertex_num]; const auto found_node = vertices.find (Node); if (found_node == vertices.end ()) { - t8_global_errorf ("Could not find Node %li.\n", static_cast (node_indices[t8_vertex_num])); + t8_global_errorf ("Could not find Node %" T8_GLOIDX_FORMAT ".\n", node_indices[t8_vertex_num]); free (line); t8_cmesh_destroy (&cmesh); return std::nullopt; diff --git a/src/t8_cmesh/t8_cmesh_vertex_connectivity/t8_cmesh_vertex_conn_tree_to_vertex.hxx b/src/t8_cmesh/t8_cmesh_vertex_connectivity/t8_cmesh_vertex_conn_tree_to_vertex.hxx index 9278ffc23d..bc9161aa73 100644 --- a/src/t8_cmesh/t8_cmesh_vertex_connectivity/t8_cmesh_vertex_conn_tree_to_vertex.hxx +++ b/src/t8_cmesh/t8_cmesh_vertex_connectivity/t8_cmesh_vertex_conn_tree_to_vertex.hxx @@ -112,7 +112,7 @@ class t8_cmesh_vertex_conn_tree_to_vertex { /* We copy the data directly, hence set data_persiss to 0 */ const int data_persists = 0; - t8_debugf ("Setting %i global vertices for global tree %li.\n", num_vertices, static_cast (global_tree)); + t8_debugf ("Setting %i global vertices for global tree %" T8_GLOIDX_FORMAT ".\n", num_vertices, global_tree); t8_cmesh_set_attribute_gloidx_array (cmesh, global_tree, t8_get_package_id (), T8_CMESH_GLOBAL_VERTICES_ATTRIBUTE_KEY, global_tree_vertices, num_vertices, data_persists); diff --git a/src/t8_cmesh/t8_cmesh_vertex_connectivity/t8_cmesh_vertex_conn_vertex_to_tree.hxx b/src/t8_cmesh/t8_cmesh_vertex_connectivity/t8_cmesh_vertex_conn_vertex_to_tree.hxx index 2806d717b4..8636ed083e 100644 --- a/src/t8_cmesh/t8_cmesh_vertex_connectivity/t8_cmesh_vertex_conn_vertex_to_tree.hxx +++ b/src/t8_cmesh/t8_cmesh_vertex_connectivity/t8_cmesh_vertex_conn_vertex_to_tree.hxx @@ -115,7 +115,7 @@ class t8_cmesh_vertex_conn_vertex_to_tree { try { return vertex_to_tree.at (global_vertex_id); } catch (const std::out_of_range& e) { - t8_errorf ("ERROR: Could not find vertex %li for cmesh.\n", static_cast (global_vertex_id)); + t8_errorf ("ERROR: Could not find vertex %" T8_GLOIDX_FORMAT " for cmesh.\n", global_vertex_id); SC_ABORTF ("Caught exception 'out of range': %s\n", e.what ()); } } diff --git a/src/t8_geometry/t8_geometry_handler.cxx b/src/t8_geometry/t8_geometry_handler.cxx index f1204ed2c8..ddef62154a 100644 --- a/src/t8_geometry/t8_geometry_handler.cxx +++ b/src/t8_geometry/t8_geometry_handler.cxx @@ -53,18 +53,18 @@ t8_geometry_handler::update_tree (t8_cmesh_t cmesh, t8_gloidx_t gtreeid) "The geometry of the tree could not be loaded, because no geometries were registered."); T8_ASSERT (active_geometry != nullptr); if (active_tree != gtreeid) { - /* This tree is not the active tree. We need to update the + /* This tree is not the active tree. We need to update the * active tree, its geometry and its data. */ /* Set the new tree as active. */ active_tree = gtreeid; if (num_geoms > 1) { - /* Find and load the geometry of that tree. + /* Find and load the geometry of that tree. * Only necessary if we have more than one geometry. */ const t8_geometry_hash geom_hash = t8_cmesh_get_tree_geom_hash (cmesh, gtreeid); active_geometry = get_geometry (geom_hash); SC_CHECK_ABORTF (active_geometry != nullptr, - "Could not find geometry with hash %lu or tree %ld has no registered geometry.", - static_cast (geom_hash), static_cast (gtreeid)); + "Could not find geometry with hash %lu or tree %" T8_GLOIDX_FORMAT " has no registered geometry.", + static_cast (geom_hash), gtreeid); } /* Get the user data for this geometry and this tree. */ active_geometry->t8_geom_load_tree_data (cmesh, gtreeid); diff --git a/src/t8_vtk/t8_vtk_write_ASCII.cxx b/src/t8_vtk/t8_vtk_write_ASCII.cxx index d12c5d3967..27fab9eb4e 100644 --- a/src/t8_vtk/t8_vtk_write_ASCII.cxx +++ b/src/t8_vtk/t8_vtk_write_ASCII.cxx @@ -327,13 +327,13 @@ t8_forest_vtk_cells_elementid_kernel (t8_forest_t forest, [[maybe_unused]] const return 1; } -/** Given a tree id and an element in the tree compute the +/** Given a tree id and an element in the tree compute the * data index, that is the index 0 <= I < num_local_elements + num_local_ghosts * corresponding to the element. * \param [in] forest A committed forest * \param [in] ltree_or_ghost_id The Id of a local tree or ghost. 0 <= \a ltree_or_ghost_id < num_local_trees + num_ghost_trees * \param [in] element_in_tree_index An index of an element of the tree. 0 <= \a element_in_tree_index < num_elements_of_tree(\a ltree_or_ghost_id) - * \return The index I, 0 <= \a I < num_local_elements + num_local_ghosts corresponding to the + * \return The index I, 0 <= \a I < num_local_elements + num_local_ghosts corresponding to the * data entry of the element as used in array for i.e. \ref t8_forest_ghost_exchange_data or * \ref t8_forest_partition_data. */ @@ -1145,7 +1145,7 @@ t8_cmesh_vtk_write_file_ext (const t8_cmesh_t cmesh, const char *fileprefix, con /* TODO: We switched to 32 Bit because Paraview could not handle 64 well enough. */ T8_ASSERT (tree->treeid + cmesh->first_tree == (t8_gloidx_t) ((long) tree->treeid + cmesh->first_tree)); - fprintf (vtufile, " %ld", static_cast (tree->treeid + cmesh->first_tree)); + fprintf (vtufile, " %" T8_GLOIDX_FORMAT, tree->treeid + cmesh->first_tree); if (!(sk % 8)) fprintf (vtufile, "\n "); } diff --git a/test/t8_cmesh/t8_gtest_cmesh_set_partition_offsets.cxx b/test/t8_cmesh/t8_gtest_cmesh_set_partition_offsets.cxx index 812840a971..21baf08c32 100644 --- a/test/t8_cmesh/t8_gtest_cmesh_set_partition_offsets.cxx +++ b/test/t8_cmesh/t8_gtest_cmesh_set_partition_offsets.cxx @@ -31,7 +31,7 @@ /* At the time of this writing (November 15 2023) t8_cmesh_offset_concentrate * has a comment stating it does not work with non-derived cmeshes. * We write the tests in this file to check this. - * + * * Theses tests will create an offset array, build a new cmesh * with trees of the same eclass, set the offset array and commit the cmesh. * We will iterate through all eclasses and all tree counts up to a given maximum. @@ -68,7 +68,7 @@ class cmesh_set_partition_offsets_nocommit: public testing::TestWithParam> { protected: @@ -105,14 +105,14 @@ class cmesh_set_partition_offsets_commit: public testing::TestWithParam (inum_trees)); + t8_debugf ("Testing t8_cmesh_set_partition_offset (no commit) with %" T8_GLOIDX_FORMAT " trees.\n", inum_trees); - /* Build a valid offset array. For this test it is only necessary that + /* Build a valid offset array. For this test it is only necessary that * the array corresponds to any valid partition. * We use the offset_concentrate function to build an offset array for a partition * that concentrates all trees at one process. */ @@ -123,15 +123,15 @@ TEST_P (cmesh_set_partition_offsets_nocommit, test_set_offsets) t8_cmesh_set_partition_offsets (cmesh, shmem_array); } -/* call t8_cmesh_offset_concentrate for non-derived cmesh +/* call t8_cmesh_offset_concentrate for non-derived cmesh * and commit it. */ TEST_P (cmesh_set_partition_offsets_commit, test_set_offsets) { - t8_debugf ("Testing t8_cmesh_set_partition_offset (with commit) with %li trees of class %s.\n", - static_cast (inum_trees), t8_eclass_to_string[ieclass]); + t8_debugf ("Testing t8_cmesh_set_partition_offset (with commit) with %" T8_GLOIDX_FORMAT " trees of class %s.\n", + inum_trees, t8_eclass_to_string[ieclass]); - /* Build a valid offset array. For this test it is only necessary that + /* Build a valid offset array. For this test it is only necessary that * the array corresponds to any valid partition. * We use the offset_concentrate function to build an offset array for a partition * that concentrates all trees at one process. */ diff --git a/test/t8_cmesh/t8_gtest_cmesh_vertex_conn.cxx b/test/t8_cmesh/t8_gtest_cmesh_vertex_conn.cxx index fb356d745f..de9a7c0c06 100644 --- a/test/t8_cmesh/t8_gtest_cmesh_vertex_conn.cxx +++ b/test/t8_cmesh/t8_gtest_cmesh_vertex_conn.cxx @@ -254,7 +254,7 @@ class t8_test_cmesh_vertex_conn_partitioned: public testing::Test { const int face_of_join_tree = 0; const int orientation = 0; // Join this tree with the next tree - t8_debugf ("Adding join %li %li [%i %i]\n", static_cast (itree), static_cast (join_with_tree), + t8_debugf ("Adding join %" T8_GLOIDX_FORMAT " %" T8_GLOIDX_FORMAT " [%i %i]\n", itree, join_with_tree, face_of_this_tree, face_of_join_tree); t8_cmesh_set_join (cmesh, itree, join_with_tree, face_of_this_tree, face_of_join_tree, orientation); // Set all vertices of this tree to the same single global index. diff --git a/test/t8_cmesh/t8_gtest_cmesh_vertex_conn_tree_to_vertex.cxx b/test/t8_cmesh/t8_gtest_cmesh_vertex_conn_tree_to_vertex.cxx index 37a4201a85..03789c6add 100644 --- a/test/t8_cmesh/t8_gtest_cmesh_vertex_conn_tree_to_vertex.cxx +++ b/test/t8_cmesh/t8_gtest_cmesh_vertex_conn_tree_to_vertex.cxx @@ -84,8 +84,8 @@ class cmesh_vertex_conn_ttv_with_core_classes: public testing::TestWithParamdimension, - static_cast (t8_cmesh_get_num_trees (committed_cmesh)), num_local_trees); + t8_debugf ("Starting test with cmesh of dim %i and %" T8_GLOIDX_FORMAT " global, %i local trees.\n", cmesh->dimension, + t8_cmesh_get_num_trees (committed_cmesh), num_local_trees); for (t8_locidx_t itree = 0; itree < num_local_trees; ++itree) { const t8_eclass_t tree_class = t8_cmesh_get_tree_class (committed_cmesh, itree); @@ -163,7 +163,7 @@ class cmesh_vertex_conn_ttv_with_core_classes_temp: const t8_eclass_t tree_class = std::get<1> (GetParam ()); t8_cmesh_init (&cmesh); - t8_debugf ("Testing cmesh with %li trees of class %s\n", static_cast (num_trees), + t8_debugf ("Testing cmesh with %" T8_GLOIDX_FORMAT " trees of class %s\n", num_trees, t8_eclass_to_string[tree_class]); for (t8_locidx_t itree = 0; itree < num_trees; ++itree) { @@ -281,8 +281,8 @@ class cmesh_vertex_conn_ttv_with_cmesh_functions: public testing::TestWithParam< t8_cmesh_set_partition_uniform (cmesh, 0, scheme); const t8_locidx_t num_local_trees = t8_cmesh_get_num_local_trees (committed_cmesh); - t8_debugf ("Starting test with cmesh of dim %i and %li global, %i local trees.\n", cmesh->dimension, - static_cast (t8_cmesh_get_num_trees (committed_cmesh)), num_local_trees); + t8_debugf ("Starting test with cmesh of dim %i and %" T8_GLOIDX_FORMAT " global, %i local trees.\n", cmesh->dimension, + t8_cmesh_get_num_trees (committed_cmesh), num_local_trees); for (t8_locidx_t itree = 0; itree < num_local_trees; ++itree) { const t8_eclass_t tree_class = t8_cmesh_get_tree_class (committed_cmesh, itree); @@ -352,7 +352,7 @@ class cmesh_vertex_conn_ttv_with_cmesh_functions_temp: const t8_eclass_t tree_class = std::get<1> (GetParam ()); t8_cmesh_init (&cmesh); - t8_debugf ("Testing cmesh with %li trees of class %s\n", static_cast (num_trees), + t8_debugf ("Testing cmesh with %" T8_GLOIDX_FORMAT " trees of class %s\n", num_trees, t8_eclass_to_string[tree_class]); for (t8_locidx_t itree = 0; itree < num_trees; ++itree) { diff --git a/test/t8_cmesh/t8_gtest_cmesh_vertex_conn_vertex_to_tree.cxx b/test/t8_cmesh/t8_gtest_cmesh_vertex_conn_vertex_to_tree.cxx index 69d311004a..181e0c6ade 100644 --- a/test/t8_cmesh/t8_gtest_cmesh_vertex_conn_vertex_to_tree.cxx +++ b/test/t8_cmesh/t8_gtest_cmesh_vertex_conn_vertex_to_tree.cxx @@ -67,8 +67,8 @@ class t8_test_cmesh_vertex_conn_vtt: public testing::TestWithParamdimension, - static_cast (t8_cmesh_get_num_trees (cmesh)), num_local_trees); + t8_debugf ("Starting test with cmesh of dim %i and %" T8_GLOIDX_FORMAT " global, %i local trees.\n", cmesh->dimension, + t8_cmesh_get_num_trees (cmesh), num_local_trees); /* look over all local trees */ for (t8_locidx_t itree = 0; itree < num_local_trees + num_ghost_trees; ++itree) { @@ -77,7 +77,7 @@ class t8_test_cmesh_vertex_conn_vtt: public testing::TestWithParam (global_vertex_id), itree, ivertex); + t8_debugf ("Adding vertex %" T8_GLOIDX_FORMAT " to tree %i v %i\n", global_vertex_id, itree, ivertex); vtt_all_to_one.add_vertex_to_tree (cmesh, global_vertex_id, itree, ivertex); /* We assign a arbitrary but computable global id to this vertex. * We compute the id to be (tree_index * vertex_index) mod num_local_trees + 1 */ diff --git a/test/t8_schemes/t8_gtest_nca.cxx b/test/t8_schemes/t8_gtest_nca.cxx index cd8f6344c4..779f07b199 100644 --- a/test/t8_schemes/t8_gtest_nca.cxx +++ b/test/t8_schemes/t8_gtest_nca.cxx @@ -66,7 +66,7 @@ class nca: public testing::TestWithParam> { /** * Test the nca for the children of the root-element - * + * */ TEST_P (nca, nca_check_shallow) { @@ -106,7 +106,7 @@ TEST_P (nca, nca_check_deep) num_children = scheme->element_get_num_children (tree_class, tmp); for (child_id = 0; child_id < num_children; child_id++) { scheme->element_get_child (tree_class, tmp, child_id, correct_nca); - /* Compute first and last descendant at every level up to elem_max_lvl. + /* Compute first and last descendant at every level up to elem_max_lvl. * They have the correct_nca as the nca */ for (check_lvl_a = lvl + 1; check_lvl_a < elem_max_level; check_lvl_a++) { scheme->element_get_first_descendant (tree_class, correct_nca, desc_a, check_lvl_a); @@ -142,8 +142,8 @@ TEST_P (nca, nca_check_deep) /** * Recursively check the computation of the nca of all possible combination of descendants of the - * \a correct_nca that have \a correct_nca as the nca. - * + * \a correct_nca that have \a correct_nca as the nca. + * * \param[in] correct_nca The correct nearest common ancestor * \param[in] desc_a Storage for the computation of a descendant of \correct_nca * \param[in] desc_b Storage for the computation of a descendant of \correct_nca @@ -189,23 +189,23 @@ t8_recursive_nca_check (t8_element_t *check_nca, t8_element_t *desc_a, t8_elemen * This makes debugging a lot easier, as one can reconstruct the descendants * via t8_element_set_linear_id and can directly test them instead of waiting * until the recursion reaches the faulty computation. */ - t8_debugf ("id of desc_a: %li, level: %i\n", - static_cast (scheme->element_get_linear_id (tree_class, desc_a, level_a)), level_a); - t8_debugf ("id of desc_b: %li, level: %i\n", - static_cast (scheme->element_get_linear_id (tree_class, desc_b, level_b)), level_b); + t8_debugf ("id of desc_a: %" T8_LINEARIDX_FORMAT ", level: %i\n", + scheme->element_get_linear_id (tree_class, desc_a, level_a), level_a); + t8_debugf ("id of desc_b: %" T8_LINEARIDX_FORMAT ", level: %i\n", + scheme->element_get_linear_id (tree_class, desc_b, level_b), level_b); for (int k = SC_MAX (level_a, level_b); k >= 0; k--) { - t8_debugf ("id of desc_a: %li, level: %i\n", - static_cast (scheme->element_get_linear_id (tree_class, desc_a, k)), k); - t8_debugf ("id of desc_b: %li, level: %i\n", - static_cast (scheme->element_get_linear_id (tree_class, desc_b, k)), k); + t8_debugf ("id of desc_a: %" T8_LINEARIDX_FORMAT ", level: %i\n", + scheme->element_get_linear_id (tree_class, desc_a, k), k); + t8_debugf ("id of desc_b: %" T8_LINEARIDX_FORMAT ", level: %i\n", + scheme->element_get_linear_id (tree_class, desc_b, k), k); } - t8_debugf ("id of the correct nca: %li, level: %i\n", - static_cast (scheme->element_get_linear_id (tree_class, check_nca, level_c)), level_c); + t8_debugf ("id of the correct nca: %" T8_LINEARIDX_FORMAT ", level: %i\n", + scheme->element_get_linear_id (tree_class, check_nca, level_c), level_c); - t8_debugf ("id of the computed nca: %li, level: %i\n", - static_cast (scheme->element_get_linear_id (tree_class, check, level_nca)), level_nca); + t8_debugf ("id of the computed nca: %" T8_LINEARIDX_FORMAT ", level: %i\n", + scheme->element_get_linear_id (tree_class, check, level_nca), level_nca); SC_ABORT ("Computed nca is not the correct nca!\n"); } @@ -220,7 +220,7 @@ t8_recursive_nca_check (t8_element_t *check_nca, t8_element_t *desc_a, t8_elemen } /* Recursively check the computation of the nca. recursion_depth defines up to which - * level we compute descendants of correct_nca that should have correct_nca as the + * level we compute descendants of correct_nca that should have correct_nca as the * output of element_get_nca.*/ TEST_P (nca, recursive_check) { @@ -255,7 +255,7 @@ TEST_P (nca, recursive_check) } /* Test the nca recursively for elements in the middle of the uniform refinement tree - * up to the maximal level. + * up to the maximal level. * Be careful when increasing the max_lvl, as it increases the number of test-cases exponentially. */ TEST_P (nca, recursive_check_higher_level) { @@ -292,7 +292,7 @@ TEST_P (nca, recursive_check_higher_level) /* Initialization for recursive_nca_check */ num_children = scheme->element_get_num_children (tree_class, correct_nca_high_level); if (num_children > 1) { - /* Compute children on two different branches in the tree an test them. + /* Compute children on two different branches in the tree an test them. * This ensures, that the nca of all their descendants has to be correct_nca_high_level*/ for (k = 0; k < num_children; k++) { scheme->element_get_child (tree_class, correct_nca_high_level, k, parent_a); diff --git a/tutorials/general/t8_step1_coarsemesh.cxx b/tutorials/general/t8_step1_coarsemesh.cxx index 5e7a92dcd6..4383ad9fe4 100644 --- a/tutorials/general/t8_step1_coarsemesh.cxx +++ b/tutorials/general/t8_step1_coarsemesh.cxx @@ -25,7 +25,7 @@ * In this example we build a coarse mesh with a cube geometry. * The cube is meshed with 6 coarse tetrahedra. * We then output it in vtu format and destroy it. - * + * * How you can experiment here: * - Use Paraview to visualize the output files. * - Change the parameters of t8_cmesh_new_hypercube @@ -53,7 +53,7 @@ t8_step1_build_tetcube_coarse_mesh (sc_MPI_Comm comm) * You can modify the first parameter to build a cube with different * tree shapes, i.e. T8_ECLASS_QUAD for a unit square with 1 quadrilateral tree. * See t8_eclass.h, t8_cmesh.h for all possible shapes. - * + * * The second argument is the MPI communicator to use for this cmesh. * The remaining arguments are 3 flags that control * do_bcast - If non-zero only the root process will build the cmesh and will broadcast it to the other processes. The result is the same. @@ -68,7 +68,7 @@ t8_step1_build_tetcube_coarse_mesh (sc_MPI_Comm comm) /** Write vtk (or more accurately vtu) files of the cmesh. * \param [in] cmesh A coarse mesh. * \param [in] prefix A string that is used as a prefix of the output files. - * + * * This will create the file prefix.pvtu and the file prefix_0000.vtu. * If the coarse mesh would be repartitioned, then it would write the .pvtu file * and additionally one file prefix_MPIRANK.vtu per MPI rank. @@ -121,7 +121,7 @@ main (int argc, char **argv) global_num_trees = t8_cmesh_get_num_trees (cmesh); t8_global_productionf (" [step1] Created coarse mesh.\n"); t8_global_productionf (" [step1] Local number of trees:\t%i\n", local_num_trees); - t8_global_productionf (" [step1] Global number of trees:\t%li\n", static_cast (global_num_trees)); + t8_global_productionf (" [step1] Global number of trees:\t%" T8_GLOIDX_FORMAT "\n", global_num_trees); t8_step1_write_cmesh_vtk (cmesh, prefix); t8_global_productionf (" [step1] Wrote coarse mesh to vtu files: %s*\n", prefix); t8_step1_destroy_cmesh (cmesh); diff --git a/tutorials/general/t8_step2_uniform_forest.cxx b/tutorials/general/t8_step2_uniform_forest.cxx index 608d1a9aad..992414e75f 100644 --- a/tutorials/general/t8_step2_uniform_forest.cxx +++ b/tutorials/general/t8_step2_uniform_forest.cxx @@ -25,7 +25,7 @@ * After we learned how to create a cmesh in step1, we will * now build our first partitioned forest, get its local and global * element count, and output it into .vtu files. - * + * * When we create a forest from a coarse mesh, the forest will always be * uniform (every element has the same refinement level) and can then be adapted * later (see the following steps). @@ -34,7 +34,7 @@ * are etc. * The default scheme in t8_schemes/t8_default/t8_default.hxx provides an implementation for * all element shapes that t8code supports (with pyramids currently under construction). - * + * * How you can experiment here: * - Use Paraview to visualize the output files. * - Execute this program with different numbers of processes. @@ -52,7 +52,7 @@ #include /* default refinement scheme. */ #include -/** Builds cmesh of 2 prisms that build up a unit cube. +/** Builds cmesh of 2 prisms that build up a unit cube. * See step1 for a detailed description. * \param [in] comm MPI Communicator to use. * \return The coarse mesh. @@ -69,7 +69,7 @@ t8_step2_build_prismcube_coarse_mesh (sc_MPI_Comm comm) return cmesh; } -/** Build a uniform forest on a cmesh +/** Build a uniform forest on a cmesh * using the default refinement scheme. * \param [in] comm MPI Communicator to use. * \param [in] cmesh The coarse mesh to use. @@ -92,7 +92,7 @@ t8_step2_build_uniform_forest (sc_MPI_Comm comm, t8_cmesh_t cmesh, int level) /** Write vtk (or more accurately vtu) files of the forest. * \param [in] forest A forest. * \param [in] prefix A string that is used as a prefix of the output files. - * + * * This will create the file prefix.pvtu * and additionally one file prefix_MPIRANK.vtu per MPI rank. */ @@ -161,7 +161,7 @@ main (int argc, char **argv) t8_global_productionf (" [step2] Created uniform forest.\n"); t8_global_productionf (" [step2] Refinement level:\t\t\t%i\n", level); t8_global_productionf (" [step2] Local number of elements:\t\t%i\n", local_num_elements); - t8_global_productionf (" [step2] Global number of elements:\t%li\n", static_cast (global_num_elements)); + t8_global_productionf (" [step2] Global number of elements:\t%" T8_GLOIDX_FORMAT "\n", global_num_elements); /* Write forest to vtu files. */ t8_step2_write_forest_vtk (forest, prefix); diff --git a/tutorials/general/t8_step3_adapt_forest.cxx b/tutorials/general/t8_step3_adapt_forest.cxx index 3c9906e328..9efcca2aed 100644 --- a/tutorials/general/t8_step3_adapt_forest.cxx +++ b/tutorials/general/t8_step3_adapt_forest.cxx @@ -24,14 +24,14 @@ * After generating a coarse mesh (step1) and building a uniform forest * on it (step2), we will now adapt (= refine and coarsen) the forest * according to our own criterion. - * + * * The geometry (coarse mesh) is again a cube, this time modelled with * 6 tetrahedra, 6 prisms and 4 cubes. * We refine an element if its midpoint is within a sphere of given radius * around the point (0.5, 0.5, 1) and we coarsen outside of a given radius. * We will use non-recursive refinement, that means that the refinement level * of any element will change by at most +-1. - * + * * How you can experiment here: * - Look at the paraview output files of the uniform and the adapted forest. * For the adapted forest you can apply a slice filter to look into the cube. @@ -71,7 +71,7 @@ T8_EXTERN_C_BEGIN (); * return > 0 -> The first element should get refined. * return = 0 -> The first element should not get refined. * return < 0 -> The whole family should get coarsened. - * + * * \param [in] forest The current forest that is in construction. * \param [in] forest_from The forest from which we adapt the current forest (in our case, the uniform forest) * \param [in] which_tree The process local id of the current tree. @@ -168,7 +168,7 @@ t8_step3_print_forest_information (t8_forest_t forest) /* Get the global number of elements. */ global_num_elements = t8_forest_get_global_num_leaf_elements (forest); t8_global_productionf (" [step3] Local number of elements:\t\t%i\n", local_num_elements); - t8_global_productionf (" [step3] Global number of elements:\t%li\n", static_cast (global_num_elements)); + t8_global_productionf (" [step3] Global number of elements:\t%" T8_GLOIDX_FORMAT "\n", global_num_elements); } int diff --git a/tutorials/general/t8_tutorial_search.cxx b/tutorials/general/t8_tutorial_search.cxx index 481514ea9a..8769a2f2bf 100644 --- a/tutorials/general/t8_tutorial_search.cxx +++ b/tutorials/general/t8_tutorial_search.cxx @@ -24,11 +24,11 @@ * In this tutorial we discuss t8code's search algorithm. * search is a powerful tool to identify leaf elements that match a given condition * and execute a function on them. - * + * * In the example we will create random 'particles', thus points in a subdomain of our domain, * and then use search to find those leaf elements that contain particles and for each element * count the number of particles it contains. - * + * * How you can experiment here: * - Load the generated vtu files with paraview and add a threshold to the * "Number of particles" field to display the elements with 1 or more particles. @@ -39,15 +39,15 @@ * - Do not count particles in elements whose x-coordinates are all smaller than 0.5 . * - Advanced: Use adapt to refine elements with more than 1 particle in them recursively until each * element contains at most 1 particle. - * - * - * The search algorithm does not iterate linearly through our elements, instead + * + * + * The search algorithm does not iterate linearly through our elements, instead * it traverses recursively through the mesh hierarchy. This has the benefit, that we * can exclude whole regions of the mesh from our search as soon as we can determine that * they will not match the criterion. * You can see in the output of this program that the number of searched elements is * significantly smaller than the actual number of elements. - * + * * In each (process local) tree of the forest, search will create the level 0 element that * coincides with the tree and call the search-callback function on it. * In the callback the user decides whether to continue the search or not. @@ -55,15 +55,15 @@ * search callback will be called for them -- again deciding whether to continue or not. * This process repeats recursively and stops at those fine elements that are actually contained * in the forest (leaf elements). - * - * The search algorithm can be given an array of 'queries' and a query-callback. + * + * The search algorithm can be given an array of 'queries' and a query-callback. * These queries can be arbitrarily defined data. In our case this will be the array of particles. * If queries and a query-callback are provided, then for each element first the search-callback * is called to decide whether or not to continue searching. If it returns true, the query-callback - * will be called once for each active query object. + * will be called once for each active query object. * If the query object returns 0, this query object will get deactivated for this element and its * recursive children. The recursion stops when no queries are active anymore. - * + * * It is probably best to illustrate this with an example. Let the following forest * with 2 quad trees be given. * __ __ __ __ __________ @@ -71,40 +71,40 @@ * |_*|_*|__ __| * | * |__|__|__|__| * | * |__|__|__|__|__________| - * + * * The '*' should mark particles for which we want to find the elements containing them. * These particles are our queries. Let us enumerate them 0, 1, 2, 3, 4 from left to right. * The search should always continue for an element as long as we still may have particles to look for, * thus the search callback can always return true. The query-callback will return true if * and only if the current particle is contained inside the element. * We discuss the search process in the left tree. - * + * * __ __ __ __ __ __ __ __ * | * | | | * | * | * * | * |_* _*|__ __| * | | * ---> | | | * |__ __ __ __| |__ __|__ __| - * - * At first, the tree element is considered The children are created and the search is called + * + * At first, the tree element is considered The children are created and the search is called * and all queries are active. The first 3 are for each one of them. For the upper left, queries 0 and 1 * inside the element, the last 2 not. Thus the will remain active. The upper right is the final forest leaf, so the search stops. - * search will continue, but only queries 0, 1, 2 For the bottom two children no queries will remain active + * search will continue, but only queries 0, 1, 2 For the bottom two children no queries will remain active * remain active. and hence the search won't continue here. - * - * __ __ + * + * __ __ * |__|__| * |_*|_*| - * + * * The search continues with the children of the upper left element. * Those are all leaves in the forest and hence the search will stop after * executing the query callback. - * + * * Afterwards the search will continue similarly in the second tree. - * + * * Note that the performance of the search could be improved by using an approximative check * on all but the leaf elements. * This check should return true whenever a particle is inside an element, but may have false positives. - * + * */ #include /* General t8code header, always include this. */ @@ -135,13 +135,13 @@ struct t8_tutorial_search_user_data_t /* * The search callback. - * It will be called once per element and generally decides whether or not + * It will be called once per element and generally decides whether or not * to continue the search with the children of the element. * Since we will continue as long as there are particles left to consider, * we always return 1 here. * The search will then only stop when no queries are active (thus, no particles * could be in this element) or the element is a leaf element. - * + * * We also increase a counter by one in order to count how many elements we * looked at during the search process. */ @@ -296,12 +296,12 @@ t8_tutorial_search_for_particles (t8_forest_t forest, sc_array *particles) /* Print the number of elements and number of searched elements. */ global_num_elements = t8_forest_get_global_num_leaf_elements (forest); - t8_global_productionf (" [search] Searched forest with %li global elements.\n", - static_cast (global_num_elements)); + t8_global_productionf (" [search] Searched forest with %" T8_GLOIDX_FORMAT " global elements.\n", + global_num_elements); t8_global_errorf (" [search] Looked at %i elements during search.\n", global_num_searched_elements); /* - * Clean up + * Clean up */ sc_array_reset (&particles_per_element); } @@ -420,7 +420,7 @@ main (int argc, char **argv) /* Create an array with random particles. */ sc_array_t *particles = t8_tutorial_search_build_particles (num_particles, seed, comm); - /* + /* * Search for particles. */ From cd1545cbfe91e4d17f0f9f7c31739fe0c6bc5de3 Mon Sep 17 00:00:00 2001 From: Alex Dutka <97711898+dutkalex@users.noreply.github.com> Date: Tue, 25 Nov 2025 18:00:46 +0100 Subject: [PATCH 16/21] indent --- example/IO/forest/netcdf/t8_write_forest_netcdf.cxx | 3 ++- example/remove/t8_example_empty_trees.cxx | 7 +++---- src/t8_cmesh/t8_cmesh_partition.cxx | 4 ++-- src/t8_geometry/t8_geometry_handler.cxx | 3 ++- .../t8_gtest_cmesh_vertex_conn_tree_to_vertex.cxx | 8 ++++---- .../t8_gtest_cmesh_vertex_conn_vertex_to_tree.cxx | 4 ++-- 6 files changed, 15 insertions(+), 14 deletions(-) diff --git a/example/IO/forest/netcdf/t8_write_forest_netcdf.cxx b/example/IO/forest/netcdf/t8_write_forest_netcdf.cxx index afcea6f446..72efb9eb55 100644 --- a/example/IO/forest/netcdf/t8_write_forest_netcdf.cxx +++ b/example/IO/forest/netcdf/t8_write_forest_netcdf.cxx @@ -243,7 +243,8 @@ t8_example_compare_performance_netcdf_var_properties (sc_MPI_Comm comm, int fore num_additional_vars = 2; } - t8_global_productionf ("The uniformly refined forest (refinement level = %d) has %" T8_GLOIDX_FORMAT " global elements.\n", + t8_global_productionf ("The uniformly refined forest (refinement level = %d) has %" T8_GLOIDX_FORMAT + " global elements.\n", forest_refinement_level, t8_forest_get_global_num_leaf_elements (forest)); t8_global_productionf ( diff --git a/example/remove/t8_example_empty_trees.cxx b/example/remove/t8_example_empty_trees.cxx index 915a746385..6140b292ac 100644 --- a/example/remove/t8_example_empty_trees.cxx +++ b/example/remove/t8_example_empty_trees.cxx @@ -80,8 +80,8 @@ t8_strip_of_quads (t8_gloidx_t num_trees, t8_gloidx_t empty_tree, const char **v "\tlast_local_tree: %" T8_GLOIDX_FORMAT "\n" "\tlocal_num_trees: %" T8_LOCIDX_FORMAT "\n" "\tglobal_num_trees: %" T8_GLOIDX_FORMAT "\n", - forest->first_local_tree, forest->last_local_tree, - t8_forest_get_num_local_trees (forest), t8_forest_get_num_global_trees (forest)); + forest->first_local_tree, forest->last_local_tree, t8_forest_get_num_local_trees (forest), + t8_forest_get_num_global_trees (forest)); t8_productionf ("The adapted forest with one empty tree:\n" "\tfirst_local_tree: %" T8_GLOIDX_FORMAT "\n" @@ -89,8 +89,7 @@ t8_strip_of_quads (t8_gloidx_t num_trees, t8_gloidx_t empty_tree, const char **v "\tlocal_num_trees: %" T8_LOCIDX_FORMAT "\n" "\tglobal_num_trees: %" T8_GLOIDX_FORMAT "\n", forest_adapt->first_local_tree, forest_adapt->last_local_tree, - t8_forest_get_num_local_trees (forest_adapt), - t8_forest_get_num_global_trees (forest_adapt)); + t8_forest_get_num_local_trees (forest_adapt), t8_forest_get_num_global_trees (forest_adapt)); t8_forest_unref (&forest_adapt); t8_forest_unref (&forest); diff --git a/src/t8_cmesh/t8_cmesh_partition.cxx b/src/t8_cmesh/t8_cmesh_partition.cxx index cc3c728044..4440101bb8 100644 --- a/src/t8_cmesh/t8_cmesh_partition.cxx +++ b/src/t8_cmesh/t8_cmesh_partition.cxx @@ -391,8 +391,8 @@ t8_cmesh_partition_sendrange (const t8_cmesh_t cmesh, const t8_cmesh_t cmesh_fro ret--; } - t8_debugf ("%s_first = %i, %s_last = %i, last_tree = %" T8_GLOIDX_FORMAT "\n", "send", *send_first, "send", *send_last, - ret); + t8_debugf ("%s_first = %i, %s_last = %i, last_tree = %" T8_GLOIDX_FORMAT "\n", "send", *send_first, "send", + *send_last, ret); T8_ASSERT (*send_first >= 0); //TODO:reactivate T8_ASSERT (*send_last >= 0); diff --git a/src/t8_geometry/t8_geometry_handler.cxx b/src/t8_geometry/t8_geometry_handler.cxx index ddef62154a..8c058c0167 100644 --- a/src/t8_geometry/t8_geometry_handler.cxx +++ b/src/t8_geometry/t8_geometry_handler.cxx @@ -63,7 +63,8 @@ t8_geometry_handler::update_tree (t8_cmesh_t cmesh, t8_gloidx_t gtreeid) const t8_geometry_hash geom_hash = t8_cmesh_get_tree_geom_hash (cmesh, gtreeid); active_geometry = get_geometry (geom_hash); SC_CHECK_ABORTF (active_geometry != nullptr, - "Could not find geometry with hash %lu or tree %" T8_GLOIDX_FORMAT " has no registered geometry.", + "Could not find geometry with hash %lu or tree %" T8_GLOIDX_FORMAT + " has no registered geometry.", static_cast (geom_hash), gtreeid); } /* Get the user data for this geometry and this tree. */ diff --git a/test/t8_cmesh/t8_gtest_cmesh_vertex_conn_tree_to_vertex.cxx b/test/t8_cmesh/t8_gtest_cmesh_vertex_conn_tree_to_vertex.cxx index 03789c6add..658420f092 100644 --- a/test/t8_cmesh/t8_gtest_cmesh_vertex_conn_tree_to_vertex.cxx +++ b/test/t8_cmesh/t8_gtest_cmesh_vertex_conn_tree_to_vertex.cxx @@ -84,8 +84,8 @@ class cmesh_vertex_conn_ttv_with_core_classes: public testing::TestWithParamdimension, - t8_cmesh_get_num_trees (committed_cmesh), num_local_trees); + t8_debugf ("Starting test with cmesh of dim %i and %" T8_GLOIDX_FORMAT " global, %i local trees.\n", + cmesh->dimension, t8_cmesh_get_num_trees (committed_cmesh), num_local_trees); for (t8_locidx_t itree = 0; itree < num_local_trees; ++itree) { const t8_eclass_t tree_class = t8_cmesh_get_tree_class (committed_cmesh, itree); @@ -281,8 +281,8 @@ class cmesh_vertex_conn_ttv_with_cmesh_functions: public testing::TestWithParam< t8_cmesh_set_partition_uniform (cmesh, 0, scheme); const t8_locidx_t num_local_trees = t8_cmesh_get_num_local_trees (committed_cmesh); - t8_debugf ("Starting test with cmesh of dim %i and %" T8_GLOIDX_FORMAT " global, %i local trees.\n", cmesh->dimension, - t8_cmesh_get_num_trees (committed_cmesh), num_local_trees); + t8_debugf ("Starting test with cmesh of dim %i and %" T8_GLOIDX_FORMAT " global, %i local trees.\n", + cmesh->dimension, t8_cmesh_get_num_trees (committed_cmesh), num_local_trees); for (t8_locidx_t itree = 0; itree < num_local_trees; ++itree) { const t8_eclass_t tree_class = t8_cmesh_get_tree_class (committed_cmesh, itree); diff --git a/test/t8_cmesh/t8_gtest_cmesh_vertex_conn_vertex_to_tree.cxx b/test/t8_cmesh/t8_gtest_cmesh_vertex_conn_vertex_to_tree.cxx index 181e0c6ade..9a6cc81263 100644 --- a/test/t8_cmesh/t8_gtest_cmesh_vertex_conn_vertex_to_tree.cxx +++ b/test/t8_cmesh/t8_gtest_cmesh_vertex_conn_vertex_to_tree.cxx @@ -67,8 +67,8 @@ class t8_test_cmesh_vertex_conn_vtt: public testing::TestWithParamdimension, - t8_cmesh_get_num_trees (cmesh), num_local_trees); + t8_debugf ("Starting test with cmesh of dim %i and %" T8_GLOIDX_FORMAT " global, %i local trees.\n", + cmesh->dimension, t8_cmesh_get_num_trees (cmesh), num_local_trees); /* look over all local trees */ for (t8_locidx_t itree = 0; itree < num_local_trees + num_ghost_trees; ++itree) { From 3655b62c34c213271c03d63dc5acd96102437296 Mon Sep 17 00:00:00 2001 From: Alex Dutka <97711898+dutkalex@users.noreply.github.com> Date: Tue, 25 Nov 2025 18:04:07 +0100 Subject: [PATCH 17/21] get rid of reinterpret_casts for printing t8_{glo|loc|linear}idx_t values --- src/t8_cmesh/t8_cmesh_readmshfile.cxx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/t8_cmesh/t8_cmesh_readmshfile.cxx b/src/t8_cmesh/t8_cmesh_readmshfile.cxx index cd8e5de755..3b72a83025 100644 --- a/src/t8_cmesh/t8_cmesh_readmshfile.cxx +++ b/src/t8_cmesh/t8_cmesh_readmshfile.cxx @@ -450,7 +450,7 @@ t8_msh_file_2_read_nodes (FILE *fp) return std::nullopt; } /* Fill the node with the entries in the file */ - retval = sscanf (line, "%li %lf %lf %lf", reinterpret_cast (&index), &coords[0], &coords[1], &coords[2]); + retval = sscanf (line, "%" T8_GLOIDX_FORMAT " %lf %lf %lf", &index, &coords[0], &coords[1], &coords[2]); if (retval != 4) { t8_global_errorf ("Error reading node file after node %li.\n", (long) last_index); free (line); @@ -741,7 +741,7 @@ t8_cmesh_msh_file_2_read_eles (t8_cmesh_t cmesh, FILE *fp, const t8_msh_node_tab for (int i_node = 0; i_node < num_nodes; i_node++) { const int t8_vertex_num = t8_msh_tree_vertex_to_t8_vertex_num[eclass][i_node]; T8_ASSERT (strcmp (line_modify, "\0")); - retval = sscanf (line_modify, "%li", reinterpret_cast (&node_indices[t8_vertex_num])); + retval = sscanf (line_modify, "%" T8_GLOIDX_FORMAT, &node_indices[t8_vertex_num]); if (retval != 1) { t8_global_errorf ("Premature end of line while reading tree.\n"); t8_debugf ("The line is %s", line); @@ -1560,7 +1560,7 @@ t8_cmesh_msh_file_4_read_eles (t8_cmesh_t cmesh, FILE *fp, const t8_msh_node_tab for (int i_node = 0; i_node < num_nodes; i_node++) { const int t8_vertex_num = t8_msh_tree_vertex_to_t8_vertex_num[eclass][i_node]; T8_ASSERT (strcmp (line_modify, "\0")); - retval = sscanf (line_modify, "%li", reinterpret_cast (&node_indices[t8_vertex_num])); + retval = sscanf (line_modify, "%" T8_GLOIDX_FORMAT, &node_indices[t8_vertex_num]); if (retval != 1) { t8_global_errorf ("Premature end of line while reading tree.\n"); t8_debugf ("The line is %s", line); From 238a392a1ae308f87afa1b4cfe2837db50e147d3 Mon Sep 17 00:00:00 2001 From: Alex Dutka <97711898+dutkalex@users.noreply.github.com> Date: Thu, 27 Nov 2025 16:33:11 +0100 Subject: [PATCH 18/21] sfinae cleanup --- test/t8_forest/t8_gtest_partition_data.cxx | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/test/t8_forest/t8_gtest_partition_data.cxx b/test/t8_forest/t8_gtest_partition_data.cxx index 5b7c86d8aa..a019705467 100644 --- a/test/t8_forest/t8_gtest_partition_data.cxx +++ b/test/t8_forest/t8_gtest_partition_data.cxx @@ -39,6 +39,7 @@ #include #include #include +#include /** * \brief A data carrier class which is used as testable object for the partition_data functionality. @@ -87,9 +88,9 @@ class t8_test_partition_data_t { /** * \brief Comparison function for floating point data. */ -template -auto -gTestCompareEQ (const T& value1, const T& value2) -> std::enable_if_t, bool> +template +bool +gTestCompareEQ (const T& value1, const T& value2) { /* Use the internal floating comparison function from googletest. */ const testing::internal::FloatingPoint val1 { value1 }; @@ -101,9 +102,9 @@ gTestCompareEQ (const T& value1, const T& value2) -> std::enable_if_t -auto -gTestCompareEQ (const T& value1, const T& value2) -> std::enable_if_t, bool> +template +bool +gTestCompareEQ (const T& value1, const T& value2) { return (value1 == value2); } @@ -111,9 +112,8 @@ gTestCompareEQ (const T& value1, const T& value2) -> std::enable_if_t -auto -gTestCompareEQ (const T& value1, const T& value2) -> std::enable_if_t, bool> +bool +gTestCompareEQ (const t8_test_partition_data_t& value1, const t8_test_partition_data_t& value2) { return (gTestCompareEQ (value1.GetData (), value2.GetData ())); } From 24e7e12e57a86ab0510a34056f9e05febff04f24 Mon Sep 17 00:00:00 2001 From: Alex Dutka <97711898+dutkalex@users.noreply.github.com> Date: Thu, 27 Nov 2025 16:39:44 +0100 Subject: [PATCH 19/21] fix t8_gtest_partition_data --- test/t8_forest/t8_gtest_partition_data.cxx | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/test/t8_forest/t8_gtest_partition_data.cxx b/test/t8_forest/t8_gtest_partition_data.cxx index a019705467..cc3c8318a8 100644 --- a/test/t8_forest/t8_gtest_partition_data.cxx +++ b/test/t8_forest/t8_gtest_partition_data.cxx @@ -50,7 +50,7 @@ class t8_test_partition_data_t { public: t8_test_partition_data_t () = default; - t8_test_partition_data_t (const t8_gloidx_t value): data { value } {}; + t8_test_partition_data_t (const t8_gloidx_t value): a {42}, b{'b'}, data { value } {}; t8_test_partition_data_t& operator++ () @@ -73,6 +73,16 @@ class t8_test_partition_data_t { return data; }; + t8_locidx_t + GetA() const { + return a; + } + + char + GetB () const { + return b; + } + t8_gloidx_t GetData () const { @@ -80,8 +90,8 @@ class t8_test_partition_data_t { }; private: - [[maybe_unused]] t8_locidx_t a; - [[maybe_unused]] char b; + t8_locidx_t a; + char b; t8_gloidx_t data { 0 }; }; @@ -115,7 +125,9 @@ gTestCompareEQ (const T& value1, const T& value2) bool gTestCompareEQ (const t8_test_partition_data_t& value1, const t8_test_partition_data_t& value2) { - return (gTestCompareEQ (value1.GetData (), value2.GetData ())); + return gTestCompareEQ (value1.GetA (), value2.GetA ()) + && gTestCompareEQ (value1.GetB (), value2.GetB ()) + && gTestCompareEQ (value1.GetData (), value2.GetData ()); } /** From fb35bb527a858c899d06450e4813a0614388d5cd Mon Sep 17 00:00:00 2001 From: Alex Dutka <97711898+dutkalex@users.noreply.github.com> Date: Thu, 27 Nov 2025 16:40:58 +0100 Subject: [PATCH 20/21] indent --- test/t8_forest/t8_gtest_partition_data.cxx | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/test/t8_forest/t8_gtest_partition_data.cxx b/test/t8_forest/t8_gtest_partition_data.cxx index cc3c8318a8..509cbcf287 100644 --- a/test/t8_forest/t8_gtest_partition_data.cxx +++ b/test/t8_forest/t8_gtest_partition_data.cxx @@ -50,7 +50,7 @@ class t8_test_partition_data_t { public: t8_test_partition_data_t () = default; - t8_test_partition_data_t (const t8_gloidx_t value): a {42}, b{'b'}, data { value } {}; + t8_test_partition_data_t (const t8_gloidx_t value): a { 42 }, b { 'b' }, data { value } {}; t8_test_partition_data_t& operator++ () @@ -74,12 +74,14 @@ class t8_test_partition_data_t { }; t8_locidx_t - GetA() const { + GetA () const + { return a; } char - GetB () const { + GetB () const + { return b; } @@ -125,9 +127,8 @@ gTestCompareEQ (const T& value1, const T& value2) bool gTestCompareEQ (const t8_test_partition_data_t& value1, const t8_test_partition_data_t& value2) { - return gTestCompareEQ (value1.GetA (), value2.GetA ()) - && gTestCompareEQ (value1.GetB (), value2.GetB ()) - && gTestCompareEQ (value1.GetData (), value2.GetData ()); + return gTestCompareEQ (value1.GetA (), value2.GetA ()) && gTestCompareEQ (value1.GetB (), value2.GetB ()) + && gTestCompareEQ (value1.GetData (), value2.GetData ()); } /** From 64cd70575a87c2697168a3754e4a4ed8cf303784 Mon Sep 17 00:00:00 2001 From: Alex Dutka <97711898+dutkalex@users.noreply.github.com> Date: Thu, 27 Nov 2025 16:42:19 +0100 Subject: [PATCH 21/21] fix default init --- test/t8_forest/t8_gtest_partition_data.cxx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/t8_forest/t8_gtest_partition_data.cxx b/test/t8_forest/t8_gtest_partition_data.cxx index 509cbcf287..59fa047de5 100644 --- a/test/t8_forest/t8_gtest_partition_data.cxx +++ b/test/t8_forest/t8_gtest_partition_data.cxx @@ -50,7 +50,7 @@ class t8_test_partition_data_t { public: t8_test_partition_data_t () = default; - t8_test_partition_data_t (const t8_gloidx_t value): a { 42 }, b { 'b' }, data { value } {}; + t8_test_partition_data_t (const t8_gloidx_t value): data { value } {}; t8_test_partition_data_t& operator++ () @@ -92,8 +92,8 @@ class t8_test_partition_data_t { }; private: - t8_locidx_t a; - char b; + t8_locidx_t a { 42 }; + char b { 'b' }; t8_gloidx_t data { 0 }; };