Skip to content

Commit

Permalink
Merge pull request #1284 from dutkalex/fix-warnings
Browse files Browse the repository at this point in the history
Fix various warnings
  • Loading branch information
sandro-elsweijer authored Oct 31, 2024
2 parents 129b742 + a5b6862 commit 0c3643f
Show file tree
Hide file tree
Showing 19 changed files with 43 additions and 40 deletions.
6 changes: 3 additions & 3 deletions example/IO/forest/netcdf/t8_write_forest_netcdf.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,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_elements (forest);
t8_productionf ("Number of process-local elements: %ld\n", num_elements);
t8_productionf ("Number of process-local elements: %ld\n", static_cast<long> (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) {
Expand Down Expand Up @@ -249,7 +249,7 @@ t8_example_compare_performance_netcdf_var_properties (sc_MPI_Comm comm, int fore
}

t8_global_productionf ("The uniformly refined forest (refinement level = %d) has %ld global elements.\n",
forest_refinement_level, t8_forest_get_global_num_elements (forest));
forest_refinement_level, static_cast<long> (t8_forest_get_global_num_elements (forest)));

t8_global_productionf (
"The different netCDF variable storage patterns and mpi variable access patterns are getting tested/timed...\n");
Expand Down Expand Up @@ -368,7 +368,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_elements (forest);
t8_debugf ("[t8] Rank %d has %ld elements\n", mpirank, num_elements);
t8_debugf ("[t8] Rank %d has %ld elements\n", mpirank, static_cast<long> (num_elements));

/* *Example user-defined NetCDF variable* */
/* Currently, integer (32bit, 64bit) and double NetCDF variables are possible */
Expand Down
2 changes: 1 addition & 1 deletion example/advect/t8_advection.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -1247,7 +1247,7 @@ t8_advect_solve (t8_cmesh_t cmesh, t8_flow_function_3d_fn u, t8_example_level_se
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,
t8_forest_get_global_num_elements (problem->forest));
static_cast<long> (t8_forest_get_global_num_elements (problem->forest)));
}
/* Time loop */

Expand Down
2 changes: 1 addition & 1 deletion example/cmesh/t8_cmesh_hypercube_pad.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,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", global_num_trees);
t8_global_productionf (" [step1] Global number of trees:\t%li\n", static_cast<long> (global_num_trees));
t8_scheme_cxx *scheme = t8_scheme_new_default_cxx ();
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);
Expand Down
2 changes: 1 addition & 1 deletion example/forest/t8_face_neighbor.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ t8_ghost_neighbor_test (t8_eclass_t eclass, sc_MPI_Comm comm, int hybrid)
if (ret != -1) {
/* Anchor is only implemented in the common scheme. */
common_scheme->t8_element_anchor (neigh, anchor_node);
t8_debugf ("neighbor of %i across face %i (in tree %li): (%i,%i,%i,%i)\n", element_id, i, ret,
t8_debugf ("neighbor of %i across face %i (in tree %li): (%i,%i,%i,%i)\n", element_id, i, static_cast<long> (ret),
neigh_scheme->t8_element_level (neigh), anchor_node[0], anchor_node[1],
t8_eclass_to_dimension[elem_eclass] > 2 ? anchor_node[2] : -1);
}
Expand Down
9 changes: 5 additions & 4 deletions example/remove/t8_example_empty_trees.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -78,16 +78,17 @@ t8_strip_of_quads (t8_gloidx_t num_trees, t8_gloidx_t empty_tree, const char **v
"\tlast_local_tree: %li\n"
"\tlocal_num_trees: %i\n"
"\tglobal_num_trees: %li\n",
forest->first_local_tree, forest->last_local_tree, t8_forest_get_num_local_trees (forest),
t8_forest_get_num_global_trees (forest));
static_cast<long> (forest->first_local_tree), static_cast<long> (forest->last_local_tree),
t8_forest_get_num_local_trees (forest), static_cast<long> (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",
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));
static_cast<long> (forest_adapt->first_local_tree), static_cast<long> (forest_adapt->last_local_tree),
t8_forest_get_num_local_trees (forest_adapt),
static_cast<long> (t8_forest_get_num_global_trees (forest_adapt)));

t8_forest_unref (&forest_adapt);
t8_forest_unref (&forest);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ struct t8_geometry_analytic: public t8_geometry
* \return True if the geometry is compatible with the tree.
*/
bool
t8_geom_check_tree_compatibility () const;
t8_geom_check_tree_compatibility () const override;

/** Update a possible internal data buffer for per tree data.
* This function is called before the first coordinates in a new tree are
Expand Down
2 changes: 1 addition & 1 deletion src/t8_vtk/t8_vtk_write_ASCII.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -1114,7 +1114,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", (long) tree->treeid + cmesh->first_tree);
fprintf (vtufile, " %ld", static_cast<long> (tree->treeid + cmesh->first_tree));
if (!(sk % 8))
fprintf (vtufile, "\n ");
}
Expand Down
6 changes: 3 additions & 3 deletions test/t8_cmesh/t8_gtest_cmesh_set_partition_offsets.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ class cmesh_set_partition_offsets_commit: public testing::TestWithParam<std::tup
TEST_P (cmesh_set_partition_offsets_nocommit, test_set_offsets)
{

t8_debugf ("Testing t8_cmesh_set_partition_offset (no commit) with %li trees.\n", inum_trees);
t8_debugf ("Testing t8_cmesh_set_partition_offset (no commit) with %li trees.\n", static_cast<long> (inum_trees));

/* Build a valid offset array. For this test it is only necessary that
* the array corresponds to any valid partition.
Expand All @@ -128,8 +128,8 @@ TEST_P (cmesh_set_partition_offsets_nocommit, test_set_offsets)
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", inum_trees,
t8_eclass_to_string[ieclass]);
t8_debugf ("Testing t8_cmesh_set_partition_offset (with commit) with %li trees of class %s.\n",
static_cast<long> (inum_trees), t8_eclass_to_string[ieclass]);

/* Build a valid offset array. For this test it is only necessary that
* the array corresponds to any valid partition.
Expand Down
4 changes: 2 additions & 2 deletions test/t8_schemes/t8_gtest_boundary_extrude.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ class class_test_boundary_extrude: public TestDFS {
/* For elements that are on the face of the root element, check that creating the boundary element
* and extruding it results in the original element
*/
virtual void
check_element ()
void
check_element () override
{
const int num_faces = ts->t8_element_num_faces (element);
for (int iface = 0; iface < num_faces; iface++) {
Expand Down
4 changes: 2 additions & 2 deletions test/t8_schemes/t8_gtest_child_parent_face.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@
#include <test/t8_gtest_macros.hxx>

class class_child_parent_face: public TestDFS {
virtual void
check_element ()
void
check_element () override
{
const int num_faces = ts->t8_element_num_faces (element);
for (int iface = 0; iface < num_faces; iface++) {
Expand Down
4 changes: 2 additions & 2 deletions test/t8_schemes/t8_gtest_equal.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@
#include "t8_gtest_dfs_base.hxx"

class class_test_equal: public TestDFS {
virtual void
check_element ()
void
check_element () override
{
const int num_children = ts->t8_element_num_children (element);
for (int ichild1 = 0; ichild1 < num_children; ichild1++) {
Expand Down
4 changes: 2 additions & 2 deletions test/t8_schemes/t8_gtest_face_descendant.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ t8_test_manual_first_last_face_descendant (const t8_eclass_scheme_c *ts, const t
}

class class_descendant: public TestDFS {
virtual void
check_element ()
void
check_element () override
{
/* Check the linear first and last descendants of an element along all faces.
* For the test the descendants are computed manually by t8_test_manual_first_last_face_descendant and
Expand Down
4 changes: 2 additions & 2 deletions test/t8_schemes/t8_gtest_find_parent.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@
#include <test/t8_gtest_macros.hxx>

class class_find_parent: public TestDFS {
virtual void
check_element ()
void
check_element () override
{
const int num_children = ts->t8_element_num_children (element);
for (int ichild = 0; ichild < num_children; ichild++) {
Expand Down
18 changes: 10 additions & 8 deletions test/t8_schemes/t8_gtest_nca.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -189,19 +189,21 @@ 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", ts->t8_element_get_linear_id (desc_a, level_a), level_a);
t8_debugf ("id of desc_b: %li, level: %i\n", ts->t8_element_get_linear_id (desc_b, level_b), level_b);
t8_debugf ("id of desc_a: %li, level: %i\n", static_cast<long> (ts->t8_element_get_linear_id (desc_a, level_a)),
level_a);
t8_debugf ("id of desc_b: %li, level: %i\n", static_cast<long> (ts->t8_element_get_linear_id (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", ts->t8_element_get_linear_id (desc_a, k), k);
t8_debugf ("id of desc_b: %li, level: %i\n", ts->t8_element_get_linear_id (desc_b, k), k);
t8_debugf ("id of desc_a: %li, level: %i\n", static_cast<long> (ts->t8_element_get_linear_id (desc_a, k)), k);
t8_debugf ("id of desc_b: %li, level: %i\n", static_cast<long> (ts->t8_element_get_linear_id (desc_b, k)), k);
}

t8_debugf ("id of the correct nca: %li, level: %i\n", ts->t8_element_get_linear_id (check_nca, level_c),
level_c);
t8_debugf ("id of the correct nca: %li, level: %i\n",
static_cast<long> (ts->t8_element_get_linear_id (check_nca, level_c)), level_c);

t8_debugf ("id of the computed nca: %li, level: %i\n", ts->t8_element_get_linear_id (check, level_nca),
level_nca);
t8_debugf ("id of the computed nca: %li, level: %i\n",
static_cast<long> (ts->t8_element_get_linear_id (check, level_nca)), level_nca);

SC_ABORT ("Computed nca is not the correct nca!\n");
}
Expand Down
5 changes: 2 additions & 3 deletions test/t8_schemes/t8_gtest_pack_unpack.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,9 @@
* Here, each element is sent individually.
*/
class class_test_pack: public TestDFS {
virtual void

/* pack the element and its children, send to ourself, unpack and check if it is the same element */
check_element ()
void
check_element () override
{
size_t count = 1;
int position = 0;
Expand Down
2 changes: 1 addition & 1 deletion tutorials/general/t8_step1_coarsemesh.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -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", global_num_trees);
t8_global_productionf (" [step1] Global number of trees:\t%li\n", static_cast<long> (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);
Expand Down
2 changes: 1 addition & 1 deletion tutorials/general/t8_step2_uniform_forest.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,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", global_num_elements);
t8_global_productionf (" [step2] Global number of elements:\t%li\n", static_cast<long> (global_num_elements));

/* Write forest to vtu files. */
t8_step2_write_forest_vtk (forest, prefix);
Expand Down
2 changes: 1 addition & 1 deletion tutorials/general/t8_step3_adapt_forest.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -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_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", global_num_elements);
t8_global_productionf (" [step3] Global number of elements:\t%li\n", static_cast<long> (global_num_elements));
}

int
Expand Down
3 changes: 2 additions & 1 deletion tutorials/general/t8_tutorial_search.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,8 @@ 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_elements (forest);
t8_global_productionf (" [search] Searched forest with %li global elements.\n", global_num_elements);
t8_global_productionf (" [search] Searched forest with %li global elements.\n",
static_cast<long> (global_num_elements));
t8_global_errorf (" [search] Looked at %i elements during search.\n", global_num_searched_elements);

/*
Expand Down

0 comments on commit 0c3643f

Please sign in to comment.