diff --git a/doc/Doxyfile.in b/doc/Doxyfile.in index 8167c71cca..7c523a0835 100644 --- a/doc/Doxyfile.in +++ b/doc/Doxyfile.in @@ -958,7 +958,7 @@ WARN_FORMAT = "$file:$line: $text" # Example: # WARN_LINE_FORMAT = "'vi $file +$line'" # See also: WARN_FORMAT -# The default value is: at line $line of file $file. +# The default value is: at line $line of file $file.test WARN_LINE_FORMAT = "at line $line of file $file" @@ -982,7 +982,8 @@ WARN_LOGFILE = # Note: If this tag is empty the current directory is searched. INPUT = @top_srcdir@/src \ - @top_srcdir@/mesh_handle + @top_srcdir@/mesh_handle \ + @top_srcdir@/test # This tag can be used to specify the character encoding of the source files # that Doxygen parses. Internally Doxygen uses the UTF-8 encoding. Doxygen uses @@ -1053,7 +1054,10 @@ EXCLUDE_SYMLINKS = NO # Note that the wildcards are matched against the file with absolute path, so to # exclude all test directories for example use the pattern */test/* -EXCLUDE_PATTERNS = +EXCLUDE_PATTERNS = */test/*.cxx \ + */test/*.c \ + */test/*.f90 \ + # The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names # (namespaces, classes, functions, etc.) that should be excluded from the diff --git a/test/t8_cmesh_generator/t8_cmesh_example_sets.hxx b/test/t8_cmesh_generator/t8_cmesh_example_sets.hxx index e690387c87..83ece334e7 100644 --- a/test/t8_cmesh_generator/t8_cmesh_example_sets.hxx +++ b/test/t8_cmesh_generator/t8_cmesh_example_sets.hxx @@ -20,6 +20,9 @@ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ +/** \file t8_cmesh_example_sets.hxx + * Define macro that includes all the cmesh example sets. Each example set should be defined in a separate file and included here. + */ #ifndef T8_GTEST_CMESH_COMM_CREATOR_HXX #define T8_GTEST_CMESH_COMM_CREATOR_HXX @@ -41,8 +44,7 @@ T8_EXTERN_C_BEGIN (); /** - * lambda to pass to an INSTANTIATE_TEST_SUITE_P to print the current cmesh_example_base - * + * lambda to pass to an INSTANTIATE_TEST_SUITE_P to print the current \ref cmesh_example_base. */ auto pretty_print_base_example = [] (const testing::TestParamInfo &info) { std::string name; @@ -50,6 +52,10 @@ auto pretty_print_base_example = [] (const testing::TestParamInfo> &info) { std::string name; std::get<1> (info.param)->param_to_string (name); @@ -59,6 +65,7 @@ auto pretty_print_base_example_scheme = [] (const testing::TestParamInfo cart_prod_vec = { new_from_class::cmesh_example, new_prism_cake::cmesh_example, new_bigmesh::cmesh_example, @@ -71,10 +78,12 @@ std::vector cart_prod_vec = { new_from_class::cmesh_example, new_empty::cmesh_example, new_periodic::cmesh_example }; +/** Constructs cmeshes according to \ref cart_prod_vec. */ cmesh_sum_of_sets cmesh_sums (cart_prod_vec); } // namespace cmesh_list +/** Macro that includes all cmesh example sets. */ #define AllCmeshsParam \ ::testing::ValuesIn (cmesh_list::cmesh_sums.cmesh_examples.begin (), cmesh_list::cmesh_sums.cmesh_examples.end ()) diff --git a/test/t8_cmesh_generator/t8_cmesh_parameterized_examples/t8_cmesh_new_bigmesh_param.hxx b/test/t8_cmesh_generator/t8_cmesh_parameterized_examples/t8_cmesh_new_bigmesh_param.hxx index 542c2f4dc1..981e5ff2e1 100644 --- a/test/t8_cmesh_generator/t8_cmesh_parameterized_examples/t8_cmesh_new_bigmesh_param.hxx +++ b/test/t8_cmesh_generator/t8_cmesh_parameterized_examples/t8_cmesh_new_bigmesh_param.hxx @@ -20,6 +20,9 @@ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ +/** \file t8_cmesh_new_bigmesh_param.hxx + * Parameterized example cmeshes providing a big mesh for test purpose. + */ #ifndef T8_CMESH_NEW_BIGMESH_PARAM_HXX #define T8_CMESH_NEW_BIGMESH_PARAM_HXX @@ -30,8 +33,14 @@ namespace new_bigmesh { +/** Wrapper function for t8_cmesh_new_bigmesh. */ std::function bigmesh = t8_cmesh_new_bigmesh; +/** Function to convert parameter values to a string. + * \param [in] eclass The eclass of the mesh. + * \param [in] num_trees The number of trees of the mesh. + * \param [in] comm The communicator. + */ std::string make_param_string (const t8_eclass_t eclass, const int num_trees, const sc_MPI_Comm comm) { @@ -41,9 +50,11 @@ make_param_string (const t8_eclass_t eclass, const int num_trees, const sc_MPI_C return params; } +/** Wrapper function for \ref make_param_string. */ std::function make_param_string_wrapper = make_param_string; +/** Example cmesh set of bigmesh cmeshes. */ example_set *cmesh_example = (example_set *) new cmesh_cartesian_product_params print_function = make_param_string; +/** Vector with functions to construct a cmesh from a communicator parameter. */ std::vector> cmesh_functions = { t8_cmesh_new_periodic_tri, t8_cmesh_new_periodic_hybrid, t8_cmesh_new_periodic_line_more_trees, @@ -51,7 +61,7 @@ std::vector> cmesh_functions = { t8_cmes t8_cmesh_new_hybrid_gate, t8_cmesh_new_hybrid_gate_deformed, t8_cmesh_new_full_hybrid }; - +/** Names of the example sets of constructed cmeshes.*/ std::vector names = { "t8_cmesh_new_periodic_tri", "t8_cmesh_new_periodic_hybrid", "t8_cmesh_new_periodic_line_more_trees", @@ -65,6 +75,7 @@ std::vector names = { "t8_cmesh_new_periodic_tri", "t8_cmesh_new_hybrid_gate_deformed", "t8_cmesh_new_full_hybrid" }; +/** Example cmesh set with different communicators. */ example_set *cmesh_example = (example_set *) new cmesh_cartesian_product_params ( std::make_pair (cmesh_params::my_comms.begin (), cmesh_params::my_comms.end ()), cmesh_functions, print_function, diff --git a/test/t8_cmesh_generator/t8_cmesh_parameterized_examples/t8_cmesh_new_disjoint_bricks_param.hxx b/test/t8_cmesh_generator/t8_cmesh_parameterized_examples/t8_cmesh_new_disjoint_bricks_param.hxx index 89dd683648..cb818ecd5a 100644 --- a/test/t8_cmesh_generator/t8_cmesh_parameterized_examples/t8_cmesh_new_disjoint_bricks_param.hxx +++ b/test/t8_cmesh_generator/t8_cmesh_parameterized_examples/t8_cmesh_new_disjoint_bricks_param.hxx @@ -20,34 +20,50 @@ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ +/** \file t8_cmesh_new_disjoint_bricks_param.hxx + * Parameterized example cmeshes with disjoint bricks. + */ +#ifndef T8_CMESH_NEW_DISJOINT_BRICKS_PARAM_HXX +#define T8_CMESH_NEW_DISJOINT_BRICKS_PARAM_HXX + #include "test/t8_cmesh_generator/t8_gtest_cmesh_cartesian_product.hxx" #include "test/t8_cmesh_generator/t8_cmesh_parameterized_examples/t8_cmesh_params.hxx" #include "t8_cmesh/t8_cmesh_examples.h" -#ifndef T8_CMESH_NEW_DISJOINT_BRICKS_PARAM_HXX -#define T8_CMESH_NEW_DISJOINT_BRICKS_PARAM_HXX - namespace new_disjoint_bricks { +/** Wrapper function for t8_cmesh_new_disjoint_bricks. */ std::function disjoint_bricks = t8_cmesh_new_disjoint_bricks; +/** Function to convert parameter values to a string. + * \param [in] num_x The number of trees in x direction for this rank. + * \param [in] num_y The number of trees in y direction for this rank. + * \param [in] num_z The number of trees in z direction for this rank. + * If nonzero, the cmesh is 3 dimensional. + * \param [in] x_periodic If nonzero, the local brick connectivity is periodic in x direction. + * \param [in] y_periodic If nonzero, the local brick connectivity is periodic in y direction. + * \param [in] z_periodic If nonzero and \a num_z > 0, the local brick connectivity is periodic in z direction. + * \param [in] comm The MPI communicator used to commit the cmesh. + */ std::string -make_param_string (const t8_gloidx_t num_x, const t8_gloidx_t num_y, const t8_gloidx_t num_z, const int num_x_periodic, - const int num_y_periodic, const int num_z_periodic, sc_MPI_Comm comm) +make_param_string (const t8_gloidx_t num_x, const t8_gloidx_t num_y, const t8_gloidx_t num_z, const int x_periodic, + const int y_periodic, const int z_periodic, sc_MPI_Comm comm) { std::string delimiter = std::string ("_"); std::string params = delimiter + std::to_string (num_x) + delimiter + std::to_string (num_y) + delimiter - + std::to_string (num_z) + delimiter + std::to_string (num_x_periodic) + delimiter - + std::to_string (num_y_periodic) + delimiter + std::to_string (num_z_periodic) + delimiter + + std::to_string (num_z) + delimiter + std::to_string (x_periodic) + delimiter + + std::to_string (y_periodic) + delimiter + std::to_string (z_periodic) + delimiter + cmesh_params::comm_to_string (comm); return params; } +/** Wrapper function for \ref make_param_string. */ std::function make_param_string_wrapper = make_param_string; +/** Example disjoint bricks cmesh set with different parameter combinations. */ example_set *cmesh_example = (example_set *) new cmesh_cartesian_product_params< decltype (cmesh_params::elems_per_dim.begin ()), decltype (cmesh_params::elems_per_dim.begin ()), decltype (cmesh_params::elems_per_dim.begin ()), decltype (cmesh_params::periodic.begin ()), diff --git a/test/t8_cmesh_generator/t8_cmesh_parameterized_examples/t8_cmesh_new_empty.hxx b/test/t8_cmesh_generator/t8_cmesh_parameterized_examples/t8_cmesh_new_empty.hxx index 2445986f9d..7c49d7025f 100644 --- a/test/t8_cmesh_generator/t8_cmesh_parameterized_examples/t8_cmesh_new_empty.hxx +++ b/test/t8_cmesh_generator/t8_cmesh_parameterized_examples/t8_cmesh_new_empty.hxx @@ -20,6 +20,9 @@ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ +/** \file t8_cmesh_new_empty.hxx + * Parameterized empty example cmeshes. + */ #ifndef T8_CMESH_NEW_EMPTY_HXX #define T8_CMESH_NEW_EMPTY_HXX @@ -30,7 +33,11 @@ namespace new_empty { - +/** Function to convert parameter values to a string. + * \param [in] comm Mpi communicator to be used with the new cmesh. + * \param [in] do_partition Flag whether the cmesh should be partitioned or not. + * \param [in] dim An empty cmesh requires a dimension nevertheless. 0 <= tree dimension <= 3. + */ std::string make_param_string (const sc_MPI_Comm &comm, const int do_partition, const int dim) { @@ -40,11 +47,13 @@ make_param_string (const sc_MPI_Comm &comm, const int do_partition, const int di = delimiter + cmesh_params::comm_to_string (comm) + delimiter + partition + delimiter + std::to_string (dim); return params; } - +/** Wrapper function for \ref make_param_string. */ std::function print_function = make_param_string; +/** Wrapper function for t8_cmesh_new_empty. */ std::function new_from_class_wrapper = t8_cmesh_new_empty; +/** Example empty cmesh set with different parameter combinations. */ example_set *cmesh_example = (example_set *) new cmesh_cartesian_product_params #include -#ifndef T8_CMESH_NEW_FROM_CLASS_PARAM -#define T8_CMESH_NEW_FROM_CLASS_PARAM - namespace new_from_class { - +/** Function to convert parameter values to a string. + * \param [in] eclass The element class. + * \param [in] comm Mpi communicator to be used with the new cmesh. + */ std::string make_param_string (const t8_eclass_t &eclass, const sc_MPI_Comm &comm) { @@ -39,11 +45,13 @@ make_param_string (const t8_eclass_t &eclass, const sc_MPI_Comm &comm) = delimiter + std::string (t8_eclass_to_string[eclass]) + delimiter + cmesh_params::comm_to_string (comm); return params; } - +/** Wrapper function for make_param_string. */ std::function print_function = make_param_string; +/** Wrapper function for t8_cmesh_new_from_class. */ std::function new_from_class_wrapper = t8_cmesh_new_from_class; +/** Example cmesh set with different parameter combinations using the new_from_class function. */ example_set *cmesh_example = (example_set *) new cmesh_cartesian_product_params ( diff --git a/test/t8_cmesh_generator/t8_cmesh_parameterized_examples/t8_cmesh_new_hypercube_pad.hxx b/test/t8_cmesh_generator/t8_cmesh_parameterized_examples/t8_cmesh_new_hypercube_pad.hxx index e692903ef4..4f5e4523a5 100644 --- a/test/t8_cmesh_generator/t8_cmesh_parameterized_examples/t8_cmesh_new_hypercube_pad.hxx +++ b/test/t8_cmesh_generator/t8_cmesh_parameterized_examples/t8_cmesh_new_hypercube_pad.hxx @@ -20,6 +20,9 @@ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ +/** \file t8_cmesh_new_hypercube_pad.hxx + * Parameterized example cmeshes a hypercube forest from one primitive tree class. + */ #ifndef T8_CMESH_NEW_HYPERCUBE_PAD #define T8_CMESH_NEW_HYPERCUBE_PAD @@ -30,6 +33,19 @@ namespace new_hypercube_pad { +/** Wrapper for t8_cmesh_new_hypercube_pad_ext to construct a hypercube cmesh from one primitive tree class. + * Offset and set_partition is set to 0. + * \param [in] eclass This element class determines the dimension of the cube. + * \param [in] comm The mpi communicator to be used. + * \param [in] boundary The vertices, that define the hypercube boundary. + * \param [in] polygons_x The number of polygons along the x-axis. + * \param [in] polygons_y The number of polygons along the y-axis. + * \param [in] polygons_z The number of polygons along the z-axis. + * \param [in] periodic_x Connect opposite sides of the hypercube in x-direction. + * \param [in] periodic_y Connect opposite sides of the hypercube in y-direction. + * \param [in] periodic_z Connect opposite sides of the hypercube in z-direction. + * \param [in] use_axis_aligned Use the axis-aligned geometry. If used, only two points per tree are stored. + */ t8_cmesh_t t8_cmesh_new_hypercube_pad_ext_wrapper (const t8_eclass_t eclass, sc_MPI_Comm comm, const double *boundary, t8_locidx_t polygons_x, t8_locidx_t polygons_y, t8_locidx_t polygons_z, @@ -44,10 +60,23 @@ t8_cmesh_new_hypercube_pad_ext_wrapper (const t8_eclass_t eclass, sc_MPI_Comm co periodic_y, periodic_z, use_axis_aligned, set_partition, offset); } +/** Wrapper function for \ref t8_cmesh_new_hypercube_pad_ext_wrapper. */ std::function hyper_pad = t8_cmesh_new_hypercube_pad_ext_wrapper; +/** Function to convert parameter values to a string. + * \param [in] eclass This element class determines the dimension of the cube. + * \param [in] comm The mpi communicator to be used. + * \param [in] boundary The vertices, that define the hypercube boundary. + * \param [in] polygons_x The number of polygons along the x-axis. + * \param [in] polygons_y The number of polygons along the y-axis. + * \param [in] polygons_z The number of polygons along the z-axis. + * \param [in] is_periodic_x Connect opposite sides of the hypercube in x-direction. + * \param [in] is_periodic_y Connect opposite sides of the hypercube in y-direction. + * \param [in] is_periodic_z Connect opposite sides of the hypercube in z-direction. + * \param [in] use_axis_aligned Use the axis-aligned geometry. If used, only two points per tree are stored. + */ std::string make_param_string (const t8_eclass_t eclass, sc_MPI_Comm comm, [[maybe_unused]] const double *boundary, t8_locidx_t polygons_x, t8_locidx_t polygons_y, t8_locidx_t polygons_z, const int is_periodic_x, @@ -66,10 +95,24 @@ make_param_string (const t8_eclass_t eclass, sc_MPI_Comm comm, [[maybe_unused]] return params; } +/** Wrapper function for \ref make_param_string. */ std::function make_param_string_wrapper = make_param_string; +/** Function to determine if a parameter combination is permissible. + * \param [in] eclass This element class determines the dimension of the cube. + * \param [in] comm The mpi communicator to be used. + * \param [in] boundary The vertices, that define the hypercube boundary. + * \param [in] polygons_x The number of polygons along the x-axis. + * \param [in] polygons_y The number of polygons along the y-axis. + * \param [in] polygons_z The number of polygons along the z-axis. + * \param [in] periodic_x Connect opposite sides of the hypercube in x-direction. + * \param [in] periodic_y Connect opposite sides of the hypercube in y-direction. + * \param [in] periodic_z Connect opposite sides of the hypercube in z-direction. + * \param [in] use_axis_aligned Use the axis-aligned geometry. If used, only two points per tree are stored. + * \return true if the parameter combination is permissible, false otherwise. + */ inline bool rule (const t8_eclass_t eclass, [[maybe_unused]] sc_MPI_Comm comm, [[maybe_unused]] const double *boundary, t8_locidx_t polygons_x, t8_locidx_t polygons_y, t8_locidx_t polygons_z, const int periodic_x, @@ -98,12 +141,12 @@ rule (const t8_eclass_t eclass, [[maybe_unused]] sc_MPI_Comm comm, [[maybe_unuse return true; } - +/** Wrapper function for \ref rule. */ std::function rule_wrapper = rule; -/* We split the hypercube tests into two parts, one testing on non-periodic boundaries, the other one testing +/** We split the hypercube tests into two parts, one testing on non-periodic boundaries, the other one testing * with periodic boundaries but with fixed number of elements. That way we don't variate over all combinations * of parameters, which would result in a very long runtime in our testsuite. */ example_set *cmesh_example_non_periodic_boundaries = (example_set *) new cmesh_cartesian_product_with_rules< @@ -124,6 +167,7 @@ example_set *cmesh_example_non_periodic_boundaries = (example_set *) new cmesh_c std::make_pair (cmesh_params::use_axis_aligned.begin (), cmesh_params::use_axis_aligned.end ()), hyper_pad, make_param_string_wrapper, rule_wrapper, "t8_cmesh_new_hypercube_pad_ext_non_periodic_boundaries"); +/** Test with periodic boundaries. */ example_set *cmesh_example_periodic_boundaries = (example_set *) new cmesh_cartesian_product_with_rules< decltype (cmesh_params::all_eclasses.begin ()), decltype (cmesh_params::my_comms.begin ()), decltype (cmesh_params::boundaries.begin ()), decltype (cmesh_params::elems_per_dim.begin ()), diff --git a/test/t8_cmesh_generator/t8_cmesh_parameterized_examples/t8_cmesh_new_hypercube_param.hxx b/test/t8_cmesh_generator/t8_cmesh_parameterized_examples/t8_cmesh_new_hypercube_param.hxx index b04ccc95de..933add099f 100644 --- a/test/t8_cmesh_generator/t8_cmesh_parameterized_examples/t8_cmesh_new_hypercube_param.hxx +++ b/test/t8_cmesh_generator/t8_cmesh_parameterized_examples/t8_cmesh_new_hypercube_param.hxx @@ -20,6 +20,9 @@ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ +/** \file t8_cmesh_new_empty.hxx + * Parameterized hypercube example cmeshes from one primitive tree class. + */ #ifndef T8_CMESH_NEW_HYPERCUBE_PARAM_HXX #define T8_CMESH_NEW_HYPERCUBE_PARAM_HXX @@ -30,6 +33,14 @@ namespace new_hypercube_cmesh { +/** Function to convert parameter values to a string. + * \param [in] eclass eclass determines the dimension and the number of trees needed to construct a cube. + * \param [in] comm The mpi communicator to be used. + * \param [in] do_bcast If this flag is nonzero the cmesh is only constructed on processor 0 and then + * broadcasted to the other processors in \a comm. + * \param [in] do_partition Create a partitioned cmesh. + * \param [in] periodic If true, the coarse mesh will be periodic in each direction. + */ std::string make_param_string (const t8_eclass_t eclass, const sc_MPI_Comm comm, const int do_bcast, const int do_partition, const int periodic) @@ -44,16 +55,18 @@ make_param_string (const t8_eclass_t eclass, const sc_MPI_Comm comm, const int d return params; } +/** Wrapper function for make_param_string. */ std::function param_to_string = make_param_string; - +/** Vector containing all periodic eclasses. */ std::vector periodic_eclasses = { T8_ECLASS_VERTEX, T8_ECLASS_LINE, T8_ECLASS_QUAD, T8_ECLASS_TRIANGLE, T8_ECLASS_HEX, T8_ECLASS_TET, T8_ECLASS_PRISM }; - +/** Wrapper function for t8_cmesh_new_hypercube. */ std::function cmesh_wrapper = t8_cmesh_new_hypercube; - +/** Vector containing the only non-periodic eclass. */ std::vector nonperiodic_eclasses = { T8_ECLASS_PYRAMID }; +/** Example cmesh set with periodic eclasses and different parameter combinations using the cmesh_wrapper function. */ example_set *cmesh_example = (example_set *) new cmesh_cartesian_product_params< decltype (periodic_eclasses.begin ()), decltype (cmesh_params::my_comms.begin ()), decltype (cmesh_params::do_bcast.begin ()), decltype (cmesh_params::partition.begin ()), @@ -65,6 +78,7 @@ example_set *cmesh_example = (example_set *) new cmesh_cartesian_product_params< std::make_pair (cmesh_params::periodic.begin (), cmesh_params::periodic.end ()), cmesh_wrapper, param_to_string, "t8_cmesh_new_hypercube"); +/** Example cmesh set with non-periodic eclasses and different parameter combinations using the cmesh_wrapper function. */ example_set *cmesh_example_pyra = (example_set *) new cmesh_cartesian_product_params< decltype (periodic_eclasses.begin ()), decltype (cmesh_params::my_comms.begin ()), decltype (cmesh_params::do_bcast.begin ()), decltype (cmesh_params::partition.begin ()), diff --git a/test/t8_cmesh_generator/t8_cmesh_parameterized_examples/t8_cmesh_new_periodic.hxx b/test/t8_cmesh_generator/t8_cmesh_parameterized_examples/t8_cmesh_new_periodic.hxx index 4cfc3ab75e..94ce719e1a 100644 --- a/test/t8_cmesh_generator/t8_cmesh_parameterized_examples/t8_cmesh_new_periodic.hxx +++ b/test/t8_cmesh_generator/t8_cmesh_parameterized_examples/t8_cmesh_new_periodic.hxx @@ -20,6 +20,9 @@ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ +/** \file t8_cmesh_new_periodic.hxx + * Parameterized example cmeshes that are periodic in each direction. + */ #ifndef T8_CMESH_NEW_PERIODIC_HXX #define T8_CMESH_NEW_PERIODIC_HXX @@ -30,7 +33,10 @@ namespace new_periodic { - +/** Function to convert parameter values to a string. + * \param [in] comm The mpi communicator to use. + * \param [in] dim The dimension of the cmesh, 1, 2 or 3. + */ std::string make_param_string (const sc_MPI_Comm &comm, const int dim) { @@ -38,10 +44,13 @@ make_param_string (const sc_MPI_Comm &comm, const int dim) std::string params = delimiter + cmesh_params::comm_to_string (comm) + delimiter + std::to_string (dim); return params; } - +/** Wrapper function for \ref make_param_string. */ std::function print_function = make_param_string; +/** Wrapper function for t8_cmesh_new_periodic. */ std::function new_from_periodic_wrapper = t8_cmesh_new_periodic; + +/** Example cmesh set with different parameter combinations using the \ref new_periodic::new_from_periodic_wrapper function. */ example_set *cmesh_example = (example_set *) new cmesh_cartesian_product_params ( diff --git a/test/t8_cmesh_generator/t8_cmesh_parameterized_examples/t8_cmesh_new_prism_cake_param.hxx b/test/t8_cmesh_generator/t8_cmesh_parameterized_examples/t8_cmesh_new_prism_cake_param.hxx index 0db4cba86d..e6ad48ad4e 100644 --- a/test/t8_cmesh_generator/t8_cmesh_parameterized_examples/t8_cmesh_new_prism_cake_param.hxx +++ b/test/t8_cmesh_generator/t8_cmesh_parameterized_examples/t8_cmesh_new_prism_cake_param.hxx @@ -20,17 +20,25 @@ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ +/** \file t8_cmesh_new_prism_cake_param.hxx + * Parameterized prism cake example cmeshes. + */ +#ifndef T8_CMESH_NEW_PRISM_CAKE_PARAM_HXX +#define T8_CMESH_NEW_PRISM_CAKE_PARAM_HXX + #include "test/t8_cmesh_generator/t8_gtest_cmesh_cartesian_product.hxx" #include "test/t8_cmesh_generator/t8_cmesh_parameterized_examples/t8_cmesh_params.hxx" #include -#ifndef T8_CMESH_NEW_PRISM_CAKE_PARAM_HXX -#define T8_CMESH_NEW_PRISM_CAKE_PARAM_HXX - namespace new_prism_cake { +/** Wrapper function for t8_cmesh_new_prism_cake. */ std::function prism_cake = t8_cmesh_new_prism_cake; +/** Function to convert parameter values to a string. + * \param [in] comm The mpi communicator to use. + * \param [in] num_prisms The number of prisms to be used. + */ std::string make_param_string (const sc_MPI_Comm &comm, const int &num_prisms) { @@ -39,8 +47,10 @@ make_param_string (const sc_MPI_Comm &comm, const int &num_prisms) return params; } +/** Wrapper function for \ref make_param_string. */ std::function make_param_string_wrapper = make_param_string; +/** Example cmesh set with different parameter combinations using the prism_cake function. */ example_set *cmesh_example = (example_set *) new cmesh_cartesian_product_params ( diff --git a/test/t8_cmesh_generator/t8_cmesh_parameterized_examples/t8_cmesh_params.hxx b/test/t8_cmesh_generator/t8_cmesh_parameterized_examples/t8_cmesh_params.hxx index 92fd2bfd1d..2a1680fef1 100644 --- a/test/t8_cmesh_generator/t8_cmesh_parameterized_examples/t8_cmesh_params.hxx +++ b/test/t8_cmesh_generator/t8_cmesh_parameterized_examples/t8_cmesh_params.hxx @@ -20,12 +20,12 @@ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -/** - * File to store the parameters that are used for our parameterized cmesh-tests +/** \file t8_cmesh_params.hxx + * File to store the parameters that are used for our parameterized cmesh-tests. */ - #ifndef T8_CMESH_PARAMS_HXX #define T8_CMESH_PARAMS_HXX + #include #include #include @@ -35,22 +35,25 @@ #include #if T8_TEST_LEVEL_INT >= 2 -#define T8_CMESH_MAX_NUM_OF_TREES 2 +#define T8_CMESH_MAX_NUM_OF_TREES 2 /**< Maximum number of trees in the cmesh. */ // Note: This is not the number of prisms used in the test but the number of different settings tested. -#define T8_CMESH_MAX_NUM_OF_PRISMS 2 -#define T8_CMESH_MAX_NUM_XYZ_TREES 1 +#define T8_CMESH_MAX_NUM_OF_PRISMS 2 /**< Maximum number of different settings tested for prisms. */ +#define T8_CMESH_MAX_NUM_XYZ_TREES 1 /**< Maximum number of trees in xyz direction in the cmesh. */ #elif T8_TEST_LEVEL_INT >= 1 -#define T8_CMESH_MAX_NUM_OF_TREES 5 -#define T8_CMESH_MAX_NUM_OF_PRISMS 5 -#define T8_CMESH_MAX_NUM_XYZ_TREES 2 +#define T8_CMESH_MAX_NUM_OF_TREES 5 /**< Maximum number of trees in the cmesh. */ +#define T8_CMESH_MAX_NUM_OF_PRISMS 5 /**< Maximum number of different settings tested for prisms. */ +#define T8_CMESH_MAX_NUM_XYZ_TREES 2 /**< Maximum number of trees in xyz direction in the cmesh. */ #else -#define T8_CMESH_MAX_NUM_OF_TREES 10 -#define T8_CMESH_MAX_NUM_OF_PRISMS 10 -#define T8_CMESH_MAX_NUM_XYZ_TREES 3 +#define T8_CMESH_MAX_NUM_OF_TREES 10 /**< Maximum number of trees in the cmesh. */ +#define T8_CMESH_MAX_NUM_OF_PRISMS 10 /**< Maximum number of different settings tested for prisms. */ +#define T8_CMESH_MAX_NUM_XYZ_TREES 3 /**< Maximum number of trees in xyz direction in the cmesh. */ #endif namespace cmesh_params { +/** Function to convert an mpi communicator to a string. + * \param [in] comm The mpi communicator to convert. + */ std::string comm_to_string (const sc_MPI_Comm &comm) { @@ -62,6 +65,12 @@ comm_to_string (const sc_MPI_Comm &comm) return std::string ("No_String_for_this_communicator"); } +/** Creates a vector filled with sequentially increasing values. + * \tparam T The type of the vector elements. + * \param [in] size The number of elements in the resulting vector. + * \param [in] start The starting value for the sequence. + * \return A vector of type T containing sequential values starting from \p start. + */ template std::vector filled_vector (const size_t size, T start) @@ -71,33 +80,44 @@ filled_vector (const size_t size, T start) return tmp; } +/** Define bounds of a unit cube in 3D. */ const double cube_bounds[24] = { 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 1, 0, 0, 0, 1, 1, 0, 1, 0, 1, 1, 1, 1, 1 }; +/** Vector containing parameters for cmesh boundaries. */ std::vector boundaries = { cube_bounds }; +/** Vector with all possibilities for usage of axis aligned. */ std::vector use_axis_aligned = { 0, 1 }; +/** Vector with parameters for a large mesh. */ std::vector large_mesh = filled_vector (T8_CMESH_MAX_NUM_OF_TREES, 1); +/** Vector with parameters for the elements per dimension. */ std::vector elems_per_dim = filled_vector (T8_CMESH_MAX_NUM_XYZ_TREES, 1); +/** Vector containing all mpi communicators used for the tests. */ std::vector my_comms = { sc_MPI_COMM_WORLD }; + +/** Vector containing all eclasses of dimension 1, 2 and 3. */ std::vector eclasses = { T8_ECLASS_VERTEX, T8_ECLASS_LINE, T8_ECLASS_QUAD, T8_ECLASS_TRIANGLE, T8_ECLASS_HEX, T8_ECLASS_TET, T8_ECLASS_PRISM, T8_ECLASS_PYRAMID }; +/** Vector containing all eclasses. */ std::vector all_eclasses = { T8_ECLASS_ZERO, T8_ECLASS_VERTEX, T8_ECLASS_LINE, T8_ECLASS_QUAD, T8_ECLASS_TRIANGLE, T8_ECLASS_HEX, T8_ECLASS_TET, T8_ECLASS_PRISM, T8_ECLASS_PYRAMID, T8_ECLASS_COUNT, T8_ECLASS_INVALID }; +/** Vector with parameters for broadcast. */ std::vector do_bcast = { 0, 1 }; +/** Vector with parameters for partition. */ std::vector partition = { 0, 1 }; - +/** Vector with parameters for periodic. */ std::vector periodic = { 0, 1 }; -/* Currently a dummy vector for examples that have periodic argument but not fully support it yet */ +/** Currently a dummy vector for examples that have periodic argument but not fully support it yet. */ std::vector no_periodic = { 0 }; - +/** Vector with parameters for the dimensions. */ std::vector dims = { 1, 2, 3 }; - +/** Vector with parameters for the number of prisms. */ std::vector num_prisms = filled_vector (T8_CMESH_MAX_NUM_OF_PRISMS, 3); } // namespace cmesh_params diff --git a/test/t8_cmesh_generator/t8_gtest_cmesh_cartesian_product.hxx b/test/t8_cmesh_generator/t8_gtest_cmesh_cartesian_product.hxx index 6b4d186751..c8e16d6377 100644 --- a/test/t8_cmesh_generator/t8_gtest_cmesh_cartesian_product.hxx +++ b/test/t8_cmesh_generator/t8_gtest_cmesh_cartesian_product.hxx @@ -20,6 +20,9 @@ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ +/** \file t8_gtest_cmesh_cartesian_product.hxx + * Provides classes to construct cmeshes from cartesian products of input parameters. + */ #ifndef T8_GTEST_CMESH_CREATOR_BASE_HXX #define T8_GTEST_CMESH_CREATOR_BASE_HXX @@ -32,11 +35,7 @@ /** * A base class for cmesh examples. - * * For pretty debug output a function to translate the parameters of the example to a string should be provided. - * - * The - * */ struct cmesh_example_base { @@ -66,7 +65,7 @@ struct cmesh_example_base param_to_string (std::string& out) const = 0; - std::string name; + std::string name; /**< Name of the cmesh examples. */ }; /** @@ -78,26 +77,38 @@ template struct cmesh_example_with_parameter: cmesh_example_base { public: + /** Constructor for a cmesh example created by a function with parameters as input. + * \param [in] function Function to create a cmesh from parameters. + * \param [in] parameter Tuple of parameters to be passed to the function. + * \param [in] parameter_to_string Function to convert parameters to a string. + * \param [in] name of the example cmesh. + */ cmesh_example_with_parameter (std::function function, std::tuple parameter, std::function parameter_to_string, std::string name) : cmesh_example_base (name), cmesh_function (function), parameter (parameter), parameter_to_string (parameter_to_string) {}; + /** Create the cmesh with given function and parameters. + * \return The created cmesh. + */ virtual t8_cmesh_t cmesh_create () const { return std::apply (cmesh_function, parameter); } + /** Convert the parameters of this example to a string. + * \param [out] out string with the parameters of this example cmesh. + */ virtual void param_to_string (std::string& out) const { out = name + std::apply (parameter_to_string, parameter); } - std::function cmesh_function; - std::tuple parameter; - std::function parameter_to_string; + std::function cmesh_function; /**< Function to create a cmesh from parameters. */ + std::tuple parameter; /**< Tuple of parameters to be passed to the function. */ + std::function parameter_to_string; /**< Function to convert parameters to a string. */ }; /** @@ -119,7 +130,7 @@ struct example_set * A helper functions that creates a pair of begin and end iterators from a vector. * * \tparam Args The type of elements in the vector - * \param[in] vec A vector + * \param [in] vec A vector * \return A pair of begin and end of the vector. */ template @@ -175,6 +186,13 @@ increment (const B& begins, std::pair& r, std::pair&... rr) return false; } +/** + * A helper function that always returns true. Used as default rule in cartesian product generation. + * Can be passed to \ref cartesian_product to indicate that all parameter combinations are allowed. + * \tparam Args Type of parameters. + * \param params Parameters. + * \return true + */ template inline bool no_rule ([[maybe_unused]] Args... params) @@ -189,8 +207,8 @@ no_rule ([[maybe_unused]] Args... params) * @tparam OutputIterator * @tparam Iter * \param[in, out] out An OutputIterator that will be filled - * \param[in] rule A function that returns true if a parameter combination is permissible, false otherwise - * \param[in] ranges Pairs of ranges + * \param [in] rule A function that returns true if a parameter combination is permissible, false otherwise + * \param [in] ranges Pairs of ranges */ template void @@ -209,17 +227,24 @@ cartesian_product (OutputIterator out, std::function struct cmesh_cartesian_product_params: example_set { public: + /** Default constructor without parameters. */ cmesh_cartesian_product_params () {}; + /** Constructor with parameters. + * \param [in] ranges Pairs of parameter ranges for each \a Iter type. + * \param [in] cmesh_function Function to create a cmesh from parameter values. + * \param [in] param_to_string Function to convert parameter values to a string. + * \param [in] name of the example set of cmeshes. + */ cmesh_cartesian_product_params (std::pair... ranges, std::function cmesh_function, std::function param_to_string, @@ -237,6 +262,12 @@ struct cmesh_cartesian_product_params: example_set } } + /** Constructor with parameters with more than one functions to create a cmesh. + * \param [in] ranges Pairs of parameter ranges for each \a Iter type. + * \param [in] cmesh_functions Functions to create a cmesh from parameter values. + * \param [in] param_to_string Function to convert parameter values to a string. + * \param [in] names of the example sets of constructed cmeshes. + */ cmesh_cartesian_product_params (std::pair... ranges, std::vector> cmesh_functions, std::function param_to_string, @@ -259,7 +290,7 @@ struct cmesh_cartesian_product_params: example_set }; /** - * Variadic template class that creates \ref base_example based on the cartesian product + * Variadic template class that creates an \ref example_set based on the cartesian product * of the input parameters. * * @tparam Iter @@ -268,8 +299,16 @@ template struct cmesh_cartesian_product_with_rules: example_set { public: + /** Default constructor without parameters. */ cmesh_cartesian_product_with_rules () {}; + /** Constructor with parameters. + * \param [in] ranges Pairs of parameter ranges for each \a Iter type. + * \param [in] cmesh_function Function to create a cmesh from parameter values. + * \param [in] param_to_string Function to convert parameter values to a string. + * \param [in] rule A function that returns true if a parameter combination is permissible, false otherwise. + * \param [in] name of the example set of cmeshes. + */ cmesh_cartesian_product_with_rules (std::pair... ranges, std::function cmesh_function, std::function param_to_string, diff --git a/test/t8_cmesh_generator/t8_gtest_cmesh_sum_of_sets.hxx b/test/t8_cmesh_generator/t8_gtest_cmesh_sum_of_sets.hxx index 3b638fbc25..6caa35f948 100644 --- a/test/t8_cmesh_generator/t8_gtest_cmesh_sum_of_sets.hxx +++ b/test/t8_cmesh_generator/t8_gtest_cmesh_sum_of_sets.hxx @@ -19,6 +19,9 @@ along with t8code; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ +/** \file t8_gtest_cmesh_sum_of_sets.hxx + * Definition of a class that holds multiple ways to create a cmesh. + */ #ifndef T8_GTEST_cmesh_sum_of_sets_HXX #define T8_GTEST_cmesh_sum_of_sets_HXX @@ -36,9 +39,9 @@ struct cmesh_sum_of_sets public: cmesh_sum_of_sets () {}; /** - * Construct a new cmesh sum of sets object, that will generate cmeshes given by \ref cmesh_set + * Construct a new cmesh sum of sets object, that will generate cmeshes given by \a cmesh_set. * - * \param[in] cmesh_set A vector of \ref parameter_cartesian_product + * \param[in] cmesh_set A vector of \ref example_set. */ cmesh_sum_of_sets (std::vector cmesh_set) { @@ -49,15 +52,14 @@ struct cmesh_sum_of_sets } /** - * Destroy the cmesh generator cxx object - * + * Destroy the cmesh sum of sets object. */ ~cmesh_sum_of_sets () { } public: - std::vector cmesh_examples; + std::vector cmesh_examples; /**< Generated cmesh examples. */ }; T8_EXTERN_C_END (); diff --git a/test/t8_data/t8_data_handler_specs.hxx b/test/t8_data/t8_data_handler_specs.hxx index 6b07d340e7..e531cbdc08 100644 --- a/test/t8_data/t8_data_handler_specs.hxx +++ b/test/t8_data/t8_data_handler_specs.hxx @@ -90,7 +90,7 @@ struct data_creator void create (const int num_data); - std::vector large_data; + std::vector large_data; /**< A vector to hold the created data items. */ }; #endif /* T8_DATA_HANDLER_SPECS_HXX */ diff --git a/test/t8_data/t8_enlarged_stdtypes.hxx b/test/t8_data/t8_enlarged_stdtypes.hxx index c7d4d50b17..2c48f6d97f 100644 --- a/test/t8_data/t8_enlarged_stdtypes.hxx +++ b/test/t8_data/t8_enlarged_stdtypes.hxx @@ -35,9 +35,11 @@ /** * pseudo_types for testing - * */ -enum pseudo_types { T8_ENLARGED_INT = 0, T8_ENLARGED_DOUBLE = 1 }; +enum pseudo_types { + T8_ENLARGED_INT = 0, /**< Pseudo data type representing an enlarged int. */ + T8_ENLARGED_DOUBLE = 1 /**< Pseudo data type representing an enlarged double. */ +}; /** * A template specialisation for handling single enlarged ints (int plus an additional int, this @@ -53,7 +55,7 @@ struct t8_data_handler> /** * Returns the size of an enlarged_int. * - * \param[in] data The data to compute the size of. + * \param[in] item The data item to compute the size of. * \param[in] comm The MPI communicator used for communication. * \return An integer representing the size of the data. */ @@ -133,7 +135,7 @@ struct t8_data_handler> /** * Returns the size of an enlarged_double. * - * \param[in] data The data to compute the size of. + * \param[in] item The data item to compute the size of. * \param[in] comm The MPI communicator used for communication. * \return An integer representing the size of the data. */ diff --git a/test/t8_data/t8_pseudo_trees.hxx b/test/t8_data/t8_pseudo_trees.hxx index 29cb2e3b1d..d993ab955c 100644 --- a/test/t8_data/t8_pseudo_trees.hxx +++ b/test/t8_data/t8_pseudo_trees.hxx @@ -20,9 +20,7 @@ along with t8code; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -/** - * /file t8_pseudo_trees.hxx - * +/** \file t8_pseudo_trees.hxx * This file provides a pseudo tree structure for testing purposes. */ @@ -39,18 +37,16 @@ along with t8code; if not, write to the Free Software Foundation, Inc., * Represents a pseudo tree structure containing topological and tree data. * * \note This class is used for testing purposes only. - * - * The pseudo_tree class encapsulates two main data members: - * - `topo_data`: A vector of integers representing topological data. - * - `tree_data`: A vector of pointers to t8_abstract_data_handler objects, representing tree data. */ struct pseudo_tree { public: - std::vector topo_data; - std::vector> tree_data; + std::vector topo_data; /**< A vector of integers representing topological data. */ + std::vector> + tree_data; /**< A vector of pointers to t8_abstract_data_handler objects, representing tree data. */ }; +/** Data handler for for the \ref pseudo_tree structure. */ template <> struct t8_data_handler { diff --git a/test/t8_gtest_custom_assertion.hxx b/test/t8_gtest_custom_assertion.hxx index 7eec9ab8c2..dc76e28886 100644 --- a/test/t8_gtest_custom_assertion.hxx +++ b/test/t8_gtest_custom_assertion.hxx @@ -33,14 +33,14 @@ #include /** - * \brief Test two elements for equality and print the elements if they aren't equal + * Test two elements for equality and print the elements if they aren't equal * - * \param[in] ts_expr The name of the scheme \a ts + * \param[in] ts_expr The name of the \a scheme * \param[in] tree_class_expr The name of the tree class * \param[in] elem_1_expr The name of the first element \a elem_1 * \param[in] elem_2_expr The name of the second element \a elem_2 * \param[in] scheme The scheme to use to check the equality - * \param[in] tree_class The eclass of the tree the elements are part of + * \param[in] eclass The eclass of the tree the elements are part of * \param[in] elem_1 The element to compare with \a elem_2 * \param[in] elem_2 the element to compare with \a elem_1 * \return testing::AssertionResult @@ -72,14 +72,26 @@ element_equality (const char *ts_expr, const char *tree_class_expr, const char * } } +/** Macro for a non-fatal failure test to check for equality of two elements. + * \param [in] scheme The scheme to use to check the equality. + * \param [in] eclass The eclass of the tree. + * \param [in] elem1 The first element to compare. + * \param [in] elem2 The second element to compare. + */ #define EXPECT_ELEM_EQ(scheme, eclass, elem1, elem2) \ EXPECT_PRED_FORMAT4 (element_equality, (scheme), (eclass), (elem1), (elem2)) -#define ASSERT_ELEM_EQ(scheme, tree_class, elem1, elem2) \ - ASSERT_PRED_FORMAT4 (element_equality, (scheme), (tree_class), (elem1), (elem2)) +/** Macro for a fatal failure test to check for equality of two elements. + * \param [in] scheme The scheme to use to check the equality. + * \param [in] eclass The eclass of the tree. + * \param [in] elem1 The first element to compare. + * \param [in] elem2 The second element to compare. + */ +#define ASSERT_ELEM_EQ(scheme, eclass, elem1, elem2) \ + ASSERT_PRED_FORMAT4 (element_equality, (scheme), (eclass), (elem1), (elem2)) /** - * \brief Test if two 3D Dimensionaltors are equal with respect to a given precision + * Test if two 3D Dimensionaltors are equal with respect to a given precision * * \tparam TDimensional2 Type of the first Dimensionaltor. * \param[in] Dimensional_1_expr Name of the first Dimensionaltor @@ -104,11 +116,16 @@ dimensional_equality (const char *Dimensional_1_expr, const char *Dimensional_2_ } } +/** Macro for a non-fatal failure test to check for equality of two vectors. + * \param[in] Dimensional_1 First Dimensionaltor to compare. + * \param[in] Dimensional_2 Second Dimensionaltor to compare. + * \param[in] precision Test equality up to this precision. + */ #define EXPECT_VEC_EQ(Dimensional_1, Dimensional_2, precision) \ EXPECT_PRED_FORMAT3 (dimensional_equality, (Dimensional_1), (Dimensional_2), (precision)) /** - * \brief Test two forests for equality. + * Test two forests for equality. * * \param[in] forest_A_expr The name of the forest \a forest_A * \param[in] forest_B_expr The name of the forest \a forest_B @@ -128,6 +145,10 @@ forest_equality (const char *forest_A_expr, const char *forest_B_expr, const t8_ } } +/** Macro for a non-fatal failure test to check for equality of two forests. + * \param[in] forest_A The forest to compare with \a forest_B. + * \param[in] forest_B The forest to compare with \a forest_A. + */ #define EXPECT_FOREST_EQ(forest_A, forest_B) EXPECT_PRED_FORMAT2 (forest_equality, (forest_A), (forest_B)) #endif /* T8_GTEST_CUSTOM_ASSERTION_HXX */ diff --git a/test/t8_gtest_macros.hxx b/test/t8_gtest_macros.hxx index 6b8cfd7a7e..8074015463 100644 --- a/test/t8_gtest_macros.hxx +++ b/test/t8_gtest_macros.hxx @@ -44,6 +44,8 @@ inline auto print_eclass /** * Initializes everything needed for the t8code testsuite. * MPI is initialized with MPI_COMM_WORLD and SC with loglevel SC_LP_PRODUCTION. + * \param [in] argc Number of command-line arguments. + * \param [in] argv Array of command-line argument strings. * \param [in] log_threshold The log threshold used to initialize t8code. */ void @@ -74,7 +76,9 @@ t8_testsuite_get_package_id (); #define T8_NUM_SAMPLE_POINTS 10000 #endif +/** Google test range for parametrized covering all eclasses. */ #define AllEclasses testing::Range (T8_ECLASS_ZERO, T8_ECLASS_COUNT) +/** Google test range for parametrized covering all 2 dimensional eclasses. */ #define AllEclasses2D testing::Values (T8_ECLASS_QUAD, T8_ECLASS_TRIANGLE) #endif /* T8_GTEST_MACROS_HXX */ diff --git a/test/t8_gtest_memory_macros.hxx b/test/t8_gtest_memory_macros.hxx index 7b0b170f8d..2eccf9acb5 100644 --- a/test/t8_gtest_memory_macros.hxx +++ b/test/t8_gtest_memory_macros.hxx @@ -21,7 +21,8 @@ */ /** \file t8_gtest_memory_macros.hxx -* Provide memory macros */ + * Provide memory macros. + */ #ifndef T8_GTEST_MEMORY_MACROS_HXX #define T8_GTEST_MEMORY_MACROS_HXX diff --git a/test/t8_gtest_schemes.hxx b/test/t8_gtest_schemes.hxx index 83165311f7..a2efc9568a 100644 --- a/test/t8_gtest_schemes.hxx +++ b/test/t8_gtest_schemes.hxx @@ -20,6 +20,10 @@ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ +/** \file t8_gtest_schemes.hxx + * File to provide different schemes for testing purposes. + */ + #ifndef T8_GTEST_SCHEMES_HXX #define T8_GTEST_SCHEMES_HXX @@ -27,6 +31,10 @@ #include #include +/** Create a scheme according to a scheme id. + * \param [in] scheme_id 0: Use default scheme; 1: Use standalone scheme. + * \return The created scheme. + */ const t8_scheme * create_from_scheme_id (const int scheme_id) { @@ -41,17 +49,22 @@ create_from_scheme_id (const int scheme_id) } } +/** Strings for the two scheme types. */ static const char *t8_scheme_to_string[] = { "default", "standalone" }; +/** Lambda to print the scheme and the eclass of an TestParamInfo object. */ auto print_all_schemes = [] (const testing::TestParamInfo> &info) { return std::string (t8_scheme_to_string[std::get<0> (info.param)]) + "_" + t8_eclass_to_string[std::get<1> (info.param)]; }; +/** Lambda to print the scheme. */ auto print_scheme = [] (const testing::TestParamInfo &info) { return std::string (t8_scheme_to_string[info.param]); }; +/** Macro for all schemes. */ #define AllSchemeCollections ::testing::Range (0, 2) +/** Macro for all schemes and all possible eclasses.*/ #define AllSchemes ::testing::Combine (AllSchemeCollections, ::testing::Range (T8_ECLASS_ZERO, T8_ECLASS_COUNT)) #endif /* T8_GTEST_SCHEMES_HXX */ diff --git a/test/t8_schemes/t8_gtest_bfs_base.hxx b/test/t8_schemes/t8_gtest_bfs_base.hxx index 49de65b599..2fc03bcd21 100644 --- a/test/t8_schemes/t8_gtest_bfs_base.hxx +++ b/test/t8_schemes/t8_gtest_bfs_base.hxx @@ -33,15 +33,17 @@ #include #include +/** A base class for breadth first search tests. */ struct TestBFS: public testing::TestWithParam> { public: - /** recursive tests check something for all descendants of a starting element (currently only root) upto maxlevel -*/ + /** recursive tests check something for all descendants of a starting element (currently only root) upto maxlevel. */ virtual void check_element () {}; - /** recursive breadth first search to iterate over all descendants of elem up to max_bfs_recursion_level */ + /** recursive breadth first search to iterate over all descendants of elem up to \a max_bfs_recursion_level + * \param [in] max_bfs_recursion_level Maximum recursion level. + */ void check_recursive_bfs_to_max_lvl (const int max_bfs_recursion_level) { @@ -75,6 +77,7 @@ struct TestBFS: public testing::TestWithParam> } } + /** Test setup for breadth first search tests. */ void bfs_test_setup () { @@ -84,29 +87,30 @@ struct TestBFS: public testing::TestWithParam> scheme->element_new (eclass, 1, &element); scheme->set_to_root (eclass, element); } - + /** Test teardown for breadth first search tests. */ void bfs_test_teardown () { scheme->unref (); } + /** Test setup for \ref TestBFS used by gtest. */ void SetUp () override { bfs_test_setup (); } - + /** Test teardown for \ref TestBFS used by gtest. */ void TearDown () override { bfs_test_teardown (); } - const t8_scheme *scheme; - t8_eclass_t eclass; - t8_element_t *element; - int current_level = 0; + const t8_scheme *scheme; /**< Scheme to be used for BFS testing. */ + t8_eclass_t eclass; /**< Eclass of the tree to be used for BFS testing. */ + t8_element_t *element; /**< Current element in the BFS traversal. */ + int current_level = 0; /**< Current level in the BFS traversal. */ }; #endif /* T8_GTEST_BFS_BASE_HXX */ diff --git a/test/t8_schemes/t8_gtest_dfs_base.hxx b/test/t8_schemes/t8_gtest_dfs_base.hxx index 156ddfb358..2f9d395423 100644 --- a/test/t8_schemes/t8_gtest_dfs_base.hxx +++ b/test/t8_schemes/t8_gtest_dfs_base.hxx @@ -20,22 +20,30 @@ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef T8_GTEST_SCHEME_HELPER_H -#define T8_GTEST_SCHEME_HELPER_H +/** + * \file t8_gtest_dfs_base.hxx + * A base class for depth first search tests. + */ + +#ifndef T8_GTEST_DFS_BASE_HXX +#define T8_GTEST_DFS_BASE_HXX #include #include #include +/** A base class for depth first search tests. */ struct TestDFS: public testing::TestWithParam> { public: /** recursive tests check something for all descendants of a starting element (currently only root) upto maxlevel -*/ + */ virtual void check_element () {}; - /** recursive depth first search to iterate over all descendants of elem up to max_dfs_recursion_level */ + /** recursive depth first search to iterate over all descendants of elem up to \a max_dfs_recursion_level. + * \param [in] max_dfs_recursion_level Maximum recursion level. + */ void check_recursive_dfs_to_max_lvl (const int max_dfs_recursion_level) { @@ -57,6 +65,7 @@ struct TestDFS: public testing::TestWithParam> } } + /** Test setup for depth first search tests. */ void dfs_test_setup () { @@ -66,6 +75,7 @@ struct TestDFS: public testing::TestWithParam> scheme->element_new (eclass, 1, &element); scheme->set_to_root (eclass, element); } + /** Test teardown for depth first search tests. */ void dfs_test_teardown () { @@ -73,20 +83,22 @@ struct TestDFS: public testing::TestWithParam> scheme->unref (); } + /** Test setup for \ref TestDFS used by gtest. */ void SetUp () override { dfs_test_setup (); } + /** Test teardown for \ref TestDFS used by gtest. */ void TearDown () override { dfs_test_teardown (); } - t8_eclass_t eclass; - const t8_scheme *scheme; - t8_element_t *element; + t8_eclass_t eclass; /**< Eclass of the tree to be used for DFS testing. */ + const t8_scheme *scheme; /**< Scheme to be used for DFS testing. */ + t8_element_t *element; /**< Current element in the DFS traversal. */ }; -#endif /*T8_GTEST_SCHEME_HELPER_H*/ +#endif /* T8_GTEST_DFS_BASE_HXX */