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

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/test_t8code_api.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ jobs:
&& echo BUILD_TYPE="$BUILD_TYPE" >> $GITHUB_ENV
&& echo SC_PATH="$SC_PATH" >> $GITHUB_ENV
&& echo P4EST_PATH="$P4EST_PATH" >> $GITHUB_ENV

#
# T8CODE
#
Expand Down
20 changes: 20 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
cmake_minimum_required( VERSION 3.16 )

include( cmake/GitProjectVersion.cmake )
include( FetchContent )

project(
T8CODE
Expand All @@ -33,6 +34,17 @@ include( GNUInstallDirs)
include( CTest )
include( CMakeDependentOption )

FetchContent_Declare(
googletest
GIT_REPOSITORY "https://github.com/DLR-SC/googletest_mpi.git"
GIT_TAG 98bfff426b057400268a00f97677d749a9e25096 #v1.17.0_mpi
GIT_PROGRESS TRUE
)

set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
mark_as_advanced( FORCE gtest_force_shared_crt)


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 `-pedantic` as done in the Github CI." OFF )
option( T8CODE_BUILD_WALL "Compile t8code with `-Wall` as done in the Github CI." OFF )
Expand Down Expand Up @@ -112,13 +124,19 @@ if( T8CODE_ENABLE_MPI )
else()
find_package( MPI 3.0 COMPONENTS C REQUIRED )
endif()
set (gtest_disable_mpi OFF CACHE BOOL "disable gtest mpi support" FORCE)

if( NOT MPIEXEC_EXECUTABLE )
message( FATAL_ERROR "MPIEXEC was not found" )
endif()
set( SC_ENABLE_MPI ON )
else()
set( gtest_disable_mpi ON CACHE BOOL "disable gtest mpi support" FORCE)
endif()

mark_as_advanced( FORCE gtest_disable_mpi)


if( T8CODE_ENABLE_VTK )
find_package( VTK REQUIRED COMPONENTS
IOXML CommonExecutionModel CommonDataModel
Expand Down Expand Up @@ -261,6 +279,8 @@ else()
mark_as_advanced( FORCE ${_new_p4est_vars} )
endif()

FetchContent_MakeAvailable( googletest )

add_subdirectory( ${CMAKE_CURRENT_LIST_DIR}/src )

if( T8CODE_BUILD_MESH_HANDLE )
Expand Down
6 changes: 5 additions & 1 deletion api/t8_fortran_interface/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,12 @@
target_sources( T8 PRIVATE t8_fortran_interface.c )
target_sources( T8 PRIVATE t8_fortran_interface_mod.f90 )


# Add this directory to header search path.
target_include_directories( T8 PRIVATE ${CMAKE_CURRENT_LIST_DIR} )
target_include_directories( T8 PUBLIC
$<BUILD_INTERFACE:${CMAKE_BINARY_DIR}/src>
$<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}>
Comment thread
sandro-elsweijer marked this conversation as resolved.
)

# Install header files.
install(
Expand Down
10 changes: 4 additions & 6 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,6 @@
# along with t8code; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.

add_library( gtest ${CMAKE_CURRENT_LIST_DIR}/../thirdparty/googletest-mpi/gtest/gtest-all.cc )
target_include_directories( gtest SYSTEM PUBLIC ${CMAKE_CURRENT_LIST_DIR}/../thirdparty/googletest-mpi ${CMAKE_CURRENT_LIST_DIR}/.. )

# Function to add a test executable and register it with CTest.
# The test executable is built from the provided source files.
function( add_t8_test )
Expand All @@ -32,15 +29,17 @@ function( add_t8_test )
# Get the path of the first file listed in the SOURCES list and use it to determine the build directory.
list (LENGTH ADD_T8_TEST_SOURCES TEST_SOURCES_LENGTH)
list(GET ADD_T8_TEST_SOURCES 0 TEST_SOURCE)

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} )

# Link base libraries.
target_include_directories( ${ADD_T8_TEST_NAME} PRIVATE ${CMAKE_BINARY_DIR}/src )
target_link_libraries( ${ADD_T8_TEST_NAME} PRIVATE T8 gtest pthread )
target_include_directories( ${ADD_T8_TEST_NAME} PRIVATE ${CMAKE_SOURCE_DIR} )

target_link_libraries( ${ADD_T8_TEST_NAME} PRIVATE GTest::gtest_main T8 pthread )

# Check if test is a Fortran or mesh handle file.
string( FIND ${ADD_T8_TEST_NAME} "fortran" is_fortran_file )
Expand Down Expand Up @@ -77,7 +76,6 @@ function( add_t8_test )
else( T8CODE_ENABLE_MPI )
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} ${TEST_BUILD_DIR}/${ADD_T8_TEST_NAME} )
if ( T8CODE_CODE_COVERAGE )
# Extent time that a single test is allowed to run to collect coverage information (as this naturally takes more time).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,9 @@ std::function<t8_cmesh_t (const t8_eclass_t, sc_MPI_Comm, const double *, t8_loc
hyper_pad = t8_cmesh_new_hypercube_pad_ext_wrapper;

std::string
make_param_string (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, const int is_periodic_x, const int is_periodic_y,
const int is_periodic_z, const int use_axis_aligned)
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,
const int is_periodic_y, const int is_periodic_z, const int use_axis_aligned)
{
std::string delimiter = std::string ("_");
std::string geometry = use_axis_aligned ? std::string ("AxisAligned") : std::string ("LinearGeom");
Expand All @@ -71,9 +71,9 @@ std::function<std::string (const t8_eclass_t, sc_MPI_Comm, const double *, t8_lo
make_param_string_wrapper = make_param_string;

inline bool
rule (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, const int periodic_x, const int periodic_y, const int periodic_z,
const int use_axis_aligned)
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,
const int periodic_y, const int periodic_z, const int use_axis_aligned)
{
const int dim = t8_eclass_to_dimension[eclass];
if (dim == 0 && (polygons_x > 1 || polygons_y > 1 || polygons_z > 1))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ make_param_string (const t8_eclass_t eclass, const sc_MPI_Comm comm, const int d
std::string bcast = do_bcast ? std::string ("bcast") : std::string ("noBcast");
std::string partition = do_partition ? std::string ("partition") : std::string ("noPartition");
std::string periodic_string = periodic ? std::string ("periodic") : std::string ("noPeriodic");
std::string params
= delimiter + t8_eclass_to_string[eclass] + delimiter + bcast + delimiter + partition + delimiter + periodic_string;
std::string params = delimiter + t8_eclass_to_string[eclass] + delimiter + cmesh_params::comm_to_string (comm)
+ delimiter + bcast + delimiter + partition + delimiter + periodic_string;

return params;
}
Expand Down
4 changes: 2 additions & 2 deletions test/t8_cmesh_generator/t8_gtest_cmesh_cartestian_product.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ vector_to_iter_pair (const std::vector<Args>& vec)
*/
template <typename Args, typename B>
bool
increment (const B& begins, std::pair<Args, Args>& r)
increment ([[maybe_unused]] const B& begins, std::pair<Args, Args>& r)
{
++r.first;
if (r.first == r.second) {
Expand Down Expand Up @@ -177,7 +177,7 @@ increment (const B& begins, std::pair<T, T>& r, std::pair<TT, TT>&... rr)

template <typename... Args>
inline bool
no_rule (Args... params)
no_rule ([[maybe_unused]] Args... params)
{
return true;
}
Expand Down
4 changes: 2 additions & 2 deletions test/t8_data/t8_enlarged_stdtypes.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ struct t8_data_handler<enlarged_data<int>>
* \return An integer representing the size of the data.
*/
inline int
size (const enlarged_data<int> &item, sc_MPI_Comm comm)
size ([[maybe_unused]] const enlarged_data<int> &item, sc_MPI_Comm comm)
{
int size;
const int mpiret = sc_MPI_Pack_size (2, sc_MPI_INT, comm, &size);
Expand Down Expand Up @@ -138,7 +138,7 @@ struct t8_data_handler<enlarged_data<double>>
* \return An integer representing the size of the data.
*/
inline int
size (const enlarged_data<double> &item, sc_MPI_Comm comm)
size ([[maybe_unused]] const enlarged_data<double> &item, sc_MPI_Comm comm)
{
int int_size;
int mpiret = sc_MPI_Pack_size (1, sc_MPI_INT, comm, &int_size);
Expand Down
16 changes: 8 additions & 8 deletions test/t8_gtest_custom_assertion.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ element_equality (const char *ts_expr, const char *tree_class_expr, const char *
const t8_element_t *elem_2)
{
if (scheme->element_is_equal (eclass, elem_1, elem_2)) {
return testing::AssertionSuccess ();
return testing::AssertionSuccess (false);
}
else {
#if T8_ENABLE_DEBUG
Expand All @@ -60,14 +60,14 @@ element_equality (const char *ts_expr, const char *tree_class_expr, const char *
const t8_eclass_t tree_class = scheme->get_eclass_scheme_eclass (eclass);
scheme->element_to_string (eclass, elem_1, elem_1_string, BUFSIZ);
scheme->element_to_string (eclass, elem_2, elem_2_string, BUFSIZ);
return testing::AssertionFailure () << elem_1_expr << " " << elem_1_string << " is not equal to \n"
<< elem_2_expr << " " << elem_2_string << " given scheme " << ts_expr
<< " and tree class " << tree_class_expr << " "
<< t8_eclass_to_string[tree_class];
return testing::AssertionFailure (false)
<< elem_1_expr << " " << elem_1_string << " is not equal to \n"
<< elem_2_expr << " " << elem_2_string << " given scheme " << ts_expr << " and tree class "
<< tree_class_expr << " " << t8_eclass_to_string[tree_class];
#else
return testing::AssertionFailure () << elem_1_expr << " is not equal to \n"
<< elem_2_expr << " given scheme " << ts_expr << " and tree class "
<< tree_class_expr;
return testing::AssertionFailure (false)
<< elem_1_expr << " is not equal to \n"
<< elem_2_expr << " given scheme " << ts_expr << " and tree class " << tree_class_expr;
#endif
}
}
Expand Down
5 changes: 5 additions & 0 deletions test/t8_gtest_main.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@
#include <t8.h>
#include <test/t8_gtest_memory_macros.hxx>

/* Check that MPI is configured consistently */
#if (defined(T8_ENABLE_MPI) && defined(gtest_disable_mpi)) || (defined(T8_ENABLE_MPI) && defined(gtest_disable_mpi))
#error "MPI configured differently in t8code and gtest"
#endif

int
main (int argc, char **argv)
{
Expand Down
1 change: 0 additions & 1 deletion test/t8_gtest_memory_macros.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
#ifndef T8_GTEST_MEMORY_MACROS_HXX
#define T8_GTEST_MEMORY_MACROS_HXX

#include <gtest/gtest.h>
#include <t8_eclass.h>
#include <t8_schemes/t8_default/t8_default.hxx>
#include <iostream>
Expand Down
10 changes: 0 additions & 10 deletions thirdparty/README.md

This file was deleted.

134 changes: 0 additions & 134 deletions thirdparty/googletest-mpi/README.md

This file was deleted.

Loading