From 84a145bf74223afcb39b398260f0a1147b03ef39 Mon Sep 17 00:00:00 2001 From: Alex Dutka <97711898+dutkalex@users.noreply.github.com> Date: Thu, 11 Jul 2024 18:34:59 +0200 Subject: [PATCH 001/114] fix override warnings --- .../t8_geometry_analytic.hxx | 22 ++++++------- .../t8_geometry_zero.hxx | 22 ++++++------- .../t8_default_common/t8_default_common.hxx | 32 +++++++++---------- 3 files changed, 38 insertions(+), 38 deletions(-) diff --git a/src/t8_geometry/t8_geometry_implementations/t8_geometry_analytic.hxx b/src/t8_geometry/t8_geometry_implementations/t8_geometry_analytic.hxx index 53331b82d9..67011ff790 100644 --- a/src/t8_geometry/t8_geometry_implementations/t8_geometry_analytic.hxx +++ b/src/t8_geometry/t8_geometry_implementations/t8_geometry_analytic.hxx @@ -70,7 +70,7 @@ struct t8_geometry_analytic: public t8_geometry * \return The type. */ inline t8_geometry_type_t - t8_geom_get_type () const + t8_geom_get_type () const override { return T8_GEOMETRY_TYPE_ANALYTIC; }; @@ -83,9 +83,9 @@ struct t8_geometry_analytic: public t8_geometry * \param [in] num_coords Amount of points of \f$ \mathrm{dim} \f$ to map. * \param [out] out_coords The mapped coordinates in physical space of \a ref_coords. The length is \a num_coords * 3. */ - virtual void + void t8_geom_evaluate (t8_cmesh_t cmesh, t8_gloidx_t gtreeid, const double *ref_coords, const size_t num_coords, - double *out_coords) const; + double *out_coords) const override; /** * Compute the jacobian of the \a t8_geom_evaluate map at a point in the reference space \f$ [0,1]^\mathrm{dim} \f$. @@ -100,9 +100,9 @@ struct t8_geometry_analytic: public t8_geometry * dim 1: J = (0) dim 2: J = (0 1) dim 3: J = (0 1 0) * (0) (0 0) (0 0 1) */ - virtual void + void t8_geom_evaluate_jacobian (t8_cmesh_t cmesh, t8_gloidx_t gtreeid, const double *ref_coords, const size_t num_coords, - double *jacobian) const; + double *jacobian) const override; /** * \param[in] forest The forest of the element. @@ -113,10 +113,10 @@ struct t8_geometry_analytic: public t8_geometry * \param[in, out] is_inside Array to fill with flags whether the point is inside or not * \param[in] tolerance Tolerance of the inside-check */ - virtual void + void t8_geom_point_batch_inside_element (t8_forest_t forest, t8_locidx_t ltreeid, const t8_element_t *element, const double *points, const int num_points, int *is_inside, - const double tolerance) + const double tolerance) const override { SC_ABORTF ("Function not yet implemented"); } @@ -125,8 +125,8 @@ struct t8_geometry_analytic: public t8_geometry * Check if the currently active tree has a negative volume * \return True (non-zero) if the currently loaded tree has a negative volume. 0 otherwise. */ - virtual bool - t8_geom_tree_negative_volume () const; + bool + t8_geom_tree_negative_volume () 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 @@ -135,8 +135,8 @@ struct t8_geometry_analytic: public t8_geometry * \param [in] cmesh The cmesh. * \param [in] gtreeid The global tree. */ - virtual void - t8_geom_load_tree_data (t8_cmesh_t cmesh, t8_gloidx_t gtreeid); + void + t8_geom_load_tree_data (t8_cmesh_t cmesh, t8_gloidx_t gtreeid) override; inline const void * t8_geom_analytic_get_user_data () diff --git a/src/t8_geometry/t8_geometry_implementations/t8_geometry_zero.hxx b/src/t8_geometry/t8_geometry_implementations/t8_geometry_zero.hxx index 94b56ecb7c..24366040c5 100644 --- a/src/t8_geometry/t8_geometry_implementations/t8_geometry_zero.hxx +++ b/src/t8_geometry/t8_geometry_implementations/t8_geometry_zero.hxx @@ -49,8 +49,8 @@ struct t8_geometry_zero: public t8_geometry * Check if the currently active tree has a negative volume * \return True (non-zero) if the currently loaded tree has a negative volume. 0 otherwise. */ - virtual bool - t8_geom_tree_negative_volume () const + bool + t8_geom_tree_negative_volume () const override { return 0; }; @@ -65,7 +65,7 @@ struct t8_geometry_zero: public t8_geometry * \return The type. */ inline t8_geometry_type_t - t8_geom_get_type () const + t8_geom_get_type () const override { return T8_GEOMETRY_TYPE_ZERO; }; @@ -79,9 +79,9 @@ struct t8_geometry_zero: public t8_geometry * \param [out] out_coords The mapped coordinates in physical space of \a ref_coords. The length is \a num_coords * 3. * \note All entries in out_coords will be set to 0. */ - virtual void + void t8_geom_evaluate (t8_cmesh_t cmesh, t8_gloidx_t gtreeid, const double *ref_coords, const size_t num_coords, - double *out_coords) const; + double *out_coords) const override; /** * Compute the jacobian of the \a t8_geom_evaluate map at a point in the reference space \f$ [0,1]^\mathrm{dim} \f$. @@ -93,9 +93,9 @@ struct t8_geometry_zero: public t8_geometry * correspond to the \f$ i \f$-th column of the jacobian (Entry \f$ 3 \cdot i + j \f$ is \f$ \frac{\partial f_j}{\partial x_i} \f$). * \note All entries in \a jacobian will be set to zero. */ - virtual void + void t8_geom_evaluate_jacobian (t8_cmesh_t cmesh, t8_gloidx_t gtreeid, const double *ref_coords, const size_t num_coords, - double *jacobian) const; + double *jacobian) const override; /** * \param[in] forest The forest of the element. @@ -106,10 +106,10 @@ struct t8_geometry_zero: public t8_geometry * \param[in, out] is_inside Array to fill with flags whether the point is inside or not * \param[in] tolerance Tolerance of the inside-check */ - virtual void + void t8_geom_point_batch_inside_element (t8_forest_t forest, t8_locidx_t ltreeid, const t8_element_t *element, const double *points, const int num_points, int *is_inside, - const double tolerance) + const double tolerance) const override { const double zeros[3] = { 0 }; for (int i_point = 0; i_point < num_points; ++i_point) { @@ -125,8 +125,8 @@ struct t8_geometry_zero: public t8_geometry * \param [in] cmesh The cmesh. * \param [in] gtreeid The global tree. */ - virtual inline void - t8_geom_load_tree_data (t8_cmesh_t cmesh, t8_gloidx_t gtreeid); + inline void + t8_geom_load_tree_data (t8_cmesh_t cmesh, t8_gloidx_t gtreeid) override; }; #endif /* !T8_GEOMETRY_ZERO_HXX */ diff --git a/src/t8_schemes/t8_default/t8_default_common/t8_default_common.hxx b/src/t8_schemes/t8_default/t8_default_common/t8_default_common.hxx index 528840d8d0..e40861ca88 100644 --- a/src/t8_schemes/t8_default/t8_default_common/t8_default_common.hxx +++ b/src/t8_schemes/t8_default/t8_default_common/t8_default_common.hxx @@ -41,20 +41,20 @@ class t8_default_scheme_common_c: public t8_eclass_scheme_c { t8_element_deinit (int length, t8_element_t *elem) const override; /** Compute the number of corners of a given element. */ - virtual int - t8_element_num_corners (const t8_element_t *elem) const; + int + t8_element_num_corners (const t8_element_t *elem) const override; /** Allocate space for a bunch of elements. */ - virtual void - t8_element_new (int length, t8_element_t **elem) const; + void + t8_element_new (int length, t8_element_t **elem) const override; /** Deallocate space for a bunch of elements. */ - virtual void - t8_element_destroy (int length, t8_element_t **elem) const; + void + t8_element_destroy (int length, t8_element_t **elem) const override; /** Return the shape of an element */ - virtual t8_element_shape_t - t8_element_shape (const t8_element_t *elem) const; + t8_element_shape_t + t8_element_shape (const t8_element_t *elem) const override; /** Count how many leaf descendants of a given uniform level an element would produce. * \param [in] t The element to be checked. @@ -64,8 +64,8 @@ class t8_default_scheme_common_c: public t8_eclass_scheme_c { * Each default element (except pyramids) refines into 2^{dim * (level - level(t))} * children. */ - virtual t8_gloidx_t - t8_element_count_leaves (const t8_element_t *t, int level) const; + t8_gloidx_t + t8_element_count_leaves (const t8_element_t *t, int level) const override; /** Compute the number of siblings of an element. That is the number of * Children of its parent. @@ -73,16 +73,16 @@ class t8_default_scheme_common_c: public t8_eclass_scheme_c { * \return The number of siblings of \a element. * Note that this number is >= 1, since we count the element itself as a sibling. */ - virtual int - t8_element_num_siblings (const t8_element_t *elem) const; + int + t8_element_num_siblings (const t8_element_t *elem) const override; /** Count how many leaf descendants of a given uniform level the root element will produce. * \param [in] level A refinement level. * \return The value of \ref t8_element_count_leaves if the input element * is the root (level 0) element. */ - virtual t8_gloidx_t - t8_element_count_leaves_from_root (int level) const; + t8_gloidx_t + t8_element_count_leaves_from_root (int level) const override; /** Compute the integer coordinates of a given element vertex. * The default scheme implements the Morton type SFCs. In these SFCs the @@ -108,9 +108,9 @@ class t8_default_scheme_common_c: public t8_eclass_scheme_c { * \param [out] out_coords The coordinates of the points in the * reference space of the tree. */ - virtual void + void t8_element_reference_coords (const t8_element_t *elem, const double *ref_coords, const size_t num_coords, - double *out_coords) const + double *out_coords) const override = 0; /** Get the integer coordinates of the anchor node of an element. From 3c254f0af3374a4aa93b15e5d7a72d69d84e2254 Mon Sep 17 00:00:00 2001 From: Alex Dutka <97711898+dutkalex@users.noreply.github.com> Date: Thu, 11 Jul 2024 18:42:51 +0200 Subject: [PATCH 002/114] fix cast errors --- src/t8_cmesh/t8_cmesh_geometry.cxx | 2 +- src/t8_cmesh/t8_cmesh_partition.cxx | 2 +- src/t8_cmesh/t8_cmesh_readmshfile.cxx | 4 ++-- src/t8_cmesh/t8_cmesh_triangle.cxx | 2 +- src/t8_cmesh/t8_cmesh_vtk_writer.c | 2 +- src/t8_geometry/t8_geometry_handler.cxx | 2 +- 6 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/t8_cmesh/t8_cmesh_geometry.cxx b/src/t8_cmesh/t8_cmesh_geometry.cxx index 10bdcc05fc..539ecf8a2c 100644 --- a/src/t8_cmesh/t8_cmesh_geometry.cxx +++ b/src/t8_cmesh/t8_cmesh_geometry.cxx @@ -97,7 +97,7 @@ t8_cmesh_get_tree_geom_hash (t8_cmesh_t cmesh, t8_gloidx_t gtreeid) const size_t *hash = (const size_t *) t8_cmesh_get_attribute (cmesh, t8_get_package_id (), T8_CMESH_GEOMETRY_ATTRIBUTE_KEY, ltreeid); if (hash == nullptr) { - SC_ABORTF ("Could not find geometry for tree %ld.", gtreeid); + SC_ABORTF ("Could not find geometry for tree %ld.", static_cast(gtreeid)); } return *hash; } diff --git a/src/t8_cmesh/t8_cmesh_partition.cxx b/src/t8_cmesh/t8_cmesh_partition.cxx index c4654fe0be..1f65890d72 100644 --- a/src/t8_cmesh/t8_cmesh_partition.cxx +++ b/src/t8_cmesh/t8_cmesh_partition.cxx @@ -387,7 +387,7 @@ t8_cmesh_partition_sendrange (t8_cmesh_t cmesh, t8_cmesh_t cmesh_from, int *send ret--; } - t8_debugf ("%s_first = %i, %s_last = %i, last_tree = %li\n", "send", *send_first, "send", *send_last, ret); + t8_debugf ("%s_first = %i, %s_last = %i, last_tree = %li\n", "send", *send_first, "send", *send_last, static_cast(ret)); T8_ASSERT (*send_first >= 0); //TODO:reactivate T8_ASSERT (*send_last >= 0); diff --git a/src/t8_cmesh/t8_cmesh_readmshfile.cxx b/src/t8_cmesh/t8_cmesh_readmshfile.cxx index 0319619367..a107601106 100644 --- a/src/t8_cmesh/t8_cmesh_readmshfile.cxx +++ b/src/t8_cmesh/t8_cmesh_readmshfile.cxx @@ -623,7 +623,7 @@ t8_cmesh_msh_file_2_read_eles (t8_cmesh_t cmesh, FILE *fp, sc_hash_t *vertices, int switch_indices[4] = { 0 }; int iswitch; T8_ASSERT (t8_eclass_to_dimension[eclass] > 1); - t8_debugf ("Correcting negative volume of tree %li\n", tree_count); + t8_debugf ("Correcting negative volume of tree %li\n", static_cast(tree_count)); switch (eclass) { case T8_ECLASS_TRIANGLE: case T8_ECLASS_QUAD: @@ -956,7 +956,7 @@ t8_cmesh_msh_file_4_read_eles (t8_cmesh_t cmesh, FILE *fp, sc_hash_t *vertices, int switch_indices[4] = { 0 }; int iswitch; T8_ASSERT (t8_eclass_to_dimension[eclass] > 1); - t8_debugf ("Correcting negative volume of tree %li\n", tree_count); + t8_debugf ("Correcting negative volume of tree %li\n", static_cast(tree_count)); switch (eclass) { case T8_ECLASS_TRIANGLE: case T8_ECLASS_QUAD: diff --git a/src/t8_cmesh/t8_cmesh_triangle.cxx b/src/t8_cmesh/t8_cmesh_triangle.cxx index ba45711c1d..4651dd5c59 100644 --- a/src/t8_cmesh/t8_cmesh_triangle.cxx +++ b/src/t8_cmesh/t8_cmesh_triangle.cxx @@ -262,7 +262,7 @@ t8_cmesh_triangle_read_eles (t8_cmesh_t cmesh, int corner_offset, char *filename double temp; T8_ASSERT (dim == 3); - t8_debugf ("Correcting negative volume of tree %li\n", (long) triangle - triangle_offset); + t8_debugf ("Correcting negative volume of tree %li\n", static_cast(triangle - triangle_offset)); /* We switch vertex 0 and vertex 1 */ for (i = 0; i < 3; i++) { temp = tree_vertices[i]; diff --git a/src/t8_cmesh/t8_cmesh_vtk_writer.c b/src/t8_cmesh/t8_cmesh_vtk_writer.c index 53bf54b0f4..e96b464223 100644 --- a/src/t8_cmesh/t8_cmesh_vtk_writer.c +++ b/src/t8_cmesh/t8_cmesh_vtk_writer.c @@ -250,7 +250,7 @@ t8_cmesh_vtk_write_file_ext (t8_cmesh_t cmesh, const char *fileprefix, int write /* 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", (long)(tree->treeid + cmesh->first_tree)); if (!(sk % 8)) fprintf (vtufile, "\n "); } diff --git a/src/t8_geometry/t8_geometry_handler.cxx b/src/t8_geometry/t8_geometry_handler.cxx index e1fd87e423..3eb644edb1 100644 --- a/src/t8_geometry/t8_geometry_handler.cxx +++ b/src/t8_geometry/t8_geometry_handler.cxx @@ -62,7 +62,7 @@ t8_geometry_handler::update_tree (t8_cmesh_t cmesh, t8_gloidx_t gtreeid) active_geometry = get_geometry (geom_hash); SC_CHECK_ABORTF (active_geometry != nullptr, "Could not find geometry with hash %zu or tree %ld has no registered geometry.", geom_hash, - gtreeid); + static_cast(gtreeid)); } /* Get the user data for this geometry and this tree. */ active_geometry->t8_geom_load_tree_data (cmesh, gtreeid); From 4b8e8f90f460205d2cc7b80378ca4b1f5035297a Mon Sep 17 00:00:00 2001 From: Alex Dutka <97711898+dutkalex@users.noreply.github.com> Date: Thu, 11 Jul 2024 18:51:35 +0200 Subject: [PATCH 003/114] fix unitialized variables --- src/t8_cmesh/t8_cmesh_partition.cxx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/t8_cmesh/t8_cmesh_partition.cxx b/src/t8_cmesh/t8_cmesh_partition.cxx index 1f65890d72..57d37e4a5a 100644 --- a/src/t8_cmesh/t8_cmesh_partition.cxx +++ b/src/t8_cmesh/t8_cmesh_partition.cxx @@ -1436,7 +1436,9 @@ t8_cmesh_partition_given (t8_cmesh_t cmesh, const struct t8_cmesh *cmesh_from, c size_t my_buffer_bytes = -1; char **send_buffer = NULL, *my_buffer = NULL; - int fs, ls, fr, lr; + int fs, ls; + int fr = 0; // is it a good default though? + int lr = 0; // to discuss before merging sc_MPI_Request *requests = NULL; t8_locidx_t num_ghosts, itree, num_trees; From 57ce3175196bc4ea80c003c2375fbe57801cca4e Mon Sep 17 00:00:00 2001 From: Alex Dutka <97711898+dutkalex@users.noreply.github.com> Date: Thu, 11 Jul 2024 18:54:54 +0200 Subject: [PATCH 004/114] fix potential out of bounds access --- src/t8_cmesh/t8_cmesh_readmshfile.cxx | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/t8_cmesh/t8_cmesh_readmshfile.cxx b/src/t8_cmesh/t8_cmesh_readmshfile.cxx index a107601106..d46a1d74cc 100644 --- a/src/t8_cmesh/t8_cmesh_readmshfile.cxx +++ b/src/t8_cmesh/t8_cmesh_readmshfile.cxx @@ -179,7 +179,7 @@ t8_cmesh_check_version_of_msh_file (FILE *fp) /* Search for the line starting with "$MeshFormat". */ while (!feof (fp) && strcmp (first_word, "$MeshFormat")) { (void) t8_cmesh_msh_read_next_line (&line, &linen, fp); - retval = sscanf (line, "%2048s", first_word); + retval = sscanf (line, "%2047s", first_word); /* Checking for read/write error */ if (retval != 1) { @@ -258,7 +258,7 @@ t8_msh_file_2_read_nodes (FILE *fp, t8_locidx_t *num_nodes, sc_mempool_t **node_ while (!feof (fp) && strcmp (first_word, "$Nodes")) { (void) t8_cmesh_msh_read_next_line (&line, &linen, fp); /* Get the first word of this line */ - retval = sscanf (line, "%2048s", first_word); + retval = sscanf (line, "%2047s", first_word); /* Checking for read/write error */ if (retval != 1) { @@ -358,7 +358,7 @@ t8_msh_file_4_read_nodes (FILE *fp, t8_locidx_t *num_nodes, sc_mempool_t **node_ while (!feof (fp) && strcmp (first_word, "$Nodes")) { (void) t8_cmesh_msh_read_next_line (&line, &linen, fp); /* Get the first word of this line */ - retval = sscanf (line, "%2048s", first_word); + retval = sscanf (line, "%2047s", first_word); /* Checking for read/write error */ if (retval != 1) { t8_global_errorf ("Premature end of line while reading nodes.\n"); @@ -519,7 +519,7 @@ t8_cmesh_msh_file_2_read_eles (t8_cmesh_t cmesh, FILE *fp, sc_hash_t *vertices, while (!feof (fp) && strcmp (first_word, "$Elements")) { (void) t8_cmesh_msh_read_next_line (&line, &linen, fp); /* Get the first word of this line */ - retval = sscanf (line, "%2048s", first_word); + retval = sscanf (line, "%2047s", first_word); /* Checking for read/write error */ if (retval != 1) { @@ -836,7 +836,7 @@ t8_cmesh_msh_file_4_read_eles (t8_cmesh_t cmesh, FILE *fp, sc_hash_t *vertices, while (!feof (fp) && strcmp (first_word, "$Elements")) { (void) t8_cmesh_msh_read_next_line (&line, &linen, fp); /* Get the first word of this line */ - retval = sscanf (line, "%2048s", first_word); + retval = sscanf (line, "%2047s", first_word); /* Checking for read/write error */ if (retval != 1) { From 945057fbec227f8e1fa1fd7e3e312dc48735d887 Mon Sep 17 00:00:00 2001 From: Alex Dutka <97711898+dutkalex@users.noreply.github.com> Date: Thu, 11 Jul 2024 19:12:05 +0200 Subject: [PATCH 005/114] fix unused variables --- src/t8_forest/t8_forest_partition.cxx | 4 +--- src/t8_forest/t8_forest_vtk.cxx | 4 ++-- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/src/t8_forest/t8_forest_partition.cxx b/src/t8_forest/t8_forest_partition.cxx index f9f79223ae..e3b67d9705 100644 --- a/src/t8_forest/t8_forest_partition.cxx +++ b/src/t8_forest/t8_forest_partition.cxx @@ -1025,7 +1025,7 @@ static void t8_forest_partition_recvloop (t8_forest_t forest, int recv_first, int recv_last, const int recv_data, sc_array_t *data_out, char *sent_to_self, size_t byte_to_self) { - int iproc, num_receive, prev_recvd; + int iproc, prev_recvd; t8_locidx_t last_received_local_element = 0; t8_forest_t forest_from; int mpiret; @@ -1045,7 +1045,6 @@ t8_forest_partition_recvloop (t8_forest_t forest, int recv_first, int recv_last, /* In order of their ranks, receive the trees and elements from the other processes. */ - num_receive = 0; prev_recvd = 0; if (!recv_data) { forest->local_num_elements = 0; @@ -1053,7 +1052,6 @@ t8_forest_partition_recvloop (t8_forest_t forest, int recv_first, int recv_last, for (iproc = recv_first; iproc <= recv_last; iproc++) { if (!t8_forest_partition_empty (offset_from, iproc)) { /* We receive from each nonempty rank between recv_first and recv_last */ - num_receive++; if (iproc != forest->mpirank) { /* Probe for the message */ mpiret = sc_MPI_Probe (iproc, T8_MPI_PARTITION_FOREST, comm, &status); diff --git a/src/t8_forest/t8_forest_vtk.cxx b/src/t8_forest/t8_forest_vtk.cxx index c97044ef88..7f726a72c0 100644 --- a/src/t8_forest/t8_forest_vtk.cxx +++ b/src/t8_forest/t8_forest_vtk.cxx @@ -114,10 +114,10 @@ typedef int (*t8_forest_vtk_cell_data_kernel) (t8_forest_t forest, const t8_loci #define T8_FOREST_VTK_QUADRATIC_ELEMENT_MAX_CORNERS 20 /** Lookup table for number of nodes for curved eclasses. */ -const int t8_curved_eclass_num_nodes[T8_ECLASS_COUNT] = { 1, 3, 8, 6, 20, 10, 15, 13 }; +[[maybe_unused]] const int t8_curved_eclass_num_nodes[T8_ECLASS_COUNT] = { 1, 3, 8, 6, 20, 10, 15, 13 }; /** Lookup table for vtk types of curved elements */ -const int t8_curved_eclass_vtk_type[T8_ECLASS_COUNT] = { 1, 21, 23, 22, 25, 24, 26, 27 }; +[[maybe_unused]] const int t8_curved_eclass_vtk_type[T8_ECLASS_COUNT] = { 1, 21, 23, 22, 25, 24, 26, 27 }; /** Map vtk element corners to element reference coordinates. The reference * coordinates are defined in such a way, that the linear vtk corners are listed From 3ec21ebacafbb8d44bbfb56546f7d5a240b4c063 Mon Sep 17 00:00:00 2001 From: Alex Dutka <97711898+dutkalex@users.noreply.github.com> Date: Thu, 11 Jul 2024 19:16:59 +0200 Subject: [PATCH 006/114] fix dangling pointer --- src/t8_geometry/t8_geometry_base.hxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/t8_geometry/t8_geometry_base.hxx b/src/t8_geometry/t8_geometry_base.hxx index df848cb2e3..43a7e01c43 100644 --- a/src/t8_geometry/t8_geometry_base.hxx +++ b/src/t8_geometry/t8_geometry_base.hxx @@ -156,7 +156,7 @@ struct t8_geometry * Get the name of this geometry. * \return The name. */ - inline const std::string + inline const std::string& t8_geom_get_name () const { return name; From f5cece6f84e1344a3b599633cca52203bbe31e40 Mon Sep 17 00:00:00 2001 From: Alex Dutka <97711898+dutkalex@users.noreply.github.com> Date: Thu, 11 Jul 2024 19:23:44 +0200 Subject: [PATCH 007/114] removed call to deprecated sprintf --- src/t8_cmesh/t8_cmesh_partition.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/t8_cmesh/t8_cmesh_partition.cxx b/src/t8_cmesh/t8_cmesh_partition.cxx index 57d37e4a5a..ebdcc1337b 100644 --- a/src/t8_cmesh/t8_cmesh_partition.cxx +++ b/src/t8_cmesh/t8_cmesh_partition.cxx @@ -1406,7 +1406,7 @@ t8_cmesh_partition_debug_listprocs (t8_cmesh_t cmesh, t8_cmesh_t cmesh_from, sc_ } } t8_debugf ("I send to: %s\n", out); - sprintf (out, " "); + std::strcpy(out, " "); if (cmesh_from->set_partition) { for (p = 0; p < mpisize; p++) { if (t8_offset_sendsto (p, mpirank, from, to)) { From a7a3e55cd5a73c8231ef0d966a2c8fb71668cffa Mon Sep 17 00:00:00 2001 From: Alex Dutka <97711898+dutkalex@users.noreply.github.com> Date: Thu, 11 Jul 2024 19:26:54 +0200 Subject: [PATCH 008/114] removed useless branch --- src/t8_forest/t8_forest_ghost.cxx | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/t8_forest/t8_forest_ghost.cxx b/src/t8_forest/t8_forest_ghost.cxx index f53b4806c7..ebdcde905b 100644 --- a/src/t8_forest/t8_forest_ghost.cxx +++ b/src/t8_forest/t8_forest_ghost.cxx @@ -595,11 +595,7 @@ t8_forest_ghost_search_boundary (t8_forest_t forest, t8_locidx_t ltreeid, const /* Store the new bounds at the entry for this element */ new_bounds[iface * 2] = lower; new_bounds[iface * 2 + 1] = upper; - if (lower == upper && lower == forest->mpirank) { - /* All neighbor leaves at this face are owned by the current rank */ - faces_totally_owned = faces_totally_owned && 1; - } - else { + if (lower != upper or lower != forest->mpirank) { faces_totally_owned = 0; } } From ca865201250b347e48df52ac85c0ca8fd39af40d Mon Sep 17 00:00:00 2001 From: Alex Dutka <97711898+dutkalex@users.noreply.github.com> Date: Thu, 11 Jul 2024 19:36:37 +0200 Subject: [PATCH 009/114] add missing include --- src/t8_cmesh/t8_cmesh_partition.cxx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/t8_cmesh/t8_cmesh_partition.cxx b/src/t8_cmesh/t8_cmesh_partition.cxx index ebdcc1337b..a5bab77bac 100644 --- a/src/t8_cmesh/t8_cmesh_partition.cxx +++ b/src/t8_cmesh/t8_cmesh_partition.cxx @@ -25,6 +25,8 @@ * TODO: document this file */ +#include + #include #include #include From 67afb459c575efb84a0a2a1fe7f1c7a2b3fc63ae Mon Sep 17 00:00:00 2001 From: Alex Dutka <97711898+dutkalex@users.noreply.github.com> Date: Fri, 26 Jul 2024 10:41:08 +0200 Subject: [PATCH 010/114] Update src/t8_cmesh/t8_cmesh_partition.cxx Co-authored-by: Sandro Elsweijer <49643115+sandro-elsweijer@users.noreply.github.com> --- src/t8_cmesh/t8_cmesh_partition.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/t8_cmesh/t8_cmesh_partition.cxx b/src/t8_cmesh/t8_cmesh_partition.cxx index 956b37a7a8..8199a539cd 100644 --- a/src/t8_cmesh/t8_cmesh_partition.cxx +++ b/src/t8_cmesh/t8_cmesh_partition.cxx @@ -1443,8 +1443,8 @@ t8_cmesh_partition_given (const t8_cmesh_t cmesh, const t8_cmesh_t cmesh_from, c char **send_buffer = NULL, *my_buffer = NULL; int fs, ls; - int fr = 0; // is it a good default though? - int lr = 0; // to discuss before merging + int fr = 0; + int lr = 0; sc_MPI_Request *requests = NULL; t8_locidx_t num_ghosts, itree, num_trees; From dc3f4752509286b7268e023da81ca8e2c6347392 Mon Sep 17 00:00:00 2001 From: Alex Dutka <97711898+dutkalex@users.noreply.github.com> Date: Fri, 26 Jul 2024 10:41:30 +0200 Subject: [PATCH 011/114] Update src/t8_cmesh/t8_cmesh_vtk_writer.c Co-authored-by: Sandro Elsweijer <49643115+sandro-elsweijer@users.noreply.github.com> --- src/t8_cmesh/t8_cmesh_vtk_writer.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/t8_cmesh/t8_cmesh_vtk_writer.c b/src/t8_cmesh/t8_cmesh_vtk_writer.c index e96b464223..29f45c41c0 100644 --- a/src/t8_cmesh/t8_cmesh_vtk_writer.c +++ b/src/t8_cmesh/t8_cmesh_vtk_writer.c @@ -250,7 +250,8 @@ t8_cmesh_vtk_write_file_ext (t8_cmesh_t cmesh, const char *fileprefix, int write /* 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)); + T8_ASSERT (tree->treeid + cmesh->first_tree == tree->treeid + (t8_locidx_t) cmesh->first_tree); + fprintf (vtufile, " %ld", tree->treeid + (t8_locidx_t) cmesh->first_tree); if (!(sk % 8)) fprintf (vtufile, "\n "); } From 0eea5c87c36f42da5423c674f5e558240cdddd38 Mon Sep 17 00:00:00 2001 From: Alex Dutka <97711898+dutkalex@users.noreply.github.com> Date: Thu, 11 Jul 2024 18:34:59 +0200 Subject: [PATCH 012/114] fix override warnings --- .../t8_geometry_analytic.hxx | 22 ++++++------- .../t8_geometry_zero.hxx | 22 ++++++------- .../t8_default_common/t8_default_common.hxx | 32 +++++++++---------- 3 files changed, 38 insertions(+), 38 deletions(-) diff --git a/src/t8_geometry/t8_geometry_implementations/t8_geometry_analytic.hxx b/src/t8_geometry/t8_geometry_implementations/t8_geometry_analytic.hxx index 53331b82d9..67011ff790 100644 --- a/src/t8_geometry/t8_geometry_implementations/t8_geometry_analytic.hxx +++ b/src/t8_geometry/t8_geometry_implementations/t8_geometry_analytic.hxx @@ -70,7 +70,7 @@ struct t8_geometry_analytic: public t8_geometry * \return The type. */ inline t8_geometry_type_t - t8_geom_get_type () const + t8_geom_get_type () const override { return T8_GEOMETRY_TYPE_ANALYTIC; }; @@ -83,9 +83,9 @@ struct t8_geometry_analytic: public t8_geometry * \param [in] num_coords Amount of points of \f$ \mathrm{dim} \f$ to map. * \param [out] out_coords The mapped coordinates in physical space of \a ref_coords. The length is \a num_coords * 3. */ - virtual void + void t8_geom_evaluate (t8_cmesh_t cmesh, t8_gloidx_t gtreeid, const double *ref_coords, const size_t num_coords, - double *out_coords) const; + double *out_coords) const override; /** * Compute the jacobian of the \a t8_geom_evaluate map at a point in the reference space \f$ [0,1]^\mathrm{dim} \f$. @@ -100,9 +100,9 @@ struct t8_geometry_analytic: public t8_geometry * dim 1: J = (0) dim 2: J = (0 1) dim 3: J = (0 1 0) * (0) (0 0) (0 0 1) */ - virtual void + void t8_geom_evaluate_jacobian (t8_cmesh_t cmesh, t8_gloidx_t gtreeid, const double *ref_coords, const size_t num_coords, - double *jacobian) const; + double *jacobian) const override; /** * \param[in] forest The forest of the element. @@ -113,10 +113,10 @@ struct t8_geometry_analytic: public t8_geometry * \param[in, out] is_inside Array to fill with flags whether the point is inside or not * \param[in] tolerance Tolerance of the inside-check */ - virtual void + void t8_geom_point_batch_inside_element (t8_forest_t forest, t8_locidx_t ltreeid, const t8_element_t *element, const double *points, const int num_points, int *is_inside, - const double tolerance) + const double tolerance) const override { SC_ABORTF ("Function not yet implemented"); } @@ -125,8 +125,8 @@ struct t8_geometry_analytic: public t8_geometry * Check if the currently active tree has a negative volume * \return True (non-zero) if the currently loaded tree has a negative volume. 0 otherwise. */ - virtual bool - t8_geom_tree_negative_volume () const; + bool + t8_geom_tree_negative_volume () 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 @@ -135,8 +135,8 @@ struct t8_geometry_analytic: public t8_geometry * \param [in] cmesh The cmesh. * \param [in] gtreeid The global tree. */ - virtual void - t8_geom_load_tree_data (t8_cmesh_t cmesh, t8_gloidx_t gtreeid); + void + t8_geom_load_tree_data (t8_cmesh_t cmesh, t8_gloidx_t gtreeid) override; inline const void * t8_geom_analytic_get_user_data () diff --git a/src/t8_geometry/t8_geometry_implementations/t8_geometry_zero.hxx b/src/t8_geometry/t8_geometry_implementations/t8_geometry_zero.hxx index 94b56ecb7c..24366040c5 100644 --- a/src/t8_geometry/t8_geometry_implementations/t8_geometry_zero.hxx +++ b/src/t8_geometry/t8_geometry_implementations/t8_geometry_zero.hxx @@ -49,8 +49,8 @@ struct t8_geometry_zero: public t8_geometry * Check if the currently active tree has a negative volume * \return True (non-zero) if the currently loaded tree has a negative volume. 0 otherwise. */ - virtual bool - t8_geom_tree_negative_volume () const + bool + t8_geom_tree_negative_volume () const override { return 0; }; @@ -65,7 +65,7 @@ struct t8_geometry_zero: public t8_geometry * \return The type. */ inline t8_geometry_type_t - t8_geom_get_type () const + t8_geom_get_type () const override { return T8_GEOMETRY_TYPE_ZERO; }; @@ -79,9 +79,9 @@ struct t8_geometry_zero: public t8_geometry * \param [out] out_coords The mapped coordinates in physical space of \a ref_coords. The length is \a num_coords * 3. * \note All entries in out_coords will be set to 0. */ - virtual void + void t8_geom_evaluate (t8_cmesh_t cmesh, t8_gloidx_t gtreeid, const double *ref_coords, const size_t num_coords, - double *out_coords) const; + double *out_coords) const override; /** * Compute the jacobian of the \a t8_geom_evaluate map at a point in the reference space \f$ [0,1]^\mathrm{dim} \f$. @@ -93,9 +93,9 @@ struct t8_geometry_zero: public t8_geometry * correspond to the \f$ i \f$-th column of the jacobian (Entry \f$ 3 \cdot i + j \f$ is \f$ \frac{\partial f_j}{\partial x_i} \f$). * \note All entries in \a jacobian will be set to zero. */ - virtual void + void t8_geom_evaluate_jacobian (t8_cmesh_t cmesh, t8_gloidx_t gtreeid, const double *ref_coords, const size_t num_coords, - double *jacobian) const; + double *jacobian) const override; /** * \param[in] forest The forest of the element. @@ -106,10 +106,10 @@ struct t8_geometry_zero: public t8_geometry * \param[in, out] is_inside Array to fill with flags whether the point is inside or not * \param[in] tolerance Tolerance of the inside-check */ - virtual void + void t8_geom_point_batch_inside_element (t8_forest_t forest, t8_locidx_t ltreeid, const t8_element_t *element, const double *points, const int num_points, int *is_inside, - const double tolerance) + const double tolerance) const override { const double zeros[3] = { 0 }; for (int i_point = 0; i_point < num_points; ++i_point) { @@ -125,8 +125,8 @@ struct t8_geometry_zero: public t8_geometry * \param [in] cmesh The cmesh. * \param [in] gtreeid The global tree. */ - virtual inline void - t8_geom_load_tree_data (t8_cmesh_t cmesh, t8_gloidx_t gtreeid); + inline void + t8_geom_load_tree_data (t8_cmesh_t cmesh, t8_gloidx_t gtreeid) override; }; #endif /* !T8_GEOMETRY_ZERO_HXX */ diff --git a/src/t8_schemes/t8_default/t8_default_common/t8_default_common.hxx b/src/t8_schemes/t8_default/t8_default_common/t8_default_common.hxx index 528840d8d0..e40861ca88 100644 --- a/src/t8_schemes/t8_default/t8_default_common/t8_default_common.hxx +++ b/src/t8_schemes/t8_default/t8_default_common/t8_default_common.hxx @@ -41,20 +41,20 @@ class t8_default_scheme_common_c: public t8_eclass_scheme_c { t8_element_deinit (int length, t8_element_t *elem) const override; /** Compute the number of corners of a given element. */ - virtual int - t8_element_num_corners (const t8_element_t *elem) const; + int + t8_element_num_corners (const t8_element_t *elem) const override; /** Allocate space for a bunch of elements. */ - virtual void - t8_element_new (int length, t8_element_t **elem) const; + void + t8_element_new (int length, t8_element_t **elem) const override; /** Deallocate space for a bunch of elements. */ - virtual void - t8_element_destroy (int length, t8_element_t **elem) const; + void + t8_element_destroy (int length, t8_element_t **elem) const override; /** Return the shape of an element */ - virtual t8_element_shape_t - t8_element_shape (const t8_element_t *elem) const; + t8_element_shape_t + t8_element_shape (const t8_element_t *elem) const override; /** Count how many leaf descendants of a given uniform level an element would produce. * \param [in] t The element to be checked. @@ -64,8 +64,8 @@ class t8_default_scheme_common_c: public t8_eclass_scheme_c { * Each default element (except pyramids) refines into 2^{dim * (level - level(t))} * children. */ - virtual t8_gloidx_t - t8_element_count_leaves (const t8_element_t *t, int level) const; + t8_gloidx_t + t8_element_count_leaves (const t8_element_t *t, int level) const override; /** Compute the number of siblings of an element. That is the number of * Children of its parent. @@ -73,16 +73,16 @@ class t8_default_scheme_common_c: public t8_eclass_scheme_c { * \return The number of siblings of \a element. * Note that this number is >= 1, since we count the element itself as a sibling. */ - virtual int - t8_element_num_siblings (const t8_element_t *elem) const; + int + t8_element_num_siblings (const t8_element_t *elem) const override; /** Count how many leaf descendants of a given uniform level the root element will produce. * \param [in] level A refinement level. * \return The value of \ref t8_element_count_leaves if the input element * is the root (level 0) element. */ - virtual t8_gloidx_t - t8_element_count_leaves_from_root (int level) const; + t8_gloidx_t + t8_element_count_leaves_from_root (int level) const override; /** Compute the integer coordinates of a given element vertex. * The default scheme implements the Morton type SFCs. In these SFCs the @@ -108,9 +108,9 @@ class t8_default_scheme_common_c: public t8_eclass_scheme_c { * \param [out] out_coords The coordinates of the points in the * reference space of the tree. */ - virtual void + void t8_element_reference_coords (const t8_element_t *elem, const double *ref_coords, const size_t num_coords, - double *out_coords) const + double *out_coords) const override = 0; /** Get the integer coordinates of the anchor node of an element. From 37e24c124dfa94e3482c400a5f7427cf37856482 Mon Sep 17 00:00:00 2001 From: Alex Dutka <97711898+dutkalex@users.noreply.github.com> Date: Thu, 11 Jul 2024 18:42:51 +0200 Subject: [PATCH 013/114] fix cast errors --- src/t8_cmesh/t8_cmesh_geometry.cxx | 2 +- src/t8_cmesh/t8_cmesh_partition.cxx | 2 +- src/t8_cmesh/t8_cmesh_readmshfile.cxx | 4 ++-- src/t8_cmesh/t8_cmesh_triangle.cxx | 2 +- src/t8_cmesh/t8_cmesh_vtk_writer.c | 2 +- src/t8_geometry/t8_geometry_handler.cxx | 2 +- 6 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/t8_cmesh/t8_cmesh_geometry.cxx b/src/t8_cmesh/t8_cmesh_geometry.cxx index 1fd599ea88..68a15da36f 100644 --- a/src/t8_cmesh/t8_cmesh_geometry.cxx +++ b/src/t8_cmesh/t8_cmesh_geometry.cxx @@ -97,7 +97,7 @@ t8_cmesh_get_tree_geom_hash (const t8_cmesh_t cmesh, const t8_gloidx_t gtreeid) const size_t *hash = (const size_t *) t8_cmesh_get_attribute (cmesh, t8_get_package_id (), T8_CMESH_GEOMETRY_ATTRIBUTE_KEY, ltreeid); if (hash == nullptr) { - SC_ABORTF ("Could not find geometry for tree %ld.", gtreeid); + SC_ABORTF ("Could not find geometry for tree %ld.", static_cast(gtreeid)); } return *hash; } diff --git a/src/t8_cmesh/t8_cmesh_partition.cxx b/src/t8_cmesh/t8_cmesh_partition.cxx index 41f48c6638..4dc1bfbecd 100644 --- a/src/t8_cmesh/t8_cmesh_partition.cxx +++ b/src/t8_cmesh/t8_cmesh_partition.cxx @@ -389,7 +389,7 @@ 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, ret); + t8_debugf ("%s_first = %i, %s_last = %i, last_tree = %li\n", "send", *send_first, "send", *send_last, static_cast(ret)); T8_ASSERT (*send_first >= 0); //TODO:reactivate T8_ASSERT (*send_last >= 0); diff --git a/src/t8_cmesh/t8_cmesh_readmshfile.cxx b/src/t8_cmesh/t8_cmesh_readmshfile.cxx index de8f05b34e..054ec0d919 100644 --- a/src/t8_cmesh/t8_cmesh_readmshfile.cxx +++ b/src/t8_cmesh/t8_cmesh_readmshfile.cxx @@ -634,7 +634,7 @@ t8_cmesh_msh_file_2_read_eles (t8_cmesh_t cmesh, FILE *fp, sc_hash_t *vertices, int switch_indices[4] = { 0 }; int iswitch; T8_ASSERT (t8_eclass_to_dimension[eclass] > 1); - t8_debugf ("Correcting negative volume of tree %li\n", tree_count); + t8_debugf ("Correcting negative volume of tree %li\n", static_cast(tree_count)); switch (eclass) { case T8_ECLASS_TRIANGLE: case T8_ECLASS_QUAD: @@ -973,7 +973,7 @@ t8_cmesh_msh_file_4_read_eles (t8_cmesh_t cmesh, FILE *fp, sc_hash_t *vertices, int switch_indices[4] = { 0 }; int iswitch; T8_ASSERT (t8_eclass_to_dimension[eclass] > 1); - t8_debugf ("Correcting negative volume of tree %li\n", tree_count); + t8_debugf ("Correcting negative volume of tree %li\n", static_cast(tree_count)); switch (eclass) { case T8_ECLASS_TRIANGLE: case T8_ECLASS_QUAD: diff --git a/src/t8_cmesh/t8_cmesh_triangle.cxx b/src/t8_cmesh/t8_cmesh_triangle.cxx index ba45711c1d..4651dd5c59 100644 --- a/src/t8_cmesh/t8_cmesh_triangle.cxx +++ b/src/t8_cmesh/t8_cmesh_triangle.cxx @@ -262,7 +262,7 @@ t8_cmesh_triangle_read_eles (t8_cmesh_t cmesh, int corner_offset, char *filename double temp; T8_ASSERT (dim == 3); - t8_debugf ("Correcting negative volume of tree %li\n", (long) triangle - triangle_offset); + t8_debugf ("Correcting negative volume of tree %li\n", static_cast(triangle - triangle_offset)); /* We switch vertex 0 and vertex 1 */ for (i = 0; i < 3; i++) { temp = tree_vertices[i]; diff --git a/src/t8_cmesh/t8_cmesh_vtk_writer.c b/src/t8_cmesh/t8_cmesh_vtk_writer.c index bed01ef3f4..4c9d5bc7fc 100644 --- a/src/t8_cmesh/t8_cmesh_vtk_writer.c +++ b/src/t8_cmesh/t8_cmesh_vtk_writer.c @@ -250,7 +250,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", (long)(tree->treeid + cmesh->first_tree)); if (!(sk % 8)) fprintf (vtufile, "\n "); } diff --git a/src/t8_geometry/t8_geometry_handler.cxx b/src/t8_geometry/t8_geometry_handler.cxx index e22b55f2c1..a64fc47412 100644 --- a/src/t8_geometry/t8_geometry_handler.cxx +++ b/src/t8_geometry/t8_geometry_handler.cxx @@ -62,7 +62,7 @@ t8_geometry_handler::update_tree (t8_cmesh_t cmesh, t8_gloidx_t gtreeid) active_geometry = get_geometry (geom_hash); SC_CHECK_ABORTF (active_geometry != nullptr, "Could not find geometry with hash %zu or tree %ld has no registered geometry.", geom_hash, - gtreeid); + static_cast(gtreeid)); } /* Get the user data for this geometry and this tree. */ active_geometry->t8_geom_load_tree_data (cmesh, gtreeid); From 2ad40390cd120236440d6d29326991a74fd1318f Mon Sep 17 00:00:00 2001 From: Alex Dutka <97711898+dutkalex@users.noreply.github.com> Date: Thu, 11 Jul 2024 18:51:35 +0200 Subject: [PATCH 014/114] fix unitialized variables --- src/t8_cmesh/t8_cmesh_partition.cxx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/t8_cmesh/t8_cmesh_partition.cxx b/src/t8_cmesh/t8_cmesh_partition.cxx index 4dc1bfbecd..d5fb3c31d0 100644 --- a/src/t8_cmesh/t8_cmesh_partition.cxx +++ b/src/t8_cmesh/t8_cmesh_partition.cxx @@ -1440,7 +1440,9 @@ t8_cmesh_partition_given (const t8_cmesh_t cmesh, const t8_cmesh_t cmesh_from, c size_t my_buffer_bytes = -1; char **send_buffer = NULL, *my_buffer = NULL; - int fs, ls, fr, lr; + int fs, ls; + int fr = 0; // is it a good default though? + int lr = 0; // to discuss before merging sc_MPI_Request *requests = NULL; t8_locidx_t num_ghosts, itree, num_trees; From 02b942135b484ee64c18570ce98173ed99638164 Mon Sep 17 00:00:00 2001 From: Alex Dutka <97711898+dutkalex@users.noreply.github.com> Date: Thu, 11 Jul 2024 18:54:54 +0200 Subject: [PATCH 015/114] fix potential out of bounds access --- src/t8_cmesh/t8_cmesh_readmshfile.cxx | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/t8_cmesh/t8_cmesh_readmshfile.cxx b/src/t8_cmesh/t8_cmesh_readmshfile.cxx index 054ec0d919..094e25622d 100644 --- a/src/t8_cmesh/t8_cmesh_readmshfile.cxx +++ b/src/t8_cmesh/t8_cmesh_readmshfile.cxx @@ -179,7 +179,7 @@ t8_cmesh_check_version_of_msh_file (FILE *fp) /* Search for the line starting with "$MeshFormat". */ while (!feof (fp) && strcmp (first_word, "$MeshFormat")) { (void) t8_cmesh_msh_read_next_line (&line, &linen, fp); - retval = sscanf (line, "%2048s", first_word); + retval = sscanf (line, "%2047s", first_word); /* Checking for read/write error */ if (retval != 1) { @@ -258,7 +258,7 @@ t8_msh_file_2_read_nodes (FILE *fp, t8_locidx_t *num_nodes, sc_mempool_t **node_ while (!feof (fp) && strcmp (first_word, "$Nodes")) { (void) t8_cmesh_msh_read_next_line (&line, &linen, fp); /* Get the first word of this line */ - retval = sscanf (line, "%2048s", first_word); + retval = sscanf (line, "%2047s", first_word); /* Checking for read/write error */ if (retval != 1) { @@ -358,7 +358,7 @@ t8_msh_file_4_read_nodes (FILE *fp, t8_locidx_t *num_nodes, sc_mempool_t **node_ while (!feof (fp) && strcmp (first_word, "$Nodes")) { (void) t8_cmesh_msh_read_next_line (&line, &linen, fp); /* Get the first word of this line */ - retval = sscanf (line, "%2048s", first_word); + retval = sscanf (line, "%2047s", first_word); /* Checking for read/write error */ if (retval != 1) { t8_global_errorf ("Premature end of line while reading nodes.\n"); @@ -524,7 +524,7 @@ t8_cmesh_msh_file_2_read_eles (t8_cmesh_t cmesh, FILE *fp, sc_hash_t *vertices, while (!feof (fp) && strcmp (first_word, "$Elements")) { (void) t8_cmesh_msh_read_next_line (&line, &linen, fp); /* Get the first word of this line */ - retval = sscanf (line, "%2048s", first_word); + retval = sscanf (line, "%2047s", first_word); /* Checking for read/write error */ if (retval != 1) { @@ -847,7 +847,7 @@ t8_cmesh_msh_file_4_read_eles (t8_cmesh_t cmesh, FILE *fp, sc_hash_t *vertices, while (!feof (fp) && strcmp (first_word, "$Elements")) { (void) t8_cmesh_msh_read_next_line (&line, &linen, fp); /* Get the first word of this line */ - retval = sscanf (line, "%2048s", first_word); + retval = sscanf (line, "%2047s", first_word); /* Checking for read/write error */ if (retval != 1) { From 627f9a721c92ae65747c66d77137be70852bb763 Mon Sep 17 00:00:00 2001 From: Alex Dutka <97711898+dutkalex@users.noreply.github.com> Date: Thu, 11 Jul 2024 19:12:05 +0200 Subject: [PATCH 016/114] fix unused variables --- src/t8_forest/t8_forest_partition.cxx | 4 +--- src/t8_forest/t8_forest_vtk.cxx | 4 ++-- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/src/t8_forest/t8_forest_partition.cxx b/src/t8_forest/t8_forest_partition.cxx index 8826af7f3a..eb77317fa4 100644 --- a/src/t8_forest/t8_forest_partition.cxx +++ b/src/t8_forest/t8_forest_partition.cxx @@ -1044,7 +1044,7 @@ static void t8_forest_partition_recvloop (t8_forest_t forest, int recv_first, int recv_last, const int recv_data, sc_array_t *data_out, char *sent_to_self, size_t byte_to_self) { - int iproc, num_receive, prev_recvd; + int iproc, prev_recvd; t8_locidx_t last_received_local_element = 0; t8_forest_t forest_from; int mpiret; @@ -1064,7 +1064,6 @@ t8_forest_partition_recvloop (t8_forest_t forest, int recv_first, int recv_last, /* In order of their ranks, receive the trees and elements from the other processes. */ - num_receive = 0; prev_recvd = 0; if (!recv_data) { forest->local_num_elements = 0; @@ -1072,7 +1071,6 @@ t8_forest_partition_recvloop (t8_forest_t forest, int recv_first, int recv_last, for (iproc = recv_first; iproc <= recv_last; iproc++) { if (!t8_forest_partition_empty (offset_from, iproc)) { /* We receive from each nonempty rank between recv_first and recv_last */ - num_receive++; if (iproc != forest->mpirank) { /* Probe for the message */ mpiret = sc_MPI_Probe (iproc, T8_MPI_PARTITION_FOREST, comm, &status); diff --git a/src/t8_forest/t8_forest_vtk.cxx b/src/t8_forest/t8_forest_vtk.cxx index c97044ef88..7f726a72c0 100644 --- a/src/t8_forest/t8_forest_vtk.cxx +++ b/src/t8_forest/t8_forest_vtk.cxx @@ -114,10 +114,10 @@ typedef int (*t8_forest_vtk_cell_data_kernel) (t8_forest_t forest, const t8_loci #define T8_FOREST_VTK_QUADRATIC_ELEMENT_MAX_CORNERS 20 /** Lookup table for number of nodes for curved eclasses. */ -const int t8_curved_eclass_num_nodes[T8_ECLASS_COUNT] = { 1, 3, 8, 6, 20, 10, 15, 13 }; +[[maybe_unused]] const int t8_curved_eclass_num_nodes[T8_ECLASS_COUNT] = { 1, 3, 8, 6, 20, 10, 15, 13 }; /** Lookup table for vtk types of curved elements */ -const int t8_curved_eclass_vtk_type[T8_ECLASS_COUNT] = { 1, 21, 23, 22, 25, 24, 26, 27 }; +[[maybe_unused]] const int t8_curved_eclass_vtk_type[T8_ECLASS_COUNT] = { 1, 21, 23, 22, 25, 24, 26, 27 }; /** Map vtk element corners to element reference coordinates. The reference * coordinates are defined in such a way, that the linear vtk corners are listed From e159a714bcebd519ac827906f5a1668fb44eeb1f Mon Sep 17 00:00:00 2001 From: Alex Dutka <97711898+dutkalex@users.noreply.github.com> Date: Thu, 11 Jul 2024 19:16:59 +0200 Subject: [PATCH 017/114] fix dangling pointer --- src/t8_geometry/t8_geometry_base.hxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/t8_geometry/t8_geometry_base.hxx b/src/t8_geometry/t8_geometry_base.hxx index df848cb2e3..43a7e01c43 100644 --- a/src/t8_geometry/t8_geometry_base.hxx +++ b/src/t8_geometry/t8_geometry_base.hxx @@ -156,7 +156,7 @@ struct t8_geometry * Get the name of this geometry. * \return The name. */ - inline const std::string + inline const std::string& t8_geom_get_name () const { return name; From 78213f66dfbef65d80f6c439a0b85c4f51605a42 Mon Sep 17 00:00:00 2001 From: Alex Dutka <97711898+dutkalex@users.noreply.github.com> Date: Thu, 11 Jul 2024 19:23:44 +0200 Subject: [PATCH 018/114] removed call to deprecated sprintf --- src/t8_cmesh/t8_cmesh_partition.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/t8_cmesh/t8_cmesh_partition.cxx b/src/t8_cmesh/t8_cmesh_partition.cxx index d5fb3c31d0..2e1ad65b27 100644 --- a/src/t8_cmesh/t8_cmesh_partition.cxx +++ b/src/t8_cmesh/t8_cmesh_partition.cxx @@ -1410,7 +1410,7 @@ t8_cmesh_partition_debug_listprocs (const t8_cmesh_t cmesh, const t8_cmesh_t cme } } t8_debugf ("I send to: %s\n", out); - sprintf (out, " "); + std::strcpy(out, " "); if (cmesh_from->set_partition) { for (p = 0; p < mpisize; p++) { if (t8_offset_sendsto (p, mpirank, from, to)) { From efa1b37e1cc737e9436b58aed9b1518332dd7fd2 Mon Sep 17 00:00:00 2001 From: Alex Dutka <97711898+dutkalex@users.noreply.github.com> Date: Thu, 11 Jul 2024 19:26:54 +0200 Subject: [PATCH 019/114] removed useless branch --- src/t8_forest/t8_forest_ghost.cxx | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/t8_forest/t8_forest_ghost.cxx b/src/t8_forest/t8_forest_ghost.cxx index f53b4806c7..ebdcde905b 100644 --- a/src/t8_forest/t8_forest_ghost.cxx +++ b/src/t8_forest/t8_forest_ghost.cxx @@ -595,11 +595,7 @@ t8_forest_ghost_search_boundary (t8_forest_t forest, t8_locidx_t ltreeid, const /* Store the new bounds at the entry for this element */ new_bounds[iface * 2] = lower; new_bounds[iface * 2 + 1] = upper; - if (lower == upper && lower == forest->mpirank) { - /* All neighbor leaves at this face are owned by the current rank */ - faces_totally_owned = faces_totally_owned && 1; - } - else { + if (lower != upper or lower != forest->mpirank) { faces_totally_owned = 0; } } From 87b36139afc65eee8569b08a1704ec095308aab3 Mon Sep 17 00:00:00 2001 From: Alex Dutka <97711898+dutkalex@users.noreply.github.com> Date: Thu, 11 Jul 2024 19:36:37 +0200 Subject: [PATCH 020/114] add missing include --- src/t8_cmesh/t8_cmesh_partition.cxx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/t8_cmesh/t8_cmesh_partition.cxx b/src/t8_cmesh/t8_cmesh_partition.cxx index 2e1ad65b27..956b37a7a8 100644 --- a/src/t8_cmesh/t8_cmesh_partition.cxx +++ b/src/t8_cmesh/t8_cmesh_partition.cxx @@ -25,6 +25,8 @@ * TODO: document this file */ +#include + #include #include #include From 669debc5185eed5a935805b36084f3e5fe613ec4 Mon Sep 17 00:00:00 2001 From: Alex Dutka <97711898+dutkalex@users.noreply.github.com> Date: Fri, 26 Jul 2024 11:05:57 +0200 Subject: [PATCH 021/114] fix new warning --- src/t8_cmesh/t8_cmesh_vtk_writer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/t8_cmesh/t8_cmesh_vtk_writer.c b/src/t8_cmesh/t8_cmesh_vtk_writer.c index 22a4cfee13..1d38c47e16 100644 --- a/src/t8_cmesh/t8_cmesh_vtk_writer.c +++ b/src/t8_cmesh/t8_cmesh_vtk_writer.c @@ -251,7 +251,7 @@ t8_cmesh_vtk_write_file_ext (const t8_cmesh_t cmesh, const char *fileprefix, con */ T8_ASSERT (tree->treeid + cmesh->first_tree == (t8_gloidx_t) ((long) tree->treeid + cmesh->first_tree)); T8_ASSERT (tree->treeid + cmesh->first_tree == tree->treeid + (t8_locidx_t) cmesh->first_tree); - fprintf (vtufile, " %ld", tree->treeid + (t8_locidx_t) cmesh->first_tree); + fprintf (vtufile, " %ld", (long)(tree->treeid + (t8_locidx_t) cmesh->first_tree)); if (!(sk % 8)) fprintf (vtufile, "\n "); } From 68581c67c9b72ee74b7a7f6015fe65c3d6f41fab Mon Sep 17 00:00:00 2001 From: Sandro Elsweijer Date: Wed, 7 Aug 2024 16:27:51 +0200 Subject: [PATCH 022/114] bump p4est for cmake CI --- p4est | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/p4est b/p4est index 7896878956..8206f0e56d 160000 --- a/p4est +++ b/p4est @@ -1 +1 @@ -Subproject commit 78968789560133460f0eee74897a44b3444790e5 +Subproject commit 8206f0e56d536d6d7f2e1d106c491b8c9386e28f From 1b49f3be9c8cb6724ea5c6ec3f59c46552f93608 Mon Sep 17 00:00:00 2001 From: Sandro Elsweijer Date: Wed, 7 Aug 2024 16:28:44 +0200 Subject: [PATCH 023/114] add preparation step for cmake CI --- .github/workflows/tests_cmake_preparation.yml | 192 ++++++++++++++++++ 1 file changed, 192 insertions(+) create mode 100644 .github/workflows/tests_cmake_preparation.yml diff --git a/.github/workflows/tests_cmake_preparation.yml b/.github/workflows/tests_cmake_preparation.yml new file mode 100644 index 0000000000..705143dd29 --- /dev/null +++ b/.github/workflows/tests_cmake_preparation.yml @@ -0,0 +1,192 @@ +name: CMake tests preparation + + +# This file is part of t8code. +# t8code is a C library to manage a collection (a forest) of multiple +# connected adaptive space-trees of general element types in parallel. +# +# Copyright (C) 2024 the developers +# +# t8code is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# t8code is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with t8code; if not, write to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + +on: + workflow_call: + inputs: + MAKEFLAGS: + required: true + type: string + IGNORE_CACHE: + required: false + type: boolean + default: false + CACHE_COUNTER: + required: true + type: number + MPI: + required: true + type: string + outputs: + USED_CACHE: + description: "Whether the cache was used" + value: ${{ jobs.cmake_preparation.outputs.USED_CACHE }} + +env: + USED_CACHE: ${{ !inputs.IGNORE_CACHE }} + +jobs: + cmake_preparation: + runs-on: ubuntu-latest + container: dlramr/t8code-ubuntu:t8-dependencies + timeout-minutes: 10 + outputs: + USED_CACHE: ${{ steps.used_cache.outputs.USED_CACHE }} + steps: +# +# Setup +# + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + - name: Update packages + run: apt-get update && apt-get upgrade -y + # This seems to be necessary because of the docker container + - name: disable ownership checks + run: git config --global --add safe.directory '*' + - name: init submodules + run: git submodule init + - name: update submodules + run: git submodule update + - name: Get input vars + run: export MAKEFLAGS="${{ inputs.MAKEFLAGS }}" + && export IGNORE_CACHE="${{ inputs.IGNORE_CACHE }}" + && export CACHE_COUNTER="${{ inputs.CACHE_COUNTER }}" + && export MPI="${{ inputs.MPI }}" + && echo MAKEFLAGS="$MAKEFLAGS" >> $GITHUB_ENV + && echo IGNORE_CACHE="$IGNORE_CACHE" >> $GITHUB_ENV + && echo CACHE_COUNTER="$CACHE_COUNTER" >> $GITHUB_ENV + && echo MPI="$MPI" >> $GITHUB_ENV +# +# SC installation +# + - name: store sc folders in var + run: echo SC_BUILD=$PWD/sc/build >> $GITHUB_ENV + && echo SC_DEBUG=$PWD/sc/build/Debug >> $GITHUB_ENV + && echo SC_RELEASE=$PWD/sc/build/Release >> $GITHUB_ENV + - name: Get sc commit hash + run: hash=`git rev-parse HEAD:sc` && echo sc_commit=$hash >> $GITHUB_ENV + - name: Check cache for previous sc installation + id: sc_cmake_cache + uses: actions/cache@v4 + with: + path: | + ${{ env.SC_DEBUG }} + ${{ env.SC_RELEASE }} + # You can increase the counter at the end to force a new key and hence recomputing the cache + key: sc-cmake-MPI-${{ inputs.MPI }}-${{ env.sc_commit }}-${{ inputs.CACHE_COUNTER }} + - name: Log that no cache was found + run: echo USED_CACHE=0 >> $GITHUB_ENV + if: ${{ steps.sc_cmake_cache.outputs.cache-hit != 'true' }} + - name: Cache info + if: ${{ steps.sc_cmake_cache.outputs.cache-hit != 'true' || inputs.IGNORE_CACHE == 1 }} + run: echo No cache found or cache will be ignored. IGNORE_CACHE=$IGNORE_CACHE + - name: if ignore cache, delete folders + if: ${{ inputs.IGNORE_CACHE == 1 }} + # The true at the end is to ignore errors that i.e. occur when the folders do not exist + run: rm -r $SC_BUILD || true + - name: make folders + run: mkdir -p $SC_DEBUG $SC_RELEASE + if: ${{ steps.sc_cmake_cache.outputs.cache-hit != 'true' || inputs.IGNORE_CACHE == 1 }} + - name: install sc + run: echo "Install sc" + if: ${{ steps.sc_cmake_cache.outputs.cache-hit != 'true' || inputs.IGNORE_CACHE == 1 }} + ## sc debug + - name: sc cmake debug + run: cd $SC_DEBUG && cmake ../../ -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX=$SC_DEBUG/install -Dmpi=$MPI -GNinja + if: ${{ steps.sc_cmake_cache.outputs.cache-hit != 'true' || inputs.IGNORE_CACHE == 1 }} + - name: sc build debug + run: cd $SC_DEBUG && ninja $MAKEFLAGS && ninja $MAKEFLAGS install + if: ${{ steps.sc_cmake_cache.outputs.cache-hit != 'true' || inputs.IGNORE_CACHE == 1 }} + ## sc release + - name: sc cmake release + run: cd $SC_RELEASE && cmake ../../ -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=$SC_RELEASE/install -Dmpi=$MPI -GNinja + if: ${{ steps.sc_cmake_cache.outputs.cache-hit != 'true' || inputs.IGNORE_CACHE == 1 }} + - name: sc build release + run: cd $SC_RELEASE && ninja $MAKEFLAGS && ninja $MAKEFLAGS install + if: ${{ steps.sc_cmake_cache.outputs.cache-hit != 'true' || inputs.IGNORE_CACHE == 1 }} +# +# P4EST +# + - name: store p4est folders in var + run: echo P4EST_BUILD=$PWD/p4est/build >> $GITHUB_ENV + && echo P4EST_DEBUG=$PWD/p4est/build/Debug >> $GITHUB_ENV + && echo P4EST_RELEASE=$PWD/p4est/build/Release >> $GITHUB_ENV + - name: Get p4est commit hash + run: hash=`git rev-parse HEAD:p4est` && echo p4est_commit=$hash >> $GITHUB_ENV + - name: Check cache for previous p4est installation + id: p4est_cmake_cache + uses: actions/cache@v4 + with: + path: | + ${{ env.P4EST_DEBUG }} + ${{ env.P4EST_RELEASE }} + # You can increase the counter at the end to force a new key and hence recomputing the cache + key: p4est-cmake-MPI-${{ inputs.MPI }}-${{ env.p4est_commit }}-${{ env.sc_commit }}-${{ inputs.CACHE_COUNTER }} + - name: Log that no cache was found + run: echo USED_CACHE=0 >> $GITHUB_ENV + if: ${{ steps.p4est_cmake_cache.outputs.cache-hit != 'true' }} + - name: Cache info + if: ${{ steps.p4est_cmake_cache.outputs.cache-hit != 'true' || inputs.IGNORE_CACHE == 1 }} + run: echo No cache found or cache will be ignored. IGNORE_CACHE=$IGNORE_CACHE + - name: install p4est + run: echo "Install p4est" + if: ${{ steps.p4est_cmake_cache.outputs.cache-hit != 'true' || inputs.IGNORE_CACHE == 1 }} + - name: if ignore cache, delete folders + if: ${{ steps.p4est_cmake_cache.outputs.cache-hit != 'true' || inputs.IGNORE_CACHE == 1 }} + # The true at the end is to ignore errors that i.e. occur when the folders do not exist + run: rm -r $P4EST_BUILD || true + - name: make folders + if: ${{ steps.p4est_cmake_cache.outputs.cache-hit != 'true' || inputs.IGNORE_CACHE == 1 }} + run: mkdir -p $P4EST_DEBUG $P4EST_RELEASE + ## p4est debug + - name: p4est cmake debug + run: cd $P4EST_DEBUG && cmake ../../ -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX=$P4EST_DEBUG/install -DP4EST_USE_SYSTEM_SC=ON -DSC_DIR=$SC_DEBUG/install/cmake -DP4EST_ENABLE_MPI=$MPI -GNinja + if: ${{ steps.p4est_cmake_cache.outputs.cache-hit != 'true' || inputs.IGNORE_CACHE == 1 }} + - name: p4est build debug + run: cd $P4EST_DEBUG && ninja $MAKEFLAGS && ninja $MAKEFLAGS install + if: ${{ steps.p4est_cmake_cache.outputs.cache-hit != 'true' || inputs.IGNORE_CACHE == 1 }} + ## p4est release + - name: p4est cmake release + run: cd $P4EST_RELEASE && cmake ../../ -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=$P4EST_RELEASE/install -DP4EST_USE_SYSTEM_SC=ON -DSC_DIR=$SC_DEBUG/install/cmake -DP4EST_ENABLE_MPI=$MPI -GNinja + if: ${{ steps.p4est_cmake_cache.outputs.cache-hit != 'true' || inputs.IGNORE_CACHE == 1 }} + - name: p4est build release + run: cd $P4EST_RELEASE && ninja $MAKEFLAGS && ninja $MAKEFLAGS install + if: ${{ steps.p4est_cmake_cache.outputs.cache-hit != 'true' || inputs.IGNORE_CACHE == 1 }} + + ## output cache info + - name: output cache info + id: used_cache + run: echo "USED_CACHE=$USED_CACHE" >> $GITHUB_OUTPUT + + ## tar artifact to keep permissions: https://github.com/actions/upload-artifact?tab=readme-ov-file#permission-loss + - name: Tar files + run: tar -cvf artifact.tar . + + ## upload artifacts + - name: Upload build artifacts + uses: actions/upload-artifact@v4 + with: + name: SC_P4EST_MPI_${{ inputs.MPI }} + path: ./artifact.tar + retention-days: 1 From d19852c8be030042361ce67ef1f176483719c85c Mon Sep 17 00:00:00 2001 From: Sandro Elsweijer Date: Wed, 7 Aug 2024 16:29:11 +0200 Subject: [PATCH 024/114] add sc and p4est cmake tests --- .github/workflows/tests_cmake_sc_p4est.yml | 119 +++++++++++++++++++++ 1 file changed, 119 insertions(+) create mode 100644 .github/workflows/tests_cmake_sc_p4est.yml diff --git a/.github/workflows/tests_cmake_sc_p4est.yml b/.github/workflows/tests_cmake_sc_p4est.yml new file mode 100644 index 0000000000..d06d16334e --- /dev/null +++ b/.github/workflows/tests_cmake_sc_p4est.yml @@ -0,0 +1,119 @@ +name: CMake tests sc and p4est + + +# This file is part of t8code. +# t8code is a C library to manage a collection (a forest) of multiple +# connected adaptive space-trees of general element types in parallel. +# +# Copyright (C) 2024 the developers +# +# t8code is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# t8code is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with t8code; if not, write to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + +# +# This github CI script installs t8code and runs its tests for various configurations. +# We compile sc and p4est as thirdparty libraries and use caching to only trigger a +# new installation of them when their versions have changed in t8code. +# +# Note: To manually enforce sc and p4est installation, either increase the counter +# in the "key:" entries of the sc and p4est steps or set the variables +# SC_IGNORE_CACHE and P4EST_IGNORE_CACHE to 1 in the respective steps. + +on: + workflow_call: + inputs: + MAKEFLAGS: + required: true + type: string + MPI: + required: true + type: string + +jobs: + sc_p4est_cmake_tests: + runs-on: ubuntu-latest + container: dlramr/t8code-ubuntu:t8-dependencies + timeout-minutes: 30 + steps: +# +# Setup +# + - name: Download artifacts + uses: actions/download-artifact@v4 + with: + name: SC_P4EST_MPI_${{ inputs.MPI }} + - name: untar artifact + run: tar -xf artifact.tar && rm artifact.tar + - name: Update packages + run: apt-get update && apt-get upgrade -y + # This seems to be necessary because of the docker container + - name: disable ownership checks + run: git config --global --add safe.directory '*' + - name: Get input vars + run: export MAKEFLAGS="${{ inputs.MAKEFLAGS }}" + && export MPI="${{ inputs.MPI }}" + && echo MPI="$MPI" >> $GITHUB_ENV + && echo MAKEFLAGS="$MAKEFLAGS" >> $GITHUB_ENV +# +# SC tests +# + ## save variables + - name: Save variables + run: export SC_DEBUG=$PWD/sc/build/Debug + && export SC_RELEASE=$PWD/sc/build/Release + && export P4EST_DEBUG=$PWD/p4est/build/Debug + && export P4EST_RELEASE=$PWD/p4est/build/Release + && echo SC_DEBUG="$SC_DEBUG" >> $GITHUB_ENV + && echo SC_RELEASE="$SC_RELEASE" >> $GITHUB_ENV + && echo P4EST_DEBUG="$P4EST_DEBUG" >> $GITHUB_ENV + && echo P4EST_RELEASE="$P4EST_RELEASE" >> $GITHUB_ENV + ## sc debug + - name: sc debug check + run: cd $SC_DEBUG && ninja test $MAKEFLAGS + - name: OnFailUploadLog + if: failure() + uses: actions/upload-artifact@v4 + with: + name: sc_debug_MPI_${{ inputs.MPI }}.log + path: $SC_DEBUG/Testing/Temporary/LastTest.log + ## sc release + - name: sc release check + run: cd $SC_RELEASE && ninja test $MAKEFLAGS + - name: OnFailUploadLog + if: failure() + uses: actions/upload-artifact@v4 + with: + name: sc_release_MPI_${{ inputs.MPI }}.log + path: $SC_RELEASE/Testing/Temporary/LastTest.log +# +# P4EST tests +# + ## p4est debug + - name: p4est debug check + run: cd $P4EST_DEBUG && ninja test $MAKEFLAGS + - name: OnFailUploadLog + if: failure() + uses: actions/upload-artifact@v4 + with: + name: sp4est_debug_MPI_${{ inputs.MPI }}.log + path: $P4EST_DEBUG/Testing/Temporary/LastTest.log + ## p4est release + - name: p4est release check + run: cd $P4EST_RELEASE && ninja test $MAKEFLAGS + - name: OnFailUploadLog + if: failure() + uses: actions/upload-artifact@v4 + with: + name: sp4est_release_MPI_${{ inputs.MPI }}.log + path: $P4EST_RELEASE/Testing/Temporary/LastTest.log From 94f8fda30c681f1e79b7fbf6d90faa636a306eab Mon Sep 17 00:00:00 2001 From: Sandro Elsweijer Date: Wed, 7 Aug 2024 16:29:38 +0200 Subject: [PATCH 025/114] add control file for cmake CI --- .github/workflows/tests_cmake_testsuite.yml | 78 +++++++++++++++++++++ 1 file changed, 78 insertions(+) create mode 100644 .github/workflows/tests_cmake_testsuite.yml diff --git a/.github/workflows/tests_cmake_testsuite.yml b/.github/workflows/tests_cmake_testsuite.yml new file mode 100644 index 0000000000..19cedc5dd4 --- /dev/null +++ b/.github/workflows/tests_cmake_testsuite.yml @@ -0,0 +1,78 @@ +name: t8code CMake testsuite + + +# This file is part of t8code. +# t8code is a C library to manage a collection (a forest) of multiple +# connected adaptive space-trees of general element types in parallel. +# +# Copyright (C) 2024 the developers +# +# t8code is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# t8code is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with t8code; if not, write to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + +# +# This github CI script installs t8code and runs its tests for various configurations. +# We compile sc and p4est as thirdparty libraries and use caching to only trigger a +# new installation of them when their versions have changed in t8code. +# +# Note: To manually enforce sc and p4est installation, either increase the counter +# in the "CACHE_COUNTER:" entries of the sc and p4est steps or set the variables +# IGNORE_CACHE to true in the respective steps. + +on: + push: + branches: + - main + - develop + - feature-*CI* # for testing this script, all feature branches with "CI" in their name + pull_request: + branches: + - main + - develop + workflow_dispatch: # Be able to trigger this manually on github.com + # Run every night at 1:10 + schedule: + - cron: '10 1 * * *' + +jobs: + # Preparation step for tests. Repo is cloned and sc + p4est are compiled with and without MPI. + preparation: + if: (github.event_name == 'schedule' && github.repository == 'DLR-AMR/t8code') || (github.event_name != 'schedule') + uses: ./.github/workflows/tests_cmake_preparation.yml + strategy: + fail-fast: false + matrix: + MPI: [OFF, ON] + include: + - MAKEFLAGS: -j4 + with: + MAKEFLAGS: ${{ matrix.MAKEFLAGS }} + IGNORE_CACHE: false # Use this to force a new installation of sc and p4est for this specific workflow run + CACHE_COUNTER: 0 # Increase this number to force a new installation of sc and p4est and to update the cache once + MPI: ${{ matrix.MPI }} + + # Run parallel tests for sc and p4est with and without MPI + sc_p4est_tests: + if: ((github.event_name == 'schedule' && github.repository == 'DLR-AMR/t8code') || (github.event_name != 'schedule')) + needs: preparation + uses: ./.github/workflows/tests_cmake_sc_p4est.yml + strategy: + fail-fast: false + matrix: + MPI: [OFF, ON] + include: + - MAKEFLAGS: -j4 + with: + MAKEFLAGS: ${{ matrix.MAKEFLAGS }} + MPI: ${{ matrix.MPI }} From 97e2427b84c18375cc1f9878da20449f02cbfba4 Mon Sep 17 00:00:00 2001 From: Sandro Elsweijer Date: Wed, 7 Aug 2024 16:42:11 +0200 Subject: [PATCH 026/114] add t8code CMake CI --- .github/workflows/tests_cmake_t8code.yml | 108 +++++++++++++++++++++++ 1 file changed, 108 insertions(+) create mode 100644 .github/workflows/tests_cmake_t8code.yml diff --git a/.github/workflows/tests_cmake_t8code.yml b/.github/workflows/tests_cmake_t8code.yml new file mode 100644 index 0000000000..f050722963 --- /dev/null +++ b/.github/workflows/tests_cmake_t8code.yml @@ -0,0 +1,108 @@ +name: CMake tests t8code + + +# This file is part of t8code. +# t8code is a C library to manage a collection (a forest) of multiple +# connected adaptive space-trees of general element types in parallel. +# +# Copyright (C) 2024 the developers +# +# t8code is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# t8code is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with t8code; if not, write to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + +on: + workflow_call: + inputs: + MAKEFLAGS: + required: true + type: string + MPI: + required: true + type: string + BUILD_TYPE: + required: true + type: string + LESS_TESTS: + required: true + type: boolean + +jobs: + t8code_cmake_tests: + timeout-minutes: 30 + runs-on: ubuntu-latest + container: dlramr/t8code-ubuntu:t8-dependencies + steps: +# +# Setup +# + - name: Download artifacts + uses: actions/download-artifact@v4 + with: + name: SC_P4EST_MPI_${{ inputs.MPI }} + - name: untar artifact + run: tar -xf artifact.tar && rm artifact.tar + - name: Update packages + run: apt-get update && apt-get upgrade -y + # This seems to be necessary because of the docker container + - name: disable ownership checks + run: git config --global --add safe.directory '*' + - name: Get input vars + run: export MAKEFLAGS="${{ inputs.MAKEFLAGS }}" + && export MPI="${{ inputs.MPI }}" + && export BUILD_TYPE="${{ inputs.BUILD_TYPE }}" + && export SC_PATH=$PWD/sc/build/$BUILD_TYPE + && export P4EST_PATH=$PWD/p4est/build/$BUILD_TYPE + && echo MAKEFLAGS="$MAKEFLAGS" >> $GITHUB_ENV + && echo MPI="$MPI" >> $GITHUB_ENV + && echo BUILD_TYPE="$BUILD_TYPE" >> $GITHUB_ENV + && echo SC_PATH="$SC_PATH" >> $GITHUB_ENV + && echo P4EST_PATH="$P4EST_PATH" >> $GITHUB_ENV +# +# T8CODE +# + # build config vars + - name: less-test option + if: ${{ inputs.LESS_TESTS }} + run: export LESS_TEST_OPTION="-DT8CODE_ENABLE_LESS_TESTS=ON" + && echo LESS_TEST_OPTION="$LESS_TEST_OPTION" >> $GITHUB_ENV + - name: build config variables + run: export CONFIG_OPTIONS="${LESS_TEST_OPTION} -GNinja -DT8CODE_USE_SYSTEM_SC=ON -DT8CODE_USE_SYSTEM_P4EST=ON -DT8CODE_BUILD_PEDANTIC=ON -DT8CODE_ENABLE_MPI=$MPI -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DSC_DIR=$SC_PATH/install/cmake -DP4EST_DIR=$P4EST_PATH/install/cmake" + && echo CONFIG_OPTIONS="$CONFIG_OPTIONS" >> $GITHUB_ENV +# cmake and test + - name: Printing MPI compiler info + run: mpicc --version && mpirun --version + - name: Printing GCC compiler info + run: gcc --version && g++ --version + - name: echo cmake line + run: echo cmake ../ $CONFIG_OPTIONS + - name: cmake + run: mkdir build && cd build && cmake ../ $CONFIG_OPTIONS + - name: OnFailUploadLog + if: failure() + uses: actions/upload-artifact@v4 + with: + name: cmake_${{ inputs.BUILD_TYPE }}_MPI_${{ inputs.MPI }}.log + path: build/CMakeFiles/CMakeOutput.log + - name: ninja + run: cd build && ninja $MAKEFLAGS + - name: ninja install + run: cd build && ninja install $MAKEFLAGS + - name: ninja test + run: cd build && ninja test $MAKEFLAGS + - name: OnFailUploadLog + if: failure() + uses: actions/upload-artifact@v4 + with: + name: test-suite_${{ inputs.BUILD_TYPE }}_MPI_${{ inputs.MPI }}.log + path: build/Testing/Temporary/LastTest.log From 2ea2a63df2302b6b0a82eea8417dbf01e745df36 Mon Sep 17 00:00:00 2001 From: Sandro Elsweijer Date: Wed, 7 Aug 2024 16:42:42 +0200 Subject: [PATCH 027/114] add t8code CMake CI to testsuite workflow --- .github/workflows/tests_cmake_testsuite.yml | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/.github/workflows/tests_cmake_testsuite.yml b/.github/workflows/tests_cmake_testsuite.yml index 19cedc5dd4..d1125f4b64 100644 --- a/.github/workflows/tests_cmake_testsuite.yml +++ b/.github/workflows/tests_cmake_testsuite.yml @@ -76,3 +76,22 @@ jobs: with: MAKEFLAGS: ${{ matrix.MAKEFLAGS }} MPI: ${{ matrix.MPI }} + + # Run t8code tests with and without MPI and in serial and debug mode + t8code_tests: + if: (github.event_name == 'schedule' && github.repository == 'DLR-AMR/t8code') || (github.event_name != 'schedule') + uses: ./.github/workflows/tests_cmake_t8code.yml + strategy: + fail-fast: false + matrix: + MPI: [OFF, ON] + BUILD_TYPE: [Debug, Release] + include: + - MAKEFLAGS: -j4 + needs: preparation + with: + MAKEFLAGS: ${{ matrix.MAKEFLAGS }} + MPI: ${{ matrix.MPI }} + BUILD_TYPE: ${{ matrix.BUILD_TYPE }} + LESS_TESTS: ${{ github.event_name == 'pull_request' }} + From 940553c27463ea9ab3a9b8533cf6d7b6b19bccc0 Mon Sep 17 00:00:00 2001 From: Sandro Elsweijer Date: Wed, 7 Aug 2024 16:52:17 +0200 Subject: [PATCH 028/114] add t8code linkage CMake CI --- .../workflows/tests_cmake_t8code_linkage.yml | 157 ++++++++++++++++++ 1 file changed, 157 insertions(+) create mode 100644 .github/workflows/tests_cmake_t8code_linkage.yml diff --git a/.github/workflows/tests_cmake_t8code_linkage.yml b/.github/workflows/tests_cmake_t8code_linkage.yml new file mode 100644 index 0000000000..e0fb4df9ea --- /dev/null +++ b/.github/workflows/tests_cmake_t8code_linkage.yml @@ -0,0 +1,157 @@ +name: CMake tests t8code linkage + + +# This file is part of t8code. +# t8code is a C library to manage a collection (a forest) of multiple +# connected adaptive space-trees of general element types in parallel. +# +# Copyright (C) 2024 the developers +# +# t8code is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# t8code is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with t8code; if not, write to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + +on: + workflow_call: + inputs: + MAKEFLAGS: + required: true + type: string + MPI: + required: true + type: string + BUILD_TYPE: + required: true + type: string + LESS_TESTS: + required: true + type: boolean + +jobs: + t8code_cmake_tests: + timeout-minutes: 30 + runs-on: ubuntu-latest + container: dlramr/t8code-ubuntu:t8-dependencies + steps: +# +# Setup +# + - name: Download artifacts + uses: actions/download-artifact@v4 + with: + name: SC_P4EST_MPI_${{ inputs.MPI }} + - name: untar artifact + run: tar -xf artifact.tar && rm artifact.tar + - name: Update packages + run: apt-get update && apt-get upgrade -y + # This seems to be necessary because of the docker container + - name: disable ownership checks + run: git config --global --add safe.directory '*' + - name: Get input vars + run: export MAKEFLAGS="${{ inputs.MAKEFLAGS }}" + && export MPI="${{ inputs.MPI }}" + && export BUILD_TYPE="${{ inputs.BUILD_TYPE }}" + && export SC_PATH=$PWD/sc/build/$BUILD_TYPE + && export P4EST_PATH=$PWD/p4est/build/$BUILD_TYPE + && echo MAKEFLAGS="$MAKEFLAGS" >> $GITHUB_ENV + && echo MPI="$MPI" >> $GITHUB_ENV + && echo BUILD_TYPE="$BUILD_TYPE" >> $GITHUB_ENV + && echo SC_PATH="$SC_PATH" >> $GITHUB_ENV + && echo P4EST_PATH="$P4EST_PATH" >> $GITHUB_ENV +# +# T8CODE +# +# + # build config vars + - name: less-test option + if: ${{ inputs.LESS_TESTS }} + run: export LESS_TEST_OPTION="-DT8CODE_ENABLE_LESS_TESTS=ON" + && echo LESS_TEST_OPTION="$LESS_TEST_OPTION" >> $GITHUB_ENV + - name: build config variables + run: export CONFIG_OPTIONS="${LESS_TEST_OPTION} -GNinja -DT8CODE_USE_SYSTEM_SC=ON -DT8CODE_USE_SYSTEM_P4EST=ON -DT8CODE_BUILD_PEDANTIC=ON -DT8CODE_ENABLE_MPI=$MPI -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DSC_DIR=$SC_PATH/install/cmake -DP4EST_DIR=$P4EST_PATH/install/cmake" + && echo CONFIG_OPTIONS="$CONFIG_OPTIONS" >> $GITHUB_ENV +# cmake and test with netcdf + - name: check NetCDF + run: echo "Checking NetCDF" + - name: echo cmake line + run: echo cmake ../ $CONFIG_OPTIONS -DT8CODE_ENABLE_NETCDF=ON + - name: cmake MPI NetCDF debug + run: mkdir build_netcdf && cd build_netcdf && cmake ../ $CONFIG_OPTIONS -DT8CODE_ENABLE_NETCDF=ON + - name: OnFailUploadLog + if: failure() + uses: actions/upload-artifact@v4 + with: + name: cmake_${{ inputs.BUILD_TYPE }}_MPI_${{ inputs.MPI }}_NetCDF.log + path: build_netcdf/CMakeFiles/CMakeOutput.log + - name: make + run: cd build_netcdf && ninja $MAKEFLAGS + - name: ninja install + run: cd build_netcdf && ninja install $MAKEFLAGS + - name: ninja test + run: cd build_netcdf && ninja test $MAKEFLAGS + - name: OnFailUploadLog + if: failure() + uses: actions/upload-artifact@v4 + with: + name: test-suite_${{ inputs.BUILD_TYPE }}_MPI_${{ inputs.MPI }}_NetCDF.log + path: build_netcdf/Testing/Temporary/LastTest.log +# cmake and test with OpenCASCADE + - name: check OpenCASCADE + run: echo "Checking OpenCASCADE" + - name: echo cmake line + run: echo cmake ../ $CONFIG_OPTIONS -DT8CODE_ENABLE_OCC=ON + - name: cmake OpenCASCADE + run: mkdir build_occ && cd build_occ && cmake ../ $CONFIG_OPTIONS -DT8CODE_ENABLE_OCC=ON + - name: OnFailUploadLog + if: failure() + uses: actions/upload-artifact@v4 + with: + name: cmake_${{ inputs.BUILD_TYPE }}_MPI_${{ inputs.MPI }}_OCC.log + path: build_occ/CMakeFiles/CMakeOutput.log + - name: make + run: cd build_occ && ninja $MAKEFLAGS + - name: ninja install + run: cd build_occ && ninja install $MAKEFLAGS + - name: ninja test + run: cd build_occ && ninja test $MAKEFLAGS + - name: OnFailUploadLog + if: failure() + uses: actions/upload-artifact@v4 + with: + name: test-suite_${{ inputs.BUILD_TYPE }}_MPI_${{ inputs.MPI }}_OCC.log + path: build_occ/Testing/Temporary/LastTest.log +# cmake and test with VTK + - name: check VTK + run: echo "Checking VTK" + - name: echo cmake line + run: echo cmake ../ $CONFIG_OPTIONS -DT8CODE_ENABLE_VTK=ON -DVTK_DIR=/usr/local/lib/cmake/vtk-9.1 + - name: cmake MPI VTK debug + run: mkdir build_vtk && cd build_vtk && cmake ../ $CONFIG_OPTIONS -DT8CODE_ENABLE_VTK=ON -DVTK_DIR=/usr/local/lib/cmake/vtk-9.1 + - name: OnFailUploadLog + if: failure() + uses: actions/upload-artifact@v4 + with: + name: cmake_${{ inputs.BUILD_TYPE }}_MPI_${{ inputs.MPI }}_VTK.log + path: build_vtk/CMakeFiles/CMakeOutput.log + - name: make + run: cd build_vtk && ninja $MAKEFLAGS + - name: ninja install + run: cd build_vtk && ninja install $MAKEFLAGS + - name: ninja test + run: cd build_vtk && ninja test $MAKEFLAGS + - name: OnFailUploadLog + if: failure() + uses: actions/upload-artifact@v4 + with: + name: test-suite_${{ inputs.BUILD_TYPE }}_MPI_${{ inputs.MPI }}_VTK.log + path: build_vtk/Testing/Temporary/LastTest.log From 54e7eaafe5cd4a814c118a23b0757e9d39f55882 Mon Sep 17 00:00:00 2001 From: Sandro Elsweijer Date: Wed, 7 Aug 2024 16:52:37 +0200 Subject: [PATCH 029/114] add t8code linkage CMake CI to workflow --- .github/workflows/tests_cmake_testsuite.yml | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/.github/workflows/tests_cmake_testsuite.yml b/.github/workflows/tests_cmake_testsuite.yml index d1125f4b64..ba3616153c 100644 --- a/.github/workflows/tests_cmake_testsuite.yml +++ b/.github/workflows/tests_cmake_testsuite.yml @@ -95,3 +95,22 @@ jobs: BUILD_TYPE: ${{ matrix.BUILD_TYPE }} LESS_TESTS: ${{ github.event_name == 'pull_request' }} + + # Run t8code linkage tests with and without MPI and in serial and debug mode + t8code_linkage_tests: + if: (github.event_name == 'schedule' && github.repository == 'DLR-AMR/t8code') || (github.event_name != 'schedule') + uses: ./.github/workflows/tests_cmake_t8code_linkage.yml + strategy: + fail-fast: false + matrix: + MPI: [OFF, ON] + BUILD_TYPE: [Debug, Release] + include: + - MAKEFLAGS: -j4 + needs: preparation + with: + MAKEFLAGS: ${{ matrix.MAKEFLAGS }} + MPI: ${{ matrix.MPI }} + BUILD_TYPE: ${{ matrix.BUILD_TYPE }} + LESS_TESTS: ${{ github.event_name == 'pull_request' }} + From 2ff18245f42ccab06e388b6ebda1c67efa2757d7 Mon Sep 17 00:00:00 2001 From: Sandro Elsweijer Date: Thu, 8 Aug 2024 14:18:11 +0200 Subject: [PATCH 030/114] indent cmake ci --- .github/workflows/tests_cmake_t8code.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tests_cmake_t8code.yml b/.github/workflows/tests_cmake_t8code.yml index f050722963..d2375595d3 100644 --- a/.github/workflows/tests_cmake_t8code.yml +++ b/.github/workflows/tests_cmake_t8code.yml @@ -79,7 +79,7 @@ jobs: - name: build config variables run: export CONFIG_OPTIONS="${LESS_TEST_OPTION} -GNinja -DT8CODE_USE_SYSTEM_SC=ON -DT8CODE_USE_SYSTEM_P4EST=ON -DT8CODE_BUILD_PEDANTIC=ON -DT8CODE_ENABLE_MPI=$MPI -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DSC_DIR=$SC_PATH/install/cmake -DP4EST_DIR=$P4EST_PATH/install/cmake" && echo CONFIG_OPTIONS="$CONFIG_OPTIONS" >> $GITHUB_ENV -# cmake and test + # cmake and test - name: Printing MPI compiler info run: mpicc --version && mpirun --version - name: Printing GCC compiler info From 63419758eb9aeae07ef9440a1423c52f67b7884b Mon Sep 17 00:00:00 2001 From: Sandro Elsweijer Date: Thu, 8 Aug 2024 15:24:14 +0200 Subject: [PATCH 031/114] indent cmake ci --- .github/workflows/tests_cmake_t8code_linkage.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tests_cmake_t8code_linkage.yml b/.github/workflows/tests_cmake_t8code_linkage.yml index e0fb4df9ea..0f939a83fa 100644 --- a/.github/workflows/tests_cmake_t8code_linkage.yml +++ b/.github/workflows/tests_cmake_t8code_linkage.yml @@ -80,7 +80,7 @@ jobs: - name: build config variables run: export CONFIG_OPTIONS="${LESS_TEST_OPTION} -GNinja -DT8CODE_USE_SYSTEM_SC=ON -DT8CODE_USE_SYSTEM_P4EST=ON -DT8CODE_BUILD_PEDANTIC=ON -DT8CODE_ENABLE_MPI=$MPI -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DSC_DIR=$SC_PATH/install/cmake -DP4EST_DIR=$P4EST_PATH/install/cmake" && echo CONFIG_OPTIONS="$CONFIG_OPTIONS" >> $GITHUB_ENV -# cmake and test with netcdf + # cmake and test with netcdf - name: check NetCDF run: echo "Checking NetCDF" - name: echo cmake line From b87d1bcc56796640a7439ca0a7e213be5f026d28 Mon Sep 17 00:00:00 2001 From: Sandro Elsweijer Date: Mon, 12 Aug 2024 11:14:57 +0200 Subject: [PATCH 032/114] add warning if geometries get added twice --- src/t8_geometry/t8_geometry_handler.hxx | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/t8_geometry/t8_geometry_handler.hxx b/src/t8_geometry/t8_geometry_handler.hxx index 207c584eae..a1fbd2f155 100644 --- a/src/t8_geometry/t8_geometry_handler.hxx +++ b/src/t8_geometry/t8_geometry_handler.hxx @@ -249,6 +249,14 @@ struct t8_geometry_handler if (registered_geometries.find (hash) == registered_geometries.end ()) { registered_geometries.emplace (hash, std::move (geom)); } + /* clang-format off */ + else { + t8_productionf ("WARNING: Did not register the geometry %s because it is already registered.\n" + "Geometries only need to be registered once per process.\n" + "If you are registering a new geometry it probably has the same name as another one.\n", + geom->t8_geom_get_name ().c_str ()); + } + /* clang-format on */ if (registered_geometries.size () == 1) { active_geometry = registered_geometries.at (hash).get (); } From a8277ce34804ca39aab5456c156e1fd7e7495829 Mon Sep 17 00:00:00 2001 From: Sandro Elsweijer Date: Mon, 12 Aug 2024 13:18:05 +0200 Subject: [PATCH 033/114] add assertion for tree vertex retrieval --- src/t8_cmesh/t8_cmesh.cxx | 3 +-- src/t8_geometry/t8_geometry_with_vertices.cxx | 3 +++ test/t8_geometry/t8_gtest_geometry_handling.cxx | 6 ++++-- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/t8_cmesh/t8_cmesh.cxx b/src/t8_cmesh/t8_cmesh.cxx index f4684d19a3..ceb23cb5b6 100644 --- a/src/t8_cmesh/t8_cmesh.cxx +++ b/src/t8_cmesh/t8_cmesh.cxx @@ -400,8 +400,7 @@ t8_cmesh_get_tree_vertices (const t8_cmesh_t cmesh, const t8_locidx_t ltreeid) { T8_ASSERT (t8_cmesh_is_committed (cmesh)); T8_ASSERT (t8_cmesh_treeid_is_local_tree (cmesh, ltreeid) || t8_cmesh_treeid_is_ghost (cmesh, ltreeid)); - - return (double *) t8_cmesh_get_attribute (cmesh, t8_get_package_id (), T8_CMESH_VERTICES_ATTRIBUTE_KEY, ltreeid); + return (double*) t8_cmesh_get_attribute (cmesh, t8_get_package_id (), T8_CMESH_VERTICES_ATTRIBUTE_KEY, ltreeid); } void * diff --git a/src/t8_geometry/t8_geometry_with_vertices.cxx b/src/t8_geometry/t8_geometry_with_vertices.cxx index 9ef5d14c28..dc37073b06 100644 --- a/src/t8_geometry/t8_geometry_with_vertices.cxx +++ b/src/t8_geometry/t8_geometry_with_vertices.cxx @@ -44,6 +44,9 @@ t8_geometry_with_vertices::t8_geom_load_tree_data (t8_cmesh_t cmesh, t8_gloidx_t } /* Load this trees vertices. */ active_tree_vertices = t8_cmesh_get_tree_vertices (cmesh, ltreeid); +#if T8_ENABLE_DEBUG + SC_CHECK_ABORTF (active_tree_vertices != NULL, "ERROR: No vertices found for tree %li\n", (long) ltreeid); +#endif /* Check whether we support this class */ T8_ASSERT (active_tree_class == T8_ECLASS_VERTEX || active_tree_class == T8_ECLASS_TRIANGLE diff --git a/test/t8_geometry/t8_gtest_geometry_handling.cxx b/test/t8_geometry/t8_gtest_geometry_handling.cxx index ae9998990f..51474b4093 100644 --- a/test/t8_geometry/t8_gtest_geometry_handling.cxx +++ b/test/t8_geometry/t8_gtest_geometry_handling.cxx @@ -118,6 +118,8 @@ TEST (test_geometry, cmesh_two_trees_and_geometries) /* Build a simple 2 tree cmesh and set geometries for the trees. */ t8_cmesh_init (&cmesh); t8_cmesh_set_tree_class (cmesh, 0, T8_ECLASS_QUAD); + /* We will assign a linear geometry, so we need vertices. */ + t8_cmesh_set_tree_vertices (cmesh, 0, *t8_element_corner_ref_coords[T8_ECLASS_QUAD], 4); t8_cmesh_set_tree_class (cmesh, 1, T8_ECLASS_TRIANGLE); /* Register the linear geometry and zero geometry to this cmesh. */ auto linear_geom = t8_cmesh_register_geometry (cmesh, 2); @@ -161,11 +163,11 @@ TEST (test_geometry, cmesh_geometry_unique) t8_debugf ("Testing cmesh tree geometry get with unique geometry.\n"); - /* Build a simple 2 tree cmesh and set geometries for the trees. */ + /* Build a simple 1 tree cmesh and set geometry for the trees. */ t8_cmesh_init (&cmesh); t8_cmesh_set_tree_class (cmesh, 0, T8_ECLASS_QUAD); /* Register the linear_geometry to this cmesh. */ - auto provided_geom = t8_cmesh_register_geometry (cmesh, 2); + auto provided_geom = t8_cmesh_register_geometry (cmesh, 2); /* Commit the cmesh */ t8_cmesh_commit (cmesh, sc_MPI_COMM_WORLD); From 3b8cc4818ed4129a22022fc736150d47e18ea169 Mon Sep 17 00:00:00 2001 From: Sandro Elsweijer Date: Mon, 12 Aug 2024 13:38:44 +0200 Subject: [PATCH 034/114] remove unnecessary indent off --- src/t8_geometry/t8_geometry_handler.hxx | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/t8_geometry/t8_geometry_handler.hxx b/src/t8_geometry/t8_geometry_handler.hxx index a1fbd2f155..f12bd52958 100644 --- a/src/t8_geometry/t8_geometry_handler.hxx +++ b/src/t8_geometry/t8_geometry_handler.hxx @@ -249,14 +249,12 @@ struct t8_geometry_handler if (registered_geometries.find (hash) == registered_geometries.end ()) { registered_geometries.emplace (hash, std::move (geom)); } - /* clang-format off */ else { t8_productionf ("WARNING: Did not register the geometry %s because it is already registered.\n" "Geometries only need to be registered once per process.\n" "If you are registering a new geometry it probably has the same name as another one.\n", geom->t8_geom_get_name ().c_str ()); } - /* clang-format on */ if (registered_geometries.size () == 1) { active_geometry = registered_geometries.at (hash).get (); } From f0d269a4ebb19c1c7411887d29445a3bcfa3cfe4 Mon Sep 17 00:00:00 2001 From: Sandro Elsweijer Date: Mon, 12 Aug 2024 13:41:10 +0200 Subject: [PATCH 035/114] Correct some comments --- src/t8_geometry/t8_geometry_base.hxx | 4 ++-- .../t8_geometry_linear_axis_aligned.hxx | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/t8_geometry/t8_geometry_base.hxx b/src/t8_geometry/t8_geometry_base.hxx index df848cb2e3..b23878d867 100644 --- a/src/t8_geometry/t8_geometry_base.hxx +++ b/src/t8_geometry/t8_geometry_base.hxx @@ -131,8 +131,8 @@ struct t8_geometry }; /** - * Check if the currently active tree has a negative volume - * \return True (non-zero) if the currently loaded tree has a negative volume. 0 otherwise. + * Check if the currently active tree has a negative volume. + * \return True if the currently loaded tree has a negative volume. */ virtual bool t8_geom_tree_negative_volume () const diff --git a/src/t8_geometry/t8_geometry_implementations/t8_geometry_linear_axis_aligned.hxx b/src/t8_geometry/t8_geometry_implementations/t8_geometry_linear_axis_aligned.hxx index b5eae50f1d..a3c70e222e 100644 --- a/src/t8_geometry/t8_geometry_implementations/t8_geometry_linear_axis_aligned.hxx +++ b/src/t8_geometry/t8_geometry_implementations/t8_geometry_linear_axis_aligned.hxx @@ -107,8 +107,8 @@ struct t8_geometry_linear_axis_aligned: public t8_geometry_with_vertices const double tolerance) const; /** - * Check if the currently active tree has a negative volume - * \return True (non-zero) if the currently loaded tree has a negative volume. 0 otherwise. + * Check if the currently active tree has a negative volume. + * \return True if the currently loaded tree has a negative volume. */ virtual bool t8_geom_tree_negative_volume () const; From 676c8631c2120e2cf96ea28bbe65bb101a381940 Mon Sep 17 00:00:00 2001 From: Sandro Elsweijer Date: Mon, 12 Aug 2024 13:42:22 +0200 Subject: [PATCH 036/114] add geometry compatibility check to cmesh commit --- src/t8_cmesh.h | 11 --- src/t8_cmesh/t8_cmesh.cxx | 71 ++++++++++--------- src/t8_geometry/t8_geometry_base.hxx | 12 ++++ src/t8_geometry/t8_geometry_handler.hxx | 13 ++++ .../t8_geometry_linear_axis_aligned.hxx | 18 +++++ 5 files changed, 79 insertions(+), 46 deletions(-) diff --git a/src/t8_cmesh.h b/src/t8_cmesh.h index 3c0a6b68b0..186835b722 100644 --- a/src/t8_cmesh.h +++ b/src/t8_cmesh.h @@ -104,17 +104,6 @@ t8_cmesh_is_committed (const t8_cmesh_t cmesh); */ int t8_cmesh_validate_geometry (const t8_cmesh_t cmesh); - -/** After a cmesh is committed, check whether all trees in a cmesh do have positive volume. - * Returns true if all trees have positive volume. - * \param [in] cmesh This cmesh is examined. May be NULL. - * \return True if \a cmesh is not NULL and all trees for - * which \ref t8_cmesh_set_tree_vertices - * was called, do have positive geometric volume. - * False otherwise. - */ -int -t8_cmesh_no_negative_volume (t8_cmesh_t cmesh); #endif /** Given a set of vertex coordinates for a tree of a given eclass. diff --git a/src/t8_cmesh/t8_cmesh.cxx b/src/t8_cmesh/t8_cmesh.cxx index ceb23cb5b6..67961da3ae 100644 --- a/src/t8_cmesh/t8_cmesh.cxx +++ b/src/t8_cmesh/t8_cmesh.cxx @@ -128,11 +128,45 @@ t8_cmesh_is_committed (const t8_cmesh_t cmesh) int t8_cmesh_validate_geometry (const t8_cmesh_t cmesh) { +/* After a cmesh is committed, check whether all trees in a cmesh are compatible + * with their geometry and if they have positive volume. + * Returns true if all trees are valid. Returns also true if no geometries are + * registered yet, since the validity computation depends on the used geometry. + */ + /* Geometry handler is not constructed yet */ if (cmesh->geometry_handler == NULL) { - return 1; + return true; + } + if (cmesh == NULL) { + return true; + } + + bool valid = true; + if (cmesh->geometry_handler->get_num_geometries () > 0) { + /* Iterate over all trees, get their vertices and check the volume */ + for (t8_locidx_t itree = 0; itree < cmesh->num_local_trees; itree++) { + /* Check if tree and geometry are compatible. */ + const int geometry_compatible = cmesh->geometry_handler->tree_compatible_with_geom (cmesh, t8_cmesh_get_global_id (cmesh, itree)); + if (!geometry_compatible) { + t8_debugf ("Detected incompatible geometry for tree %li\n", (long) itree); + valid = false; + } + if (geometry_compatible) + { + /* Check for negative volume. This only makes sense if the geometry is valid for the tree. */ + const int negative_volume = cmesh->geometry_handler->tree_negative_volume (cmesh, t8_cmesh_get_global_id (cmesh, itree)); + if (negative_volume) { + t8_debugf ("Detected negative volume in tree %li\n", (long) itree); + valid = false; + } + } + } + return valid; + } + else { + return true; } - return t8_cmesh_no_negative_volume (cmesh); } #endif /* T8_ENABLE_DEBUG */ @@ -581,39 +615,6 @@ t8_cmesh_tree_vertices_negative_volume (const t8_eclass_t eclass, const double * return eclass == T8_ECLASS_TET ? sc_prod > 0 : sc_prod < 0; } -#ifdef T8_ENABLE_DEBUG -/* After a cmesh is committed, check whether all trees in a cmesh do have positive volume. - * Returns true if all trees have positive volume. Returns also true if no geometries are - * registered yet, since the volume computation depends on the used geometry. - */ -int -t8_cmesh_no_negative_volume (const t8_cmesh_t cmesh) -{ - bool res = false; - - if (cmesh == NULL) { - return 0; - } - if (cmesh->geometry_handler == NULL) { - return 0; - } - if (cmesh->geometry_handler->get_num_geometries () > 0) { - /* Iterate over all trees, get their vertices and check the volume */ - for (t8_locidx_t itree = 0; itree < cmesh->num_local_trees; itree++) { - const int ret = cmesh->geometry_handler->tree_negative_volume (cmesh, t8_cmesh_get_global_id (cmesh, itree)); - if (ret) { - t8_debugf ("Detected negative volume in tree %li\n", (long) itree); - } - res |= ret; /* res is true if one ret value is true */ - } - return !res; - } - else { - return true; - } -} -#endif - void t8_cmesh_set_tree_vertices (t8_cmesh_t cmesh, const t8_gloidx_t gtree_id, const double *vertices, const int num_vertices) diff --git a/src/t8_geometry/t8_geometry_base.hxx b/src/t8_geometry/t8_geometry_base.hxx index b23878d867..b81b824a15 100644 --- a/src/t8_geometry/t8_geometry_base.hxx +++ b/src/t8_geometry/t8_geometry_base.hxx @@ -142,6 +142,18 @@ struct t8_geometry return 0; }; + /** + * Check for compatibility of the currently loaded tree with the geometry. + * If the geometry has limitations these can be checked here. + * This includes for example if only specific tree types or dimensions are supported. + * \return True if the geometry is compatible with the tree. + */ + virtual bool + t8_geom_check_tree_compatibility () const + { + return 1; + } + /** * Get the dimension of this geometry. * \return The dimension. diff --git a/src/t8_geometry/t8_geometry_handler.hxx b/src/t8_geometry/t8_geometry_handler.hxx index f12bd52958..b4229c6a4b 100644 --- a/src/t8_geometry/t8_geometry_handler.hxx +++ b/src/t8_geometry/t8_geometry_handler.hxx @@ -211,6 +211,19 @@ struct t8_geometry_handler return active_geometry->t8_geom_tree_negative_volume (); } + /** + * Check for compatibility of the tree with the assigned geometry. + * \param [in] cmesh The cmesh. + * \param [in] gtreeid The global tree id of the tree to check. + * \return True if the tree and assigned geometry are compatible. + */ + inline bool + tree_compatible_with_geom (const t8_cmesh_t cmesh, const t8_gloidx_t gtreeid) + { + update_tree (cmesh, gtreeid); + return active_geometry->t8_geom_check_tree_compatibility (); + } + /** * Increase the reference count of the geometry handler. */ diff --git a/src/t8_geometry/t8_geometry_implementations/t8_geometry_linear_axis_aligned.hxx b/src/t8_geometry/t8_geometry_implementations/t8_geometry_linear_axis_aligned.hxx index a3c70e222e..7216361f99 100644 --- a/src/t8_geometry/t8_geometry_implementations/t8_geometry_linear_axis_aligned.hxx +++ b/src/t8_geometry/t8_geometry_implementations/t8_geometry_linear_axis_aligned.hxx @@ -112,6 +112,24 @@ struct t8_geometry_linear_axis_aligned: public t8_geometry_with_vertices */ virtual bool t8_geom_tree_negative_volume () const; + + /** + * Check for compatibility of the currently loaded tree with the geometry. + * Only line, quad and hex elements are supported by this geometry. + * \return True if the geometry is compatible with the tree. + */ + bool + t8_geom_check_tree_compatibility () const override + { + if (active_tree_class == T8_ECLASS_LINE || active_tree_class == T8_ECLASS_QUAD + || active_tree_class == T8_ECLASS_HEX) { + t8_productionf ("Axis-aligned geometry is not compatible with tree type %s\n It is only compatible with line, " + "quad and hex elements.\n", + t8_eclass_to_string[active_tree_class]); + return true; + } + return false; + } }; #endif /* !T8_GEOMETRY_LINEAR_AXIS_ALIGNED_HXX */ From bc2f826210a119da01375512f480b068c9da140b Mon Sep 17 00:00:00 2001 From: Sandro Elsweijer Date: Mon, 12 Aug 2024 13:42:44 +0200 Subject: [PATCH 037/114] add test for geometry compatibility checking --- .../t8_gtest_geometry_handling.cxx | 35 +++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/test/t8_geometry/t8_gtest_geometry_handling.cxx b/test/t8_geometry/t8_gtest_geometry_handling.cxx index 51474b4093..1ace88ed52 100644 --- a/test/t8_geometry/t8_gtest_geometry_handling.cxx +++ b/test/t8_geometry/t8_gtest_geometry_handling.cxx @@ -182,3 +182,38 @@ TEST (test_geometry, cmesh_geometry_unique) /* clean-up */ t8_cmesh_destroy (&cmesh); } + +TEST (test_geometry, incompatible_geometry) +{ + t8_cmesh_t cmesh; + + t8_debugf ("Testing geometry compatibility checking.\n"); + + /* Build a simple set geometries for the tree. */ + t8_cmesh_init (&cmesh); + t8_cmesh_set_tree_class (cmesh, 0, T8_ECLASS_QUAD); + t8_cmesh_set_tree_vertices (cmesh, 0, *t8_element_corner_ref_coords[T8_ECLASS_QUAD], 4); + /* Commit the cmesh */ + t8_cmesh_commit (cmesh, sc_MPI_COMM_WORLD); + /* Register the t8_geometry_linear_axis_aligned geometry to this cmesh. */ + t8_cmesh_register_geometry (cmesh, 2); + /* Should return true since the t8_geometry_linear_axis_aligned geometry is compatible with quads. */ + ASSERT_TRUE (t8_cmesh_validate_geometry (cmesh)); + t8_cmesh_destroy (&cmesh); + + /* Build a simple set geometries for the tree. */ + t8_cmesh_init (&cmesh); + t8_cmesh_set_tree_class (cmesh, 0, T8_ECLASS_TRIANGLE); + t8_cmesh_set_tree_vertices (cmesh, 0, *t8_element_corner_ref_coords[T8_ECLASS_TRIANGLE], 3); + t8_cmesh_set_tree_class (cmesh, 1, T8_ECLASS_QUAD); + t8_cmesh_set_tree_vertices (cmesh, 1, *t8_element_corner_ref_coords[T8_ECLASS_QUAD], 4); + /* Commit the cmesh */ + t8_cmesh_commit (cmesh, sc_MPI_COMM_WORLD); + /* Register the linear axis aligned geometry to this cmesh. + * We register it after committing because it would throw an assertion and do not have death tests.*/ + t8_cmesh_register_geometry (cmesh, 2); + /* Check validity after committing to circumvent the assertion. + * Should return false since the t8_geometry_linear_axis_aligned geometry is not compatible with triangles. */ + ASSERT_FALSE (t8_cmesh_validate_geometry (cmesh)); + t8_cmesh_destroy (&cmesh); +} From d88331b5bf3db126c1f86f659ed2638f43bf717b Mon Sep 17 00:00:00 2001 From: Sandro Elsweijer Date: Mon, 12 Aug 2024 14:51:22 +0200 Subject: [PATCH 038/114] indent --- src/t8_cmesh/t8_cmesh.cxx | 13 +++++++------ src/t8_geometry/t8_geometry_with_vertices.cxx | 2 +- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/t8_cmesh/t8_cmesh.cxx b/src/t8_cmesh/t8_cmesh.cxx index 67961da3ae..b2d8809f55 100644 --- a/src/t8_cmesh/t8_cmesh.cxx +++ b/src/t8_cmesh/t8_cmesh.cxx @@ -128,7 +128,7 @@ t8_cmesh_is_committed (const t8_cmesh_t cmesh) int t8_cmesh_validate_geometry (const t8_cmesh_t cmesh) { -/* After a cmesh is committed, check whether all trees in a cmesh are compatible + /* After a cmesh is committed, check whether all trees in a cmesh are compatible * with their geometry and if they have positive volume. * Returns true if all trees are valid. Returns also true if no geometries are * registered yet, since the validity computation depends on the used geometry. @@ -147,15 +147,16 @@ t8_cmesh_validate_geometry (const t8_cmesh_t cmesh) /* Iterate over all trees, get their vertices and check the volume */ for (t8_locidx_t itree = 0; itree < cmesh->num_local_trees; itree++) { /* Check if tree and geometry are compatible. */ - const int geometry_compatible = cmesh->geometry_handler->tree_compatible_with_geom (cmesh, t8_cmesh_get_global_id (cmesh, itree)); + const int geometry_compatible + = cmesh->geometry_handler->tree_compatible_with_geom (cmesh, t8_cmesh_get_global_id (cmesh, itree)); if (!geometry_compatible) { t8_debugf ("Detected incompatible geometry for tree %li\n", (long) itree); valid = false; } - if (geometry_compatible) - { + if (geometry_compatible) { /* Check for negative volume. This only makes sense if the geometry is valid for the tree. */ - const int negative_volume = cmesh->geometry_handler->tree_negative_volume (cmesh, t8_cmesh_get_global_id (cmesh, itree)); + const int negative_volume + = cmesh->geometry_handler->tree_negative_volume (cmesh, t8_cmesh_get_global_id (cmesh, itree)); if (negative_volume) { t8_debugf ("Detected negative volume in tree %li\n", (long) itree); valid = false; @@ -434,7 +435,7 @@ t8_cmesh_get_tree_vertices (const t8_cmesh_t cmesh, const t8_locidx_t ltreeid) { T8_ASSERT (t8_cmesh_is_committed (cmesh)); T8_ASSERT (t8_cmesh_treeid_is_local_tree (cmesh, ltreeid) || t8_cmesh_treeid_is_ghost (cmesh, ltreeid)); - return (double*) t8_cmesh_get_attribute (cmesh, t8_get_package_id (), T8_CMESH_VERTICES_ATTRIBUTE_KEY, ltreeid); + return (double *) t8_cmesh_get_attribute (cmesh, t8_get_package_id (), T8_CMESH_VERTICES_ATTRIBUTE_KEY, ltreeid); } void * diff --git a/src/t8_geometry/t8_geometry_with_vertices.cxx b/src/t8_geometry/t8_geometry_with_vertices.cxx index dc37073b06..b952680b95 100644 --- a/src/t8_geometry/t8_geometry_with_vertices.cxx +++ b/src/t8_geometry/t8_geometry_with_vertices.cxx @@ -45,7 +45,7 @@ t8_geometry_with_vertices::t8_geom_load_tree_data (t8_cmesh_t cmesh, t8_gloidx_t /* Load this trees vertices. */ active_tree_vertices = t8_cmesh_get_tree_vertices (cmesh, ltreeid); #if T8_ENABLE_DEBUG - SC_CHECK_ABORTF (active_tree_vertices != NULL, "ERROR: No vertices found for tree %li\n", (long) ltreeid); + SC_CHECK_ABORTF (active_tree_vertices != NULL, "ERROR: No vertices found for tree %li\n", (long) ltreeid); #endif /* Check whether we support this class */ From 2d50976480e6d03badf112bb39791aae7d0c2507 Mon Sep 17 00:00:00 2001 From: Sandro Elsweijer Date: Mon, 12 Aug 2024 14:53:25 +0200 Subject: [PATCH 039/114] add missing include --- test/t8_geometry/t8_gtest_geometry_handling.cxx | 1 + 1 file changed, 1 insertion(+) diff --git a/test/t8_geometry/t8_gtest_geometry_handling.cxx b/test/t8_geometry/t8_gtest_geometry_handling.cxx index 1ace88ed52..19b1a88574 100644 --- a/test/t8_geometry/t8_gtest_geometry_handling.cxx +++ b/test/t8_geometry/t8_gtest_geometry_handling.cxx @@ -27,6 +27,7 @@ #include #include #include +#include #include #include #include From 5d50d4ab34a3c5b071f6dcad537dae145949f723 Mon Sep 17 00:00:00 2001 From: Sandro Elsweijer Date: Mon, 12 Aug 2024 15:18:54 +0200 Subject: [PATCH 040/114] increase timeout for linkage tests --- .github/workflows/tests_cmake_t8code_linkage.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tests_cmake_t8code_linkage.yml b/.github/workflows/tests_cmake_t8code_linkage.yml index 0f939a83fa..910423f6dc 100644 --- a/.github/workflows/tests_cmake_t8code_linkage.yml +++ b/.github/workflows/tests_cmake_t8code_linkage.yml @@ -39,7 +39,7 @@ on: jobs: t8code_cmake_tests: - timeout-minutes: 30 + timeout-minutes: 60 runs-on: ubuntu-latest container: dlramr/t8code-ubuntu:t8-dependencies steps: From 4fb6658a5065ee1e07af94f6f230a9e936f74c1a Mon Sep 17 00:00:00 2001 From: David Knapp Date: Tue, 13 Aug 2024 10:20:42 +0200 Subject: [PATCH 041/114] only search for components of the vtk library --- CMakeLists.txt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index c9727328e4..ec64d7f618 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -57,7 +57,10 @@ if( T8CODE_ENABLE_MPI ) endif() if( T8CODE_ENABLE_VTK ) - find_package( VTK REQUIRED ) + find_package( VTK REQUIRED COMPONENTS + IOXML CommonExecutionModel CommonDataModel + IOGeometry IOXMLParser IOParallelXML IOPLY + ParallelMPI FiltersCore vtksys CommonCore zlib IOLegacy) if(VTK_FOUND) message("Found VTK") endif (VTK_FOUND) From 53f0564fa565c66882658a263deb670de90fc9b0 Mon Sep 17 00:00:00 2001 From: Sandro Elsweijer Date: Tue, 13 Aug 2024 12:17:42 +0200 Subject: [PATCH 042/114] move active_tree_class to geometry base class --- src/t8_geometry/t8_geometry_base.cxx | 22 +++++++++++++++++++ src/t8_geometry/t8_geometry_base.hxx | 21 ++++++++---------- src/t8_geometry/t8_geometry_with_vertices.cxx | 18 ++------------- src/t8_geometry/t8_geometry_with_vertices.hxx | 2 -- 4 files changed, 33 insertions(+), 30 deletions(-) diff --git a/src/t8_geometry/t8_geometry_base.cxx b/src/t8_geometry/t8_geometry_base.cxx index c5b55fe4d8..be867a7289 100644 --- a/src/t8_geometry/t8_geometry_base.cxx +++ b/src/t8_geometry/t8_geometry_base.cxx @@ -62,3 +62,25 @@ t8_geom_get_type (const t8_geometry_c *geom) return geom->t8_geom_get_type (); } + +/* Load the id and class of the newly active tree to the active_tree and active_tree_class variable. */ +void +t8_geometry::t8_geom_load_tree_data (t8_cmesh_t cmesh, t8_gloidx_t gtreeid) +{ + /* Set active id and eclass */ + const t8_locidx_t ltreeid = t8_cmesh_get_local_id (cmesh, gtreeid); + active_tree = gtreeid; + const t8_locidx_t num_local_trees = t8_cmesh_get_num_local_trees (cmesh); + if (0 <= ltreeid && ltreeid < num_local_trees) { + active_tree_class = t8_cmesh_get_tree_class (cmesh, ltreeid); + } + else { + active_tree_class = t8_cmesh_get_ghost_class (cmesh, ltreeid - num_local_trees); + } + + /* Check whether we support this class */ + T8_ASSERT (active_tree_class == T8_ECLASS_VERTEX || active_tree_class == T8_ECLASS_TRIANGLE + || active_tree_class == T8_ECLASS_TET || active_tree_class == T8_ECLASS_QUAD + || active_tree_class == T8_ECLASS_HEX || active_tree_class == T8_ECLASS_LINE + || active_tree_class == T8_ECLASS_PRISM || active_tree_class == T8_ECLASS_PYRAMID); +} diff --git a/src/t8_geometry/t8_geometry_base.hxx b/src/t8_geometry/t8_geometry_base.hxx index b81b824a15..ddc5aab67c 100644 --- a/src/t8_geometry/t8_geometry_base.hxx +++ b/src/t8_geometry/t8_geometry_base.hxx @@ -98,14 +98,14 @@ struct t8_geometry /** Update a possible internal data buffer for per tree data. * This function is called before the first coordinates in a new tree are - * evaluated. You can use it for example to load the vertex coordinates of the - * tree into an internal buffer (as is done in the linear geometry). + * evaluated. + * In this base implementation we use it to load the treeid and class + * to the internal member variables \a active_tree and \a active_tree_class. * \param [in] cmesh The cmesh. * \param [in] gtreeid The global tree. */ virtual void - t8_geom_load_tree_data (t8_cmesh_t cmesh, t8_gloidx_t gtreeid) - = 0; + t8_geom_load_tree_data (t8_cmesh_t cmesh, t8_gloidx_t gtreeid); /** Query whether a batch of points lies inside an element. * \param [in] forest The forest. @@ -189,14 +189,11 @@ struct t8_geometry = 0; protected: - int dimension; - /**< The dimension of reference space for which this is a geometry. */ - - std::string name; - /**< The name of this geometry. */ - - size_t hash; - /**< The hash of the name of this geometry. */ + int dimension; /**< The dimension of reference space for which this is a geometry. */ + std::string name; /**< The name of this geometry. */ + size_t hash; /**< The hash of the name of this geometry. */ + t8_gloidx_t active_tree; /**< The tree of which currently vertices are loaded. */ + t8_eclass_t active_tree_class; /**< The class of the currently active tree. */ }; T8_EXTERN_C_END (); diff --git a/src/t8_geometry/t8_geometry_with_vertices.cxx b/src/t8_geometry/t8_geometry_with_vertices.cxx index b952680b95..33f591d478 100644 --- a/src/t8_geometry/t8_geometry_with_vertices.cxx +++ b/src/t8_geometry/t8_geometry_with_vertices.cxx @@ -32,27 +32,13 @@ void t8_geometry_with_vertices::t8_geom_load_tree_data (t8_cmesh_t cmesh, t8_gloidx_t gtreeid) { - /* Set active id and eclass */ - t8_locidx_t ltreeid = t8_cmesh_get_local_id (cmesh, gtreeid); - active_tree = gtreeid; - const t8_locidx_t num_local_trees = t8_cmesh_get_num_local_trees (cmesh); - if (0 <= ltreeid && ltreeid < num_local_trees) { - active_tree_class = t8_cmesh_get_tree_class (cmesh, ltreeid); - } - else { - active_tree_class = t8_cmesh_get_ghost_class (cmesh, ltreeid - num_local_trees); - } + t8_geometry::t8_geom_load_tree_data (cmesh, gtreeid); /* Load this trees vertices. */ + const t8_locidx_t ltreeid = t8_cmesh_get_local_id (cmesh, gtreeid); active_tree_vertices = t8_cmesh_get_tree_vertices (cmesh, ltreeid); #if T8_ENABLE_DEBUG SC_CHECK_ABORTF (active_tree_vertices != NULL, "ERROR: No vertices found for tree %li\n", (long) ltreeid); #endif - - /* Check whether we support this class */ - T8_ASSERT (active_tree_class == T8_ECLASS_VERTEX || active_tree_class == T8_ECLASS_TRIANGLE - || active_tree_class == T8_ECLASS_TET || active_tree_class == T8_ECLASS_QUAD - || active_tree_class == T8_ECLASS_HEX || active_tree_class == T8_ECLASS_LINE - || active_tree_class == T8_ECLASS_PRISM || active_tree_class == T8_ECLASS_PYRAMID); } bool diff --git a/src/t8_geometry/t8_geometry_with_vertices.hxx b/src/t8_geometry/t8_geometry_with_vertices.hxx index dbaeb8e3af..57c1c82b93 100644 --- a/src/t8_geometry/t8_geometry_with_vertices.hxx +++ b/src/t8_geometry/t8_geometry_with_vertices.hxx @@ -93,8 +93,6 @@ struct t8_geometry_with_vertices: public t8_geometry }; protected: - t8_gloidx_t active_tree; /*< The tree of which currently vertices are loaded. */ - t8_eclass_t active_tree_class; /*< The class of the currently active tree. */ const double* active_tree_vertices; /*< The vertices of the currently active tree. */ }; From d4b139eebb2da1f0603170e7c88c547e69bac308 Mon Sep 17 00:00:00 2001 From: Sandro Elsweijer Date: Tue, 13 Aug 2024 12:19:01 +0200 Subject: [PATCH 043/114] rename T8_CMESH_LAGRANGE_POLY_DEGREE to T8_CMESH_LAGRANGE_POLY_DEGREE_KEY --- src/t8_cmesh/t8_cmesh_types.h | 4 ++-- .../t8_geometry_implementations/t8_geometry_lagrange.cxx | 7 ++++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/t8_cmesh/t8_cmesh_types.h b/src/t8_cmesh/t8_cmesh_types.h index 854d80c471..4022a4a006 100644 --- a/src/t8_cmesh/t8_cmesh_types.h +++ b/src/t8_cmesh/t8_cmesh_types.h @@ -59,9 +59,9 @@ typedef struct t8_cprofile t8_cprofile_t; /* Defined below */ +T8_ECLASS_MAX_EDGES /* Used to store which face is linked to which surface */ #define T8_CMESH_CAD_FACE_PARAMETERS_ATTRIBUTE_KEY \ T8_CMESH_CAD_FACE_ATTRIBUTE_KEY + 1 /* Used to store face parameters */ -#define T8_CMESH_LAGRANGE_POLY_DEGREE T8_CMESH_CAD_FACE_PARAMETERS_ATTRIBUTE_KEY + T8_ECLASS_MAX_FACES +#define T8_CMESH_LAGRANGE_POLY_DEGREE_KEY T8_CMESH_CAD_FACE_PARAMETERS_ATTRIBUTE_KEY + T8_ECLASS_MAX_FACES #define T8_CMESH_NEXT_POSSIBLE_KEY \ - T8_CMESH_LAGRANGE_POLY_DEGREE + 1 /* The next free value for a t8code attribute key */ + T8_CMESH_LAGRANGE_POLY_DEGREE_KEY + 1 /* The next free value for a t8code attribute key */ /** This structure holds the connectivity data of the coarse mesh. * It can either be replicated, then each process stores a copy of the whole diff --git a/src/t8_geometry/t8_geometry_implementations/t8_geometry_lagrange.cxx b/src/t8_geometry/t8_geometry_implementations/t8_geometry_lagrange.cxx index f151a90ee5..21541caac0 100644 --- a/src/t8_geometry/t8_geometry_implementations/t8_geometry_lagrange.cxx +++ b/src/t8_geometry/t8_geometry_implementations/t8_geometry_lagrange.cxx @@ -71,8 +71,9 @@ inline void t8_geometry_lagrange::t8_geom_load_tree_data (t8_cmesh_t cmesh, t8_gloidx_t gtreeid) { t8_geometry_with_vertices::t8_geom_load_tree_data (cmesh, gtreeid); - t8_locidx_t ltreeid = t8_cmesh_get_local_id (cmesh, gtreeid); - degree = (const int *) t8_cmesh_get_attribute (cmesh, t8_get_package_id (), T8_CMESH_LAGRANGE_POLY_DEGREE, ltreeid); + const t8_locidx_t ltreeid = t8_cmesh_get_local_id (cmesh, gtreeid); + degree + = (const int *) t8_cmesh_get_attribute (cmesh, t8_get_package_id (), T8_CMESH_LAGRANGE_POLY_DEGREE_KEY, ltreeid); T8_ASSERT (degree != NULL); } @@ -272,7 +273,7 @@ t8_lagrange_element::t8_lagrange_element (t8_eclass_t eclass, uint32_t degree, s /* Create a cmesh with a single element */ int dim = t8_eclass_to_dimension[eclass]; t8_cmesh_init (&cmesh); - t8_cmesh_set_attribute (cmesh, 0, t8_get_package_id (), T8_CMESH_LAGRANGE_POLY_DEGREE, °ree, sizeof (int), 1); + t8_cmesh_set_attribute (cmesh, 0, t8_get_package_id (), T8_CMESH_LAGRANGE_POLY_DEGREE_KEY, °ree, sizeof (int), 1); t8_cmesh_register_geometry (cmesh, dim); t8_cmesh_set_tree_class (cmesh, 0, eclass); t8_cmesh_set_tree_vertices (cmesh, 0, nodes.data (), nodes.size ()); From a812df6dbb965bcec99da7aef156b93fdb9cdf30 Mon Sep 17 00:00:00 2001 From: Sandro Elsweijer Date: Tue, 13 Aug 2024 12:20:59 +0200 Subject: [PATCH 044/114] move incompatible geom test to linear axis aligned --- .../t8_gtest_geometry_linear.cxx | 37 +++++++++++++++++++ .../t8_gtest_geometry_handling.cxx | 36 ------------------ 2 files changed, 37 insertions(+), 36 deletions(-) diff --git a/test/t8_geometry/t8_geometry_implementations/t8_gtest_geometry_linear.cxx b/test/t8_geometry/t8_geometry_implementations/t8_gtest_geometry_linear.cxx index a3979dad77..6627dd9141 100644 --- a/test/t8_geometry/t8_geometry_implementations/t8_gtest_geometry_linear.cxx +++ b/test/t8_geometry/t8_geometry_implementations/t8_gtest_geometry_linear.cxx @@ -160,3 +160,40 @@ INSTANTIATE_TEST_SUITE_P ( t8_gtest_geometry, geometry_test, ::testing::Combine (::testing::Values (T8_GEOMETRY_TYPE_LINEAR, T8_GEOMETRY_TYPE_LINEAR_AXIS_ALIGNED), AllEclasses), print_test); + +#ifdef T8_ENABLE_DEBUG +TEST (test_geometry_linear, incompatible_geometry) +{ + t8_cmesh_t cmesh; + + t8_debugf ("Testing geometry compatibility checking for linear axis aligned geometry.\n"); + + /* Build a simple set geometries for the tree. */ + t8_cmesh_init (&cmesh); + t8_cmesh_set_tree_class (cmesh, 0, T8_ECLASS_QUAD); + t8_cmesh_set_tree_vertices (cmesh, 0, *t8_element_corner_ref_coords[T8_ECLASS_QUAD], 4); + /* Commit the cmesh */ + t8_cmesh_commit (cmesh, sc_MPI_COMM_WORLD); + /* Register the t8_geometry_linear_axis_aligned geometry to this cmesh. */ + t8_cmesh_register_geometry (cmesh, 2); + /* Should return true since the t8_geometry_linear_axis_aligned geometry is compatible with quads. */ + ASSERT_TRUE (t8_cmesh_validate_geometry (cmesh)); + t8_cmesh_destroy (&cmesh); + + /* Build a simple set geometries for the tree. */ + t8_cmesh_init (&cmesh); + t8_cmesh_set_tree_class (cmesh, 0, T8_ECLASS_TRIANGLE); + t8_cmesh_set_tree_vertices (cmesh, 0, *t8_element_corner_ref_coords[T8_ECLASS_TRIANGLE], 3); + t8_cmesh_set_tree_class (cmesh, 1, T8_ECLASS_QUAD); + t8_cmesh_set_tree_vertices (cmesh, 1, *t8_element_corner_ref_coords[T8_ECLASS_QUAD], 4); + /* Commit the cmesh */ + t8_cmesh_commit (cmesh, sc_MPI_COMM_WORLD); + /* Register the linear axis aligned geometry to this cmesh. + * We register it after committing because it would throw an assertion and do not have death tests.*/ + t8_cmesh_register_geometry (cmesh, 2); + /* Check validity after committing to circumvent the assertion. + * Should return false since the t8_geometry_linear_axis_aligned geometry is not compatible with triangles. */ + ASSERT_FALSE (t8_cmesh_validate_geometry (cmesh)); + t8_cmesh_destroy (&cmesh); +} +#endif /* T8_ENABLE_DEBUG */ diff --git a/test/t8_geometry/t8_gtest_geometry_handling.cxx b/test/t8_geometry/t8_gtest_geometry_handling.cxx index 19b1a88574..51474b4093 100644 --- a/test/t8_geometry/t8_gtest_geometry_handling.cxx +++ b/test/t8_geometry/t8_gtest_geometry_handling.cxx @@ -27,7 +27,6 @@ #include #include #include -#include #include #include #include @@ -183,38 +182,3 @@ TEST (test_geometry, cmesh_geometry_unique) /* clean-up */ t8_cmesh_destroy (&cmesh); } - -TEST (test_geometry, incompatible_geometry) -{ - t8_cmesh_t cmesh; - - t8_debugf ("Testing geometry compatibility checking.\n"); - - /* Build a simple set geometries for the tree. */ - t8_cmesh_init (&cmesh); - t8_cmesh_set_tree_class (cmesh, 0, T8_ECLASS_QUAD); - t8_cmesh_set_tree_vertices (cmesh, 0, *t8_element_corner_ref_coords[T8_ECLASS_QUAD], 4); - /* Commit the cmesh */ - t8_cmesh_commit (cmesh, sc_MPI_COMM_WORLD); - /* Register the t8_geometry_linear_axis_aligned geometry to this cmesh. */ - t8_cmesh_register_geometry (cmesh, 2); - /* Should return true since the t8_geometry_linear_axis_aligned geometry is compatible with quads. */ - ASSERT_TRUE (t8_cmesh_validate_geometry (cmesh)); - t8_cmesh_destroy (&cmesh); - - /* Build a simple set geometries for the tree. */ - t8_cmesh_init (&cmesh); - t8_cmesh_set_tree_class (cmesh, 0, T8_ECLASS_TRIANGLE); - t8_cmesh_set_tree_vertices (cmesh, 0, *t8_element_corner_ref_coords[T8_ECLASS_TRIANGLE], 3); - t8_cmesh_set_tree_class (cmesh, 1, T8_ECLASS_QUAD); - t8_cmesh_set_tree_vertices (cmesh, 1, *t8_element_corner_ref_coords[T8_ECLASS_QUAD], 4); - /* Commit the cmesh */ - t8_cmesh_commit (cmesh, sc_MPI_COMM_WORLD); - /* Register the linear axis aligned geometry to this cmesh. - * We register it after committing because it would throw an assertion and do not have death tests.*/ - t8_cmesh_register_geometry (cmesh, 2); - /* Check validity after committing to circumvent the assertion. - * Should return false since the t8_geometry_linear_axis_aligned geometry is not compatible with triangles. */ - ASSERT_FALSE (t8_cmesh_validate_geometry (cmesh)); - t8_cmesh_destroy (&cmesh); -} From 4e153abb5689890729d8d7249f418e296d53b43f Mon Sep 17 00:00:00 2001 From: Sandro Elsweijer Date: Tue, 13 Aug 2024 12:21:28 +0200 Subject: [PATCH 045/114] rework macro --- src/t8_cmesh/t8_cmesh.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/t8_cmesh/t8_cmesh.cxx b/src/t8_cmesh/t8_cmesh.cxx index b2d8809f55..165f4a39f5 100644 --- a/src/t8_cmesh/t8_cmesh.cxx +++ b/src/t8_cmesh/t8_cmesh.cxx @@ -124,7 +124,7 @@ t8_cmesh_is_committed (const t8_cmesh_t cmesh) return 1; } -#ifdef T8_ENABLE_DEBUG +#if T8_ENABLE_DEBUG int t8_cmesh_validate_geometry (const t8_cmesh_t cmesh) { From 67d9c0ddd8acf8e75971af3a2937aa675f4b2440 Mon Sep 17 00:00:00 2001 From: Sandro Elsweijer Date: Tue, 13 Aug 2024 12:22:42 +0200 Subject: [PATCH 046/114] add tree compatibility to analytic geom --- example/geometry/t8_example_geometries.cxx | 2 +- .../t8_geometry_analytic.cxx | 23 +++++++++++++--- .../t8_geometry_analytic.h | 26 +++++++++++++++---- .../t8_geometry_analytic.hxx | 17 +++++++++++- 4 files changed, 57 insertions(+), 11 deletions(-) diff --git a/example/geometry/t8_example_geometries.cxx b/example/geometry/t8_example_geometries.cxx index 0139974b6e..69d4b1beb3 100644 --- a/example/geometry/t8_example_geometries.cxx +++ b/example/geometry/t8_example_geometries.cxx @@ -653,7 +653,7 @@ t8_analytic_geom (int level, t8_example_geom_type geom_type) case T8_GEOM_ANALYTIC_QUAD_TO_SPHERE: t8_global_productionf ("Wrapping a quad around a sphere.\n"); t8_cmesh_register_geometry (cmesh, 3, "geom_quad_to_sphere", quad_to_sphere_callback, nullptr, - nullptr, nullptr, nullptr); + nullptr, nullptr, nullptr, nullptr); t8_cmesh_set_tree_class (cmesh, 0, T8_ECLASS_QUAD); t8_cmesh_set_join (cmesh, 0, 0, 1, 0, 0); diff --git a/src/t8_geometry/t8_geometry_implementations/t8_geometry_analytic.cxx b/src/t8_geometry/t8_geometry_implementations/t8_geometry_analytic.cxx index 8ca8b98ba9..24dc718566 100644 --- a/src/t8_geometry/t8_geometry_implementations/t8_geometry_analytic.cxx +++ b/src/t8_geometry/t8_geometry_implementations/t8_geometry_analytic.cxx @@ -26,13 +26,14 @@ t8_geometry_analytic::t8_geometry_analytic (int dim, std::string name, t8_geom_a t8_geom_analytic_jacobian_fn jacobian_in, t8_geom_load_tree_data_fn load_tree_data_in, t8_geom_tree_negative_volume_fn tree_negative_volume_in, - const void *user_data_in) + t8_geom_tree_compatible_fn tree_compatible_in, const void *user_data_in) : t8_geometry (dim, name + "_" + std::to_string (dim)) { analytical_function = analytical; jacobian = jacobian_in; load_tree_data = load_tree_data_in; tree_negative_volume = tree_negative_volume_in; + tree_compatible = tree_compatible_in; user_data = user_data_in; } @@ -43,6 +44,7 @@ t8_geometry_analytic::t8_geometry_analytic (int dim, std::string name) jacobian = NULL; load_tree_data = NULL; tree_negative_volume = NULL; + tree_compatible = NULL; user_data = NULL; } @@ -87,6 +89,18 @@ t8_geometry_analytic::t8_geom_tree_negative_volume () const } } +bool +t8_geometry_analytic::t8_geom_check_tree_compatibility () const +{ + if (tree_compatible != NULL) { + /* tree_compatible if a loading function was provided. */ + return tree_compatible (); + } + else { + return true; + } +} + T8_EXTERN_C_BEGIN (); void @@ -101,10 +115,11 @@ t8_geometry_analytic_destroy (t8_geometry_c **geom) t8_geometry_c * t8_geometry_analytic_new (int dim, const char *name, t8_geom_analytic_fn analytical, t8_geom_analytic_jacobian_fn jacobian, t8_geom_load_tree_data_fn load_tree_data, - t8_geom_tree_negative_volume_fn tree_negative_volume, const void *user_data) + t8_geom_tree_negative_volume_fn tree_negative_volume, + t8_geom_tree_compatible_fn tree_compatible, const void *user_data) { - t8_geometry_analytic *geom - = new t8_geometry_analytic (dim, name, analytical, jacobian, load_tree_data, tree_negative_volume, user_data); + t8_geometry_analytic *geom = new t8_geometry_analytic (dim, name, analytical, jacobian, load_tree_data, + tree_negative_volume, tree_compatible, user_data); return (t8_geometry_c *) geom; } diff --git a/src/t8_geometry/t8_geometry_implementations/t8_geometry_analytic.h b/src/t8_geometry/t8_geometry_implementations/t8_geometry_analytic.h index f846437257..66199b3226 100644 --- a/src/t8_geometry/t8_geometry_implementations/t8_geometry_analytic.h +++ b/src/t8_geometry/t8_geometry_implementations/t8_geometry_analytic.h @@ -71,6 +71,11 @@ typedef void (*t8_geom_load_tree_data_fn) (t8_cmesh_t cmesh, t8_gloidx_t gtreeid */ typedef int (*t8_geom_tree_negative_volume_fn) (); +/** + * Definition for the tree compatible function. + */ +typedef int (*t8_geom_tree_compatible_fn) (); + T8_EXTERN_C_BEGIN (); /** Destroy a geometry analytic object. @@ -79,19 +84,30 @@ T8_EXTERN_C_BEGIN (); void t8_geometry_analytic_destroy (t8_geometry_c **geom); -/** Create a new analytical geometry. - * \return A pointer to an allocated geometry struct. - */ +/** + * Create a new analytic geometry with a given dimension. The geometry + * is viable with all tree types and uses a user-provided analytic and + * jacobian function. The actual mappings are done by these functions. + * \param [in] dim The dimension of this geometry. + * \param [in] name The name to give this geometry. + * \param [in] analytical The analytical function to use for this geometry. + * \param [in] jacobian The jacobian of \a analytical. + * \param [in] load_tree_data The function that is used to load a tree's data. + * \param [in] tree_negative_volume_in The function that is used to compute if a trees volume is negative. + * \param [in] tree_compatible_in The function that is used to check if a tree is compatible with the geometry. + * \return A pointer to an allocated geometry struct. + */ t8_geometry_c * t8_geometry_analytic_new (int dim, const char *name, t8_geom_analytic_fn analytical, t8_geom_analytic_jacobian_fn jacobian, t8_geom_load_tree_data_fn load_tree_data, - t8_geom_tree_negative_volume_fn tree_negative_volume, const void *user_data); + t8_geom_tree_negative_volume_fn tree_negative_volume, + t8_geom_tree_compatible_fn tree_compatible, const void *user_data); /** * Load vertex data from given tree. * \param [in] cmesh The cmesh. * \param [in] gtreeid The global tree id (in the cmesh). - * \param [out] vertex_out The load tree vertices. + * \param [out] user_data The load tree vertices. */ void t8_geom_load_tree_data_vertices (t8_cmesh_t cmesh, t8_gloidx_t gtreeid, const void **user_data); diff --git a/src/t8_geometry/t8_geometry_implementations/t8_geometry_analytic.hxx b/src/t8_geometry/t8_geometry_implementations/t8_geometry_analytic.hxx index 53331b82d9..9c0ca571e7 100644 --- a/src/t8_geometry/t8_geometry_implementations/t8_geometry_analytic.hxx +++ b/src/t8_geometry/t8_geometry_implementations/t8_geometry_analytic.hxx @@ -46,10 +46,13 @@ struct t8_geometry_analytic: public t8_geometry * \param [in] analytical The analytical function to use for this geometry. * \param [in] jacobian The jacobian of \a analytical. * \param [in] load_tree_data The function that is used to load a tree's data. + * \param [in] tree_negative_volume_in The function that is used to compute if a trees volume is negative. + * \param [in] tree_compatible_in The function that is used to check if a tree is compatible with the geometry. */ t8_geometry_analytic (int dim, std::string name, t8_geom_analytic_fn analytical, t8_geom_analytic_jacobian_fn jacobian, t8_geom_load_tree_data_fn load_tree_data, - t8_geom_tree_negative_volume_fn tree_negative_volume_in, const void *user_data); + t8_geom_tree_negative_volume_fn tree_negative_volume_in, + t8_geom_tree_compatible_fn tree_compatible_in, const void *user_data); /** * Constructor of the analytic geometry for testing purposes. @@ -128,6 +131,16 @@ struct t8_geometry_analytic: public t8_geometry virtual bool t8_geom_tree_negative_volume () const; + /** + * Check for compatibility of the currently loaded tree with the geometry. + * If the geometry has limitations these can be checked here. + * This includes for example if only specific tree types or dimensions are supported. + * If all trees are supported, this function should return true. + * \return True if the geometry is compatible with the tree. + */ + bool + t8_geom_check_tree_compatibility () const; + /** Update a possible internal data buffer for per tree data. * This function is called before the first coordinates in a new tree are * evaluated. You can use it for example to load the vertex coordinates of the @@ -153,6 +166,8 @@ struct t8_geometry_analytic: public t8_geometry t8_geom_tree_negative_volume_fn tree_negative_volume; /**< The function to check for negative volumes. */ + t8_geom_tree_compatible_fn tree_compatible; /**< The function to check if a tree is compatible. */ + const void *tree_data; /** Tree data pointer that can be set in \a load_tree_data and is passed onto \a analytical_function and \a jacobian. */ From 2cf3a0151fd16e5b4b4b6cec6d307ab250f94eb9 Mon Sep 17 00:00:00 2001 From: Sandro Elsweijer Date: Tue, 13 Aug 2024 12:23:11 +0200 Subject: [PATCH 047/114] add tree compatibility to lagrange geom --- .../t8_geometry_lagrange.cxx | 21 +++++++++++++++++++ .../t8_geometry_lagrange.hxx | 8 +++++++ 2 files changed, 29 insertions(+) diff --git a/src/t8_geometry/t8_geometry_implementations/t8_geometry_lagrange.cxx b/src/t8_geometry/t8_geometry_implementations/t8_geometry_lagrange.cxx index 21541caac0..f30a4dd804 100644 --- a/src/t8_geometry/t8_geometry_implementations/t8_geometry_lagrange.cxx +++ b/src/t8_geometry/t8_geometry_implementations/t8_geometry_lagrange.cxx @@ -47,6 +47,7 @@ t8_geometry_lagrange::t8_geom_evaluate (t8_cmesh_t cmesh, t8_gloidx_t gtreeid, c { if (num_points != 1) SC_ABORT ("Error: Batch computation of geometry not yet supported."); + T8_ASSERT (t8_geom_check_tree_compatibility ()); const auto basis_functions = t8_geometry_lagrange::t8_geom_compute_basis (ref_coords); const size_t n_vertex = basis_functions.size (); for (size_t i_component = 0; i_component < T8_ECLASS_MAX_DIM; i_component++) { @@ -115,6 +116,26 @@ t8_geometry_lagrange::t8_geom_compute_basis (const double *ref_coords) const } } +bool +t8_geometry_lagrange::t8_geom_check_tree_compatibility () const +{ + bool return_val = true; + if (*degree > T8_GEOMETRY_MAX_POLYNOMIAL_DEGREE) { + t8_debugf ("Lagrange tree with degree %i detected.\n" + "Only degrees up to %i are supported.", + *degree, T8_GEOMETRY_MAX_POLYNOMIAL_DEGREE); + return_val = false; + } + if (active_tree_class != T8_ECLASS_LINE && active_tree_class != T8_ECLASS_TRIANGLE + && active_tree_class != T8_ECLASS_QUAD && active_tree_class != T8_ECLASS_HEX) { + t8_debugf ("Lagrange tree with class %i detected.\n" + "Only lines, triangles, quadrilaterals and hexahedra are supported with the lagrangian geometry.\n", + active_tree_class); + return_val = false; + } + return return_val; +} + inline std::vector t8_geometry_lagrange::t8_geom_s2_basis (const double *ref_point) const { diff --git a/src/t8_geometry/t8_geometry_implementations/t8_geometry_lagrange.hxx b/src/t8_geometry/t8_geometry_implementations/t8_geometry_lagrange.hxx index 3c3bbb4cff..0fbe66ef00 100644 --- a/src/t8_geometry/t8_geometry_implementations/t8_geometry_lagrange.hxx +++ b/src/t8_geometry/t8_geometry_implementations/t8_geometry_lagrange.hxx @@ -153,6 +153,14 @@ struct t8_geometry_lagrange: public t8_geometry_with_vertices virtual void t8_geom_load_tree_data (t8_cmesh_t cmesh, t8_gloidx_t gtreeid); + /** + * Check for compatibility of the currently loaded tree with the geometry. + * This geometry supports lines, triangles, quadrilaterals and hexahedra up to degree 2. + * \return True if the geometry is compatible with the tree. + */ + bool + t8_geom_check_tree_compatibility () const; + private: /** * Evaluates the basis functions of the current tree type at a point. From 55ff56b34cc9a930d5051427213cc15f93d23eee Mon Sep 17 00:00:00 2001 From: Sandro Elsweijer Date: Tue, 13 Aug 2024 12:23:33 +0200 Subject: [PATCH 048/114] add tree compatibility test for lagrange geom --- .../t8_gtest_geometry_lagrange.cxx | 62 ++++++++++++++++++- 1 file changed, 61 insertions(+), 1 deletion(-) diff --git a/test/t8_geometry/t8_geometry_implementations/t8_gtest_geometry_lagrange.cxx b/test/t8_geometry/t8_geometry_implementations/t8_gtest_geometry_lagrange.cxx index 121a599bc9..7c5b293316 100644 --- a/test/t8_geometry/t8_geometry_implementations/t8_gtest_geometry_lagrange.cxx +++ b/test/t8_geometry/t8_geometry_implementations/t8_gtest_geometry_lagrange.cxx @@ -35,7 +35,7 @@ along with t8code; if not, write to the Free Software Foundation, Inc., #include #include #include -#include +#include #include #include #include @@ -249,3 +249,63 @@ INSTANTIATE_TEST_SUITE_P (t8_gtest_geometry_lagrange, LagrangeCmesh, << "_degree" << std::get<1> (info.param); return test_name.str ();}); /* clang-format on */ + +TEST (test_geometry_lagrange, incompatible_geometry) +{ + t8_cmesh_t cmesh; + int degree = 1; + + t8_debugf ("Testing geometry compatibility checking for lagrange geometry.\n"); + + /* Build a simple set geometries for the tree. */ + t8_cmesh_init (&cmesh); + t8_cmesh_set_tree_class (cmesh, 0, T8_ECLASS_QUAD); + t8_cmesh_set_tree_vertices (cmesh, 0, *t8_element_corner_ref_coords[T8_ECLASS_QUAD], 4); + t8_cmesh_set_attribute (cmesh, 0, t8_get_package_id (), T8_CMESH_LAGRANGE_POLY_DEGREE_KEY, °ree, sizeof (degree), + 0); + + /* Commit the cmesh */ + t8_cmesh_commit (cmesh, sc_MPI_COMM_WORLD); + /* Register the t8_geometry_lagrange geometry to this cmesh. */ + t8_cmesh_register_geometry (cmesh, 2); + /* Should return true since the t8_geometry_lagrange geometry is compatible with quads. */ + ASSERT_TRUE (t8_cmesh_validate_geometry (cmesh)); + t8_cmesh_destroy (&cmesh); + + /* Build a simple set geometries for the tree. */ + t8_cmesh_init (&cmesh); + t8_cmesh_set_tree_class (cmesh, 0, T8_ECLASS_HEX); + t8_cmesh_set_tree_vertices (cmesh, 0, *t8_element_corner_ref_coords[T8_ECLASS_HEX], 8); + t8_cmesh_set_attribute (cmesh, 0, t8_get_package_id (), T8_CMESH_LAGRANGE_POLY_DEGREE_KEY, °ree, sizeof (degree), + 0); + t8_cmesh_set_tree_class (cmesh, 1, T8_ECLASS_PRISM); + t8_cmesh_set_tree_vertices (cmesh, 1, *t8_element_corner_ref_coords[T8_ECLASS_PRISM], 6); + t8_cmesh_set_attribute (cmesh, 1, t8_get_package_id (), T8_CMESH_LAGRANGE_POLY_DEGREE_KEY, °ree, sizeof (degree), + 0); + /* Commit the cmesh */ + t8_cmesh_commit (cmesh, sc_MPI_COMM_WORLD); + /* Register the t8_geometry_lagrange to this cmesh. + * We register it after committing because it would throw an assertion and do not have death tests.*/ + t8_cmesh_register_geometry (cmesh, 3); + /* Check validity after committing to circumvent the assertion. + * Should return false since the t8_geometry_lagrange geometry is not compatible with prisms. */ + ASSERT_FALSE (t8_cmesh_validate_geometry (cmesh)); + t8_cmesh_destroy (&cmesh); + + degree = T8_GEOMETRY_MAX_POLYNOMIAL_DEGREE + 1; + /* Build a simple set geometries for the tree. */ + t8_cmesh_init (&cmesh); + t8_cmesh_set_tree_class (cmesh, 0, T8_ECLASS_HEX); + t8_cmesh_set_tree_vertices (cmesh, 0, *t8_element_corner_ref_coords[T8_ECLASS_HEX], 8); + t8_cmesh_set_attribute (cmesh, 0, t8_get_package_id (), T8_CMESH_LAGRANGE_POLY_DEGREE_KEY, °ree, sizeof (degree), + 0); + /* Commit the cmesh */ + t8_cmesh_commit (cmesh, sc_MPI_COMM_WORLD); + /* Register the t8_geometry_lagrange to this cmesh. + * We register it after committing because it would throw an assertion and do not have death tests.*/ + t8_cmesh_register_geometry (cmesh, 3); + /* Check validity after committing to circumvent the assertion. + * Should return false since the maximum polynomial degree is exceeded. */ + ASSERT_FALSE (t8_cmesh_validate_geometry (cmesh)); + t8_cmesh_destroy (&cmesh); +} From 22d6429e3ed9661d62d249395ac128c75a25a3e9 Mon Sep 17 00:00:00 2001 From: Sandro Elsweijer Date: Tue, 13 Aug 2024 12:24:07 +0200 Subject: [PATCH 049/114] fix logic in tree compatibility test --- .../t8_geometry_linear_axis_aligned.hxx | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/t8_geometry/t8_geometry_implementations/t8_geometry_linear_axis_aligned.hxx b/src/t8_geometry/t8_geometry_implementations/t8_geometry_linear_axis_aligned.hxx index 7216361f99..893663f2c5 100644 --- a/src/t8_geometry/t8_geometry_implementations/t8_geometry_linear_axis_aligned.hxx +++ b/src/t8_geometry/t8_geometry_implementations/t8_geometry_linear_axis_aligned.hxx @@ -119,16 +119,16 @@ struct t8_geometry_linear_axis_aligned: public t8_geometry_with_vertices * \return True if the geometry is compatible with the tree. */ bool - t8_geom_check_tree_compatibility () const override + t8_geom_check_tree_compatibility () const { - if (active_tree_class == T8_ECLASS_LINE || active_tree_class == T8_ECLASS_QUAD - || active_tree_class == T8_ECLASS_HEX) { + if (active_tree_class != T8_ECLASS_LINE && active_tree_class != T8_ECLASS_QUAD + && active_tree_class != T8_ECLASS_HEX) { t8_productionf ("Axis-aligned geometry is not compatible with tree type %s\n It is only compatible with line, " "quad and hex elements.\n", t8_eclass_to_string[active_tree_class]); - return true; + return false; } - return false; + return true; } }; From a2bd846bb804f29daba2fe94dd4010609bccd57b Mon Sep 17 00:00:00 2001 From: Sandro Elsweijer Date: Tue, 13 Aug 2024 12:24:42 +0200 Subject: [PATCH 050/114] add tree compatibility test for linear geom --- .../t8_geometry_linear.hxx | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/t8_geometry/t8_geometry_implementations/t8_geometry_linear.hxx b/src/t8_geometry/t8_geometry_implementations/t8_geometry_linear.hxx index 0141f731a8..db757e73be 100644 --- a/src/t8_geometry/t8_geometry_implementations/t8_geometry_linear.hxx +++ b/src/t8_geometry/t8_geometry_implementations/t8_geometry_linear.hxx @@ -104,6 +104,17 @@ struct t8_geometry_linear: public t8_geometry_with_vertices const double *points, const int num_points, int *is_inside, const double tolerance) const; + /** + * Check for compatibility of the currently loaded tree with the geometry. + * This geometry supports all element types, hence it returns true. + * \return True if the geometry is compatible with the tree. + */ + bool + t8_geom_check_tree_compatibility () const + { + return true; + } + /* Load tree data is inherited from t8_geometry_with_vertices. */ }; From 5189a190be8678eceef87b4f6c1d6e948b898266 Mon Sep 17 00:00:00 2001 From: Sandro Elsweijer Date: Tue, 13 Aug 2024 12:24:54 +0200 Subject: [PATCH 051/114] add tree compatibility test for cad geom --- .../t8_geometry_implementations/t8_geometry_cad.hxx | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/t8_geometry/t8_geometry_implementations/t8_geometry_cad.hxx b/src/t8_geometry/t8_geometry_implementations/t8_geometry_cad.hxx index 44c4b8fb18..c4b3e0ab6f 100644 --- a/src/t8_geometry/t8_geometry_implementations/t8_geometry_cad.hxx +++ b/src/t8_geometry/t8_geometry_implementations/t8_geometry_cad.hxx @@ -135,6 +135,17 @@ struct t8_geometry_cad: public t8_geometry_with_vertices virtual void t8_geom_load_tree_data (t8_cmesh_t cmesh, t8_gloidx_t gtreeid); + /** + * Check for compatibility of the currently loaded tree with the geometry. + * This geometry supports all element types, hence it returns true. + * \return True if the geometry is compatible with the tree. + */ + bool + t8_geom_check_tree_compatibility () const + { + return true; + } + /** Check if a cad_curve is a line. * \param [in] curve_index The index of the cad_curve. * \return 1 if curve is a line, 0 if curve is not a line. From af533aeedae2cc6bfe6beb5cb247513106635183 Mon Sep 17 00:00:00 2001 From: Sandro Elsweijer Date: Tue, 13 Aug 2024 12:25:08 +0200 Subject: [PATCH 052/114] add tree compatibility test for zero geom --- .../t8_geometry_implementations/t8_geometry_zero.hxx | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/t8_geometry/t8_geometry_implementations/t8_geometry_zero.hxx b/src/t8_geometry/t8_geometry_implementations/t8_geometry_zero.hxx index 94b56ecb7c..f83e849c94 100644 --- a/src/t8_geometry/t8_geometry_implementations/t8_geometry_zero.hxx +++ b/src/t8_geometry/t8_geometry_implementations/t8_geometry_zero.hxx @@ -127,6 +127,17 @@ struct t8_geometry_zero: public t8_geometry */ virtual inline void t8_geom_load_tree_data (t8_cmesh_t cmesh, t8_gloidx_t gtreeid); + + /** + * Check for compatibility of the currently loaded tree with the geometry. + * This geometry supports all element types, hence it returns true. + * \return True if the geometry is compatible with the tree. + */ + bool + t8_geom_check_tree_compatibility () const override + { + return true; + } }; #endif /* !T8_GEOMETRY_ZERO_HXX */ From dfa2e0d0bfba11a9204f1d3860407dcd3349c513 Mon Sep 17 00:00:00 2001 From: Sandro Elsweijer Date: Tue, 13 Aug 2024 12:25:38 +0200 Subject: [PATCH 053/114] add tree compatibility test for example cmesh geoms --- .../t8_geometry_examples.hxx | 102 ++++++++++++++++++ 1 file changed, 102 insertions(+) diff --git a/src/t8_geometry/t8_geometry_implementations/t8_geometry_examples.hxx b/src/t8_geometry/t8_geometry_implementations/t8_geometry_examples.hxx index 203dec3872..c2142bd473 100644 --- a/src/t8_geometry/t8_geometry_implementations/t8_geometry_examples.hxx +++ b/src/t8_geometry/t8_geometry_implementations/t8_geometry_examples.hxx @@ -84,6 +84,23 @@ struct t8_geometry_quadrangulated_disk: public t8_geometry_with_vertices return T8_GEOMETRY_TYPE_UNDEFINED; }; + /** + * Check for compatibility of the currently loaded tree with the geometry. + * Only quad elements are supported by this geometry. + * \return True if the geometry is compatible with the tree. + */ + bool + t8_geom_check_tree_compatibility () const + { + if (active_tree_class != T8_ECLASS_QUAD) { + t8_productionf ("t8_geometry_quadrangulated_disk is not compatible with tree type %s\n" + "It is only compatible with quad elements.\n", + t8_eclass_to_string[active_tree_class]); + return true; + } + return false; + } + /* Load tree data is inherited from t8_geometry_with_vertices. */ }; @@ -126,6 +143,23 @@ struct t8_geometry_triangulated_spherical_surface: public t8_geometry_with_verti SC_ABORT_NOT_REACHED (); } + /** + * Check for compatibility of the currently loaded tree with the geometry. + * Only triangle elements are supported by this geometry. + * \return True if the geometry is compatible with the tree. + */ + bool + t8_geom_check_tree_compatibility () const + { + if (active_tree_class != T8_ECLASS_TRIANGLE) { + t8_productionf ("t8_geometry_triangulated_spherical_surface is not compatible with tree type %s\n" + "It is only compatible with triangle elements.\n", + t8_eclass_to_string[active_tree_class]); + return true; + } + return false; + } + /* Load tree data is inherited from t8_geometry_with_vertices. */ }; @@ -167,6 +201,23 @@ struct t8_geometry_quadrangulated_spherical_surface: public t8_geometry_with_ver SC_ABORT_NOT_REACHED (); } + /** + * Check for compatibility of the currently loaded tree with the geometry. + * Only quad elements are supported by this geometry. + * \return True if the geometry is compatible with the tree. + */ + bool + t8_geom_check_tree_compatibility () const + { + if (active_tree_class != T8_ECLASS_QUAD) { + t8_productionf ("t8_geometry_quadrangulated_spherical_surface is not compatible with tree type %s\n" + "It is only compatible with quad elements.\n", + t8_eclass_to_string[active_tree_class]); + return true; + } + return false; + } + /* Load tree data is inherited from t8_geometry_with_vertices. */ }; @@ -208,6 +259,23 @@ struct t8_geometry_cubed_spherical_shell: public t8_geometry_with_vertices SC_ABORT_NOT_REACHED (); } + /** + * Check for compatibility of the currently loaded tree with the geometry. + * Only hex elements are supported by this geometry. + * \return True if the geometry is compatible with the tree. + */ + bool + t8_geom_check_tree_compatibility () const + { + if (active_tree_class != T8_ECLASS_HEX) { + t8_productionf ("t8_geometry_cubed_spherical_shell is not compatible with tree type %s\n" + "It is only compatible with hex elements.\n", + t8_eclass_to_string[active_tree_class]); + return true; + } + return false; + } + /* Load tree data is inherited from t8_geometry_with_vertices. */ }; @@ -249,6 +317,23 @@ struct t8_geometry_prismed_spherical_shell: public t8_geometry_with_vertices SC_ABORT_NOT_REACHED (); } + /** + * Check for compatibility of the currently loaded tree with the geometry. + * Only prism elements are supported by this geometry. + * \return True if the geometry is compatible with the tree. + */ + bool + t8_geom_check_tree_compatibility () const + { + if (active_tree_class != T8_ECLASS_PRISM) { + t8_productionf ("t8_geometry_prismed_spherical_shell is not compatible with tree type %s\n" + "It is only compatible with prism elements.\n", + t8_eclass_to_string[active_tree_class]); + return true; + } + return false; + } + /* Load tree data is inherited from t8_geometry_with_vertices. */ }; @@ -290,6 +375,23 @@ struct t8_geometry_cubed_sphere: public t8_geometry_with_vertices SC_ABORT_NOT_REACHED (); } + /** + * Check for compatibility of the currently loaded tree with the geometry. + * Only hex elements are supported by this geometry. + * \return True if the geometry is compatible with the tree. + */ + bool + t8_geom_check_tree_compatibility () const + { + if (active_tree_class != T8_ECLASS_HEX) { + t8_productionf ("t8_geometry_cubed_sphere is not compatible with tree type %s\n" + "It is only compatible with hex elements.\n", + t8_eclass_to_string[active_tree_class]); + return true; + } + return false; + } + /* Load tree data is inherited from t8_geometry_with_vertices. */ }; From 4e3779ac24ee6ae1174c35db9de2ad459115c3d5 Mon Sep 17 00:00:00 2001 From: Sandro Elsweijer Date: Tue, 13 Aug 2024 12:28:41 +0200 Subject: [PATCH 054/114] add tree compatibility test for example geoms --- example/geometry/t8_example_geometries.cxx | 96 ++++++++++++++++++++++ 1 file changed, 96 insertions(+) diff --git a/example/geometry/t8_example_geometries.cxx b/example/geometry/t8_example_geometries.cxx index 69d4b1beb3..7736d72aab 100644 --- a/example/geometry/t8_example_geometries.cxx +++ b/example/geometry/t8_example_geometries.cxx @@ -139,6 +139,22 @@ struct t8_geometry_sincos: public t8_geometry return 0; } + /** + * Check for compatibility of the currently loaded tree with the geometry. + * Only quad elements are supported by this geometry. + */ + bool + t8_geom_check_tree_compatibility () const + { + if (active_tree_class != T8_ECLASS_QUAD) { + t8_productionf ( + "t8_geometry_sincos is not compatible with tree type %s\n It is only compatible with quad elements.\n", + t8_eclass_to_string[active_tree_class]); + return false; + } + return true; + } + /** * Get the type of this geometry. * \return The type. @@ -203,6 +219,22 @@ struct t8_geometry_moebius: public t8_geometry_with_vertices SC_ABORT_NOT_REACHED (); } + /** + * Check for compatibility of the currently loaded tree with the geometry. + * Only quad elements are supported by this geometry. + */ + bool + t8_geom_check_tree_compatibility () const + { + if (active_tree_class != T8_ECLASS_QUAD) { + t8_productionf ( + "t8_geometry_moebius is not compatible with tree type %s\n It is only compatible with quad elements.\n", + t8_eclass_to_string[active_tree_class]); + return false; + } + return true; + } + /** * Get the type of this geometry. * \return The type. @@ -273,6 +305,22 @@ struct t8_geometry_cylinder: public t8_geometry return 0; } + /** + * Check for compatibility of the currently loaded tree with the geometry. + * Only quad elements are supported by this geometry. + */ + bool + t8_geom_check_tree_compatibility () const + { + if (active_tree_class != T8_ECLASS_QUAD) { + t8_productionf ( + "t8_geometry_cylinder is not compatible with tree type %s\n It is only compatible with quad elements.\n", + t8_eclass_to_string[active_tree_class]); + return false; + } + return true; + } + /** * Get the type of this geometry. * \return The type. @@ -341,6 +389,22 @@ struct t8_geometry_circle: public t8_geometry_with_vertices SC_ABORT_NOT_REACHED (); } + /** + * Check for compatibility of the currently loaded tree with the geometry. + * Only quad elements are supported by this geometry. + */ + bool + t8_geom_check_tree_compatibility () const + { + if (active_tree_class != T8_ECLASS_QUAD) { + t8_productionf ( + "t8_geometry_circle is not compatible with tree type %s\n It is only compatible with quad elements.\n", + t8_eclass_to_string[active_tree_class]); + return false; + } + return true; + } + /** * Get the type of this geometry. * \return The type. @@ -434,6 +498,22 @@ struct t8_geometry_moving: public t8_geometry return 0; } + /** + * Check for compatibility of the currently loaded tree with the geometry. + * Only quad elements are supported by this geometry. + */ + bool + t8_geom_check_tree_compatibility () const + { + if (active_tree_class != T8_ECLASS_QUAD) { + t8_productionf ( + "t8_geometry_moving is not compatible with tree type %s\n It is only compatible with quad elements.\n", + t8_eclass_to_string[active_tree_class]); + return false; + } + return true; + } + /** * Get the type of this geometry. * \return The type. @@ -504,6 +584,22 @@ struct t8_geometry_cube_zdistorted: public t8_geometry return 0; } + /** + * Check for compatibility of the currently loaded tree with the geometry. + * Only hex elements are supported by this geometry. + */ + bool + t8_geom_check_tree_compatibility () const + { + if (active_tree_class != T8_ECLASS_HEX) { + t8_productionf ( + "t8_geometry_cube_zdistorted is not compatible with tree type %s\n It is only compatible with hex elements.\n", + t8_eclass_to_string[active_tree_class]); + return false; + } + return true; + } + /** * Get the type of this geometry. * \return The type. From f770fcda47aede5a5932aa206019a3c0cf59896c Mon Sep 17 00:00:00 2001 From: Sandro Elsweijer Date: Tue, 13 Aug 2024 12:29:08 +0200 Subject: [PATCH 055/114] make tree compatibility implementation mandatory for all geoms --- src/t8_geometry/t8_geometry_base.hxx | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/t8_geometry/t8_geometry_base.hxx b/src/t8_geometry/t8_geometry_base.hxx index ddc5aab67c..bcf83d4b19 100644 --- a/src/t8_geometry/t8_geometry_base.hxx +++ b/src/t8_geometry/t8_geometry_base.hxx @@ -146,13 +146,12 @@ struct t8_geometry * Check for compatibility of the currently loaded tree with the geometry. * If the geometry has limitations these can be checked here. * This includes for example if only specific tree types or dimensions are supported. + * If all trees are supported, this function should return true. * \return True if the geometry is compatible with the tree. */ virtual bool t8_geom_check_tree_compatibility () const - { - return 1; - } + = 0; /** * Get the dimension of this geometry. From f6bc3bcd798f03a8902dcfff5932427c5d9571be Mon Sep 17 00:00:00 2001 From: Sandro Elsweijer Date: Tue, 13 Aug 2024 16:47:50 +0200 Subject: [PATCH 056/114] Add api folder to indent all files script --- scripts/indent_all_files.scp | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/indent_all_files.scp b/scripts/indent_all_files.scp index 2b176f09b1..8879513291 100755 --- a/scripts/indent_all_files.scp +++ b/scripts/indent_all_files.scp @@ -55,6 +55,7 @@ echo $PWD/../example/ echo $PWD/../test/ echo $PWD/../tutorials/ echo $PWD/../benchmarks/ +echo $PWD/../api/ echo read -p "Are you sure? ('Y' or 'y' to continue)" -n 1 -r echo From d95cfd0447eab199d238ba0b6b886f5c551e81ad Mon Sep 17 00:00:00 2001 From: Sandro Elsweijer Date: Tue, 13 Aug 2024 17:03:56 +0200 Subject: [PATCH 057/114] fix test --- .../t8_geometry_implementations/t8_gtest_geometry_lagrange.cxx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/test/t8_geometry/t8_geometry_implementations/t8_gtest_geometry_lagrange.cxx b/test/t8_geometry/t8_geometry_implementations/t8_gtest_geometry_lagrange.cxx index 7c5b293316..588bcdf1e6 100644 --- a/test/t8_geometry/t8_geometry_implementations/t8_gtest_geometry_lagrange.cxx +++ b/test/t8_geometry/t8_geometry_implementations/t8_gtest_geometry_lagrange.cxx @@ -250,6 +250,7 @@ INSTANTIATE_TEST_SUITE_P (t8_gtest_geometry_lagrange, LagrangeCmesh, return test_name.str ();}); /* clang-format on */ +#if T8_ENABLE_DEBUG TEST (test_geometry_lagrange, incompatible_geometry) { t8_cmesh_t cmesh; @@ -309,3 +310,4 @@ TEST (test_geometry_lagrange, incompatible_geometry) ASSERT_FALSE (t8_cmesh_validate_geometry (cmesh)); t8_cmesh_destroy (&cmesh); } +#endif /* T8_ENABLE_DEBUG */ From b3b88df49840da08e8c2610d7333883fbb97db0a Mon Sep 17 00:00:00 2001 From: Alex Dutka <97711898+dutkalex@users.noreply.github.com> Date: Fri, 16 Aug 2024 12:32:23 +0200 Subject: [PATCH 058/114] remove [[maybe_unused]] attributes --- src/t8_forest/t8_forest_vtk.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/t8_forest/t8_forest_vtk.cxx b/src/t8_forest/t8_forest_vtk.cxx index 7f726a72c0..c97044ef88 100644 --- a/src/t8_forest/t8_forest_vtk.cxx +++ b/src/t8_forest/t8_forest_vtk.cxx @@ -114,10 +114,10 @@ typedef int (*t8_forest_vtk_cell_data_kernel) (t8_forest_t forest, const t8_loci #define T8_FOREST_VTK_QUADRATIC_ELEMENT_MAX_CORNERS 20 /** Lookup table for number of nodes for curved eclasses. */ -[[maybe_unused]] const int t8_curved_eclass_num_nodes[T8_ECLASS_COUNT] = { 1, 3, 8, 6, 20, 10, 15, 13 }; +const int t8_curved_eclass_num_nodes[T8_ECLASS_COUNT] = { 1, 3, 8, 6, 20, 10, 15, 13 }; /** Lookup table for vtk types of curved elements */ -[[maybe_unused]] const int t8_curved_eclass_vtk_type[T8_ECLASS_COUNT] = { 1, 21, 23, 22, 25, 24, 26, 27 }; +const int t8_curved_eclass_vtk_type[T8_ECLASS_COUNT] = { 1, 21, 23, 22, 25, 24, 26, 27 }; /** Map vtk element corners to element reference coordinates. The reference * coordinates are defined in such a way, that the linear vtk corners are listed From b65182dfd91f5fcc409543aefa37302fde7a06f6 Mon Sep 17 00:00:00 2001 From: Alex Dutka <97711898+dutkalex@users.noreply.github.com> Date: Fri, 16 Aug 2024 15:16:08 +0200 Subject: [PATCH 059/114] Delete src/t8_cmesh/t8_cmesh_vtk_writer.c --- src/t8_cmesh/t8_cmesh_vtk_writer.c | 311 ----------------------------- 1 file changed, 311 deletions(-) delete mode 100644 src/t8_cmesh/t8_cmesh_vtk_writer.c diff --git a/src/t8_cmesh/t8_cmesh_vtk_writer.c b/src/t8_cmesh/t8_cmesh_vtk_writer.c deleted file mode 100644 index 1d38c47e16..0000000000 --- a/src/t8_cmesh/t8_cmesh_vtk_writer.c +++ /dev/null @@ -1,311 +0,0 @@ -/* - This file is part of t8code. - t8code is a C library to manage a collection (a forest) of multiple - connected adaptive space-trees of general element classes in parallel. - - Copyright (C) 2015 the developers - - t8code is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - t8code is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with t8code; if not, write to the Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -*/ - -#include -#include -#include "t8_cmesh_trees.h" -#include "t8_cmesh_types.h" - -/* Return the local number of vertices in a cmesh. - * \param [in] cmesh The cmesh to be considered. - * \param [in] count_ghosts If true, we also count the vertices of the ghost trees. - * \return The number of vertices associated to \a cmesh. - * \a cmesh must be committed before calling this function. - */ -static t8_gloidx_t -t8_cmesh_get_num_vertices (const t8_cmesh_t cmesh, const int count_ghosts) -{ - int iclass; - t8_eclass_t ghost_class; - t8_gloidx_t num_vertices = 0; - t8_locidx_t ighost; - T8_ASSERT (cmesh != NULL); - T8_ASSERT (cmesh->committed); - - for (iclass = T8_ECLASS_ZERO; iclass < T8_ECLASS_COUNT; iclass++) { - num_vertices += t8_eclass_num_vertices[iclass] * cmesh->num_local_trees_per_eclass[iclass]; - } - if (count_ghosts) { - /* Also count the vertices of the ghost trees */ - for (ighost = 0; ighost < t8_cmesh_get_num_ghosts (cmesh); ighost++) { - ghost_class = t8_cmesh_get_ghost_class (cmesh, ighost); - num_vertices += t8_eclass_num_vertices[ghost_class]; - } - } - - return num_vertices; -} - -static int -t8_cmesh_vtk_write_file_ext (const t8_cmesh_t cmesh, const char *fileprefix, const int write_ghosts) -{ - T8_ASSERT (cmesh != NULL); - T8_ASSERT (t8_cmesh_is_committed (cmesh)); - T8_ASSERT (fileprefix != NULL); - - if (cmesh->mpirank == 0) { - /* Write the pvtu header file. */ - int num_ranks_that_write = cmesh->set_partition ? cmesh->mpisize : 1; - if (t8_write_pvtu (fileprefix, num_ranks_that_write, 1, 1, 0, 0, 0, NULL)) { - SC_ABORTF ("Error when writing file %s.pvtu\n", fileprefix); - } - } - /* If the cmesh is replicated only rank 0 prints it, - * otherwise each process prints its part of the cmesh.*/ - if (cmesh->mpirank == 0 || cmesh->set_partition) { - char vtufilename[BUFSIZ]; - FILE *vtufile; - t8_locidx_t num_vertices, ivertex; - t8_locidx_t num_trees; - t8_ctree_t tree; - double x, y, z; - double *vertices, *vertex; - int k, sk; - long long offset, count_vertices; - t8_locidx_t ighost, num_ghosts = 0, num_loc_trees; -#ifdef T8_ENABLE_DEBUG - t8_cghost_t ghost; -#endif - t8_eclass_t eclass; - - num_vertices = t8_cmesh_get_num_vertices (cmesh, write_ghosts); - num_trees = t8_cmesh_get_num_local_trees (cmesh); - if (write_ghosts) { - num_trees += t8_cmesh_get_num_ghosts (cmesh); - } - - snprintf (vtufilename, BUFSIZ, "%s_%04d.vtu", fileprefix, cmesh->mpirank); - vtufile = fopen (vtufilename, "wb"); - if (vtufile == NULL) { - t8_global_errorf ("Could not open file %s for output.\n", vtufilename); - return -1; - } - fprintf (vtufile, "\n"); - fprintf (vtufile, "\n"); -#else - fprintf (vtufile, " byte_order=\"LittleEndian\">\n"); -#endif - fprintf (vtufile, " \n"); - fprintf (vtufile, " \n", (long long) num_vertices, - (long long) num_trees); - fprintf (vtufile, " \n"); - - /* write point position data */ - fprintf (vtufile, - " \n", - T8_VTK_FLOAT_NAME, T8_VTK_FORMAT_STRING); - - for (tree = t8_cmesh_get_first_tree (cmesh); tree != NULL; tree = t8_cmesh_get_next_tree (cmesh, tree)) { - /* TODO: Use new geometry here. Need cmesh_get_reference coords function. */ - vertices = t8_cmesh_get_tree_vertices (cmesh, tree->treeid); - for (ivertex = 0; ivertex < t8_eclass_num_vertices[tree->eclass]; ivertex++) { - vertex = vertices + 3 * t8_eclass_t8_to_vtk_corner_number[tree->eclass][ivertex]; - x = vertex[0]; - y = vertex[1]; - z = vertex[2]; -#ifdef T8_VTK_DOUBLES - fprintf (vtufile, " %24.16e %24.16e %24.16e\n", x, y, z); -#else - fprintf (vtufile, " %16.8e %16.8e %16.8e\n", x, y, z); -#endif - } - } /* end tree loop */ - if (write_ghosts) { - - /* Write the vertices of the ghost trees */ - num_ghosts = t8_cmesh_get_num_ghosts (cmesh); - num_loc_trees = t8_cmesh_get_num_local_trees (cmesh); - for (ighost = 0; ighost < num_ghosts; ighost++) { - /* Get the eclass of this ghost */ - eclass = t8_cmesh_get_ghost_class (cmesh, ighost); - /* Get a pointer to this ghosts vertices */ - vertices = (double *) t8_cmesh_get_attribute (cmesh, t8_get_package_id (), 0, ighost + num_loc_trees); - T8_ASSERT (vertices != NULL); - /* TODO: This code is duplicated above */ - for (ivertex = 0; ivertex < t8_eclass_num_vertices[eclass]; ivertex++) { - vertex = vertices + 3 * t8_eclass_vtk_to_t8_corner_number[eclass][ivertex]; - x = vertex[0]; - y = vertex[1]; - z = vertex[2]; -#ifdef T8_VTK_DOUBLES - fprintf (vtufile, " %24.16e %24.16e %24.16e\n", x, y, z); -#else - fprintf (vtufile, " %16.8e %16.8e %16.8e\n", x, y, z); -#endif - } - } /* end ghost loop */ - } - fprintf (vtufile, " \n"); - fprintf (vtufile, " \n"); - fprintf (vtufile, " \n"); - - /* write connectivity data */ - fprintf (vtufile, - " \n", - T8_VTK_LOCIDX, T8_VTK_FORMAT_STRING); - for (tree = t8_cmesh_get_first_tree (cmesh), count_vertices = 0; tree != NULL; - tree = t8_cmesh_get_next_tree (cmesh, tree)) { - fprintf (vtufile, " "); - for (k = 0; k < t8_eclass_num_vertices[tree->eclass]; ++k, count_vertices++) { - fprintf (vtufile, " %lld", count_vertices); - } - fprintf (vtufile, "\n"); - } - if (write_ghosts) { - /* Write the ghost connectivity */ - for (ighost = 0; ighost < num_ghosts; ighost++) { - eclass = t8_cmesh_get_ghost_class (cmesh, ighost); - fprintf (vtufile, " "); - for (k = 0; k < t8_eclass_num_vertices[eclass]; ++k, count_vertices++) { - fprintf (vtufile, " %lld", count_vertices); - } - fprintf (vtufile, "\n"); - } - } - fprintf (vtufile, " \n"); - - /* write offset data */ - fprintf (vtufile, - " \n", - T8_VTK_LOCIDX, T8_VTK_FORMAT_STRING); - fprintf (vtufile, " "); - for (tree = t8_cmesh_get_first_tree (cmesh), sk = 1, offset = 0; tree != NULL; - tree = t8_cmesh_get_next_tree (cmesh, tree), ++sk) { - offset += t8_eclass_num_vertices[tree->eclass]; - fprintf (vtufile, " %lld", offset); - if (!(sk % 8)) - fprintf (vtufile, "\n "); - } - if (write_ghosts) { - /* ghost offset data */ - for (ighost = 0; ighost < num_ghosts; ighost++, ++sk) { - eclass = t8_cmesh_get_ghost_class (cmesh, ighost); - offset += t8_eclass_num_vertices[eclass]; - fprintf (vtufile, " %lld", offset); - if (!(sk % 8)) - fprintf (vtufile, "\n "); - } - } - fprintf (vtufile, "\n"); - fprintf (vtufile, " \n"); - /* write type data */ - fprintf (vtufile, - " \n", - T8_VTK_FORMAT_STRING); - fprintf (vtufile, " "); - for (tree = t8_cmesh_get_first_tree (cmesh), sk = 1; tree != NULL; - tree = t8_cmesh_get_next_tree (cmesh, tree), ++sk) { - fprintf (vtufile, " %d", t8_eclass_vtk_type[tree->eclass]); - if (!(sk % 20) && tree->treeid != (cmesh->num_local_trees - 1)) - fprintf (vtufile, "\n "); - } - if (write_ghosts) { - /* ghost offset types */ - for (ighost = 0; ighost < num_ghosts; ighost++, ++sk) { - eclass = t8_cmesh_get_ghost_class (cmesh, ighost); - fprintf (vtufile, " %d", t8_eclass_vtk_type[eclass]); - if (!(sk % 20) && ighost != (num_ghosts - 1)) - fprintf (vtufile, "\n "); - } - } - fprintf (vtufile, "\n"); - fprintf (vtufile, " \n"); - fprintf (vtufile, " \n"); - /* write treeif data */ - fprintf (vtufile, " \n"); - fprintf (vtufile, - " \n", - T8_VTK_GLOIDX, T8_VTK_FORMAT_STRING); - fprintf (vtufile, " "); - for (tree = t8_cmesh_get_first_tree (cmesh), sk = 1, offset = 0; tree != NULL; - tree = t8_cmesh_get_next_tree (cmesh, tree), ++sk) { - /* Since tree_id is actually 64 Bit but we store it as 32, we have to check - * that we do not get into conversion errors */ - /* 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)); - T8_ASSERT (tree->treeid + cmesh->first_tree == tree->treeid + (t8_locidx_t) cmesh->first_tree); - fprintf (vtufile, " %ld", (long)(tree->treeid + (t8_locidx_t) cmesh->first_tree)); - if (!(sk % 8)) - fprintf (vtufile, "\n "); - } - if (write_ghosts) { - /* ghost offset types */ - for (ighost = 0; ighost < num_ghosts; ighost++, ++sk) { -#ifdef T8_ENABLE_DEBUG - ghost = t8_cmesh_trees_get_ghost (cmesh->trees, ighost); - /* Check for conversion errors */ - T8_ASSERT (ghost->treeid == (t8_gloidx_t) ((long) ghost->treeid)); -#endif - /* Write -1 as tree_id so that we can distinguish ghosts from normal trees - * in the vtk file */ - fprintf (vtufile, " %ld", (long) -1); - if (!(sk % 8)) - fprintf (vtufile, "\n "); - } - } - fprintf (vtufile, "\n"); - fprintf (vtufile, " \n"); - /* write mpirank data */ - fprintf (vtufile, - " \n", - "Int32", T8_VTK_FORMAT_STRING); - fprintf (vtufile, " "); - for (tree = t8_cmesh_get_first_tree (cmesh), sk = 1, offset = 0; tree != NULL; - tree = t8_cmesh_get_next_tree (cmesh, tree), ++sk) { - fprintf (vtufile, " %i", cmesh->mpirank); - if (!(sk % 8)) - fprintf (vtufile, "\n "); - } - if (write_ghosts) { - /* write our rank for each ghost */ - for (ighost = 0; ighost < num_ghosts; ighost++, ++sk) { - fprintf (vtufile, " %i", cmesh->mpirank); - if (!(sk % 8)) - fprintf (vtufile, "\n "); - } - } - fprintf (vtufile, "\n"); - fprintf (vtufile, " \n"); - fprintf (vtufile, " \n"); - /* write type data */ - fprintf (vtufile, " \n"); - fprintf (vtufile, " \n"); - fprintf (vtufile, "\n"); - fclose (vtufile); - } - return 0; -} - -int -t8_cmesh_vtk_write_file (const t8_cmesh_t cmesh, const char *fileprefix) -{ - return t8_cmesh_vtk_write_file_ext (cmesh, fileprefix, 1); -} From 6399e1605ba7c0b35cae725d83a11bbbcd6a1c2a Mon Sep 17 00:00:00 2001 From: Sandro Elsweijer Date: Fri, 16 Aug 2024 16:25:44 +0200 Subject: [PATCH 060/114] indent --- src/t8_cmesh/t8_cmesh_geometry.cxx | 2 +- src/t8_cmesh/t8_cmesh_partition.cxx | 5 +++-- src/t8_cmesh/t8_cmesh_readmshfile.cxx | 4 ++-- src/t8_cmesh/t8_cmesh_triangle.cxx | 2 +- src/t8_geometry/t8_geometry_base.hxx | 2 +- src/t8_geometry/t8_geometry_handler.cxx | 2 +- 6 files changed, 9 insertions(+), 8 deletions(-) diff --git a/src/t8_cmesh/t8_cmesh_geometry.cxx b/src/t8_cmesh/t8_cmesh_geometry.cxx index 68a15da36f..eca196b4bf 100644 --- a/src/t8_cmesh/t8_cmesh_geometry.cxx +++ b/src/t8_cmesh/t8_cmesh_geometry.cxx @@ -97,7 +97,7 @@ t8_cmesh_get_tree_geom_hash (const t8_cmesh_t cmesh, const t8_gloidx_t gtreeid) const size_t *hash = (const size_t *) t8_cmesh_get_attribute (cmesh, t8_get_package_id (), T8_CMESH_GEOMETRY_ATTRIBUTE_KEY, ltreeid); if (hash == nullptr) { - SC_ABORTF ("Could not find geometry for tree %ld.", static_cast(gtreeid)); + SC_ABORTF ("Could not find geometry for tree %ld.", static_cast (gtreeid)); } return *hash; } diff --git a/src/t8_cmesh/t8_cmesh_partition.cxx b/src/t8_cmesh/t8_cmesh_partition.cxx index d0fd523884..b9de8fbc54 100644 --- a/src/t8_cmesh/t8_cmesh_partition.cxx +++ b/src/t8_cmesh/t8_cmesh_partition.cxx @@ -391,7 +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 = %li\n", "send", *send_first, "send", *send_last, + static_cast (ret)); T8_ASSERT (*send_first >= 0); //TODO:reactivate T8_ASSERT (*send_last >= 0); @@ -1412,7 +1413,7 @@ t8_cmesh_partition_debug_listprocs (const t8_cmesh_t cmesh, const t8_cmesh_t cme } } t8_debugf ("I send to: %s\n", out); - std::strcpy(out, " "); + std::strcpy (out, " "); if (cmesh_from->set_partition) { for (p = 0; p < mpisize; p++) { if (t8_offset_sendsto (p, mpirank, from, to)) { diff --git a/src/t8_cmesh/t8_cmesh_readmshfile.cxx b/src/t8_cmesh/t8_cmesh_readmshfile.cxx index 094e25622d..18479c58d5 100644 --- a/src/t8_cmesh/t8_cmesh_readmshfile.cxx +++ b/src/t8_cmesh/t8_cmesh_readmshfile.cxx @@ -634,7 +634,7 @@ t8_cmesh_msh_file_2_read_eles (t8_cmesh_t cmesh, FILE *fp, sc_hash_t *vertices, int switch_indices[4] = { 0 }; int iswitch; T8_ASSERT (t8_eclass_to_dimension[eclass] > 1); - t8_debugf ("Correcting negative volume of tree %li\n", static_cast(tree_count)); + t8_debugf ("Correcting negative volume of tree %li\n", static_cast (tree_count)); switch (eclass) { case T8_ECLASS_TRIANGLE: case T8_ECLASS_QUAD: @@ -973,7 +973,7 @@ t8_cmesh_msh_file_4_read_eles (t8_cmesh_t cmesh, FILE *fp, sc_hash_t *vertices, int switch_indices[4] = { 0 }; int iswitch; T8_ASSERT (t8_eclass_to_dimension[eclass] > 1); - t8_debugf ("Correcting negative volume of tree %li\n", static_cast(tree_count)); + t8_debugf ("Correcting negative volume of tree %li\n", static_cast (tree_count)); switch (eclass) { case T8_ECLASS_TRIANGLE: case T8_ECLASS_QUAD: diff --git a/src/t8_cmesh/t8_cmesh_triangle.cxx b/src/t8_cmesh/t8_cmesh_triangle.cxx index 4651dd5c59..6d66dae5c4 100644 --- a/src/t8_cmesh/t8_cmesh_triangle.cxx +++ b/src/t8_cmesh/t8_cmesh_triangle.cxx @@ -262,7 +262,7 @@ t8_cmesh_triangle_read_eles (t8_cmesh_t cmesh, int corner_offset, char *filename double temp; T8_ASSERT (dim == 3); - t8_debugf ("Correcting negative volume of tree %li\n", static_cast(triangle - triangle_offset)); + t8_debugf ("Correcting negative volume of tree %li\n", static_cast (triangle - triangle_offset)); /* We switch vertex 0 and vertex 1 */ for (i = 0; i < 3; i++) { temp = tree_vertices[i]; diff --git a/src/t8_geometry/t8_geometry_base.hxx b/src/t8_geometry/t8_geometry_base.hxx index 43a7e01c43..cc96324199 100644 --- a/src/t8_geometry/t8_geometry_base.hxx +++ b/src/t8_geometry/t8_geometry_base.hxx @@ -156,7 +156,7 @@ struct t8_geometry * Get the name of this geometry. * \return The name. */ - inline const std::string& + inline const std::string & t8_geom_get_name () const { return name; diff --git a/src/t8_geometry/t8_geometry_handler.cxx b/src/t8_geometry/t8_geometry_handler.cxx index a64fc47412..57900be091 100644 --- a/src/t8_geometry/t8_geometry_handler.cxx +++ b/src/t8_geometry/t8_geometry_handler.cxx @@ -62,7 +62,7 @@ t8_geometry_handler::update_tree (t8_cmesh_t cmesh, t8_gloidx_t gtreeid) active_geometry = get_geometry (geom_hash); SC_CHECK_ABORTF (active_geometry != nullptr, "Could not find geometry with hash %zu or tree %ld has no registered geometry.", geom_hash, - static_cast(gtreeid)); + static_cast (gtreeid)); } /* Get the user data for this geometry and this tree. */ active_geometry->t8_geom_load_tree_data (cmesh, gtreeid); From ff9055f7a778701d080c97e5be1a53be23b98922 Mon Sep 17 00:00:00 2001 From: Sandro Elsweijer Date: Tue, 20 Aug 2024 11:41:20 +0200 Subject: [PATCH 061/114] add input description for cmake ci preparation --- .github/workflows/tests_cmake_preparation.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/tests_cmake_preparation.yml b/.github/workflows/tests_cmake_preparation.yml index 705143dd29..4325e59f35 100644 --- a/.github/workflows/tests_cmake_preparation.yml +++ b/.github/workflows/tests_cmake_preparation.yml @@ -27,16 +27,20 @@ on: MAKEFLAGS: required: true type: string + description: 'Make flags to use for compilation (like -j4)' IGNORE_CACHE: required: false type: boolean default: false + description: 'Ignore cache and force recompilation' CACHE_COUNTER: required: true type: number + description: 'Counter to force updating the cache' MPI: required: true type: string + description: 'Use MPI for compilation (ON/OFF)' outputs: USED_CACHE: description: "Whether the cache was used" From 65dd30145b845816d7ede57bb85000a7f9d96127 Mon Sep 17 00:00:00 2001 From: Sandro Elsweijer Date: Tue, 20 Aug 2024 11:42:08 +0200 Subject: [PATCH 062/114] add input description for cmake ci sc p4est --- .github/workflows/tests_cmake_sc_p4est.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/tests_cmake_sc_p4est.yml b/.github/workflows/tests_cmake_sc_p4est.yml index d06d16334e..fe3ab95796 100644 --- a/.github/workflows/tests_cmake_sc_p4est.yml +++ b/.github/workflows/tests_cmake_sc_p4est.yml @@ -36,9 +36,11 @@ on: MAKEFLAGS: required: true type: string + description: 'Make flags to use for compilation (like -j4)' MPI: required: true type: string + description: 'Use MPI for compilation (ON/OFF)' jobs: sc_p4est_cmake_tests: From 0930ac67dba7b8fe25f7e22156c1582a0391fbe4 Mon Sep 17 00:00:00 2001 From: Sandro Elsweijer Date: Tue, 20 Aug 2024 11:45:27 +0200 Subject: [PATCH 063/114] add input description for cmake ci t8code tests --- .github/workflows/tests_cmake_t8code.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/tests_cmake_t8code.yml b/.github/workflows/tests_cmake_t8code.yml index d2375595d3..8e29cd92fc 100644 --- a/.github/workflows/tests_cmake_t8code.yml +++ b/.github/workflows/tests_cmake_t8code.yml @@ -27,15 +27,19 @@ on: MAKEFLAGS: required: true type: string + description: 'Make flags to use for compilation (like -j4)' MPI: required: true type: string + description: 'Use MPI for compilation (ON/OFF)' BUILD_TYPE: required: true type: string + description: 'Build type (Release/Debug)' LESS_TESTS: required: true type: boolean + description: 'Enable less tests option for configuring' jobs: t8code_cmake_tests: From e002136ec5b7ea4aabd128eabe0d91e80ffad3f9 Mon Sep 17 00:00:00 2001 From: Sandro Elsweijer Date: Tue, 20 Aug 2024 11:47:17 +0200 Subject: [PATCH 064/114] add input description for cmake ci t8code linkage tests --- .github/workflows/tests_cmake_t8code_linkage.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/tests_cmake_t8code_linkage.yml b/.github/workflows/tests_cmake_t8code_linkage.yml index 910423f6dc..f5b73414be 100644 --- a/.github/workflows/tests_cmake_t8code_linkage.yml +++ b/.github/workflows/tests_cmake_t8code_linkage.yml @@ -27,15 +27,19 @@ on: MAKEFLAGS: required: true type: string + description: 'Make flags to use for compilation (like -j4)' MPI: required: true type: string + description: 'Use MPI for compilation (ON/OFF)' BUILD_TYPE: required: true type: string + description: 'Build type (Release/Debug)' LESS_TESTS: required: true type: boolean + description: 'Enable less tests option for configuring' jobs: t8code_cmake_tests: From 7d02ec837e70d4e58920efc181355c7fa74c9323 Mon Sep 17 00:00:00 2001 From: Sandro Elsweijer Date: Tue, 20 Aug 2024 14:00:26 +0200 Subject: [PATCH 065/114] switch from ninja test to ctest for parallel test execution --- .github/workflows/tests_cmake_sc_p4est.yml | 8 ++++---- .github/workflows/tests_cmake_t8code.yml | 4 ++-- .github/workflows/tests_cmake_t8code_linkage.yml | 12 ++++++------ 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/.github/workflows/tests_cmake_sc_p4est.yml b/.github/workflows/tests_cmake_sc_p4est.yml index fe3ab95796..cf609c314f 100644 --- a/.github/workflows/tests_cmake_sc_p4est.yml +++ b/.github/workflows/tests_cmake_sc_p4est.yml @@ -82,7 +82,7 @@ jobs: && echo P4EST_RELEASE="$P4EST_RELEASE" >> $GITHUB_ENV ## sc debug - name: sc debug check - run: cd $SC_DEBUG && ninja test $MAKEFLAGS + run: cd $SC_DEBUG && ctest $MAKEFLAGS - name: OnFailUploadLog if: failure() uses: actions/upload-artifact@v4 @@ -91,7 +91,7 @@ jobs: path: $SC_DEBUG/Testing/Temporary/LastTest.log ## sc release - name: sc release check - run: cd $SC_RELEASE && ninja test $MAKEFLAGS + run: cd $SC_RELEASE && ctest $MAKEFLAGS - name: OnFailUploadLog if: failure() uses: actions/upload-artifact@v4 @@ -103,7 +103,7 @@ jobs: # ## p4est debug - name: p4est debug check - run: cd $P4EST_DEBUG && ninja test $MAKEFLAGS + run: cd $P4EST_DEBUG && ctest $MAKEFLAGS - name: OnFailUploadLog if: failure() uses: actions/upload-artifact@v4 @@ -112,7 +112,7 @@ jobs: path: $P4EST_DEBUG/Testing/Temporary/LastTest.log ## p4est release - name: p4est release check - run: cd $P4EST_RELEASE && ninja test $MAKEFLAGS + run: cd $P4EST_RELEASE && ctest $MAKEFLAGS - name: OnFailUploadLog if: failure() uses: actions/upload-artifact@v4 diff --git a/.github/workflows/tests_cmake_t8code.yml b/.github/workflows/tests_cmake_t8code.yml index 8e29cd92fc..0dff77b194 100644 --- a/.github/workflows/tests_cmake_t8code.yml +++ b/.github/workflows/tests_cmake_t8code.yml @@ -102,8 +102,8 @@ jobs: run: cd build && ninja $MAKEFLAGS - name: ninja install run: cd build && ninja install $MAKEFLAGS - - name: ninja test - run: cd build && ninja test $MAKEFLAGS + - name: ctest + run: cd build && ctest $MAKEFLAGS - name: OnFailUploadLog if: failure() uses: actions/upload-artifact@v4 diff --git a/.github/workflows/tests_cmake_t8code_linkage.yml b/.github/workflows/tests_cmake_t8code_linkage.yml index f5b73414be..fdce2ddbff 100644 --- a/.github/workflows/tests_cmake_t8code_linkage.yml +++ b/.github/workflows/tests_cmake_t8code_linkage.yml @@ -101,8 +101,8 @@ jobs: run: cd build_netcdf && ninja $MAKEFLAGS - name: ninja install run: cd build_netcdf && ninja install $MAKEFLAGS - - name: ninja test - run: cd build_netcdf && ninja test $MAKEFLAGS + - name: ctest + run: cd build_netcdf && ctest $MAKEFLAGS - name: OnFailUploadLog if: failure() uses: actions/upload-artifact@v4 @@ -126,8 +126,8 @@ jobs: run: cd build_occ && ninja $MAKEFLAGS - name: ninja install run: cd build_occ && ninja install $MAKEFLAGS - - name: ninja test - run: cd build_occ && ninja test $MAKEFLAGS + - name: ctest + run: cd build_occ && ctest $MAKEFLAGS - name: OnFailUploadLog if: failure() uses: actions/upload-artifact@v4 @@ -151,8 +151,8 @@ jobs: run: cd build_vtk && ninja $MAKEFLAGS - name: ninja install run: cd build_vtk && ninja install $MAKEFLAGS - - name: ninja test - run: cd build_vtk && ninja test $MAKEFLAGS + - name: ctest + run: cd build_vtk && ctest $MAKEFLAGS - name: OnFailUploadLog if: failure() uses: actions/upload-artifact@v4 From 52b4a9125eb391e652afa838e601a51caf31b406 Mon Sep 17 00:00:00 2001 From: Sandro Elsweijer Date: Wed, 21 Aug 2024 09:14:47 +0200 Subject: [PATCH 066/114] let tests run in parallel as default --- CMakeLists.txt | 2 +- test/CMakeLists.txt | 14 ++++++++++++-- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index ec64d7f618..f06b37a63a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -29,7 +29,7 @@ option( T8CODE_BUILD_DOCUMENTATION "Build t8code's documentation" OFF ) include(CMakeDependentOption) cmake_dependent_option( T8CODE_BUILD_DOCUMENTATION_SPHINX "Build t8code's documentation using sphinx" OFF "T8CODE_BUILD_DOCUMENTATION" OFF ) -set(T8CODE_CUSTOM_TEST_COMMAND "" CACHE STRING "Define custom test command, e.g.: mpirun -n 4") +set(T8CODE_CUSTOM_TEST_COMMAND "" CACHE STRING "Define custom test command, e.g.: mpirun -np 8 (overwrites standard mpirun -np 4 if build with mpi)") if( NOT CMAKE_BUILD_TYPE ) set( CMAKE_BUILD_TYPE "Release" ) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 33ce3ffd72..3b86619d98 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -11,9 +11,19 @@ function( add_t8_test ) target_link_libraries( ${ADD_T8_TEST_NAME} PRIVATE T8 gtest pthread) # Split custom test command into a list by whitespace. - separate_arguments (T8CODE_CUSTOM_TEST_COMMAND_LIST NATIVE_COMMAND "${T8CODE_CUSTOM_TEST_COMMAND}") + # If MPI is enabled, and no custom test command is provided, use mpirun -np 4 as the default command. + # If MPI is not enabled, use the custom test command as is. + if ( T8CODE_ENABLE_MPI ) + if ( T8CODE_CUSTOM_TEST_COMMAND STREQUAL "" ) + separate_arguments (T8CODE_TEST_COMMAND_LIST NATIVE_COMMAND "mpirun -np 4") + else ( T8CODE_CUSTOM_TEST_COMMAND STREQUAL "" ) + separate_arguments (T8CODE_TEST_COMMAND_LIST NATIVE_COMMAND ${T8CODE_CUSTOM_TEST_COMMAND}) + endif ( T8CODE_CUSTOM_TEST_COMMAND STREQUAL "" ) + else( T8CODE_ENABLE_MPI ) + separate_arguments (T8CODE_TEST_COMMAND_LIST NATIVE_COMMAND ${T8CODE_CUSTOM_TEST_COMMAND}) + endif ( T8CODE_ENABLE_MPI ) - add_test( NAME ${ADD_T8_TEST_NAME} COMMAND ${T8CODE_CUSTOM_TEST_COMMAND_LIST} ./${ADD_T8_TEST_NAME} ) + add_test( NAME ${ADD_T8_TEST_NAME} COMMAND ${T8CODE_TEST_COMMAND_LIST} ./${ADD_T8_TEST_NAME} ) endfunction() # Copy test files to build folder so that the t8_test programs can find them. From d0ae185d56d14bcbba1d5c6d8fc878f3b3b01b4a Mon Sep 17 00:00:00 2001 From: Sandro Elsweijer Date: Wed, 21 Aug 2024 10:05:18 +0200 Subject: [PATCH 067/114] enhance default build type selection --- CMakeLists.txt | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index ec64d7f618..9362254c8b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -31,12 +31,18 @@ cmake_dependent_option( T8CODE_BUILD_DOCUMENTATION_SPHINX "Build t8code's docume set(T8CODE_CUSTOM_TEST_COMMAND "" CACHE STRING "Define custom test command, e.g.: mpirun -n 4") -if( NOT CMAKE_BUILD_TYPE ) - set( CMAKE_BUILD_TYPE "Release" ) +# Set a default build type if none was specified +set(default_build_type "Release") + +if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) + message(STATUS "Setting build type to '${default_build_type}' as none was specified.") + set(CMAKE_BUILD_TYPE "${default_build_type}" CACHE + STRING "Choose the type of build. Build types available: Release Debug RelWithDebInfo" FORCE) + # Set the possible values of build type for cmake-gui + set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS + "Debug" "Release" "RelWithDebInfo") endif() -set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS Release RelWithDebInfo Debug) - set( CMAKE_C_STANDARD 11 ) set( CMAKE_C_STANDARD_REQUIRED ON ) set( CMAKE_C_EXTENSIONS OFF ) From 03e9657abe7922b4876226bec8507be5732133de Mon Sep 17 00:00:00 2001 From: Sandro Elsweijer Date: Thu, 22 Aug 2024 11:32:54 +0200 Subject: [PATCH 068/114] add option to export cmake compile commands --- CMakeLists.txt | 1 + src/CMakeLists.txt | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index f06b37a63a..aea1a63e88 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -10,6 +10,7 @@ include( CTest ) option( T8CODE_BUILD_AS_SHARED_LIBRARY "Whether t8code should be built as a shared or a static library" ON ) option( T8CODE_BUILD_PEDANTIC "Compile t8code with `-Wall -pedantic -Werror` as done in the Github CI." OFF ) +option( T8CODE_EXPORT_COMPILE_COMMANDS "Export the compile commands as json. Can be used in code editors for intellisense" OFF ) option( T8CODE_BUILD_TESTS "Build t8code's automated tests" ON ) option( T8CODE_BUILD_TUTORIALS "Build t8code's tutorials" ON ) option( T8CODE_BUILD_EXAMPLES "Build t8code's examples" ON ) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 6cc4516e49..1f0a4baacf 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -25,6 +25,10 @@ if( CMAKE_BUILD_TYPE STREQUAL "Debug" ) target_compile_definitions( T8 PUBLIC T8_ENABLE_DEBUG ) endif() +if( T8CODE_EXPORT_COMPILE_COMMANDS ) + target_compile_definitions(T8 PRIVATE CMAKE_EXPORT_COMPILE_COMMANDS=1) +endif( T8CODE_EXPORT_COMPILE_COMMANDS ) + if( T8CODE_ENABLE_NETCDF ) target_link_libraries( T8 PUBLIC netCDF::netcdf ) target_compile_definitions(T8 PUBLIC From e7ac0695cd2795b783ea211ca886b0cd1953da9a Mon Sep 17 00:00:00 2001 From: Sandro Elsweijer <49643115+sandro-elsweijer@users.noreply.github.com> Date: Fri, 23 Aug 2024 10:40:29 +0200 Subject: [PATCH 069/114] typo --- pull_request_template.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pull_request_template.md b/pull_request_template.md index b253b5fe7f..e6c1982284 100644 --- a/pull_request_template.md +++ b/pull_request_template.md @@ -33,6 +33,6 @@ As a reviewer please read through all the code lines and make sure that the code - [ ] If a new directory with source-files is added, it must be covered by the `script/find_all_source_files.scp` to check the indentation of these files. - [ ] If this PR introduces a new feature, it must be covered in an example/tutorial and a Wiki article. -#### Licence +#### License - [ ] The author added a BSD statement to `doc/` (or already has one) From 27b0867d7354fcbcaf86993806b93a286ef60a64 Mon Sep 17 00:00:00 2001 From: Sandro Elsweijer <49643115+sandro-elsweijer@users.noreply.github.com> Date: Fri, 23 Aug 2024 11:58:25 +0200 Subject: [PATCH 070/114] Revert "Enable parallel tests in cmake ci" --- .github/workflows/tests_cmake_sc_p4est.yml | 8 ++++---- .github/workflows/tests_cmake_t8code.yml | 4 ++-- .github/workflows/tests_cmake_t8code_linkage.yml | 12 ++++++------ 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/.github/workflows/tests_cmake_sc_p4est.yml b/.github/workflows/tests_cmake_sc_p4est.yml index cf609c314f..fe3ab95796 100644 --- a/.github/workflows/tests_cmake_sc_p4est.yml +++ b/.github/workflows/tests_cmake_sc_p4est.yml @@ -82,7 +82,7 @@ jobs: && echo P4EST_RELEASE="$P4EST_RELEASE" >> $GITHUB_ENV ## sc debug - name: sc debug check - run: cd $SC_DEBUG && ctest $MAKEFLAGS + run: cd $SC_DEBUG && ninja test $MAKEFLAGS - name: OnFailUploadLog if: failure() uses: actions/upload-artifact@v4 @@ -91,7 +91,7 @@ jobs: path: $SC_DEBUG/Testing/Temporary/LastTest.log ## sc release - name: sc release check - run: cd $SC_RELEASE && ctest $MAKEFLAGS + run: cd $SC_RELEASE && ninja test $MAKEFLAGS - name: OnFailUploadLog if: failure() uses: actions/upload-artifact@v4 @@ -103,7 +103,7 @@ jobs: # ## p4est debug - name: p4est debug check - run: cd $P4EST_DEBUG && ctest $MAKEFLAGS + run: cd $P4EST_DEBUG && ninja test $MAKEFLAGS - name: OnFailUploadLog if: failure() uses: actions/upload-artifact@v4 @@ -112,7 +112,7 @@ jobs: path: $P4EST_DEBUG/Testing/Temporary/LastTest.log ## p4est release - name: p4est release check - run: cd $P4EST_RELEASE && ctest $MAKEFLAGS + run: cd $P4EST_RELEASE && ninja test $MAKEFLAGS - name: OnFailUploadLog if: failure() uses: actions/upload-artifact@v4 diff --git a/.github/workflows/tests_cmake_t8code.yml b/.github/workflows/tests_cmake_t8code.yml index 0dff77b194..8e29cd92fc 100644 --- a/.github/workflows/tests_cmake_t8code.yml +++ b/.github/workflows/tests_cmake_t8code.yml @@ -102,8 +102,8 @@ jobs: run: cd build && ninja $MAKEFLAGS - name: ninja install run: cd build && ninja install $MAKEFLAGS - - name: ctest - run: cd build && ctest $MAKEFLAGS + - name: ninja test + run: cd build && ninja test $MAKEFLAGS - name: OnFailUploadLog if: failure() uses: actions/upload-artifact@v4 diff --git a/.github/workflows/tests_cmake_t8code_linkage.yml b/.github/workflows/tests_cmake_t8code_linkage.yml index fdce2ddbff..f5b73414be 100644 --- a/.github/workflows/tests_cmake_t8code_linkage.yml +++ b/.github/workflows/tests_cmake_t8code_linkage.yml @@ -101,8 +101,8 @@ jobs: run: cd build_netcdf && ninja $MAKEFLAGS - name: ninja install run: cd build_netcdf && ninja install $MAKEFLAGS - - name: ctest - run: cd build_netcdf && ctest $MAKEFLAGS + - name: ninja test + run: cd build_netcdf && ninja test $MAKEFLAGS - name: OnFailUploadLog if: failure() uses: actions/upload-artifact@v4 @@ -126,8 +126,8 @@ jobs: run: cd build_occ && ninja $MAKEFLAGS - name: ninja install run: cd build_occ && ninja install $MAKEFLAGS - - name: ctest - run: cd build_occ && ctest $MAKEFLAGS + - name: ninja test + run: cd build_occ && ninja test $MAKEFLAGS - name: OnFailUploadLog if: failure() uses: actions/upload-artifact@v4 @@ -151,8 +151,8 @@ jobs: run: cd build_vtk && ninja $MAKEFLAGS - name: ninja install run: cd build_vtk && ninja install $MAKEFLAGS - - name: ctest - run: cd build_vtk && ctest $MAKEFLAGS + - name: ninja test + run: cd build_vtk && ninja test $MAKEFLAGS - name: OnFailUploadLog if: failure() uses: actions/upload-artifact@v4 From 17560e784bc2576c16ce760d2b6120e052ea8749 Mon Sep 17 00:00:00 2001 From: Sandro Elsweijer Date: Fri, 23 Aug 2024 12:06:29 +0200 Subject: [PATCH 071/114] remove makeflags from ninja test to avoid confusion --- .github/workflows/tests_cmake_sc_p4est.yml | 8 ++++---- .github/workflows/tests_cmake_t8code.yml | 2 +- .github/workflows/tests_cmake_t8code_linkage.yml | 6 +++--- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/tests_cmake_sc_p4est.yml b/.github/workflows/tests_cmake_sc_p4est.yml index fe3ab95796..15efd0db5b 100644 --- a/.github/workflows/tests_cmake_sc_p4est.yml +++ b/.github/workflows/tests_cmake_sc_p4est.yml @@ -82,7 +82,7 @@ jobs: && echo P4EST_RELEASE="$P4EST_RELEASE" >> $GITHUB_ENV ## sc debug - name: sc debug check - run: cd $SC_DEBUG && ninja test $MAKEFLAGS + run: cd $SC_DEBUG && ninja test - name: OnFailUploadLog if: failure() uses: actions/upload-artifact@v4 @@ -91,7 +91,7 @@ jobs: path: $SC_DEBUG/Testing/Temporary/LastTest.log ## sc release - name: sc release check - run: cd $SC_RELEASE && ninja test $MAKEFLAGS + run: cd $SC_RELEASE && ninja test - name: OnFailUploadLog if: failure() uses: actions/upload-artifact@v4 @@ -103,7 +103,7 @@ jobs: # ## p4est debug - name: p4est debug check - run: cd $P4EST_DEBUG && ninja test $MAKEFLAGS + run: cd $P4EST_DEBUG && ninja test - name: OnFailUploadLog if: failure() uses: actions/upload-artifact@v4 @@ -112,7 +112,7 @@ jobs: path: $P4EST_DEBUG/Testing/Temporary/LastTest.log ## p4est release - name: p4est release check - run: cd $P4EST_RELEASE && ninja test $MAKEFLAGS + run: cd $P4EST_RELEASE && ninja test - name: OnFailUploadLog if: failure() uses: actions/upload-artifact@v4 diff --git a/.github/workflows/tests_cmake_t8code.yml b/.github/workflows/tests_cmake_t8code.yml index 8e29cd92fc..5f6e45ade8 100644 --- a/.github/workflows/tests_cmake_t8code.yml +++ b/.github/workflows/tests_cmake_t8code.yml @@ -103,7 +103,7 @@ jobs: - name: ninja install run: cd build && ninja install $MAKEFLAGS - name: ninja test - run: cd build && ninja test $MAKEFLAGS + run: cd build && ninja test - name: OnFailUploadLog if: failure() uses: actions/upload-artifact@v4 diff --git a/.github/workflows/tests_cmake_t8code_linkage.yml b/.github/workflows/tests_cmake_t8code_linkage.yml index f5b73414be..df83c47b97 100644 --- a/.github/workflows/tests_cmake_t8code_linkage.yml +++ b/.github/workflows/tests_cmake_t8code_linkage.yml @@ -102,7 +102,7 @@ jobs: - name: ninja install run: cd build_netcdf && ninja install $MAKEFLAGS - name: ninja test - run: cd build_netcdf && ninja test $MAKEFLAGS + run: cd build_netcdf && ninja test - name: OnFailUploadLog if: failure() uses: actions/upload-artifact@v4 @@ -127,7 +127,7 @@ jobs: - name: ninja install run: cd build_occ && ninja install $MAKEFLAGS - name: ninja test - run: cd build_occ && ninja test $MAKEFLAGS + run: cd build_occ && ninja test - name: OnFailUploadLog if: failure() uses: actions/upload-artifact@v4 @@ -152,7 +152,7 @@ jobs: - name: ninja install run: cd build_vtk && ninja install $MAKEFLAGS - name: ninja test - run: cd build_vtk && ninja test $MAKEFLAGS + run: cd build_vtk && ninja test - name: OnFailUploadLog if: failure() uses: actions/upload-artifact@v4 From d5a91d2fa81fd45286bec52392615de4669b6d09 Mon Sep 17 00:00:00 2001 From: Sandro Elsweijer Date: Fri, 23 Aug 2024 14:02:16 +0200 Subject: [PATCH 072/114] retain folder structure of examples --- example/CMakeLists.txt | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/example/CMakeLists.txt b/example/CMakeLists.txt index 5fcb9239eb..9e511c8432 100644 --- a/example/CMakeLists.txt +++ b/example/CMakeLists.txt @@ -5,8 +5,8 @@ else() add_library( t8example STATIC ) endif() target_sources( t8example PRIVATE common/t8_example_common.cxx common/t8_example_common_functions.cxx ) -target_include_directories( t8example PRIVATE ${CMAKE_CURRENT_LIST_DIR}/.. ) -target_link_libraries( t8example PRIVATE T8 ) +target_include_directories( t8example PRIVATE ${CMAKE_CURRENT_LIST_DIR}/.. ${SC_INCLUDE_DIR} ) +target_link_libraries( t8example PRIVATE T8 ${SC_LIBRARIES} m ) install( TARGETS t8example DESTINATION ${CMAKE_INSTALL_PREFIX}/lib ) function( add_t8_example ) @@ -15,10 +15,20 @@ function( add_t8_example ) set( multiValueArgs "SOURCES" ) cmake_parse_arguments( ADD_T8_EXAMPLE "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN} ) + get_filename_component(EXAMPLE_SOURCE_DIR "${CMAKE_CURRENT_LIST_DIR}/${ADD_T8_EXAMPLE_SOURCES}" DIRECTORY) + file(RELATIVE_PATH EXAMPLE_RELATIVE_DIR "${CMAKE_SOURCE_DIR}" "${EXAMPLE_SOURCE_DIR}") + set(EXAMPLE_BUILD_DIR "${CMAKE_BINARY_DIR}/${EXAMPLE_RELATIVE_DIR}") + add_executable( ${ADD_T8_EXAMPLE_NAME} ${ADD_T8_EXAMPLE_SOURCES} ) target_link_libraries( ${ADD_T8_EXAMPLE_NAME} PRIVATE T8 t8example SC::SC ) target_include_directories( ${ADD_T8_EXAMPLE_NAME} PRIVATE ${CMAKE_CURRENT_LIST_DIR}/.. ) + set_target_properties(${ADD_T8_EXAMPLE_NAME} PROPERTIES + RUNTIME_OUTPUT_DIRECTORY "${EXAMPLE_BUILD_DIR}" + LIBRARY_OUTPUT_DIRECTORY "${EXAMPLE_BUILD_DIR}" + ARCHIVE_OUTPUT_DIRECTORY "${EXAMPLE_BUILD_DIR}" + ) + install( TARGETS ${ADD_T8_EXAMPLE_NAME} DESTINATION ${CMAKE_INSTALL_PREFIX}/bin ) endfunction() From 4ba3e69501152a5490308311ffcab7133904c1df Mon Sep 17 00:00:00 2001 From: Sandro Elsweijer Date: Fri, 23 Aug 2024 14:44:57 +0200 Subject: [PATCH 073/114] make macro ready for multiple executable files --- example/CMakeLists.txt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/example/CMakeLists.txt b/example/CMakeLists.txt index 9e511c8432..300e2f41b6 100644 --- a/example/CMakeLists.txt +++ b/example/CMakeLists.txt @@ -15,7 +15,10 @@ function( add_t8_example ) set( multiValueArgs "SOURCES" ) cmake_parse_arguments( ADD_T8_EXAMPLE "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN} ) - get_filename_component(EXAMPLE_SOURCE_DIR "${CMAKE_CURRENT_LIST_DIR}/${ADD_T8_EXAMPLE_SOURCES}" DIRECTORY) + # Get the path of the first file listed in the SOURCES list and use it to determine the build directory. + # The executable will be build in the same directory as the first source file. + list(GET ADD_T8_EXAMPLE_SOURCES 0 FIRST_SOURCE) + get_filename_component(EXAMPLE_SOURCE_DIR "${CMAKE_CURRENT_LIST_DIR}/${FIRST_SOURCE}" DIRECTORY) file(RELATIVE_PATH EXAMPLE_RELATIVE_DIR "${CMAKE_SOURCE_DIR}" "${EXAMPLE_SOURCE_DIR}") set(EXAMPLE_BUILD_DIR "${CMAKE_BINARY_DIR}/${EXAMPLE_RELATIVE_DIR}") From 7891a4d06605475d1e7fddc0916ff5833e3a16c9 Mon Sep 17 00:00:00 2001 From: Sandro Elsweijer Date: Fri, 23 Aug 2024 14:45:22 +0200 Subject: [PATCH 074/114] retain folder structure of tutorials --- tutorials/CMakeLists.txt | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/tutorials/CMakeLists.txt b/tutorials/CMakeLists.txt index ec38320344..32a874ecab 100644 --- a/tutorials/CMakeLists.txt +++ b/tutorials/CMakeLists.txt @@ -4,10 +4,23 @@ function( add_t8_tutorial ) set( multiValueArgs "SOURCES" ) cmake_parse_arguments( ADD_T8_TUTORIAL "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN} ) + # Get the path of the first file listed in the SOURCES list and use it to determine the build directory. + # The executable will be build in the same directory as the first source file. + list(GET ADD_T8_TUTORIAL_SOURCES 0 FIRST_SOURCE) + get_filename_component(TUTORIAL_SOURCE_DIR "${CMAKE_CURRENT_LIST_DIR}/${FIRST_SOURCE}" DIRECTORY) + file(RELATIVE_PATH TUTORIAL_RELATIVE_DIR "${CMAKE_SOURCE_DIR}" "${TUTORIAL_SOURCE_DIR}") + set(TUTORIAL_BUILD_DIR "${CMAKE_BINARY_DIR}/${TUTORIAL_RELATIVE_DIR}") + add_executable( ${ADD_T8_TUTORIAL_NAME} ${ADD_T8_TUTORIAL_SOURCES} ) target_link_libraries( ${ADD_T8_TUTORIAL_NAME} PRIVATE T8 SC::SC ) target_include_directories( ${ADD_T8_TUTORIAL_NAME} PRIVATE ${CMAKE_CURRENT_LIST_DIR}/.. ) + set_target_properties(${ADD_T8_TUTORIAL_NAME} PROPERTIES + RUNTIME_OUTPUT_DIRECTORY "${TUTORIAL_BUILD_DIR}" + LIBRARY_OUTPUT_DIRECTORY "${TUTORIAL_BUILD_DIR}" + ARCHIVE_OUTPUT_DIRECTORY "${TUTORIAL_BUILD_DIR}" + ) + install( TARGETS ${ADD_T8_TUTORIAL_NAME} DESTINATION ${CMAKE_INSTALL_PREFIX}/bin ) endfunction() From 95ef71a1647f80a425b58ed4181f520c82b8393f Mon Sep 17 00:00:00 2001 From: Sandro Elsweijer Date: Fri, 23 Aug 2024 15:51:49 +0200 Subject: [PATCH 075/114] retain folder structure of tests --- test/CMakeLists.txt | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 3b86619d98..f55967cde2 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -7,9 +7,27 @@ function( add_t8_test ) set( multiValueArgs "SOURCES" ) cmake_parse_arguments( ADD_T8_TEST "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN} ) + # Get the path of the second file listed in the SOURCES list (if there is one then from the first) and use it to determine the build directory. + # We use the second file, because the first is t8_gtest_main, which is in the root test dir. The executable will be build in the same directory as the second source file. + list (LENGTH ADD_T8_TEST_SOURCES TEST_SOURCES_LENGTH) + if ( TEST_SOURCES_LENGTH GREATER 1 ) + list(GET ADD_T8_TEST_SOURCES 1 TEST_SOURCE) + else() + list(GET ADD_T8_TEST_SOURCES 0 TEST_SOURCE) + endif() + get_filename_component(TEST_SOURCE_DIR "${CMAKE_CURRENT_LIST_DIR}/${TEST_SOURCE}" DIRECTORY) + file(RELATIVE_PATH TEST_RELATIVE_DIR "${CMAKE_SOURCE_DIR}" "${TEST_SOURCE_DIR}") + set(TEST_BUILD_DIR "${CMAKE_BINARY_DIR}/${TEST_RELATIVE_DIR}") + add_executable( ${ADD_T8_TEST_NAME} ${ADD_T8_TEST_SOURCES} ) target_link_libraries( ${ADD_T8_TEST_NAME} PRIVATE T8 gtest pthread) + set_target_properties(${ADD_T8_TEST_NAME} PROPERTIES + RUNTIME_OUTPUT_DIRECTORY "${TEST_BUILD_DIR}" + LIBRARY_OUTPUT_DIRECTORY "${TEST_BUILD_DIR}" + ARCHIVE_OUTPUT_DIRECTORY "${TEST_BUILD_DIR}" + ) + # Split custom test command into a list by whitespace. # If MPI is enabled, and no custom test command is provided, use mpirun -np 4 as the default command. # If MPI is not enabled, use the custom test command as is. @@ -23,7 +41,7 @@ function( add_t8_test ) separate_arguments (T8CODE_TEST_COMMAND_LIST NATIVE_COMMAND ${T8CODE_CUSTOM_TEST_COMMAND}) endif ( T8CODE_ENABLE_MPI ) - add_test( NAME ${ADD_T8_TEST_NAME} COMMAND ${T8CODE_TEST_COMMAND_LIST} ./${ADD_T8_TEST_NAME} ) + add_test( NAME ${ADD_T8_TEST_NAME} COMMAND ${T8CODE_TEST_COMMAND_LIST} ${TEST_BUILD_DIR}/${ADD_T8_TEST_NAME} ) endfunction() # Copy test files to build folder so that the t8_test programs can find them. From 88e5f2956231bbf59b4233f0310e7edbf70b5e0e Mon Sep 17 00:00:00 2001 From: Sandro Elsweijer Date: Fri, 23 Aug 2024 15:58:09 +0200 Subject: [PATCH 076/114] retain folder structure of benchmarks --- benchmarks/CMakeLists.txt | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/benchmarks/CMakeLists.txt b/benchmarks/CMakeLists.txt index 462d0c3184..6d79e10c3d 100644 --- a/benchmarks/CMakeLists.txt +++ b/benchmarks/CMakeLists.txt @@ -4,10 +4,23 @@ function( add_t8_benchmark ) set( multiValueArgs "SOURCES" ) cmake_parse_arguments( ADD_T8_BENCHMARK "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN} ) + # Get the path of the first file listed in the SOURCES list and use it to determine the build directory. + # The executable will be build in the same directory as the first source file. + list(GET ADD_T8_BENCHMARK_SOURCES 0 FIRST_SOURCE) + get_filename_component(BENCHMARK_SOURCE_DIR "${CMAKE_CURRENT_LIST_DIR}/${FIRST_SOURCE}" DIRECTORY) + file(RELATIVE_PATH BENCHMARK_RELATIVE_DIR "${CMAKE_SOURCE_DIR}" "${BENCHMARK_SOURCE_DIR}") + set(BENCHMARK_BUILD_DIR "${CMAKE_BINARY_DIR}/${BENCHMARK_RELATIVE_DIR}") + add_executable( ${ADD_T8_BENCHMARK_NAME} ${ADD_T8_BENCHMARK_SOURCES} ) target_include_directories( ${ADD_T8_BENCHMARK_NAME} PRIVATE ${PROJECT_SOURCE_DIR} ) target_link_libraries( ${ADD_T8_BENCHMARK_NAME} PRIVATE T8 SC::SC ) + set_target_properties(${ADD_T8_BENCHMARK_NAME} PROPERTIES + RUNTIME_OUTPUT_DIRECTORY "${BENCHMARK_BUILD_DIR}" + LIBRARY_OUTPUT_DIRECTORY "${BENCHMARK_BUILD_DIR}" + ARCHIVE_OUTPUT_DIRECTORY "${BENCHMARK_BUILD_DIR}" + ) + install( TARGETS ${ADD_T8_BENCHMARK_NAME} DESTINATION ${CMAKE_INSTALL_PREFIX}/bin ) endfunction() From 4ddb420ea1b3d4b6889b91d6e73e964fcdab1e2f Mon Sep 17 00:00:00 2001 From: David Knapp Date: Tue, 27 Aug 2024 10:21:37 +0200 Subject: [PATCH 077/114] Add _serial suffix to all tests that should only run in serial --- test/CMakeLists.txt | 68 ++++++++++++++++++++++----------------------- 1 file changed, 34 insertions(+), 34 deletions(-) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 3b86619d98..f01b11c037 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -31,16 +31,16 @@ function( copy_test_file TEST_FILE_NAME ) configure_file(${CMAKE_CURRENT_LIST_DIR}/testfiles/${TEST_FILE_NAME} ${CMAKE_CURRENT_BINARY_DIR}/test/testfiles/${TEST_FILE_NAME} COPYONLY) endfunction() -add_t8_test( NAME t8_gtest_cmesh_bcast SOURCES t8_gtest_main.cxx t8_cmesh/t8_gtest_bcast.cxx ) -add_t8_test( NAME t8_gtest_eclass SOURCES t8_gtest_main.cxx t8_gtest_eclass.cxx ) -add_t8_test( NAME t8_gtest_vec SOURCES t8_gtest_main.cxx t8_gtest_vec.cxx ) -add_t8_test( NAME t8_gtest_mat SOURCES t8_gtest_main.cxx t8_gtest_mat.cxx ) -add_t8_test( NAME t8_gtest_refcount SOURCES t8_gtest_main.cxx t8_gtest_refcount.cxx ) -add_t8_test( NAME t8_gtest_occ_linkage SOURCES t8_gtest_main.cxx t8_gtest_occ_linkage.cxx ) -add_t8_test( NAME t8_gtest_version SOURCES t8_gtest_main.cxx t8_gtest_version.cxx ) -add_t8_test( NAME t8_gtest_basics SOURCES t8_gtest_main.cxx t8_gtest_basics.cxx ) -add_t8_test( NAME t8_gtest_netcdf_linkage SOURCES t8_gtest_main.cxx t8_gtest_netcdf_linkage.cxx ) -add_t8_test( NAME t8_gtest_vtk_linkage SOURCES t8_gtest_main.cxx t8_gtest_vtk_linkage.cxx ) +add_t8_test( NAME t8_gtest_cmesh_bcast_serial SOURCES t8_gtest_main.cxx t8_cmesh/t8_gtest_bcast.cxx ) +add_t8_test( NAME t8_gtest_eclass_serial SOURCES t8_gtest_main.cxx t8_gtest_eclass.cxx ) +add_t8_test( NAME t8_gtest_vec_serial SOURCES t8_gtest_main.cxx t8_gtest_vec.cxx ) +add_t8_test( NAME t8_gtest_mat_serial SOURCES t8_gtest_main.cxx t8_gtest_mat.cxx ) +add_t8_test( NAME t8_gtest_refcount_serial SOURCES t8_gtest_main.cxx t8_gtest_refcount.cxx ) +add_t8_test( NAME t8_gtest_occ_linkage_serial SOURCES t8_gtest_main.cxx t8_gtest_occ_linkage.cxx ) +add_t8_test( NAME t8_gtest_version_serial SOURCES t8_gtest_main.cxx t8_gtest_version.cxx ) +add_t8_test( NAME t8_gtest_basics_serial SOURCES t8_gtest_main.cxx t8_gtest_basics.cxx ) +add_t8_test( NAME t8_gtest_netcdf_linkage_serial SOURCES t8_gtest_main.cxx t8_gtest_netcdf_linkage.cxx ) +add_t8_test( NAME t8_gtest_vtk_linkage_serial SOURCES t8_gtest_main.cxx t8_gtest_vtk_linkage.cxx ) add_t8_test( NAME t8_gtest_hypercube SOURCES t8_gtest_main.cxx t8_cmesh/t8_gtest_hypercube.cxx ) add_t8_test( NAME t8_gtest_cmesh_readmshfile SOURCES t8_gtest_main.cxx t8_cmesh/t8_gtest_cmesh_readmshfile.cxx ) @@ -57,7 +57,7 @@ add_t8_test( NAME t8_gtest_attribute_gloidx_array SOURCES t8_gtest_main.c add_t8_test( NAME t8_gtest_shmem SOURCES t8_gtest_main.cxx t8_data/t8_gtest_shmem.cxx ) -add_t8_test( NAME t8_gtest_element_volume SOURCES t8_gtest_main.cxx t8_forest/t8_gtest_element_volume.cxx ) +add_t8_test( NAME t8_gtest_element_volume_serial SOURCES t8_gtest_main.cxx t8_forest/t8_gtest_element_volume.cxx ) add_t8_test( NAME t8_gtest_search SOURCES t8_gtest_main.cxx t8_forest/t8_gtest_search.cxx ) add_t8_test( NAME t8_gtest_half_neighbors SOURCES t8_gtest_main.cxx t8_forest/t8_gtest_half_neighbors.cxx ) add_t8_test( NAME t8_gtest_find_owner SOURCES t8_gtest_main.cxx t8_forest/t8_gtest_find_owner.cxx ) @@ -78,34 +78,34 @@ add_t8_test( NAME t8_gtest_iterate_replace SOURCES t8_gtest_main.cxx t8_forest add_t8_test( NAME t8_gtest_empty_local_tree SOURCES t8_gtest_main.cxx t8_forest_incomplete/t8_gtest_empty_local_tree.cxx ) add_t8_test( NAME t8_gtest_empty_global_tree SOURCES t8_gtest_main.cxx t8_forest_incomplete/t8_gtest_empty_global_tree.cxx ) -add_t8_test( NAME t8_gtest_geometry_cad SOURCES t8_gtest_main.cxx t8_geometry/t8_geometry_implementations/t8_gtest_geometry_cad.cxx ) -add_t8_test( NAME t8_gtest_geometry_linear SOURCES t8_gtest_main.cxx t8_geometry/t8_geometry_implementations/t8_gtest_geometry_linear.cxx ) -add_t8_test( NAME t8_gtest_geometry_lagrange SOURCES t8_gtest_main.cxx t8_geometry/t8_geometry_implementations/t8_gtest_geometry_lagrange.cxx ) -add_t8_test( NAME t8_gtest_geometry_triangular_interpolation SOURCES t8_gtest_main.cxx t8_geometry/t8_gtest_geometry_triangular_interpolation.cxx ) +add_t8_test( NAME t8_gtest_geometry_cad_serial SOURCES t8_gtest_main.cxx t8_geometry/t8_geometry_implementations/t8_gtest_geometry_cad.cxx ) +add_t8_test( NAME t8_gtest_geometry_linear_serial SOURCES t8_gtest_main.cxx t8_geometry/t8_geometry_implementations/t8_gtest_geometry_linear.cxx ) +add_t8_test( NAME t8_gtest_geometry_lagrange_serial SOURCES t8_gtest_main.cxx t8_geometry/t8_geometry_implementations/t8_gtest_geometry_lagrange.cxx ) +add_t8_test( NAME t8_gtest_geometry_triangular_interpolation_serial SOURCES t8_gtest_main.cxx t8_geometry/t8_gtest_geometry_triangular_interpolation.cxx ) add_t8_test( NAME t8_gtest_geometry_handling SOURCES t8_gtest_main.cxx t8_geometry/t8_gtest_geometry_handling.cxx ) -add_t8_test( NAME t8_gtest_point_inside SOURCES t8_gtest_main.cxx t8_geometry/t8_gtest_point_inside.cxx ) +add_t8_test( NAME t8_gtest_point_inside_serial SOURCES t8_gtest_main.cxx t8_geometry/t8_gtest_point_inside.cxx ) add_t8_test( NAME t8_gtest_vtk_reader SOURCES t8_gtest_main.cxx t8_IO/t8_gtest_vtk_reader.cxx ) add_t8_test( NAME t8_gtest_vtk_writer SOURCES t8_gtest_main.cxx t8_IO/t8_gtest_vtk_writer.cxx ) -add_t8_test( NAME t8_gtest_nca SOURCES t8_gtest_main.cxx t8_schemes/t8_gtest_nca.cxx ) -add_t8_test( NAME t8_gtest_pyra_connectivity SOURCES t8_gtest_main.cxx t8_schemes/t8_gtest_pyra_connectivity.cxx ) -add_t8_test( NAME t8_gtest_face_neigh SOURCES t8_gtest_main.cxx t8_schemes/t8_gtest_face_neigh.cxx ) -add_t8_test( NAME t8_gtest_init_linear_id SOURCES t8_gtest_main.cxx t8_schemes/t8_gtest_init_linear_id.cxx ) -add_t8_test( NAME t8_gtest_ancestor SOURCES t8_gtest_main.cxx t8_schemes/t8_gtest_ancestor.cxx ) -add_t8_test( NAME t8_gtest_element_count_leaves SOURCES t8_gtest_main.cxx t8_schemes/t8_gtest_element_count_leaves.cxx ) -add_t8_test( NAME t8_gtest_element_ref_coords SOURCES t8_gtest_main.cxx t8_schemes/t8_gtest_element_ref_coords.cxx ) -add_t8_test( NAME t8_gtest_descendant SOURCES t8_gtest_main.cxx t8_schemes/t8_gtest_descendant.cxx ) -add_t8_test( NAME t8_gtest_find_parent SOURCES t8_gtest_main.cxx t8_schemes/t8_gtest_find_parent.cxx ) -add_t8_test( NAME t8_gtest_equal SOURCES t8_gtest_main.cxx t8_schemes/t8_gtest_equal.cxx ) -add_t8_test( NAME t8_gtest_successor SOURCES t8_gtest_main.cxx t8_schemes/t8_gtest_successor.cxx ) -add_t8_test( NAME t8_gtest_boundary_extrude SOURCES t8_gtest_main.cxx t8_schemes/t8_gtest_boundary_extrude.cxx ) -add_t8_test( NAME t8_gtest_face_descendant SOURCES t8_gtest_main.cxx t8_schemes/t8_gtest_face_descendant.cxx ) -add_t8_test( NAME t8_gtest_default SOURCES t8_gtest_main.cxx t8_schemes/t8_gtest_default.cxx ) -add_t8_test( NAME t8_gtest_child_parent_face SOURCES t8_gtest_main.cxx t8_schemes/t8_gtest_child_parent_face.cxx ) -add_t8_test( NAME t8_gtest_pack_unpack SOURCES t8_gtest_main.cxx t8_schemes/t8_gtest_pack_unpack.cxx ) -add_t8_test( NAME t8_gtest_root SOURCES t8_gtest_main.cxx t8_schemes/t8_gtest_root.cxx ) -add_t8_test( NAME t8_gtest_scheme_consistency SOURCES t8_gtest_main.cxx t8_schemes/t8_gtest_scheme_consistency.cxx ) +add_t8_test( NAME t8_gtest_nca_serial SOURCES t8_gtest_main.cxx t8_schemes/t8_gtest_nca.cxx ) +add_t8_test( NAME t8_gtest_pyra_connectivity_serial SOURCES t8_gtest_main.cxx t8_schemes/t8_gtest_pyra_connectivity.cxx ) +add_t8_test( NAME t8_gtest_face_neigh_serial SOURCES t8_gtest_main.cxx t8_schemes/t8_gtest_face_neigh.cxx ) +add_t8_test( NAME t8_gtest_init_linear_id_serial SOURCES t8_gtest_main.cxx t8_schemes/t8_gtest_init_linear_id.cxx ) +add_t8_test( NAME t8_gtest_ancestor_serial SOURCES t8_gtest_main.cxx t8_schemes/t8_gtest_ancestor.cxx ) +add_t8_test( NAME t8_gtest_element_count_leaves_serial SOURCES t8_gtest_main.cxx t8_schemes/t8_gtest_element_count_leaves.cxx ) +add_t8_test( NAME t8_gtest_element_ref_coords_serial SOURCES t8_gtest_main.cxx t8_schemes/t8_gtest_element_ref_coords.cxx ) +add_t8_test( NAME t8_gtest_descendant_serial SOURCES t8_gtest_main.cxx t8_schemes/t8_gtest_descendant.cxx ) +add_t8_test( NAME t8_gtest_find_parent_serial SOURCES t8_gtest_main.cxx t8_schemes/t8_gtest_find_parent.cxx ) +add_t8_test( NAME t8_gtest_equal_serial SOURCES t8_gtest_main.cxx t8_schemes/t8_gtest_equal.cxx ) +add_t8_test( NAME t8_gtest_successor_serial SOURCES t8_gtest_main.cxx t8_schemes/t8_gtest_successor.cxx ) +add_t8_test( NAME t8_gtest_boundary_extrude_serial SOURCES t8_gtest_main.cxx t8_schemes/t8_gtest_boundary_extrude.cxx ) +add_t8_test( NAME t8_gtest_face_descendant_serial SOURCES t8_gtest_main.cxx t8_schemes/t8_gtest_face_descendant.cxx ) +add_t8_test( NAME t8_gtest_default_serial SOURCES t8_gtest_main.cxx t8_schemes/t8_gtest_default.cxx ) +add_t8_test( NAME t8_gtest_child_parent_face_serial SOURCES t8_gtest_main.cxx t8_schemes/t8_gtest_child_parent_face.cxx ) +add_t8_test( NAME t8_gtest_pack_unpack_serial SOURCES t8_gtest_main.cxx t8_schemes/t8_gtest_pack_unpack.cxx ) +add_t8_test( NAME t8_gtest_root_serial SOURCES t8_gtest_main.cxx t8_schemes/t8_gtest_root.cxx ) +add_t8_test( NAME t8_gtest_scheme_consistency_serial SOURCES t8_gtest_main.cxx t8_schemes/t8_gtest_scheme_consistency.cxx ) copy_test_file( test_cube_unstructured_1.inp ) copy_test_file( test_cube_unstructured_2.inp ) From fd3493aa4a01f50941edc38d7eaf6ad3b1dcb5d8 Mon Sep 17 00:00:00 2001 From: David Knapp Date: Tue, 27 Aug 2024 10:28:18 +0200 Subject: [PATCH 078/114] Run serial tests only on 1 proc --- test/CMakeLists.txt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index f01b11c037..d8aae46269 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -14,7 +14,9 @@ function( add_t8_test ) # If MPI is enabled, and no custom test command is provided, use mpirun -np 4 as the default command. # If MPI is not enabled, use the custom test command as is. if ( T8CODE_ENABLE_MPI ) - if ( T8CODE_CUSTOM_TEST_COMMAND STREQUAL "" ) + if (NAME MATCHES "_serial") + separate_arguments(T8CODE_TEST_COMMAND_LIST "mpirun -np 1") + elseif ( T8CODE_CUSTOM_TEST_COMMAND STREQUAL "" ) separate_arguments (T8CODE_TEST_COMMAND_LIST NATIVE_COMMAND "mpirun -np 4") else ( T8CODE_CUSTOM_TEST_COMMAND STREQUAL "" ) separate_arguments (T8CODE_TEST_COMMAND_LIST NATIVE_COMMAND ${T8CODE_CUSTOM_TEST_COMMAND}) From e189147d48fac3cf45e150807543f652720c76c0 Mon Sep 17 00:00:00 2001 From: David Knapp Date: Tue, 27 Aug 2024 10:37:56 +0200 Subject: [PATCH 079/114] Add parallel suffix to indicate mpi-parallel execution for tests --- test/CMakeLists.txt | 66 ++++++++++++++++++++++----------------------- 1 file changed, 33 insertions(+), 33 deletions(-) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index d8aae46269..d6a3253c18 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -44,51 +44,51 @@ add_t8_test( NAME t8_gtest_basics_serial SOURCES t8_gtest_main.cxx t8 add_t8_test( NAME t8_gtest_netcdf_linkage_serial SOURCES t8_gtest_main.cxx t8_gtest_netcdf_linkage.cxx ) add_t8_test( NAME t8_gtest_vtk_linkage_serial SOURCES t8_gtest_main.cxx t8_gtest_vtk_linkage.cxx ) -add_t8_test( NAME t8_gtest_hypercube SOURCES t8_gtest_main.cxx t8_cmesh/t8_gtest_hypercube.cxx ) -add_t8_test( NAME t8_gtest_cmesh_readmshfile SOURCES t8_gtest_main.cxx t8_cmesh/t8_gtest_cmesh_readmshfile.cxx ) -add_t8_test( NAME t8_gtest_cmesh_copy SOURCES t8_gtest_main.cxx t8_cmesh/t8_gtest_cmesh_copy.cxx ) -add_t8_test( NAME t8_gtest_cmesh_face_is_boundary SOURCES t8_gtest_main.cxx t8_cmesh/t8_gtest_cmesh_face_is_boundary.cxx ) -add_t8_test( NAME t8_gtest_cmesh_partition SOURCES t8_gtest_main.cxx t8_cmesh/t8_gtest_cmesh_partition.cxx ) -add_t8_test( NAME t8_gtest_cmesh_set_partition_offsets SOURCES t8_gtest_main.cxx t8_cmesh/t8_gtest_cmesh_set_partition_offsets.cxx ) -add_t8_test( NAME t8_gtest_cmesh_set_join_by_vertices SOURCES t8_gtest_main.cxx t8_cmesh/t8_gtest_cmesh_set_join_by_vertices.cxx ) -add_t8_test( NAME t8_gtest_cmesh_add_attributes_when_derive SOURCES t8_gtest_main.cxx t8_cmesh/t8_gtest_cmesh_add_attributes_when_derive.cxx ) -add_t8_test( NAME t8_gtest_cmesh_tree_vertices_negative_volume SOURCES t8_gtest_main.cxx t8_cmesh/t8_gtest_cmesh_tree_vertices_negative_volume.cxx ) +add_t8_test( NAME t8_gtest_hypercube_parallel SOURCES t8_gtest_main.cxx t8_cmesh/t8_gtest_hypercube.cxx ) +add_t8_test( NAME t8_gtest_cmesh_readmshfile_parallel SOURCES t8_gtest_main.cxx t8_cmesh/t8_gtest_cmesh_readmshfile.cxx ) +add_t8_test( NAME t8_gtest_cmesh_copy_parallel SOURCES t8_gtest_main.cxx t8_cmesh/t8_gtest_cmesh_copy.cxx ) +add_t8_test( NAME t8_gtest_cmesh_face_is_boundary_parallel SOURCES t8_gtest_main.cxx t8_cmesh/t8_gtest_cmesh_face_is_boundary.cxx ) +add_t8_test( NAME t8_gtest_cmesh_partition_parallel SOURCES t8_gtest_main.cxx t8_cmesh/t8_gtest_cmesh_partition.cxx ) +add_t8_test( NAME t8_gtest_cmesh_set_partition_offsets_parallel SOURCES t8_gtest_main.cxx t8_cmesh/t8_gtest_cmesh_set_partition_offsets.cxx ) +add_t8_test( NAME t8_gtest_cmesh_set_join_by_vertices_serial SOURCES t8_gtest_main.cxx t8_cmesh/t8_gtest_cmesh_set_join_by_vertices.cxx ) +add_t8_test( NAME t8_gtest_cmesh_add_attributes_when_derive_parallel SOURCES t8_gtest_main.cxx t8_cmesh/t8_gtest_cmesh_add_attributes_when_derive.cxx ) +add_t8_test( NAME t8_gtest_cmesh_tree_vertices_negative_volume_parallel SOURCES t8_gtest_main.cxx t8_cmesh/t8_gtest_cmesh_tree_vertices_negative_volume.cxx ) -add_t8_test( NAME t8_gtest_multiple_attributes SOURCES t8_gtest_main.cxx t8_cmesh/t8_gtest_multiple_attributes.cxx ) -add_t8_test( NAME t8_gtest_attribute_gloidx_array SOURCES t8_gtest_main.cxx t8_cmesh/t8_gtest_attribute_gloidx_array.cxx ) +add_t8_test( NAME t8_gtest_multiple_attributes_parallel SOURCES t8_gtest_main.cxx t8_cmesh/t8_gtest_multiple_attributes.cxx ) +add_t8_test( NAME t8_gtest_attribute_gloidx_array_parallel SOURCES t8_gtest_main.cxx t8_cmesh/t8_gtest_attribute_gloidx_array.cxx ) -add_t8_test( NAME t8_gtest_shmem SOURCES t8_gtest_main.cxx t8_data/t8_gtest_shmem.cxx ) +add_t8_test( NAME t8_gtest_shmem_parallel SOURCES t8_gtest_main.cxx t8_data/t8_gtest_shmem.cxx ) add_t8_test( NAME t8_gtest_element_volume_serial SOURCES t8_gtest_main.cxx t8_forest/t8_gtest_element_volume.cxx ) -add_t8_test( NAME t8_gtest_search SOURCES t8_gtest_main.cxx t8_forest/t8_gtest_search.cxx ) -add_t8_test( NAME t8_gtest_half_neighbors SOURCES t8_gtest_main.cxx t8_forest/t8_gtest_half_neighbors.cxx ) -add_t8_test( NAME t8_gtest_find_owner SOURCES t8_gtest_main.cxx t8_forest/t8_gtest_find_owner.cxx ) -add_t8_test( NAME t8_gtest_user_data SOURCES t8_gtest_main.cxx t8_forest/t8_gtest_user_data.cxx ) -add_t8_test( NAME t8_gtest_transform SOURCES t8_gtest_main.cxx t8_forest/t8_gtest_transform.cxx ) -add_t8_test( NAME t8_gtest_ghost_exchange SOURCES t8_gtest_main.cxx t8_forest/t8_gtest_ghost_exchange.cxx ) -add_t8_test( NAME t8_gtest_ghost_delete SOURCES t8_gtest_main.cxx t8_forest/t8_gtest_ghost_delete.cxx ) -add_t8_test( NAME t8_gtest_ghost_and_owner SOURCES t8_gtest_main.cxx t8_forest/t8_gtest_ghost_and_owner.cxx ) -add_t8_test( NAME t8_gtest_balance SOURCES t8_gtest_main.cxx t8_forest/t8_gtest_balance.cxx ) -add_t8_test( NAME t8_gtest_forest_commit SOURCES t8_gtest_main.cxx t8_forest/t8_gtest_forest_commit.cxx ) -add_t8_test( NAME t8_gtest_forest_face_normal SOURCES t8_gtest_main.cxx t8_forest/t8_gtest_forest_face_normal.cxx ) -add_t8_test( NAME t8_gtest_element_is_leaf SOURCES t8_gtest_main.cxx t8_forest/t8_gtest_element_is_leaf.cxx ) -add_t8_test( NAME t8_gtest_partition_data SOURCES t8_gtest_main.cxx t8_forest/t8_gtest_partition_data.cxx ) +add_t8_test( NAME t8_gtest_search_parallel SOURCES t8_gtest_main.cxx t8_forest/t8_gtest_search.cxx ) +add_t8_test( NAME t8_gtest_half_neighbors_parallel SOURCES t8_gtest_main.cxx t8_forest/t8_gtest_half_neighbors.cxx ) +add_t8_test( NAME t8_gtest_find_owner_parallel SOURCES t8_gtest_main.cxx t8_forest/t8_gtest_find_owner.cxx ) +add_t8_test( NAME t8_gtest_user_data_parallel SOURCES t8_gtest_main.cxx t8_forest/t8_gtest_user_data.cxx ) +add_t8_test( NAME t8_gtest_transform_parallel SOURCES t8_gtest_main.cxx t8_forest/t8_gtest_transform.cxx ) +add_t8_test( NAME t8_gtest_ghost_exchange_parallel SOURCES t8_gtest_main.cxx t8_forest/t8_gtest_ghost_exchange.cxx ) +add_t8_test( NAME t8_gtest_ghost_delete_parallel SOURCES t8_gtest_main.cxx t8_forest/t8_gtest_ghost_delete.cxx ) +add_t8_test( NAME t8_gtest_ghost_and_owner_parallel SOURCES t8_gtest_main.cxx t8_forest/t8_gtest_ghost_and_owner.cxx ) +add_t8_test( NAME t8_gtest_balance_parallel SOURCES t8_gtest_main.cxx t8_forest/t8_gtest_balance.cxx ) +add_t8_test( NAME t8_gtest_forest_commit_parallel SOURCES t8_gtest_main.cxx t8_forest/t8_gtest_forest_commit.cxx ) +add_t8_test( NAME t8_gtest_forest_face_normal_parallel SOURCES t8_gtest_main.cxx t8_forest/t8_gtest_forest_face_normal.cxx ) +add_t8_test( NAME t8_gtest_element_is_leaf_parallel SOURCES t8_gtest_main.cxx t8_forest/t8_gtest_element_is_leaf.cxx ) +add_t8_test( NAME t8_gtest_partition_data_parallel SOURCES t8_gtest_main.cxx t8_forest/t8_gtest_partition_data.cxx ) -add_t8_test( NAME t8_gtest_permute_hole SOURCES t8_gtest_main.cxx t8_forest_incomplete/t8_gtest_permute_hole.cxx ) -add_t8_test( NAME t8_gtest_recursive SOURCES t8_gtest_main.cxx t8_forest_incomplete/t8_gtest_recursive.cxx ) -add_t8_test( NAME t8_gtest_iterate_replace SOURCES t8_gtest_main.cxx t8_forest_incomplete/t8_gtest_iterate_replace.cxx ) -add_t8_test( NAME t8_gtest_empty_local_tree SOURCES t8_gtest_main.cxx t8_forest_incomplete/t8_gtest_empty_local_tree.cxx ) -add_t8_test( NAME t8_gtest_empty_global_tree SOURCES t8_gtest_main.cxx t8_forest_incomplete/t8_gtest_empty_global_tree.cxx ) +add_t8_test( NAME t8_gtest_permute_hole_serial SOURCES t8_gtest_main.cxx t8_forest_incomplete/t8_gtest_permute_hole.cxx ) +add_t8_test( NAME t8_gtest_recursive_serial SOURCES t8_gtest_main.cxx t8_forest_incomplete/t8_gtest_recursive.cxx ) +add_t8_test( NAME t8_gtest_iterate_replace_serial SOURCES t8_gtest_main.cxx t8_forest_incomplete/t8_gtest_iterate_replace.cxx ) +add_t8_test( NAME t8_gtest_empty_local_tree_parallel SOURCES t8_gtest_main.cxx t8_forest_incomplete/t8_gtest_empty_local_tree.cxx ) +add_t8_test( NAME t8_gtest_empty_global_tree_parallel SOURCES t8_gtest_main.cxx t8_forest_incomplete/t8_gtest_empty_global_tree.cxx ) add_t8_test( NAME t8_gtest_geometry_cad_serial SOURCES t8_gtest_main.cxx t8_geometry/t8_geometry_implementations/t8_gtest_geometry_cad.cxx ) add_t8_test( NAME t8_gtest_geometry_linear_serial SOURCES t8_gtest_main.cxx t8_geometry/t8_geometry_implementations/t8_gtest_geometry_linear.cxx ) add_t8_test( NAME t8_gtest_geometry_lagrange_serial SOURCES t8_gtest_main.cxx t8_geometry/t8_geometry_implementations/t8_gtest_geometry_lagrange.cxx ) add_t8_test( NAME t8_gtest_geometry_triangular_interpolation_serial SOURCES t8_gtest_main.cxx t8_geometry/t8_gtest_geometry_triangular_interpolation.cxx ) -add_t8_test( NAME t8_gtest_geometry_handling SOURCES t8_gtest_main.cxx t8_geometry/t8_gtest_geometry_handling.cxx ) +add_t8_test( NAME t8_gtest_geometry_handling_parallel SOURCES t8_gtest_main.cxx t8_geometry/t8_gtest_geometry_handling.cxx ) add_t8_test( NAME t8_gtest_point_inside_serial SOURCES t8_gtest_main.cxx t8_geometry/t8_gtest_point_inside.cxx ) -add_t8_test( NAME t8_gtest_vtk_reader SOURCES t8_gtest_main.cxx t8_IO/t8_gtest_vtk_reader.cxx ) -add_t8_test( NAME t8_gtest_vtk_writer SOURCES t8_gtest_main.cxx t8_IO/t8_gtest_vtk_writer.cxx ) +add_t8_test( NAME t8_gtest_vtk_reader_parallel SOURCES t8_gtest_main.cxx t8_IO/t8_gtest_vtk_reader.cxx ) +add_t8_test( NAME t8_gtest_vtk_writer_parallel SOURCES t8_gtest_main.cxx t8_IO/t8_gtest_vtk_writer.cxx ) add_t8_test( NAME t8_gtest_nca_serial SOURCES t8_gtest_main.cxx t8_schemes/t8_gtest_nca.cxx ) add_t8_test( NAME t8_gtest_pyra_connectivity_serial SOURCES t8_gtest_main.cxx t8_schemes/t8_gtest_pyra_connectivity.cxx ) From 072f0f287e01f0b00b2a5cac8de221a3db734c4d Mon Sep 17 00:00:00 2001 From: David Knapp Date: Tue, 27 Aug 2024 10:52:23 +0200 Subject: [PATCH 080/114] split CI testrun in a serial and a parallel run. For the serial tests run ctest -j 4 --- .github/workflows/tests_cmake_t8code.yml | 6 ++++-- .github/workflows/tests_cmake_t8code_linkage.yml | 12 ++++++++---- test/CMakeLists.txt | 6 +++--- 3 files changed, 15 insertions(+), 9 deletions(-) diff --git a/.github/workflows/tests_cmake_t8code.yml b/.github/workflows/tests_cmake_t8code.yml index 5f6e45ade8..13f62ba72b 100644 --- a/.github/workflows/tests_cmake_t8code.yml +++ b/.github/workflows/tests_cmake_t8code.yml @@ -102,8 +102,10 @@ jobs: run: cd build && ninja $MAKEFLAGS - name: ninja install run: cd build && ninja install $MAKEFLAGS - - name: ninja test - run: cd build && ninja test + - name: serial tests + run: cd build && ctest -j4 -R _serial + - name: parallel tests + run: cd build && ctest -R _parallel - name: OnFailUploadLog if: failure() uses: actions/upload-artifact@v4 diff --git a/.github/workflows/tests_cmake_t8code_linkage.yml b/.github/workflows/tests_cmake_t8code_linkage.yml index df83c47b97..4782bd23a5 100644 --- a/.github/workflows/tests_cmake_t8code_linkage.yml +++ b/.github/workflows/tests_cmake_t8code_linkage.yml @@ -126,8 +126,10 @@ jobs: run: cd build_occ && ninja $MAKEFLAGS - name: ninja install run: cd build_occ && ninja install $MAKEFLAGS - - name: ninja test - run: cd build_occ && ninja test + - name: serial test + run: cd build_occ && ctest -j4 -R _serial + - name: parallel test + run: cd build_occ && ctest -R _parallel - name: OnFailUploadLog if: failure() uses: actions/upload-artifact@v4 @@ -151,8 +153,10 @@ jobs: run: cd build_vtk && ninja $MAKEFLAGS - name: ninja install run: cd build_vtk && ninja install $MAKEFLAGS - - name: ninja test - run: cd build_vtk && ninja test + - name: serial test + run: cd build_vtk && ctest -j4 -R _serial + - name: parallel test + run: cd build_vtk && ctest -R _parallel - name: OnFailUploadLog if: failure() uses: actions/upload-artifact@v4 diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index d6a3253c18..b4b54bbc47 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -14,13 +14,13 @@ function( add_t8_test ) # If MPI is enabled, and no custom test command is provided, use mpirun -np 4 as the default command. # If MPI is not enabled, use the custom test command as is. if ( T8CODE_ENABLE_MPI ) - if (NAME MATCHES "_serial") - separate_arguments(T8CODE_TEST_COMMAND_LIST "mpirun -np 1") + if (${ADD_T8_TEST_NAME} MATCHES "_serial") + separate_arguments(T8CODE_TEST_COMMAND_LIST NATIVE_COMMAND "mpirun -np 1") elseif ( T8CODE_CUSTOM_TEST_COMMAND STREQUAL "" ) separate_arguments (T8CODE_TEST_COMMAND_LIST NATIVE_COMMAND "mpirun -np 4") else ( T8CODE_CUSTOM_TEST_COMMAND STREQUAL "" ) separate_arguments (T8CODE_TEST_COMMAND_LIST NATIVE_COMMAND ${T8CODE_CUSTOM_TEST_COMMAND}) - endif ( T8CODE_CUSTOM_TEST_COMMAND STREQUAL "" ) + endif () else( T8CODE_ENABLE_MPI ) separate_arguments (T8CODE_TEST_COMMAND_LIST NATIVE_COMMAND ${T8CODE_CUSTOM_TEST_COMMAND}) endif ( T8CODE_ENABLE_MPI ) From 3fb4ddbeae0b1f5c37cf466c82650bda7fe8b827 Mon Sep 17 00:00:00 2001 From: David Knapp Date: Tue, 27 Aug 2024 10:58:40 +0200 Subject: [PATCH 081/114] Add missing test-split --- .github/workflows/tests_cmake_t8code_linkage.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/tests_cmake_t8code_linkage.yml b/.github/workflows/tests_cmake_t8code_linkage.yml index 4782bd23a5..d1ee6a453e 100644 --- a/.github/workflows/tests_cmake_t8code_linkage.yml +++ b/.github/workflows/tests_cmake_t8code_linkage.yml @@ -101,8 +101,10 @@ jobs: run: cd build_netcdf && ninja $MAKEFLAGS - name: ninja install run: cd build_netcdf && ninja install $MAKEFLAGS - - name: ninja test - run: cd build_netcdf && ninja test + - name: serial test + run: cd build_netcdf && ctest -j4 -R _serial + - name: parallel test + run: cd build_netcdf && ctest -R _parallel - name: OnFailUploadLog if: failure() uses: actions/upload-artifact@v4 From 023e2b6cb27f9bfca0cfd2b99866d53480da7bf1 Mon Sep 17 00:00:00 2001 From: David Knapp Date: Tue, 27 Aug 2024 11:29:28 +0200 Subject: [PATCH 082/114] Apply changes from code review --- .github/workflows/tests_cmake_t8code.yml | 2 +- .github/workflows/tests_cmake_t8code_linkage.yml | 6 +++--- test/CMakeLists.txt | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/tests_cmake_t8code.yml b/.github/workflows/tests_cmake_t8code.yml index 13f62ba72b..1fbafc54d4 100644 --- a/.github/workflows/tests_cmake_t8code.yml +++ b/.github/workflows/tests_cmake_t8code.yml @@ -103,7 +103,7 @@ jobs: - name: ninja install run: cd build && ninja install $MAKEFLAGS - name: serial tests - run: cd build && ctest -j4 -R _serial + run: cd build && ctest $MAKEFLAGS -R _serial - name: parallel tests run: cd build && ctest -R _parallel - name: OnFailUploadLog diff --git a/.github/workflows/tests_cmake_t8code_linkage.yml b/.github/workflows/tests_cmake_t8code_linkage.yml index d1ee6a453e..2b5f5cf97f 100644 --- a/.github/workflows/tests_cmake_t8code_linkage.yml +++ b/.github/workflows/tests_cmake_t8code_linkage.yml @@ -102,7 +102,7 @@ jobs: - name: ninja install run: cd build_netcdf && ninja install $MAKEFLAGS - name: serial test - run: cd build_netcdf && ctest -j4 -R _serial + run: cd build_netcdf && ctest $MAKEFLAGS -R _serial - name: parallel test run: cd build_netcdf && ctest -R _parallel - name: OnFailUploadLog @@ -129,7 +129,7 @@ jobs: - name: ninja install run: cd build_occ && ninja install $MAKEFLAGS - name: serial test - run: cd build_occ && ctest -j4 -R _serial + run: cd build_occ && ctest $MAKEFLAGS -R _serial - name: parallel test run: cd build_occ && ctest -R _parallel - name: OnFailUploadLog @@ -156,7 +156,7 @@ jobs: - name: ninja install run: cd build_vtk && ninja install $MAKEFLAGS - name: serial test - run: cd build_vtk && ctest -j4 -R _serial + run: cd build_vtk && ctest $MAKEFLAGS -R _serial - name: parallel test run: cd build_vtk && ctest -R _parallel - name: OnFailUploadLog diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index b4b54bbc47..5997499ce0 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -15,7 +15,7 @@ function( add_t8_test ) # If MPI is not enabled, use the custom test command as is. if ( T8CODE_ENABLE_MPI ) if (${ADD_T8_TEST_NAME} MATCHES "_serial") - separate_arguments(T8CODE_TEST_COMMAND_LIST NATIVE_COMMAND "mpirun -np 1") + separate_arguments(T8CODE_TEST_COMMAND_LIST NATIVE_COMMAND "") elseif ( T8CODE_CUSTOM_TEST_COMMAND STREQUAL "" ) separate_arguments (T8CODE_TEST_COMMAND_LIST NATIVE_COMMAND "mpirun -np 4") else ( T8CODE_CUSTOM_TEST_COMMAND STREQUAL "" ) From 7c395e81acac589cfaf67fa9f5113dba16750e30 Mon Sep 17 00:00:00 2001 From: David Knapp Date: Tue, 27 Aug 2024 12:34:06 +0200 Subject: [PATCH 083/114] Execute half-neighbor test in serial + Indentation --- test/CMakeLists.txt | 74 ++++++++++++++++++++++----------------------- 1 file changed, 37 insertions(+), 37 deletions(-) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 5997499ce0..882798f2f5 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -33,9 +33,9 @@ function( copy_test_file TEST_FILE_NAME ) configure_file(${CMAKE_CURRENT_LIST_DIR}/testfiles/${TEST_FILE_NAME} ${CMAKE_CURRENT_BINARY_DIR}/test/testfiles/${TEST_FILE_NAME} COPYONLY) endfunction() -add_t8_test( NAME t8_gtest_cmesh_bcast_serial SOURCES t8_gtest_main.cxx t8_cmesh/t8_gtest_bcast.cxx ) -add_t8_test( NAME t8_gtest_eclass_serial SOURCES t8_gtest_main.cxx t8_gtest_eclass.cxx ) -add_t8_test( NAME t8_gtest_vec_serial SOURCES t8_gtest_main.cxx t8_gtest_vec.cxx ) +add_t8_test( NAME t8_gtest_cmesh_bcast_serial SOURCES t8_gtest_main.cxx t8_cmesh/t8_gtest_bcast.cxx ) +add_t8_test( NAME t8_gtest_eclass_serial SOURCES t8_gtest_main.cxx t8_gtest_eclass.cxx ) +add_t8_test( NAME t8_gtest_vec_serial SOURCES t8_gtest_main.cxx t8_gtest_vec.cxx ) add_t8_test( NAME t8_gtest_mat_serial SOURCES t8_gtest_main.cxx t8_gtest_mat.cxx ) add_t8_test( NAME t8_gtest_refcount_serial SOURCES t8_gtest_main.cxx t8_gtest_refcount.cxx ) add_t8_test( NAME t8_gtest_occ_linkage_serial SOURCES t8_gtest_main.cxx t8_gtest_occ_linkage.cxx ) @@ -44,48 +44,48 @@ add_t8_test( NAME t8_gtest_basics_serial SOURCES t8_gtest_main.cxx t8 add_t8_test( NAME t8_gtest_netcdf_linkage_serial SOURCES t8_gtest_main.cxx t8_gtest_netcdf_linkage.cxx ) add_t8_test( NAME t8_gtest_vtk_linkage_serial SOURCES t8_gtest_main.cxx t8_gtest_vtk_linkage.cxx ) -add_t8_test( NAME t8_gtest_hypercube_parallel SOURCES t8_gtest_main.cxx t8_cmesh/t8_gtest_hypercube.cxx ) -add_t8_test( NAME t8_gtest_cmesh_readmshfile_parallel SOURCES t8_gtest_main.cxx t8_cmesh/t8_gtest_cmesh_readmshfile.cxx ) -add_t8_test( NAME t8_gtest_cmesh_copy_parallel SOURCES t8_gtest_main.cxx t8_cmesh/t8_gtest_cmesh_copy.cxx ) -add_t8_test( NAME t8_gtest_cmesh_face_is_boundary_parallel SOURCES t8_gtest_main.cxx t8_cmesh/t8_gtest_cmesh_face_is_boundary.cxx ) -add_t8_test( NAME t8_gtest_cmesh_partition_parallel SOURCES t8_gtest_main.cxx t8_cmesh/t8_gtest_cmesh_partition.cxx ) -add_t8_test( NAME t8_gtest_cmesh_set_partition_offsets_parallel SOURCES t8_gtest_main.cxx t8_cmesh/t8_gtest_cmesh_set_partition_offsets.cxx ) +add_t8_test( NAME t8_gtest_hypercube_parallel SOURCES t8_gtest_main.cxx t8_cmesh/t8_gtest_hypercube.cxx ) +add_t8_test( NAME t8_gtest_cmesh_readmshfile_parallel SOURCES t8_gtest_main.cxx t8_cmesh/t8_gtest_cmesh_readmshfile.cxx ) +add_t8_test( NAME t8_gtest_cmesh_copy_parallel SOURCES t8_gtest_main.cxx t8_cmesh/t8_gtest_cmesh_copy.cxx ) +add_t8_test( NAME t8_gtest_cmesh_face_is_boundary_parallel SOURCES t8_gtest_main.cxx t8_cmesh/t8_gtest_cmesh_face_is_boundary.cxx ) +add_t8_test( NAME t8_gtest_cmesh_partition_parallel SOURCES t8_gtest_main.cxx t8_cmesh/t8_gtest_cmesh_partition.cxx ) +add_t8_test( NAME t8_gtest_cmesh_set_partition_offsets_parallel SOURCES t8_gtest_main.cxx t8_cmesh/t8_gtest_cmesh_set_partition_offsets.cxx ) add_t8_test( NAME t8_gtest_cmesh_set_join_by_vertices_serial SOURCES t8_gtest_main.cxx t8_cmesh/t8_gtest_cmesh_set_join_by_vertices.cxx ) -add_t8_test( NAME t8_gtest_cmesh_add_attributes_when_derive_parallel SOURCES t8_gtest_main.cxx t8_cmesh/t8_gtest_cmesh_add_attributes_when_derive.cxx ) -add_t8_test( NAME t8_gtest_cmesh_tree_vertices_negative_volume_parallel SOURCES t8_gtest_main.cxx t8_cmesh/t8_gtest_cmesh_tree_vertices_negative_volume.cxx ) +add_t8_test( NAME t8_gtest_cmesh_add_attributes_when_derive_parallel SOURCES t8_gtest_main.cxx t8_cmesh/t8_gtest_cmesh_add_attributes_when_derive.cxx ) +add_t8_test( NAME t8_gtest_cmesh_tree_vertices_negative_volume_parallel SOURCES t8_gtest_main.cxx t8_cmesh/t8_gtest_cmesh_tree_vertices_negative_volume.cxx ) -add_t8_test( NAME t8_gtest_multiple_attributes_parallel SOURCES t8_gtest_main.cxx t8_cmesh/t8_gtest_multiple_attributes.cxx ) -add_t8_test( NAME t8_gtest_attribute_gloidx_array_parallel SOURCES t8_gtest_main.cxx t8_cmesh/t8_gtest_attribute_gloidx_array.cxx ) +add_t8_test( NAME t8_gtest_multiple_attributes_parallel SOURCES t8_gtest_main.cxx t8_cmesh/t8_gtest_multiple_attributes.cxx ) +add_t8_test( NAME t8_gtest_attribute_gloidx_array_parallel SOURCES t8_gtest_main.cxx t8_cmesh/t8_gtest_attribute_gloidx_array.cxx ) add_t8_test( NAME t8_gtest_shmem_parallel SOURCES t8_gtest_main.cxx t8_data/t8_gtest_shmem.cxx ) add_t8_test( NAME t8_gtest_element_volume_serial SOURCES t8_gtest_main.cxx t8_forest/t8_gtest_element_volume.cxx ) -add_t8_test( NAME t8_gtest_search_parallel SOURCES t8_gtest_main.cxx t8_forest/t8_gtest_search.cxx ) -add_t8_test( NAME t8_gtest_half_neighbors_parallel SOURCES t8_gtest_main.cxx t8_forest/t8_gtest_half_neighbors.cxx ) -add_t8_test( NAME t8_gtest_find_owner_parallel SOURCES t8_gtest_main.cxx t8_forest/t8_gtest_find_owner.cxx ) -add_t8_test( NAME t8_gtest_user_data_parallel SOURCES t8_gtest_main.cxx t8_forest/t8_gtest_user_data.cxx ) -add_t8_test( NAME t8_gtest_transform_parallel SOURCES t8_gtest_main.cxx t8_forest/t8_gtest_transform.cxx ) -add_t8_test( NAME t8_gtest_ghost_exchange_parallel SOURCES t8_gtest_main.cxx t8_forest/t8_gtest_ghost_exchange.cxx ) -add_t8_test( NAME t8_gtest_ghost_delete_parallel SOURCES t8_gtest_main.cxx t8_forest/t8_gtest_ghost_delete.cxx ) -add_t8_test( NAME t8_gtest_ghost_and_owner_parallel SOURCES t8_gtest_main.cxx t8_forest/t8_gtest_ghost_and_owner.cxx ) -add_t8_test( NAME t8_gtest_balance_parallel SOURCES t8_gtest_main.cxx t8_forest/t8_gtest_balance.cxx ) -add_t8_test( NAME t8_gtest_forest_commit_parallel SOURCES t8_gtest_main.cxx t8_forest/t8_gtest_forest_commit.cxx ) -add_t8_test( NAME t8_gtest_forest_face_normal_parallel SOURCES t8_gtest_main.cxx t8_forest/t8_gtest_forest_face_normal.cxx ) -add_t8_test( NAME t8_gtest_element_is_leaf_parallel SOURCES t8_gtest_main.cxx t8_forest/t8_gtest_element_is_leaf.cxx ) -add_t8_test( NAME t8_gtest_partition_data_parallel SOURCES t8_gtest_main.cxx t8_forest/t8_gtest_partition_data.cxx ) +add_t8_test( NAME t8_gtest_search_parallel SOURCES t8_gtest_main.cxx t8_forest/t8_gtest_search.cxx ) +add_t8_test( NAME t8_gtest_half_neighbors_serial SOURCES t8_gtest_main.cxx t8_forest/t8_gtest_half_neighbors.cxx ) +add_t8_test( NAME t8_gtest_find_owner_parallel SOURCES t8_gtest_main.cxx t8_forest/t8_gtest_find_owner.cxx ) +add_t8_test( NAME t8_gtest_user_data_parallel SOURCES t8_gtest_main.cxx t8_forest/t8_gtest_user_data.cxx ) +add_t8_test( NAME t8_gtest_transform_parallel SOURCES t8_gtest_main.cxx t8_forest/t8_gtest_transform.cxx ) +add_t8_test( NAME t8_gtest_ghost_exchange_parallel SOURCES t8_gtest_main.cxx t8_forest/t8_gtest_ghost_exchange.cxx ) +add_t8_test( NAME t8_gtest_ghost_delete_parallel SOURCES t8_gtest_main.cxx t8_forest/t8_gtest_ghost_delete.cxx ) +add_t8_test( NAME t8_gtest_ghost_and_owner_parallel SOURCES t8_gtest_main.cxx t8_forest/t8_gtest_ghost_and_owner.cxx ) +add_t8_test( NAME t8_gtest_balance_parallel SOURCES t8_gtest_main.cxx t8_forest/t8_gtest_balance.cxx ) +add_t8_test( NAME t8_gtest_forest_commit_parallel SOURCES t8_gtest_main.cxx t8_forest/t8_gtest_forest_commit.cxx ) +add_t8_test( NAME t8_gtest_forest_face_normal_parallel SOURCES t8_gtest_main.cxx t8_forest/t8_gtest_forest_face_normal.cxx ) +add_t8_test( NAME t8_gtest_element_is_leaf_parallel SOURCES t8_gtest_main.cxx t8_forest/t8_gtest_element_is_leaf.cxx ) +add_t8_test( NAME t8_gtest_partition_data_parallel SOURCES t8_gtest_main.cxx t8_forest/t8_gtest_partition_data.cxx ) -add_t8_test( NAME t8_gtest_permute_hole_serial SOURCES t8_gtest_main.cxx t8_forest_incomplete/t8_gtest_permute_hole.cxx ) -add_t8_test( NAME t8_gtest_recursive_serial SOURCES t8_gtest_main.cxx t8_forest_incomplete/t8_gtest_recursive.cxx ) -add_t8_test( NAME t8_gtest_iterate_replace_serial SOURCES t8_gtest_main.cxx t8_forest_incomplete/t8_gtest_iterate_replace.cxx ) -add_t8_test( NAME t8_gtest_empty_local_tree_parallel SOURCES t8_gtest_main.cxx t8_forest_incomplete/t8_gtest_empty_local_tree.cxx ) -add_t8_test( NAME t8_gtest_empty_global_tree_parallel SOURCES t8_gtest_main.cxx t8_forest_incomplete/t8_gtest_empty_global_tree.cxx ) +add_t8_test( NAME t8_gtest_permute_hole_serial SOURCES t8_gtest_main.cxx t8_forest_incomplete/t8_gtest_permute_hole.cxx ) +add_t8_test( NAME t8_gtest_recursive_serial SOURCES t8_gtest_main.cxx t8_forest_incomplete/t8_gtest_recursive.cxx ) +add_t8_test( NAME t8_gtest_iterate_replace_serial SOURCES t8_gtest_main.cxx t8_forest_incomplete/t8_gtest_iterate_replace.cxx ) +add_t8_test( NAME t8_gtest_empty_local_tree_parallel SOURCES t8_gtest_main.cxx t8_forest_incomplete/t8_gtest_empty_local_tree.cxx ) +add_t8_test( NAME t8_gtest_empty_global_tree_parallel SOURCES t8_gtest_main.cxx t8_forest_incomplete/t8_gtest_empty_global_tree.cxx ) -add_t8_test( NAME t8_gtest_geometry_cad_serial SOURCES t8_gtest_main.cxx t8_geometry/t8_geometry_implementations/t8_gtest_geometry_cad.cxx ) -add_t8_test( NAME t8_gtest_geometry_linear_serial SOURCES t8_gtest_main.cxx t8_geometry/t8_geometry_implementations/t8_gtest_geometry_linear.cxx ) -add_t8_test( NAME t8_gtest_geometry_lagrange_serial SOURCES t8_gtest_main.cxx t8_geometry/t8_geometry_implementations/t8_gtest_geometry_lagrange.cxx ) -add_t8_test( NAME t8_gtest_geometry_triangular_interpolation_serial SOURCES t8_gtest_main.cxx t8_geometry/t8_gtest_geometry_triangular_interpolation.cxx ) -add_t8_test( NAME t8_gtest_geometry_handling_parallel SOURCES t8_gtest_main.cxx t8_geometry/t8_gtest_geometry_handling.cxx ) -add_t8_test( NAME t8_gtest_point_inside_serial SOURCES t8_gtest_main.cxx t8_geometry/t8_gtest_point_inside.cxx ) +add_t8_test( NAME t8_gtest_geometry_cad_serial SOURCES t8_gtest_main.cxx t8_geometry/t8_geometry_implementations/t8_gtest_geometry_cad.cxx ) +add_t8_test( NAME t8_gtest_geometry_linear_serial SOURCES t8_gtest_main.cxx t8_geometry/t8_geometry_implementations/t8_gtest_geometry_linear.cxx ) +add_t8_test( NAME t8_gtest_geometry_lagrange_serial SOURCES t8_gtest_main.cxx t8_geometry/t8_geometry_implementations/t8_gtest_geometry_lagrange.cxx ) +add_t8_test( NAME t8_gtest_geometry_triangular_interpolation_serial SOURCES t8_gtest_main.cxx t8_geometry/t8_gtest_geometry_triangular_interpolation.cxx ) +add_t8_test( NAME t8_gtest_geometry_handling_parallel SOURCES t8_gtest_main.cxx t8_geometry/t8_gtest_geometry_handling.cxx ) +add_t8_test( NAME t8_gtest_point_inside_serial SOURCES t8_gtest_main.cxx t8_geometry/t8_gtest_point_inside.cxx ) add_t8_test( NAME t8_gtest_vtk_reader_parallel SOURCES t8_gtest_main.cxx t8_IO/t8_gtest_vtk_reader.cxx ) add_t8_test( NAME t8_gtest_vtk_writer_parallel SOURCES t8_gtest_main.cxx t8_IO/t8_gtest_vtk_writer.cxx ) From 5840f5b5c7752babf6771eaed8ce99b634cffd4f Mon Sep 17 00:00:00 2001 From: David Knapp Date: Tue, 27 Aug 2024 12:39:38 +0200 Subject: [PATCH 084/114] Apply suggestions from code review Co-authored-by: Sandro Elsweijer <49643115+sandro-elsweijer@users.noreply.github.com> --- test/CMakeLists.txt | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 5997499ce0..7ce328bcc4 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -33,7 +33,7 @@ function( copy_test_file TEST_FILE_NAME ) configure_file(${CMAKE_CURRENT_LIST_DIR}/testfiles/${TEST_FILE_NAME} ${CMAKE_CURRENT_BINARY_DIR}/test/testfiles/${TEST_FILE_NAME} COPYONLY) endfunction() -add_t8_test( NAME t8_gtest_cmesh_bcast_serial SOURCES t8_gtest_main.cxx t8_cmesh/t8_gtest_bcast.cxx ) +add_t8_test( NAME t8_gtest_cmesh_bcast_parallel SOURCES t8_gtest_main.cxx t8_cmesh/t8_gtest_bcast.cxx ) add_t8_test( NAME t8_gtest_eclass_serial SOURCES t8_gtest_main.cxx t8_gtest_eclass.cxx ) add_t8_test( NAME t8_gtest_vec_serial SOURCES t8_gtest_main.cxx t8_gtest_vec.cxx ) add_t8_test( NAME t8_gtest_mat_serial SOURCES t8_gtest_main.cxx t8_gtest_mat.cxx ) @@ -45,17 +45,17 @@ add_t8_test( NAME t8_gtest_netcdf_linkage_serial SOURCES t8_gtest_main.cxx t8 add_t8_test( NAME t8_gtest_vtk_linkage_serial SOURCES t8_gtest_main.cxx t8_gtest_vtk_linkage.cxx ) add_t8_test( NAME t8_gtest_hypercube_parallel SOURCES t8_gtest_main.cxx t8_cmesh/t8_gtest_hypercube.cxx ) -add_t8_test( NAME t8_gtest_cmesh_readmshfile_parallel SOURCES t8_gtest_main.cxx t8_cmesh/t8_gtest_cmesh_readmshfile.cxx ) -add_t8_test( NAME t8_gtest_cmesh_copy_parallel SOURCES t8_gtest_main.cxx t8_cmesh/t8_gtest_cmesh_copy.cxx ) +add_t8_test( NAME t8_gtest_cmesh_readmshfile_serial SOURCES t8_gtest_main.cxx t8_cmesh/t8_gtest_cmesh_readmshfile.cxx ) +add_t8_test( NAME t8_gtest_cmesh_copy_serial SOURCES t8_gtest_main.cxx t8_cmesh/t8_gtest_cmesh_copy.cxx ) add_t8_test( NAME t8_gtest_cmesh_face_is_boundary_parallel SOURCES t8_gtest_main.cxx t8_cmesh/t8_gtest_cmesh_face_is_boundary.cxx ) add_t8_test( NAME t8_gtest_cmesh_partition_parallel SOURCES t8_gtest_main.cxx t8_cmesh/t8_gtest_cmesh_partition.cxx ) add_t8_test( NAME t8_gtest_cmesh_set_partition_offsets_parallel SOURCES t8_gtest_main.cxx t8_cmesh/t8_gtest_cmesh_set_partition_offsets.cxx ) add_t8_test( NAME t8_gtest_cmesh_set_join_by_vertices_serial SOURCES t8_gtest_main.cxx t8_cmesh/t8_gtest_cmesh_set_join_by_vertices.cxx ) add_t8_test( NAME t8_gtest_cmesh_add_attributes_when_derive_parallel SOURCES t8_gtest_main.cxx t8_cmesh/t8_gtest_cmesh_add_attributes_when_derive.cxx ) -add_t8_test( NAME t8_gtest_cmesh_tree_vertices_negative_volume_parallel SOURCES t8_gtest_main.cxx t8_cmesh/t8_gtest_cmesh_tree_vertices_negative_volume.cxx ) +add_t8_test( NAME t8_gtest_cmesh_tree_vertices_negative_volume_serial SOURCES t8_gtest_main.cxx t8_cmesh/t8_gtest_cmesh_tree_vertices_negative_volume.cxx ) add_t8_test( NAME t8_gtest_multiple_attributes_parallel SOURCES t8_gtest_main.cxx t8_cmesh/t8_gtest_multiple_attributes.cxx ) -add_t8_test( NAME t8_gtest_attribute_gloidx_array_parallel SOURCES t8_gtest_main.cxx t8_cmesh/t8_gtest_attribute_gloidx_array.cxx ) +add_t8_test( NAME t8_gtest_attribute_gloidx_array_serial SOURCES t8_gtest_main.cxx t8_cmesh/t8_gtest_attribute_gloidx_array.cxx ) add_t8_test( NAME t8_gtest_shmem_parallel SOURCES t8_gtest_main.cxx t8_data/t8_gtest_shmem.cxx ) @@ -64,13 +64,13 @@ add_t8_test( NAME t8_gtest_search_parallel SOURCES t8_gtest_ add_t8_test( NAME t8_gtest_half_neighbors_parallel SOURCES t8_gtest_main.cxx t8_forest/t8_gtest_half_neighbors.cxx ) add_t8_test( NAME t8_gtest_find_owner_parallel SOURCES t8_gtest_main.cxx t8_forest/t8_gtest_find_owner.cxx ) add_t8_test( NAME t8_gtest_user_data_parallel SOURCES t8_gtest_main.cxx t8_forest/t8_gtest_user_data.cxx ) -add_t8_test( NAME t8_gtest_transform_parallel SOURCES t8_gtest_main.cxx t8_forest/t8_gtest_transform.cxx ) +add_t8_test( NAME t8_gtest_transform_serial SOURCES t8_gtest_main.cxx t8_forest/t8_gtest_transform.cxx ) add_t8_test( NAME t8_gtest_ghost_exchange_parallel SOURCES t8_gtest_main.cxx t8_forest/t8_gtest_ghost_exchange.cxx ) add_t8_test( NAME t8_gtest_ghost_delete_parallel SOURCES t8_gtest_main.cxx t8_forest/t8_gtest_ghost_delete.cxx ) add_t8_test( NAME t8_gtest_ghost_and_owner_parallel SOURCES t8_gtest_main.cxx t8_forest/t8_gtest_ghost_and_owner.cxx ) add_t8_test( NAME t8_gtest_balance_parallel SOURCES t8_gtest_main.cxx t8_forest/t8_gtest_balance.cxx ) add_t8_test( NAME t8_gtest_forest_commit_parallel SOURCES t8_gtest_main.cxx t8_forest/t8_gtest_forest_commit.cxx ) -add_t8_test( NAME t8_gtest_forest_face_normal_parallel SOURCES t8_gtest_main.cxx t8_forest/t8_gtest_forest_face_normal.cxx ) +add_t8_test( NAME t8_gtest_forest_face_normal_serial SOURCES t8_gtest_main.cxx t8_forest/t8_gtest_forest_face_normal.cxx ) add_t8_test( NAME t8_gtest_element_is_leaf_parallel SOURCES t8_gtest_main.cxx t8_forest/t8_gtest_element_is_leaf.cxx ) add_t8_test( NAME t8_gtest_partition_data_parallel SOURCES t8_gtest_main.cxx t8_forest/t8_gtest_partition_data.cxx ) @@ -84,7 +84,7 @@ add_t8_test( NAME t8_gtest_geometry_cad_serial SOURCES t8_gtest_main.cxx add_t8_test( NAME t8_gtest_geometry_linear_serial SOURCES t8_gtest_main.cxx t8_geometry/t8_geometry_implementations/t8_gtest_geometry_linear.cxx ) add_t8_test( NAME t8_gtest_geometry_lagrange_serial SOURCES t8_gtest_main.cxx t8_geometry/t8_geometry_implementations/t8_gtest_geometry_lagrange.cxx ) add_t8_test( NAME t8_gtest_geometry_triangular_interpolation_serial SOURCES t8_gtest_main.cxx t8_geometry/t8_gtest_geometry_triangular_interpolation.cxx ) -add_t8_test( NAME t8_gtest_geometry_handling_parallel SOURCES t8_gtest_main.cxx t8_geometry/t8_gtest_geometry_handling.cxx ) +add_t8_test( NAME t8_gtest_geometry_handling_serial SOURCES t8_gtest_main.cxx t8_geometry/t8_gtest_geometry_handling.cxx ) add_t8_test( NAME t8_gtest_point_inside_serial SOURCES t8_gtest_main.cxx t8_geometry/t8_gtest_point_inside.cxx ) add_t8_test( NAME t8_gtest_vtk_reader_parallel SOURCES t8_gtest_main.cxx t8_IO/t8_gtest_vtk_reader.cxx ) From 4e4eac7c6b054dd2fbf85f6dc61775b428c9761c Mon Sep 17 00:00:00 2001 From: Sandro Elsweijer Date: Tue, 27 Aug 2024 12:41:09 +0200 Subject: [PATCH 085/114] fix typo --- test/t8_cmesh/t8_gtest_hypercube.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/t8_cmesh/t8_gtest_hypercube.cxx b/test/t8_cmesh/t8_gtest_hypercube.cxx index 7062cad8cc..2228263236 100644 --- a/test/t8_cmesh/t8_gtest_hypercube.cxx +++ b/test/t8_cmesh/t8_gtest_hypercube.cxx @@ -63,7 +63,7 @@ TEST_P (cmesh_hypercube_trees, check_cmesh_and_its_trees) ASSERT_EQ (t8_cmesh_get_dimension (cmesh), t8_eclass_to_dimension[eclass]) << "Wrong dimension set for cmesh."; } -/* Use the testing range for eclass with [T8_ECLASS_ZERO, T8_ECLASS_COUNT]. For the generation of the cmesh with or withaout broadcast +/* Use the testing range for eclass with [T8_ECLASS_ZERO, T8_ECLASS_COUNT]. For the generation of the cmesh with or without broadcast * the booleans 0 and 1 are used. Analogue with partition. */ INSTANTIATE_TEST_SUITE_P (t8_gtest_hypercube, cmesh_hypercube_trees, testing::Combine (AllEclasses, testing::Values (0, 1), testing::Values (0, 1))); From 5383a7d55f55a23a57eeaae8b50e46ffe48eaa99 Mon Sep 17 00:00:00 2001 From: Sandro Elsweijer Date: Tue, 27 Aug 2024 12:41:47 +0200 Subject: [PATCH 086/114] adapt epsilon --- test/t8_forest/t8_gtest_element_volume.cxx | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/test/t8_forest/t8_gtest_element_volume.cxx b/test/t8_forest/t8_gtest_element_volume.cxx index 5edc73ea33..a44c990fe1 100644 --- a/test/t8_forest/t8_gtest_element_volume.cxx +++ b/test/t8_forest/t8_gtest_element_volume.cxx @@ -33,7 +33,6 @@ /** * This file tests the volume-computation of elements. */ -#define epsilon 1e-9 /* Construct a forest of a hypercube with volume 1. If the element are refined uniformly * all elements have volume 1/global_num_elements. */ @@ -109,10 +108,10 @@ TEST_P (t8_forest_volume, volume_check) const double volume = t8_forest_element_volume (forest, itree, element); if (eclass == T8_ECLASS_PYRAMID) { const double shape_volume = pyramid_control_volume ((t8_dpyramid_t *) element); - EXPECT_NEAR (volume, shape_volume, epsilon); + EXPECT_NEAR (volume, shape_volume, T8_PRECISION_SQRT_EPS); } else { - EXPECT_NEAR (volume, control_volume, epsilon); + EXPECT_NEAR (volume, control_volume, T8_PRECISION_SQRT_EPS); } } } From c6277b2f7f6e7d54170cb860cd918872e8d565a8 Mon Sep 17 00:00:00 2001 From: Sandro Elsweijer Date: Tue, 27 Aug 2024 12:42:17 +0200 Subject: [PATCH 087/114] typo --- test/t8_forest/t8_gtest_forest_commit.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/t8_forest/t8_gtest_forest_commit.cxx b/test/t8_forest/t8_gtest_forest_commit.cxx index 0fb6be0b67..3ab727f497 100644 --- a/test/t8_forest/t8_gtest_forest_commit.cxx +++ b/test/t8_forest/t8_gtest_forest_commit.cxx @@ -30,7 +30,7 @@ #include "test/t8_cmesh_generator/t8_cmesh_example_sets.hxx" #include -/* In this test, we adapt, balance and partition a uniform forest. +/* In this test we adapt, balance and partition a uniform forest. * We do this in two ways: * 1st All operations are performed in one single call to t8_forest_commit * 2nd Each intermediate step is performed in a separate commit From bdf3b3690976a0491f4e0e85132894cf8736b5f5 Mon Sep 17 00:00:00 2001 From: David Knapp Date: Tue, 27 Aug 2024 13:02:13 +0200 Subject: [PATCH 088/114] Offer two custom commands, one for serial, one for parallel tests --- CMakeLists.txt | 3 ++- test/CMakeLists.txt | 14 +++++++++----- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 53b3cf1387..0b5dfa614e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -29,7 +29,8 @@ option( T8CODE_BUILD_DOCUMENTATION "Build t8code's documentation" OFF ) include(CMakeDependentOption) cmake_dependent_option( T8CODE_BUILD_DOCUMENTATION_SPHINX "Build t8code's documentation using sphinx" OFF "T8CODE_BUILD_DOCUMENTATION" OFF ) -set(T8CODE_CUSTOM_TEST_COMMAND "" CACHE STRING "Define custom test command, e.g.: mpirun -np 8 (overwrites standard mpirun -np 4 if build with mpi)") +set(T8CODE_CUSTOM_PARALLEL_TEST_COMMAND "" CACHE STRING "Define custom command for parallel tests , e.g.: mpirun -np 8 (overwrites standard mpirun -np 4 if build with mpi)") +set(T8CODE_CUSTOM_SERIAL_TEST_COMMAND "" CACHE STRING "Define custom command for serial tests.") # Set a default build type if none was specified set(default_build_type "Release") diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 1e8db308d8..16698f2830 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -15,14 +15,18 @@ function( add_t8_test ) # If MPI is not enabled, use the custom test command as is. if ( T8CODE_ENABLE_MPI ) if (${ADD_T8_TEST_NAME} MATCHES "_serial") - separate_arguments(T8CODE_TEST_COMMAND_LIST NATIVE_COMMAND "") - elseif ( T8CODE_CUSTOM_TEST_COMMAND STREQUAL "" ) + if (T8CODE_CUSTOM_SERIAL_TEST_COMMAND STREQUAL "") + separate_arguments(T8CODE_TEST_COMMAND_LIST NATIVE_COMMAND "") + else (T8CODE_CUSTOM_SERIAL_TEST_COMMAND STREQUAL "") + separate_arguments(T8CODE_TEST_COMMAND_LIST NATIVE_COMMAND ${T8CODE_CUSTOM_SERIAL_TEST_COMMAND}) + endif(T8CODE_CUSTOM_SERIAL_TEST_COMMAND STREQUAL "") + elseif ( T8CODE_CUSTOM_PARALLEL_TEST_COMMAND STREQUAL "" ) separate_arguments (T8CODE_TEST_COMMAND_LIST NATIVE_COMMAND "mpirun -np 4") - else ( T8CODE_CUSTOM_TEST_COMMAND STREQUAL "" ) - separate_arguments (T8CODE_TEST_COMMAND_LIST NATIVE_COMMAND ${T8CODE_CUSTOM_TEST_COMMAND}) + else ( T8CODE_CUSTOM_PARALLEL_TEST_COMMAND STREQUAL "" ) + separate_arguments (T8CODE_TEST_COMMAND_LIST NATIVE_COMMAND ${T8CODE_CUSTOM_PARALLEL_TEST_COMMAND}) endif () else( T8CODE_ENABLE_MPI ) - separate_arguments (T8CODE_TEST_COMMAND_LIST NATIVE_COMMAND ${T8CODE_CUSTOM_TEST_COMMAND}) + separate_arguments (T8CODE_TEST_COMMAND_LIST NATIVE_COMMAND ${T8CODE_CUSTOM_SERIAL_TEST_COMMAND}) endif ( T8CODE_ENABLE_MPI ) add_test( NAME ${ADD_T8_TEST_NAME} COMMAND ${T8CODE_TEST_COMMAND_LIST} ./${ADD_T8_TEST_NAME} ) From 1b501a80733702ba9108cd4821d5255430f0dfe5 Mon Sep 17 00:00:00 2001 From: David Knapp Date: Tue, 27 Aug 2024 13:19:34 +0200 Subject: [PATCH 089/114] Move is_leaf to serial execution --- test/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 16698f2830..c0b22ced9c 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -75,7 +75,7 @@ add_t8_test( NAME t8_gtest_ghost_and_owner_parallel SOURCES t8_gtest_main.cx add_t8_test( NAME t8_gtest_balance_parallel SOURCES t8_gtest_main.cxx t8_forest/t8_gtest_balance.cxx ) add_t8_test( NAME t8_gtest_forest_commit_parallel SOURCES t8_gtest_main.cxx t8_forest/t8_gtest_forest_commit.cxx ) add_t8_test( NAME t8_gtest_forest_face_normal_serial SOURCES t8_gtest_main.cxx t8_forest/t8_gtest_forest_face_normal.cxx ) -add_t8_test( NAME t8_gtest_element_is_leaf_parallel SOURCES t8_gtest_main.cxx t8_forest/t8_gtest_element_is_leaf.cxx ) +add_t8_test( NAME t8_gtest_element_is_leaf_serial SOURCES t8_gtest_main.cxx t8_forest/t8_gtest_element_is_leaf.cxx ) add_t8_test( NAME t8_gtest_partition_data_parallel SOURCES t8_gtest_main.cxx t8_forest/t8_gtest_partition_data.cxx ) add_t8_test( NAME t8_gtest_permute_hole_serial SOURCES t8_gtest_main.cxx t8_forest_incomplete/t8_gtest_permute_hole.cxx ) From 7c279b6910f035140d20900a4a47373d2778e478 Mon Sep 17 00:00:00 2001 From: David Knapp Date: Tue, 27 Aug 2024 13:33:49 +0200 Subject: [PATCH 090/114] update serial execution --- test/CMakeLists.txt | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index c0b22ced9c..ab617943f2 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -15,11 +15,7 @@ function( add_t8_test ) # If MPI is not enabled, use the custom test command as is. if ( T8CODE_ENABLE_MPI ) if (${ADD_T8_TEST_NAME} MATCHES "_serial") - if (T8CODE_CUSTOM_SERIAL_TEST_COMMAND STREQUAL "") - separate_arguments(T8CODE_TEST_COMMAND_LIST NATIVE_COMMAND "") - else (T8CODE_CUSTOM_SERIAL_TEST_COMMAND STREQUAL "") - separate_arguments(T8CODE_TEST_COMMAND_LIST NATIVE_COMMAND ${T8CODE_CUSTOM_SERIAL_TEST_COMMAND}) - endif(T8CODE_CUSTOM_SERIAL_TEST_COMMAND STREQUAL "") + separate_arguments(T8CODE_TEST_COMMAND_LIST NATIVE_COMMAND ${T8CODE_CUSTOM_SERIAL_TEST_COMMAND}) elseif ( T8CODE_CUSTOM_PARALLEL_TEST_COMMAND STREQUAL "" ) separate_arguments (T8CODE_TEST_COMMAND_LIST NATIVE_COMMAND "mpirun -np 4") else ( T8CODE_CUSTOM_PARALLEL_TEST_COMMAND STREQUAL "" ) From badec87841e9f7d26ffef294bab6c4f81d618fe0 Mon Sep 17 00:00:00 2001 From: David Knapp Date: Tue, 27 Aug 2024 13:39:46 +0200 Subject: [PATCH 091/114] Update CMakeLists.txt Co-authored-by: Sandro Elsweijer <49643115+sandro-elsweijer@users.noreply.github.com> --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 0b5dfa614e..2a996f43a8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -30,7 +30,7 @@ include(CMakeDependentOption) cmake_dependent_option( T8CODE_BUILD_DOCUMENTATION_SPHINX "Build t8code's documentation using sphinx" OFF "T8CODE_BUILD_DOCUMENTATION" OFF ) set(T8CODE_CUSTOM_PARALLEL_TEST_COMMAND "" CACHE STRING "Define custom command for parallel tests , e.g.: mpirun -np 8 (overwrites standard mpirun -np 4 if build with mpi)") -set(T8CODE_CUSTOM_SERIAL_TEST_COMMAND "" CACHE STRING "Define custom command for serial tests.") +set(T8CODE_CUSTOM_SERIAL_TEST_COMMAND "" CACHE STRING "Define a custom command for serial tests.") # Set a default build type if none was specified set(default_build_type "Release") From b405fa1829c6ff7785b7091613d5ffa904bf52fa Mon Sep 17 00:00:00 2001 From: David Knapp Date: Tue, 27 Aug 2024 13:40:30 +0200 Subject: [PATCH 092/114] Update CMakeLists.txt Co-authored-by: Sandro Elsweijer <49643115+sandro-elsweijer@users.noreply.github.com> --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 2a996f43a8..07a2b12557 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -29,7 +29,7 @@ option( T8CODE_BUILD_DOCUMENTATION "Build t8code's documentation" OFF ) include(CMakeDependentOption) cmake_dependent_option( T8CODE_BUILD_DOCUMENTATION_SPHINX "Build t8code's documentation using sphinx" OFF "T8CODE_BUILD_DOCUMENTATION" OFF ) -set(T8CODE_CUSTOM_PARALLEL_TEST_COMMAND "" CACHE STRING "Define custom command for parallel tests , e.g.: mpirun -np 8 (overwrites standard mpirun -np 4 if build with mpi)") +set(T8CODE_CUSTOM_PARALLEL_TEST_COMMAND "" CACHE STRING "Define a custom command for parallel tests , e.g.: mpirun -np 8 (overwrites standard mpirun -np 4 if build with mpi)") set(T8CODE_CUSTOM_SERIAL_TEST_COMMAND "" CACHE STRING "Define a custom command for serial tests.") # Set a default build type if none was specified From 5248f221b5c31f84cd64c9cc4ab866f0017e8e7d Mon Sep 17 00:00:00 2001 From: David Knapp Date: Tue, 27 Aug 2024 13:47:31 +0200 Subject: [PATCH 093/114] Update workflow --- .github/workflows/tests_cmake_t8code.yml | 9 +++++-- .../workflows/tests_cmake_t8code_linkage.yml | 27 ++++++++++++++----- 2 files changed, 28 insertions(+), 8 deletions(-) diff --git a/.github/workflows/tests_cmake_t8code.yml b/.github/workflows/tests_cmake_t8code.yml index 1fbafc54d4..1effcaba77 100644 --- a/.github/workflows/tests_cmake_t8code.yml +++ b/.github/workflows/tests_cmake_t8code.yml @@ -102,10 +102,15 @@ jobs: run: cd build && ninja $MAKEFLAGS - name: ninja install run: cd build && ninja install $MAKEFLAGS - - name: serial tests + - name: serial tests (if MPI is enabled) run: cd build && ctest $MAKEFLAGS -R _serial - - name: parallel tests + if: ${{ inputs.MPI == 'ON' }} + - name: parallel tests (if MPI is enabled) run: cd build && ctest -R _parallel + if: ${{ inputs.MPI == 'ON' }} + - name: tests (if MPI is disabled) + run: cd build && ctest $MAKEFLAGS + if: ${{ inputs.MPI == 'OFF' }} - name: OnFailUploadLog if: failure() uses: actions/upload-artifact@v4 diff --git a/.github/workflows/tests_cmake_t8code_linkage.yml b/.github/workflows/tests_cmake_t8code_linkage.yml index 2b5f5cf97f..6e58ed8ffd 100644 --- a/.github/workflows/tests_cmake_t8code_linkage.yml +++ b/.github/workflows/tests_cmake_t8code_linkage.yml @@ -101,10 +101,15 @@ jobs: run: cd build_netcdf && ninja $MAKEFLAGS - name: ninja install run: cd build_netcdf && ninja install $MAKEFLAGS - - name: serial test + - name: serial tests (if MPI is enabled) run: cd build_netcdf && ctest $MAKEFLAGS -R _serial - - name: parallel test + if: ${{ inputs.MPI == 'ON' }} + - name: parallel tests (if MPI is enabled) run: cd build_netcdf && ctest -R _parallel + if: ${{ inputs.MPI == 'ON' }} + - name: tests (if MPI is disabled) + run: cd build_netcdf && ctest $MAKEFLAGS + if: ${{ inputs.MPI == 'OFF' }} - name: OnFailUploadLog if: failure() uses: actions/upload-artifact@v4 @@ -128,10 +133,15 @@ jobs: run: cd build_occ && ninja $MAKEFLAGS - name: ninja install run: cd build_occ && ninja install $MAKEFLAGS - - name: serial test + - name: serial tests (if MPI is enabled) run: cd build_occ && ctest $MAKEFLAGS -R _serial - - name: parallel test + if: ${{ inputs.MPI == 'ON' }} + - name: parallel tests (if MPI is enabled) run: cd build_occ && ctest -R _parallel + if: ${{ inputs.MPI == 'ON' }} + - name: tests (if MPI is disabled) + run: cd build_occ && ctest $MAKEFLAGS + if: ${{ inputs.MPI == 'OFF' }} - name: OnFailUploadLog if: failure() uses: actions/upload-artifact@v4 @@ -155,10 +165,15 @@ jobs: run: cd build_vtk && ninja $MAKEFLAGS - name: ninja install run: cd build_vtk && ninja install $MAKEFLAGS - - name: serial test + - name: serial tests (if MPI is enabled) run: cd build_vtk && ctest $MAKEFLAGS -R _serial - - name: parallel test + if: ${{ inputs.MPI == 'ON' }} + - name: parallel tests (if MPI is enabled) run: cd build_vtk && ctest -R _parallel + if: ${{ inputs.MPI == 'ON' }} + - name: tests (if MPI is disabled) + run: cd build_vtk && ctest $MAKEFLAGS + if: ${{ inputs.MPI == 'OFF' }} - name: OnFailUploadLog if: failure() uses: actions/upload-artifact@v4 From 2023e3b58e1aea2437ee928aa437ddb47d393f75 Mon Sep 17 00:00:00 2001 From: Johannes Markert Date: Fri, 30 Aug 2024 11:18:22 +0200 Subject: [PATCH 094/114] Removing constexpr. --- src/t8_cmesh/t8_cmesh_examples.cxx | 8 ++++---- .../t8_geometry_implementations/t8_geometry_examples.cxx | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/t8_cmesh/t8_cmesh_examples.cxx b/src/t8_cmesh/t8_cmesh_examples.cxx index 8425beb751..b3726504c6 100644 --- a/src/t8_cmesh/t8_cmesh_examples.cxx +++ b/src/t8_cmesh/t8_cmesh_examples.cxx @@ -3126,7 +3126,7 @@ t8_cmesh_new_triangulated_spherical_surface_cube (const double radius, sc_MPI_Co const int nface_rot = 4; // Four triangles create a cube's face. const int ncube_rot = 6; // Six rotations of the four triangles to the six cube's faces. - constexpr int ntrees = nface_rot * ncube_rot; // Number of cmesh elements resp. trees. + const int ntrees = nface_rot * ncube_rot; // Number of cmesh elements resp. trees. const int nverts = 3; // Number of cmesh element (triangle) vertices. // Arrays for the face connectivity computations via vertices. @@ -3139,7 +3139,7 @@ t8_cmesh_new_triangulated_spherical_surface_cube (const double radius, sc_MPI_Co all_eclasses[itree] = T8_ECLASS_TRIANGLE; } - constexpr double _CBRT = std::cbrt (1.0); + const double _CBRT = std::cbrt (1.0); const double r = radius / _CBRT; const double vertices[3][3] = { { -r, -r, r }, { r, -r, r }, { 0.0, 0.0, r } }; @@ -3220,7 +3220,7 @@ t8_cmesh_new_quadrangulated_spherical_surface (const double radius, sc_MPI_Comm all_eclasses[itree] = T8_ECLASS_QUAD; } - constexpr double _CBRT = std::cbrt (1.0); + const double _CBRT = std::cbrt (1.0); const double r = radius / _CBRT; const double vertices[4][3] = { { -r, -r, r }, { r, -r, r }, { -r, r, r }, { r, r, r } }; @@ -3514,7 +3514,7 @@ t8_cmesh_new_cubed_sphere (const double radius, sc_MPI_Comm comm) const double inner_radius = 0.6 * radius; const double outer_radius = radius; - constexpr double _CBRT = std::cbrt(1.0); + const double _CBRT = std::cbrt(1.0); const double inner_x = inner_radius / _CBRT; const double inner_y = inner_x; diff --git a/src/t8_geometry/t8_geometry_implementations/t8_geometry_examples.cxx b/src/t8_geometry/t8_geometry_implementations/t8_geometry_examples.cxx index 31672c465d..de3689e4c1 100644 --- a/src/t8_geometry/t8_geometry_implementations/t8_geometry_examples.cxx +++ b/src/t8_geometry/t8_geometry_implementations/t8_geometry_examples.cxx @@ -211,7 +211,7 @@ t8_geometry_cubed_spherical_shell::t8_geom_evaluate (t8_cmesh_t cmesh, t8_gloidx const double distance = std::abs (t8_vec_dot (active_tree_vertices, normal)); // Compute actual radius of the sphere. - constexpr double CBRT = std::cbrt (1.0); + const double CBRT = std::cbrt (1.0); const double inner_radius = distance * CBRT; const double shell_thickness = std::abs (t8_vec_dot (active_tree_vertices + t8_eclass_num_vertices[active_tree_class] * 3 / 2, normal)) * CBRT From 6c4d6fe1f301d5e19513b06a968d11e4e7ba8167 Mon Sep 17 00:00:00 2001 From: Johannes Markert Date: Fri, 30 Aug 2024 16:28:50 +0200 Subject: [PATCH 095/114] Fixing minor stuff. --- src/t8_cmesh/t8_cmesh_examples.cxx | 1 + .../t8_geometry_implementations/t8_geometry_examples.cxx | 1 + src/t8_vtk/t8_vtk_write_ASCII.cxx | 2 +- 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/t8_cmesh/t8_cmesh_examples.cxx b/src/t8_cmesh/t8_cmesh_examples.cxx index b3726504c6..9b2791d116 100644 --- a/src/t8_cmesh/t8_cmesh_examples.cxx +++ b/src/t8_cmesh/t8_cmesh_examples.cxx @@ -20,6 +20,7 @@ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ +#include #include #include #include diff --git a/src/t8_geometry/t8_geometry_implementations/t8_geometry_examples.cxx b/src/t8_geometry/t8_geometry_implementations/t8_geometry_examples.cxx index de3689e4c1..04fcadf40f 100644 --- a/src/t8_geometry/t8_geometry_implementations/t8_geometry_examples.cxx +++ b/src/t8_geometry/t8_geometry_implementations/t8_geometry_examples.cxx @@ -20,6 +20,7 @@ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ +#include #include #include #include diff --git a/src/t8_vtk/t8_vtk_write_ASCII.cxx b/src/t8_vtk/t8_vtk_write_ASCII.cxx index f2b7f45a24..71cf9ea95a 100644 --- a/src/t8_vtk/t8_vtk_write_ASCII.cxx +++ b/src/t8_vtk/t8_vtk_write_ASCII.cxx @@ -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, " %lld", (long) tree->treeid + cmesh->first_tree); if (!(sk % 8)) fprintf (vtufile, "\n "); } From dbfd67986a248e8f1e9f90d9762845d9ee46aeff Mon Sep 17 00:00:00 2001 From: Sandro Elsweijer <49643115+sandro-elsweijer@users.noreply.github.com> Date: Mon, 2 Sep 2024 12:46:05 +0200 Subject: [PATCH 096/114] Apply suggestion from code review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Maël Karembe <82219355+maelk3@users.noreply.github.com> --- src/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 1f0a4baacf..d80de92643 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -26,7 +26,7 @@ if( CMAKE_BUILD_TYPE STREQUAL "Debug" ) endif() if( T8CODE_EXPORT_COMPILE_COMMANDS ) - target_compile_definitions(T8 PRIVATE CMAKE_EXPORT_COMPILE_COMMANDS=1) + set_target_properties( T8 PROPERTIES EXPORT_COMPILE_COMMANDS ON ) endif( T8CODE_EXPORT_COMPILE_COMMANDS ) if( T8CODE_ENABLE_NETCDF ) From 07c7fb585cc5b49d4dd7d367223a18267f110f66 Mon Sep 17 00:00:00 2001 From: Sandro Elsweijer <49643115+sandro-elsweijer@users.noreply.github.com> Date: Mon, 2 Sep 2024 12:46:13 +0200 Subject: [PATCH 097/114] Apply suggestion from code review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Maël Karembe <82219355+maelk3@users.noreply.github.com> --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index aea1a63e88..55d0ebfd93 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -10,7 +10,7 @@ include( CTest ) option( T8CODE_BUILD_AS_SHARED_LIBRARY "Whether t8code should be built as a shared or a static library" ON ) option( T8CODE_BUILD_PEDANTIC "Compile t8code with `-Wall -pedantic -Werror` as done in the Github CI." OFF ) -option( T8CODE_EXPORT_COMPILE_COMMANDS "Export the compile commands as json. Can be used in code editors for intellisense" OFF ) +option( T8CODE_EXPORT_COMPILE_COMMANDS "Export the compile commands as json. Can be used by IDEs for code completion (e.g. intellisense, clangd)" OFF ) option( T8CODE_BUILD_TESTS "Build t8code's automated tests" ON ) option( T8CODE_BUILD_TUTORIALS "Build t8code's tutorials" ON ) option( T8CODE_BUILD_EXAMPLES "Build t8code's examples" ON ) From bb33b730b25174db70c7d8ee245be6c18a28e32a Mon Sep 17 00:00:00 2001 From: Sandro Elsweijer Date: Mon, 2 Sep 2024 13:11:31 +0200 Subject: [PATCH 098/114] add compile command output to benchmarks --- benchmarks/CMakeLists.txt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/benchmarks/CMakeLists.txt b/benchmarks/CMakeLists.txt index 462d0c3184..3fedcee0af 100644 --- a/benchmarks/CMakeLists.txt +++ b/benchmarks/CMakeLists.txt @@ -8,6 +8,10 @@ function( add_t8_benchmark ) target_include_directories( ${ADD_T8_BENCHMARK_NAME} PRIVATE ${PROJECT_SOURCE_DIR} ) target_link_libraries( ${ADD_T8_BENCHMARK_NAME} PRIVATE T8 SC::SC ) + if( T8CODE_EXPORT_COMPILE_COMMANDS ) + set_target_properties( ${ADD_T8_BENCHMARK_NAME} PROPERTIES EXPORT_COMPILE_COMMANDS ON ) + endif( T8CODE_EXPORT_COMPILE_COMMANDS ) + install( TARGETS ${ADD_T8_BENCHMARK_NAME} DESTINATION ${CMAKE_INSTALL_PREFIX}/bin ) endfunction() From ac02b4462c45e05bcd6994220df8418b259d887d Mon Sep 17 00:00:00 2001 From: Sandro Elsweijer Date: Mon, 2 Sep 2024 13:11:49 +0200 Subject: [PATCH 099/114] add compile command output to example --- example/CMakeLists.txt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/example/CMakeLists.txt b/example/CMakeLists.txt index 5fcb9239eb..fdf02a86da 100644 --- a/example/CMakeLists.txt +++ b/example/CMakeLists.txt @@ -19,6 +19,10 @@ function( add_t8_example ) target_link_libraries( ${ADD_T8_EXAMPLE_NAME} PRIVATE T8 t8example SC::SC ) target_include_directories( ${ADD_T8_EXAMPLE_NAME} PRIVATE ${CMAKE_CURRENT_LIST_DIR}/.. ) + if( T8CODE_EXPORT_COMPILE_COMMANDS ) + set_target_properties( ${ADD_T8_EXAMPLE_NAME} PROPERTIES EXPORT_COMPILE_COMMANDS ON ) + endif( T8CODE_EXPORT_COMPILE_COMMANDS ) + install( TARGETS ${ADD_T8_EXAMPLE_NAME} DESTINATION ${CMAKE_INSTALL_PREFIX}/bin ) endfunction() From 0f1e35037be3a4fab6efefd8b4e8bf35482785fb Mon Sep 17 00:00:00 2001 From: Sandro Elsweijer Date: Mon, 2 Sep 2024 13:12:07 +0200 Subject: [PATCH 100/114] add compile command output to tests --- test/CMakeLists.txt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 3b86619d98..e94885da40 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -10,6 +10,10 @@ function( add_t8_test ) add_executable( ${ADD_T8_TEST_NAME} ${ADD_T8_TEST_SOURCES} ) target_link_libraries( ${ADD_T8_TEST_NAME} PRIVATE T8 gtest pthread) + if( T8CODE_EXPORT_COMPILE_COMMANDS ) + set_target_properties( ${ADD_T8_TEST_NAME} PROPERTIES EXPORT_COMPILE_COMMANDS ON ) + endif( T8CODE_EXPORT_COMPILE_COMMANDS ) + # Split custom test command into a list by whitespace. # If MPI is enabled, and no custom test command is provided, use mpirun -np 4 as the default command. # If MPI is not enabled, use the custom test command as is. From 1bb258075a96afc72f5103d433de755bfbc2f7dc Mon Sep 17 00:00:00 2001 From: Sandro Elsweijer Date: Mon, 2 Sep 2024 13:12:23 +0200 Subject: [PATCH 101/114] add compile command output to tutorials --- tutorials/CMakeLists.txt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tutorials/CMakeLists.txt b/tutorials/CMakeLists.txt index ec38320344..98f6bef698 100644 --- a/tutorials/CMakeLists.txt +++ b/tutorials/CMakeLists.txt @@ -8,6 +8,10 @@ function( add_t8_tutorial ) target_link_libraries( ${ADD_T8_TUTORIAL_NAME} PRIVATE T8 SC::SC ) target_include_directories( ${ADD_T8_TUTORIAL_NAME} PRIVATE ${CMAKE_CURRENT_LIST_DIR}/.. ) + if( T8CODE_EXPORT_COMPILE_COMMANDS ) + set_target_properties( ${ADD_T8_TUTORIAL_NAME} PROPERTIES EXPORT_COMPILE_COMMANDS ON ) + endif( T8CODE_EXPORT_COMPILE_COMMANDS ) + install( TARGETS ${ADD_T8_TUTORIAL_NAME} DESTINATION ${CMAKE_INSTALL_PREFIX}/bin ) endfunction() From 7f823ff0504d3d2feaeed383ae3ffaf046120439 Mon Sep 17 00:00:00 2001 From: Sandro Elsweijer Date: Mon, 2 Sep 2024 15:22:20 +0200 Subject: [PATCH 102/114] indent --- .../t8_geometry_implementations/t8_geometry_zero.hxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/t8_geometry/t8_geometry_implementations/t8_geometry_zero.hxx b/src/t8_geometry/t8_geometry_implementations/t8_geometry_zero.hxx index eb0ad0fca1..12c7796ffd 100644 --- a/src/t8_geometry/t8_geometry_implementations/t8_geometry_zero.hxx +++ b/src/t8_geometry/t8_geometry_implementations/t8_geometry_zero.hxx @@ -127,7 +127,7 @@ struct t8_geometry_zero: public t8_geometry */ inline void t8_geom_load_tree_data (t8_cmesh_t cmesh, t8_gloidx_t gtreeid) override; - + /** * Check for compatibility of the currently loaded tree with the geometry. * This geometry supports all element types, hence it returns true. From df09d6bc61244182a8c5189ec84be3984081e16c Mon Sep 17 00:00:00 2001 From: Johannes Markert Date: Tue, 3 Sep 2024 17:01:21 +0200 Subject: [PATCH 103/114] Applying formater. --- src/t8_cmesh/t8_cmesh_examples.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/t8_cmesh/t8_cmesh_examples.cxx b/src/t8_cmesh/t8_cmesh_examples.cxx index 9b2791d116..c56dad878e 100644 --- a/src/t8_cmesh/t8_cmesh_examples.cxx +++ b/src/t8_cmesh/t8_cmesh_examples.cxx @@ -3128,7 +3128,7 @@ t8_cmesh_new_triangulated_spherical_surface_cube (const double radius, sc_MPI_Co const int ncube_rot = 6; // Six rotations of the four triangles to the six cube's faces. const int ntrees = nface_rot * ncube_rot; // Number of cmesh elements resp. trees. - const int nverts = 3; // Number of cmesh element (triangle) vertices. + const int nverts = 3; // Number of cmesh element (triangle) vertices. // Arrays for the face connectivity computations via vertices. double all_verts[ntrees * T8_ECLASS_MAX_CORNERS * T8_ECLASS_MAX_DIM]; From 4d55d2a5a5ee17d7b52239d8a92d4da04b65d39b Mon Sep 17 00:00:00 2001 From: Johannes Markert <10619309+jmark@users.noreply.github.com> Date: Wed, 4 Sep 2024 09:41:54 +0200 Subject: [PATCH 104/114] Update t8_vtk_write_ASCII.cxx Revert format string change. --- src/t8_vtk/t8_vtk_write_ASCII.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/t8_vtk/t8_vtk_write_ASCII.cxx b/src/t8_vtk/t8_vtk_write_ASCII.cxx index 71cf9ea95a..f2b7f45a24 100644 --- a/src/t8_vtk/t8_vtk_write_ASCII.cxx +++ b/src/t8_vtk/t8_vtk_write_ASCII.cxx @@ -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, " %lld", (long) tree->treeid + cmesh->first_tree); + fprintf (vtufile, " %ld", (long) tree->treeid + cmesh->first_tree); if (!(sk % 8)) fprintf (vtufile, "\n "); } From 717fcf53494f3fed7d262b0fd8447194cc0b63c2 Mon Sep 17 00:00:00 2001 From: Sandro Elsweijer Date: Fri, 6 Sep 2024 13:27:26 +0200 Subject: [PATCH 105/114] simplify return value --- src/t8_cmesh/t8_cmesh.cxx | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/src/t8_cmesh/t8_cmesh.cxx b/src/t8_cmesh/t8_cmesh.cxx index 165f4a39f5..4ab894c0fb 100644 --- a/src/t8_cmesh/t8_cmesh.cxx +++ b/src/t8_cmesh/t8_cmesh.cxx @@ -141,8 +141,6 @@ t8_cmesh_validate_geometry (const t8_cmesh_t cmesh) if (cmesh == NULL) { return true; } - - bool valid = true; if (cmesh->geometry_handler->get_num_geometries () > 0) { /* Iterate over all trees, get their vertices and check the volume */ for (t8_locidx_t itree = 0; itree < cmesh->num_local_trees; itree++) { @@ -151,7 +149,7 @@ t8_cmesh_validate_geometry (const t8_cmesh_t cmesh) = cmesh->geometry_handler->tree_compatible_with_geom (cmesh, t8_cmesh_get_global_id (cmesh, itree)); if (!geometry_compatible) { t8_debugf ("Detected incompatible geometry for tree %li\n", (long) itree); - valid = false; + return false; } if (geometry_compatible) { /* Check for negative volume. This only makes sense if the geometry is valid for the tree. */ @@ -159,15 +157,12 @@ t8_cmesh_validate_geometry (const t8_cmesh_t cmesh) = cmesh->geometry_handler->tree_negative_volume (cmesh, t8_cmesh_get_global_id (cmesh, itree)); if (negative_volume) { t8_debugf ("Detected negative volume in tree %li\n", (long) itree); - valid = false; + return false; } } } - return valid; - } - else { - return true; } + return true; } #endif /* T8_ENABLE_DEBUG */ From 05949f79b21557f513a2bcf983649b3864396c1d Mon Sep 17 00:00:00 2001 From: Sandro Elsweijer <49643115+sandro-elsweijer@users.noreply.github.com> Date: Fri, 6 Sep 2024 13:32:15 +0200 Subject: [PATCH 106/114] consting Co-authored-by: David Knapp --- src/t8_geometry/t8_geometry_base.cxx | 2 +- src/t8_geometry/t8_geometry_base.hxx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/t8_geometry/t8_geometry_base.cxx b/src/t8_geometry/t8_geometry_base.cxx index be867a7289..a5a560d5a4 100644 --- a/src/t8_geometry/t8_geometry_base.cxx +++ b/src/t8_geometry/t8_geometry_base.cxx @@ -65,7 +65,7 @@ t8_geom_get_type (const t8_geometry_c *geom) /* Load the id and class of the newly active tree to the active_tree and active_tree_class variable. */ void -t8_geometry::t8_geom_load_tree_data (t8_cmesh_t cmesh, t8_gloidx_t gtreeid) +t8_geometry::t8_geom_load_tree_data (const t8_cmesh_t cmesh, const t8_gloidx_t gtreeid) { /* Set active id and eclass */ const t8_locidx_t ltreeid = t8_cmesh_get_local_id (cmesh, gtreeid); diff --git a/src/t8_geometry/t8_geometry_base.hxx b/src/t8_geometry/t8_geometry_base.hxx index 8e5db5ad7f..01274231c5 100644 --- a/src/t8_geometry/t8_geometry_base.hxx +++ b/src/t8_geometry/t8_geometry_base.hxx @@ -105,7 +105,7 @@ struct t8_geometry * \param [in] gtreeid The global tree. */ virtual void - t8_geom_load_tree_data (t8_cmesh_t cmesh, t8_gloidx_t gtreeid); + t8_geom_load_tree_data (const t8_cmesh_t cmesh, const t8_gloidx_t gtreeid); /** Query whether a batch of points lies inside an element. * \param [in] forest The forest. From 1053773e2aece765bcf4811277902a2700424353 Mon Sep 17 00:00:00 2001 From: Sandro Elsweijer Date: Fri, 6 Sep 2024 13:32:37 +0200 Subject: [PATCH 107/114] typo --- .../t8_gtest_geometry_lagrange.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/t8_geometry/t8_geometry_implementations/t8_gtest_geometry_lagrange.cxx b/test/t8_geometry/t8_geometry_implementations/t8_gtest_geometry_lagrange.cxx index f82c2e205e..6fe843f2be 100644 --- a/test/t8_geometry/t8_geometry_implementations/t8_gtest_geometry_lagrange.cxx +++ b/test/t8_geometry/t8_geometry_implementations/t8_gtest_geometry_lagrange.cxx @@ -286,7 +286,7 @@ TEST (test_geometry_lagrange, incompatible_geometry) /* Commit the cmesh */ t8_cmesh_commit (cmesh, sc_MPI_COMM_WORLD); /* Register the t8_geometry_lagrange to this cmesh. - * We register it after committing because it would throw an assertion and do not have death tests.*/ + * We register it after committing because it would throw an assertion and we do not have death tests.*/ t8_cmesh_register_geometry (cmesh, 3); /* Check validity after committing to circumvent the assertion. * Should return false since the t8_geometry_lagrange geometry is not compatible with prisms. */ @@ -303,7 +303,7 @@ TEST (test_geometry_lagrange, incompatible_geometry) /* Commit the cmesh */ t8_cmesh_commit (cmesh, sc_MPI_COMM_WORLD); /* Register the t8_geometry_lagrange to this cmesh. - * We register it after committing because it would throw an assertion and do not have death tests.*/ + * We register it after committing because it would throw an assertion and we do not have death tests.*/ t8_cmesh_register_geometry (cmesh, 3); /* Check validity after committing to circumvent the assertion. * Should return false since the maximum polynomial degree is exceeded. */ From 66e8634ca75bb88ccb19f846d7d4ea7f25423840 Mon Sep 17 00:00:00 2001 From: Sandro Elsweijer <49643115+sandro-elsweijer@users.noreply.github.com> Date: Fri, 6 Sep 2024 13:33:43 +0200 Subject: [PATCH 108/114] simplify return value Co-authored-by: David Knapp --- .../t8_geometry_implementations/t8_geometry_lagrange.cxx | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/t8_geometry/t8_geometry_implementations/t8_geometry_lagrange.cxx b/src/t8_geometry/t8_geometry_implementations/t8_geometry_lagrange.cxx index f30a4dd804..c6c69b9859 100644 --- a/src/t8_geometry/t8_geometry_implementations/t8_geometry_lagrange.cxx +++ b/src/t8_geometry/t8_geometry_implementations/t8_geometry_lagrange.cxx @@ -119,21 +119,20 @@ t8_geometry_lagrange::t8_geom_compute_basis (const double *ref_coords) const bool t8_geometry_lagrange::t8_geom_check_tree_compatibility () const { - bool return_val = true; if (*degree > T8_GEOMETRY_MAX_POLYNOMIAL_DEGREE) { t8_debugf ("Lagrange tree with degree %i detected.\n" "Only degrees up to %i are supported.", *degree, T8_GEOMETRY_MAX_POLYNOMIAL_DEGREE); - return_val = false; + return false; } if (active_tree_class != T8_ECLASS_LINE && active_tree_class != T8_ECLASS_TRIANGLE && active_tree_class != T8_ECLASS_QUAD && active_tree_class != T8_ECLASS_HEX) { t8_debugf ("Lagrange tree with class %i detected.\n" "Only lines, triangles, quadrilaterals and hexahedra are supported with the lagrangian geometry.\n", active_tree_class); - return_val = false; + return false; } - return return_val; + return true; } inline std::vector From 65e363a18afcefacedeb5c3c3ddbeeb82f268576 Mon Sep 17 00:00:00 2001 From: Sandro Elsweijer Date: Fri, 6 Sep 2024 13:37:08 +0200 Subject: [PATCH 109/114] documentation --- .../t8_geometry_implementations/t8_geometry_analytic.h | 1 + .../t8_geometry_implementations/t8_geometry_analytic.hxx | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/t8_geometry/t8_geometry_implementations/t8_geometry_analytic.h b/src/t8_geometry/t8_geometry_implementations/t8_geometry_analytic.h index 66199b3226..1f723a57a8 100644 --- a/src/t8_geometry/t8_geometry_implementations/t8_geometry_analytic.h +++ b/src/t8_geometry/t8_geometry_implementations/t8_geometry_analytic.h @@ -95,6 +95,7 @@ t8_geometry_analytic_destroy (t8_geometry_c **geom); * \param [in] load_tree_data The function that is used to load a tree's data. * \param [in] tree_negative_volume_in The function that is used to compute if a trees volume is negative. * \param [in] tree_compatible_in The function that is used to check if a tree is compatible with the geometry. + * \param [in] user_data Additional user data which the geometry can use. Gets retrieved via \ref t8_geom_analytic_get_user_data. * \return A pointer to an allocated geometry struct. */ t8_geometry_c * diff --git a/src/t8_geometry/t8_geometry_implementations/t8_geometry_analytic.hxx b/src/t8_geometry/t8_geometry_implementations/t8_geometry_analytic.hxx index 8f8370dc8d..b9ddc1df2c 100644 --- a/src/t8_geometry/t8_geometry_implementations/t8_geometry_analytic.hxx +++ b/src/t8_geometry/t8_geometry_implementations/t8_geometry_analytic.hxx @@ -169,10 +169,10 @@ struct t8_geometry_analytic: public t8_geometry t8_geom_tree_compatible_fn tree_compatible; /**< The function to check if a tree is compatible. */ const void *tree_data; /** Tree data pointer that can be set in \a load_tree_data and - is passed onto \a analytical_function and \a jacobian. */ + is passed onto \a analytical_function and \a jacobian. */ const void *user_data; /** Additional user data pointer that can be set in constructor - * and modified via \ref t8_geom_analytic_get_user_data. */ + and modified via \ref t8_geom_analytic_get_user_data. */ }; #endif /* !T8_GEOMETRY_ANALYTICAL_HXX */ From 3e07b1623354938f3fe56a5b6871db3710a7d314 Mon Sep 17 00:00:00 2001 From: Sandro Elsweijer Date: Fri, 6 Sep 2024 13:39:38 +0200 Subject: [PATCH 110/114] documentation --- .../t8_gtest_geometry_lagrange.cxx | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/test/t8_geometry/t8_geometry_implementations/t8_gtest_geometry_lagrange.cxx b/test/t8_geometry/t8_geometry_implementations/t8_gtest_geometry_lagrange.cxx index 6fe843f2be..ce849ef8a9 100644 --- a/test/t8_geometry/t8_geometry_implementations/t8_gtest_geometry_lagrange.cxx +++ b/test/t8_geometry/t8_geometry_implementations/t8_gtest_geometry_lagrange.cxx @@ -251,6 +251,11 @@ INSTANTIATE_TEST_SUITE_P (t8_gtest_geometry_lagrange, LagrangeCmesh, /* clang-format on */ #if T8_ENABLE_DEBUG + +/** + * Tests the compatibility checking for the Lagrange geometry. + * The geometry should throw assertions if the geometry is not compatible with an assigned tree. + */ TEST (test_geometry_lagrange, incompatible_geometry) { t8_cmesh_t cmesh; From c0f0007cc8eeea6aebdaa7b725364cd40bf37f24 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 9 Sep 2024 11:17:27 +0000 Subject: [PATCH 111/114] Bump peter-evans/create-pull-request from 6 to 7 Bumps [peter-evans/create-pull-request](https://github.com/peter-evans/create-pull-request) from 6 to 7. - [Release notes](https://github.com/peter-evans/create-pull-request/releases) - [Commits](https://github.com/peter-evans/create-pull-request/compare/v6...v7) --- updated-dependencies: - dependency-name: peter-evans/create-pull-request dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- .github/workflows/add_release_documentation.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/add_release_documentation.yml b/.github/workflows/add_release_documentation.yml index fcf9326d7d..be9fd17f94 100644 --- a/.github/workflows/add_release_documentation.yml +++ b/.github/workflows/add_release_documentation.yml @@ -146,7 +146,7 @@ jobs: ./generate_redirections.sh $GITHUB_REF_NAME - name: Create Pull Request at DLR-AMR/t8code-website if: ${{ env.MINOR_RELEASE == 'true' }} - uses: peter-evans/create-pull-request@v6 + uses: peter-evans/create-pull-request@v7 with: path: t8code-website title: Add documentation for t8code ${{ github.ref_name }} From c236276ec17510fb2fdfc8072a1e761024c0fe0e Mon Sep 17 00:00:00 2001 From: Sandro Elsweijer <49643115+sandro-elsweijer@users.noreply.github.com> Date: Fri, 13 Sep 2024 13:20:02 +0200 Subject: [PATCH 112/114] typo --- example/IO/cmesh/gmsh/t8_read_msh_file.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/example/IO/cmesh/gmsh/t8_read_msh_file.cxx b/example/IO/cmesh/gmsh/t8_read_msh_file.cxx index 48616cf92f..192976f77a 100644 --- a/example/IO/cmesh/gmsh/t8_read_msh_file.cxx +++ b/example/IO/cmesh/gmsh/t8_read_msh_file.cxx @@ -3,7 +3,7 @@ t8code is a C library to manage a collection (a forest) of multiple connected adaptive space-trees of general element types in parallel. - Copyright (C) 2015 the developers + Copyright (C) 2024 the developers t8code is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -140,7 +140,7 @@ main (int argc, char *argv[]) opt = sc_options_new (argv[0]); sc_options_add_switch (opt, 'h', "help", &helpme, "Display a short help message."); - sc_options_add_string (opt, 'f', "prefix", &prefix, "", "The prefix of the tetgen files."); + sc_options_add_string (opt, 'f', "prefix", &prefix, "", "The prefix of the gmsh files."); sc_options_add_switch (opt, 'p', "partition", &partition, "If true the generated cmesh is repartitioned uniformly."); sc_options_add_int (opt, 'd', "dim", &dim, 2, "The dimension of the mesh"); sc_options_add_int (opt, 'm', "master", &master, -1, From e68a0658639d4fae6fdf046f518f41712be16d86 Mon Sep 17 00:00:00 2001 From: Sandro Elsweijer <49643115+sandro-elsweijer@users.noreply.github.com> Date: Fri, 13 Sep 2024 13:35:01 +0200 Subject: [PATCH 113/114] convert int to switch --- example/IO/forest/gmsh/t8_gmsh_to_vtk.cxx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/example/IO/forest/gmsh/t8_gmsh_to_vtk.cxx b/example/IO/forest/gmsh/t8_gmsh_to_vtk.cxx index fb8c862b89..3eaa922574 100644 --- a/example/IO/forest/gmsh/t8_gmsh_to_vtk.cxx +++ b/example/IO/forest/gmsh/t8_gmsh_to_vtk.cxx @@ -79,9 +79,9 @@ main (int argc, char **argv) sc_options_add_string (opt, 'f', "fileprefix", &fileprefix, NULL, "Fileprefix of the msh and brep files."); sc_options_add_int (opt, 'l', "level", &level, 2, "The uniform refinement level. Default: 2"); sc_options_add_int (opt, 'd', "dimension", &dim, 3, "The dimension of the mesh. Default: 3"); - sc_options_add_int ( - opt, 'c', "use_cad", &use_cad, 0, - "Enable CAD-based curvilinear geometry. Needs a `.brep` file with the same file prefix. Default: 0"); + sc_options_add_switch ( + opt, 'c', "use_cad", &use_cad, + "Enable CAD-based curvilinear geometry. Needs a `.brep` file with the same file prefix."); parsed = sc_options_parse (t8_get_package_id (), SC_LP_ERROR, opt, argc, argv); if (helpme) { From 37691ab37faabb6f334708eb9a162a6362cd27ca Mon Sep 17 00:00:00 2001 From: Sandro Elsweijer Date: Fri, 13 Sep 2024 13:46:55 +0200 Subject: [PATCH 114/114] indent --- example/IO/forest/gmsh/t8_gmsh_to_vtk.cxx | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/example/IO/forest/gmsh/t8_gmsh_to_vtk.cxx b/example/IO/forest/gmsh/t8_gmsh_to_vtk.cxx index 3eaa922574..cb0e662e51 100644 --- a/example/IO/forest/gmsh/t8_gmsh_to_vtk.cxx +++ b/example/IO/forest/gmsh/t8_gmsh_to_vtk.cxx @@ -79,9 +79,8 @@ main (int argc, char **argv) sc_options_add_string (opt, 'f', "fileprefix", &fileprefix, NULL, "Fileprefix of the msh and brep files."); sc_options_add_int (opt, 'l', "level", &level, 2, "The uniform refinement level. Default: 2"); sc_options_add_int (opt, 'd', "dimension", &dim, 3, "The dimension of the mesh. Default: 3"); - sc_options_add_switch ( - opt, 'c', "use_cad", &use_cad, - "Enable CAD-based curvilinear geometry. Needs a `.brep` file with the same file prefix."); + sc_options_add_switch (opt, 'c', "use_cad", &use_cad, + "Enable CAD-based curvilinear geometry. Needs a `.brep` file with the same file prefix."); parsed = sc_options_parse (t8_get_package_id (), SC_LP_ERROR, opt, argc, argv); if (helpme) {