-
Notifications
You must be signed in to change notification settings - Fork 52
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #871 from DLR-AMR/enhance-cmesh-testing
Enhance cmesh testing
- Loading branch information
Showing
10 changed files
with
666 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
/* | ||
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) 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. | ||
*/ | ||
|
||
#ifndef T8_GTEST_CMESH_COMM_CREATOR_HXX | ||
#define T8_GTEST_CMESH_COMM_CREATOR_HXX | ||
|
||
#include <vector> | ||
|
||
#include "test/t8_cmesh_generator/t8_cmesh_parametrized_examples/t8_cmesh_new_prism_cake_param.hxx" | ||
#include "test/t8_cmesh_generator/t8_cmesh_parametrized_examples/t8_cmesh_new_from_class_param.hxx" | ||
#include "test/t8_cmesh_generator/t8_cmesh_parametrized_examples/t8_cmesh_new_bigmesh_param.hxx" | ||
#include "test/t8_cmesh_generator/t8_gtest_cmesh_cartestian_product.hxx" | ||
#include "test/t8_cmesh_generator/t8_gtest_cmesh_sum_of_sets.hxx" | ||
|
||
T8_EXTERN_C_BEGIN (); | ||
|
||
/** | ||
* lambda to pass to an INSTANTIATE_TEST_SUITE_P to print the current cmesh_example_base | ||
* | ||
*/ | ||
auto pretty_print_base_example = [] (const testing::TestParamInfo<cmesh_example_base *> &info) { | ||
std::string name; | ||
info.param->param_to_string (name); | ||
return name; | ||
}; | ||
|
||
namespace cmesh_list | ||
{ | ||
std::vector<example_set *> cart_prod_vec | ||
= { new_from_class::cmesh_example, new_prism_cake::cmesh_example, new_bigmesh::cmesh_example }; | ||
|
||
cmesh_sum_of_sets cmesh_sums (cart_prod_vec); | ||
|
||
} // namespace cmesh_list | ||
|
||
#define AllCmeshsParam \ | ||
::testing::ValuesIn (cmesh_list::cmesh_sums.cmesh_examples.begin (), cmesh_list::cmesh_sums.cmesh_examples.end ()) | ||
|
||
T8_EXTERN_C_END (); | ||
|
||
#endif /* T8_GTEST_CMESH_COMM_CREATOR_HXX */ |
57 changes: 57 additions & 0 deletions
57
test/t8_cmesh_generator/t8_cmesh_parametrized_examples/t8_cmesh_new_bigmesh_param.hxx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
/* | ||
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) 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. | ||
*/ | ||
|
||
#ifndef T8_CMESH_NEW_BIGMESH_PARAM_HXX | ||
#define T8_CMESH_NEW_BIGMESH_PARAM_HXX | ||
|
||
#include "test/t8_cmesh_generator/t8_gtest_cmesh_cartestian_product.hxx" | ||
#include "test/t8_cmesh_generator/t8_cmesh_parametrized_examples/t8_cmesh_params.hxx" | ||
#include "t8_cmesh/t8_cmesh_examples.h" | ||
#include <t8_eclass.h> | ||
|
||
namespace new_bigmesh | ||
{ | ||
std::function<t8_cmesh_t (t8_eclass_t, int, sc_MPI_Comm)> bigmesh = t8_cmesh_new_bigmesh; | ||
|
||
std::string | ||
make_param_string (const t8_eclass_t eclass, const int num_trees, const sc_MPI_Comm comm) | ||
{ | ||
std::string delimiter = std::string ("_"); | ||
std::string params = delimiter + t8_eclass_to_string[eclass] + delimiter + std::to_string (num_trees) + delimiter | ||
+ cmesh_params::comm_to_string (comm); | ||
return params; | ||
} | ||
|
||
std::function<std::string (const t8_eclass_t, const int, const sc_MPI_Comm)> make_param_string_wrapper | ||
= make_param_string; | ||
|
||
example_set *cmesh_example | ||
= (example_set *) new cmesh_cartesian_product_params<decltype (cmesh_params::eclasses.begin ()), | ||
decltype (cmesh_params::large_mesh.begin ()), | ||
decltype (cmesh_params::my_comms.begin ())> ( | ||
std::make_pair (cmesh_params::eclasses.begin (), cmesh_params::eclasses.end ()), | ||
std::make_pair (cmesh_params::large_mesh.begin (), cmesh_params::large_mesh.end ()), | ||
std::make_pair (cmesh_params::my_comms.begin (), cmesh_params::my_comms.end ()), bigmesh, make_param_string_wrapper, | ||
"t8_cmesh_new_bigmesh_"); | ||
} // namespace new_bigmesh | ||
|
||
#endif /* T8_CMESH_NEW_BIGMESH_PARAM_HXX */ |
56 changes: 56 additions & 0 deletions
56
test/t8_cmesh_generator/t8_cmesh_parametrized_examples/t8_cmesh_new_from_class_param.hxx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
/* | ||
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) 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. | ||
*/ | ||
|
||
#include "test/t8_cmesh_generator/t8_gtest_cmesh_cartestian_product.hxx" | ||
#include "test/t8_cmesh_generator/t8_cmesh_parametrized_examples/t8_cmesh_params.hxx" | ||
#include <t8_cmesh/t8_cmesh_examples.h> | ||
#include <t8_eclass.h> | ||
|
||
#ifndef T8_CMESH_NEW_FROM_CLASS_PARAM | ||
#define T8_CMESH_NEW_FROM_CLASS_PARAM | ||
|
||
namespace new_from_class | ||
{ | ||
|
||
std::string | ||
make_param_string (const t8_eclass_t &eclass, const sc_MPI_Comm &comm) | ||
{ | ||
std::string delimiter = std::string ("_"); | ||
std::string params | ||
= delimiter + std::string (t8_eclass_to_string[eclass]) + delimiter + cmesh_params::comm_to_string (comm); | ||
return params; | ||
} | ||
|
||
std::function<std::string (const t8_eclass_t &, const sc_MPI_Comm &)> print_function = make_param_string; | ||
|
||
std::function<t8_cmesh_t (t8_eclass_t, sc_MPI_Comm)> new_from_class_wrapper = t8_cmesh_new_from_class; | ||
|
||
example_set *cmesh_example | ||
= (example_set *) new cmesh_cartesian_product_params<decltype (cmesh_params::eclasses.begin ()), | ||
decltype (cmesh_params::my_comms.begin ())> ( | ||
std::make_pair (cmesh_params::eclasses.begin (), cmesh_params::eclasses.end ()), | ||
std::make_pair (cmesh_params::my_comms.begin (), cmesh_params::my_comms.end ()), new_from_class_wrapper, | ||
print_function, "t8_cmesh_new_from_class_"); | ||
|
||
} // namespace new_from_class | ||
|
||
#endif /* T8_CMESH_NEW_FROM_CLASS_PARAM */ |
52 changes: 52 additions & 0 deletions
52
test/t8_cmesh_generator/t8_cmesh_parametrized_examples/t8_cmesh_new_prism_cake_param.hxx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
/* | ||
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) 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. | ||
*/ | ||
|
||
#include "test/t8_cmesh_generator/t8_gtest_cmesh_cartestian_product.hxx" | ||
#include "test/t8_cmesh_generator/t8_cmesh_parametrized_examples/t8_cmesh_params.hxx" | ||
#include <t8_cmesh/t8_cmesh_examples.h> | ||
|
||
#ifndef T8_CMESH_NEW_PRISM_CAKE_PARAM_HXX | ||
#define T8_CMESH_NEW_PRISM_CAKE_PARAM_HXX | ||
|
||
namespace new_prism_cake | ||
{ | ||
std::function<t8_cmesh_t (sc_MPI_Comm, int)> prism_cake = t8_cmesh_new_prism_cake; | ||
|
||
std::string | ||
make_param_string (const sc_MPI_Comm &comm, const int &num_prisms) | ||
{ | ||
std::string delimiter = std::string ("_"); | ||
std::string params = delimiter + cmesh_params::comm_to_string (comm) + delimiter + std::to_string (num_prisms); | ||
return params; | ||
} | ||
|
||
std::function<std::string (const sc_MPI_Comm &, const int &)> make_param_string_wrapper = make_param_string; | ||
|
||
example_set *cmesh_example | ||
= (example_set *) new cmesh_cartesian_product_params<decltype (cmesh_params::my_comms.begin ()), | ||
decltype (cmesh_params::num_prisms.begin ())> ( | ||
std::make_pair (cmesh_params::my_comms.begin (), cmesh_params::my_comms.end ()), | ||
std::make_pair (cmesh_params::num_prisms.begin (), cmesh_params::num_prisms.end ()), prism_cake, | ||
make_param_string_wrapper, "t8_cmesh_new_prism_cake_"); | ||
} // namespace new_prism_cake | ||
|
||
#endif /* T8_CMESH_NEW_PRISM_CAKE_PARAM_HXX */ |
Oops, something went wrong.