Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion benchmarks/t8_time_fractal.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
19 changes: 10 additions & 9 deletions example/IO/forest/netcdf/t8_write_forest_netcdf.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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'.
Expand All @@ -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).
Expand Down Expand Up @@ -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).
Expand Down Expand Up @@ -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<long> (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) {
Expand Down Expand Up @@ -243,8 +243,9 @@ 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<long> (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");
Expand Down Expand Up @@ -308,7 +309,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).
Expand Down Expand Up @@ -360,7 +361,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<long> (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 */
Expand Down
4 changes: 2 additions & 2 deletions example/advect/t8_advection.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -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<long> (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 */

Expand Down
8 changes: 3 additions & 5 deletions example/cmesh/t8_cmesh_hypercube_pad.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -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. */
Expand All @@ -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<long> (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);
Expand Down
27 changes: 13 additions & 14 deletions example/remove/t8_example_empty_trees.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -76,21 +76,20 @@ 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<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)));
"\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<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)));
"\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), t8_forest_get_num_global_trees (forest_adapt));

t8_forest_unref (&forest_adapt);
t8_forest_unref (&forest);
Expand All @@ -115,7 +114,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);
}
Expand Down
6 changes: 3 additions & 3 deletions example/remove/t8_example_gauss_blob.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -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 };

Expand Down Expand Up @@ -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);
}
Expand Down Expand Up @@ -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 {
Expand Down
12 changes: 6 additions & 6 deletions example/remove/t8_example_spheres.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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<t8_3D_point> midpoints
Expand Down Expand Up @@ -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);
}
Expand Down Expand Up @@ -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 {
Expand Down
8 changes: 8 additions & 0 deletions src/t8.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@
#ifndef T8_H
#define T8_H

#include <inttypes.h>

#include <sc_config.h>
#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"
Expand Down Expand Up @@ -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 */
Expand All @@ -102,6 +106,8 @@ typedef int32_t t8_locidx_t;
typedef int t8_procidx_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 */
Expand All @@ -113,6 +119,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

Expand Down
6 changes: 3 additions & 3 deletions src/t8_cmesh/t8_cmesh_internal/t8_cmesh_partition.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -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<long> (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);
Expand Down Expand Up @@ -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 ();
Expand Down
12 changes: 6 additions & 6 deletions src/t8_cmesh/t8_cmesh_io/t8_cmesh_readmshfile.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,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 */
Expand Down Expand Up @@ -455,7 +455,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, "%" 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);
Expand All @@ -466,7 +466,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 %" T8_GLOIDX_FORMAT " defined more than once.\n", index);
free (line);
return std::nullopt;
}
Expand Down Expand Up @@ -746,7 +746,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, "%" 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);
Expand All @@ -759,7 +759,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 %" T8_GLOIDX_FORMAT ".\n", node_indices[t8_vertex_num]);
free (line);
t8_cmesh_destroy (&cmesh);
return std::nullopt;
Expand Down Expand Up @@ -1565,7 +1565,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, "%" 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);
Expand Down
Loading