Skip to content

Commit 3526184

Browse files
Merge branch 'main' into cmesh-mpicomm
2 parents 3f2eb23 + 50b167e commit 3526184

File tree

18 files changed

+146
-141
lines changed

18 files changed

+146
-141
lines changed

CMakeLists.txt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,14 @@ if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
9191
"Debug" "Release" "RelWithDebInfo")
9292
endif()
9393

94+
if( CMAKE_BUILD_TYPE STREQUAL "Debug" )
95+
# Option to generate code coverage target.
96+
option( T8CODE_CODE_COVERAGE "Enable code coverage reporting" OFF)
97+
if(T8CODE_CODE_COVERAGE)
98+
include(./cmake/CodeCoverage.cmake)
99+
endif()
100+
endif()
101+
94102
set(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake" ${CMAKE_MODULE_PATH})
95103

96104
if( T8CODE_BUILD_FORTRAN_INTERFACE )

benchmarks/t8_time_fractal.cxx

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
#include <sc_options.h>
3636

3737
/* Refine a tree with quadrilateral elements.
38-
* At every second adaptcall (level is even) remove the central elements
38+
* At every second adaptcall (level is even) remove the central elements
3939
* of the mesh or leave them untouched. Refine the remaining elements.
4040
*
4141
* |x|x|x|x| |x|x|x|x|
@@ -75,7 +75,7 @@ t8_adapt_menger_quad (t8_forest_t forest, [[maybe_unused]] t8_forest_t forest_fr
7575
}
7676

7777
/* Refine a tree with triangular elements.
78-
* At every adaptcall remove the central element with child id 2
78+
* At every adaptcall remove the central element with child id 2
7979
* of the mesh or leave it untouched. Refine the remaining elements.
8080
*/
8181
static int
@@ -102,7 +102,7 @@ t8_adapt_sierpinski_tri (t8_forest_t forest, [[maybe_unused]] t8_forest_t forest
102102
}
103103

104104
/* Refine a tree with hexahedral elements.
105-
* At every second adaptcall (level is even) remove the central elements
105+
* At every second adaptcall (level is even) remove the central elements
106106
* of the mesh or leave them untouched. Refine the remaining elements.
107107
*/
108108
static int
@@ -153,7 +153,7 @@ t8_adapt_menger_hex (t8_forest_t forest, [[maybe_unused]] t8_forest_t forest_fro
153153
}
154154

155155
/* Refine a tree with tetrahedral elements.
156-
* At every adaptcall remove the elements with child id 2, 3, 5 and 6
156+
* At every adaptcall remove the elements with child id 2, 3, 5 and 6
157157
* of the mesh or leave it untouched. Refine the remaining elements.
158158
*/
159159
static int
@@ -180,7 +180,7 @@ t8_adapt_sierpinski_tet (t8_forest_t forest, [[maybe_unused]] t8_forest_t forest
180180
}
181181

182182
/* Refine a tree with prism elements.
183-
* At every adaptcall remove the elements with child id 2 and 6
183+
* At every adaptcall remove the elements with child id 2 and 6
184184
* of the mesh or leave it untouched. Refine the remaining elements.
185185
*/
186186
static int
@@ -207,7 +207,7 @@ t8_adapt_sierpinski_prism (t8_forest_t forest, [[maybe_unused]] t8_forest_t fore
207207
}
208208

209209
/* Refine a tree with pyramid elements.
210-
* At every adaptcall remove the elements with child id 1, 3, 5, 6 and 8
210+
* At every adaptcall remove the elements with child id 1, 3, 5, 6 and 8
211211
* of the mesh or leave it untouched. Refine the remaining elements.
212212
*/
213213
static int
@@ -252,7 +252,7 @@ t8_adapt_coarse ([[maybe_unused]] t8_forest_t forest, [[maybe_unused]] t8_forest
252252
* \param [in] level_end Final level of the fractal.
253253
* \param [in] iterative 1 if fractal is constructed iterative
254254
* 0 if recursive
255-
* \param [in] remove 1 if elements that will not get refined will be
255+
* \param [in] remove 1 if elements that will not get refined will be
256256
* removed instead.
257257
* \param [in] trees Number of trees the forest will contain.
258258
* \param [in] eclass Element type for each tree.
@@ -267,12 +267,12 @@ t8_construct_fractal (int level_initial, int level_end, const int iterative, con
267267
T8_ASSERT (eclass == T8_ECLASS_QUAD || eclass == T8_ECLASS_TRIANGLE || eclass == T8_ECLASS_HEX
268268
|| eclass == T8_ECLASS_TET || eclass == T8_ECLASS_PRISM || eclass == T8_ECLASS_PYRAMID);
269269

270-
/* Quadrilateral and hexahedron elements must have an even initial level
270+
/* Quadrilateral and hexahedron elements must have an even initial level
271271
* greater 0, such that the refinement pattern can be applied. */
272272
T8_ASSERT ((eclass == T8_ECLASS_QUAD || eclass == T8_ECLASS_HEX) && level_initial > 1 && 0 == level_initial % 2
273273
&& 0 == level_end % 2);
274274

275-
/* Set up userdata to adapt forest.
275+
/* Set up userdata to adapt forest.
276276
* user_data[0] -> level_end
277277
* user_data[1] -> {0, -2} -> return for adapt callback */
278278
int user_data[2] = { level_end, (remove == 1) ? -2 : remove };
@@ -385,7 +385,7 @@ main (int argc, char **argv)
385385

386386
if (sreturnA > BUFSIZ || sreturnB > BUFSIZ) {
387387
/* The usage string or help message was truncated */
388-
/* Note: gcc >= 7.1 prints a warning if we
388+
/* Note: gcc >= 7.1 prints a warning if we
389389
* do not check the return value of snprintf. */
390390
t8_debugf ("Warning: Truncated usage string and help message to '%s' and '%s'\n", usage, help);
391391
}
@@ -439,7 +439,7 @@ main (int argc, char **argv)
439439
sc_options_add_int (opt, 'c', "coarse", &coarse, 0, "Number of times to coarse hole mesh.");
440440
sc_options_add_int (opt, 'r', "runs", &runs, 1,
441441
"Number of times the fractal gets constructed. The default is 1.\n"
442-
"\t\t\t\t Note, the runntime summs up.");
442+
"\t\t\t\t Note, the runtime summs up.");
443443

444444
int parsed = sc_options_parse (t8_get_package_id (), SC_LP_ERROR, opt, argc, argv);
445445
if (helpme) {

cmake/CodeCoverage.cmake

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313
# Adds compiler flags necessary to be able to collect coverage information.
1414
#
1515
function(append_coverage_compiler_flags)
16-
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g --coverage" PARENT_SCOPE)
17-
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g --coverage" PARENT_SCOPE)
16+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g --coverage -O0" PARENT_SCOPE)
17+
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g --coverage -O0" PARENT_SCOPE)
1818
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} --coverage" PARENT_SCOPE)
1919
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} --coverage" PARENT_SCOPE)
2020
endfunction() # append_coverage_compiler_flags
@@ -79,8 +79,6 @@ function(setup_target_for_coverage)
7979

8080
# Generate HTML file using genhtml.
8181
COMMAND ${GENHTML_PATH} -o ${Coverage_NAME} ${Coverage_NAME}.info
82-
# Show result in terminal.
83-
COMMAND ${LCOV_PATH} --list ${Coverage_NAME}.info
8482

8583
BYPRODUCTS
8684
${Coverage_NAME}.base
@@ -95,9 +93,11 @@ function(setup_target_for_coverage)
9593
endfunction() # setup_target_for_coverage
9694

9795
# Call functions defined above with customized arguments.
96+
# Attention: For some gcov versions, you have to add --ignore-errors mismatch to the LCOV_ARGS.
97+
# This seems to be a common gcov problem.
9898
append_coverage_compiler_flags()
9999
setup_target_for_coverage(
100100
NAME coverage
101-
EXCLUDE "${CMAKE_SOURCE_DIR}/sc*"
102-
LCOV_ARGS "--no-external"
101+
EXCLUDE "${CMAKE_SOURCE_DIR}/sc*" "${CMAKE_SOURCE_DIR}/p4est*" "${CMAKE_SOURCE_DIR}/test*" "${CMAKE_SOURCE_DIR}/thirdparty*" "${CMAKE_SOURCE_DIR}/tutorials*" "${CMAKE_SOURCE_DIR}/example*" "${CMAKE_SOURCE_DIR}/benchmarks*"
102+
LCOV_ARGS --no-external --ignore-errors gcov
103103
)

doc/author_lampert.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
I place my contributions to t8code under the FreeBSD license. Joshua Lampert (joshua.lampert@uni-hamburg.de)

src/CMakeLists.txt

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,6 @@ if( CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo" )
4141
endif()
4242

4343
if( CMAKE_BUILD_TYPE STREQUAL "Debug" )
44-
# Option to generate code coverage target.
45-
option( T8CODE_CODE_COVERAGE "Enable code coverage reporting" OFF)
46-
if(T8CODE_CODE_COVERAGE)
47-
include(CodeCoverage)
48-
endif()
49-
5044
set (T8_CXXFLAGS "${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_DEBUG}")
5145
set (T8_CFLAGS "${CMAKE_C_FLAGS} ${CMAKE_C_FLAGS_DEBUG}")
5246

src/t8_cmesh/t8_cmesh_commit.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -534,7 +534,7 @@ t8_cmesh_commit_from_stash (t8_cmesh_t cmesh, sc_MPI_Comm comm)
534534
}
535535

536536
/* TODO: set boundary face connections here.
537-
* not trivial if replicated and not level 3 face_knowledg
537+
* not trivial if replicated and not level 3 face_knowledge
538538
* Edit: boundary face is default. If no face-connection is added then
539539
* we assume a boundary face.
540540
* TODO: Implement a debug check for mesh consistency between processes.

src/t8_cmesh/t8_cmesh_trees.cxx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ t8_cmesh_trees_start_part (const t8_cmesh_trees_t trees, const int proc, const t
214214
}
215215

216216
/**
217-
*
217+
*
218218
* Helper struct for sorting the number of ghost attributes by global id.
219219
* In order to sort them, we need the part ghost id to access the global id.
220220
* Thus, we store both the part id and the number of attributes.
@@ -262,7 +262,7 @@ t8_cmesh_allocate_ghost_num_atts_array (t8_locidx_t part_num_ghosts)
262262
* stored temporarily in the att_offset variable
263263
* we grow the part array by the needed amount of memory and set the
264264
* offsets appropriately */
265-
/* The workflow can be: call start_part, set tree and ghost classes maually, call
265+
/* The workflow can be: call start_part, set tree and ghost classes manually, call
266266
* init_attributes, call finish_part, successively call add_attributes
267267
* and also set all face neighbors (TODO: write function)*/
268268
void

src/t8_cmesh/t8_cmesh_vertex_connectivity/t8_cmesh_vertex_connectivity.cxx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,9 @@ t8_cmesh_get_global_vertices_of_tree (const t8_cmesh_t cmesh, const t8_locidx_t
6060
{
6161
T8_ASSERT (t8_cmesh_is_committed (cmesh));
6262
const auto global_vertices = cmesh->vertex_connectivity->get_global_vertices_of_tree (local_tree);
63-
*num_vertices = global_vertices.size ();
63+
if (num_vertices) {
64+
*num_vertices = global_vertices.size ();
65+
}
6466
return global_vertices.data ();
6567
}
6668

src/t8_cmesh/t8_cmesh_vertex_connectivity/t8_cmesh_vertex_connectivity.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ t8_cmesh_get_num_local_vertices (const t8_cmesh_t cmesh);
6666
/** Get the global vertex indices of a tree in its local vertex order.
6767
* \param [in] cmesh A committed cmesh.
6868
* \param [in] local_tree A local tree in \a cmesh.
69-
* \param [out] num_vertices The number of vertices of \a local_tree
69+
* \param [out] num_vertices The number of vertices of \a local_tree, if not null
7070
* \return The global vertices of \a local_tree
7171
*/
7272
const t8_gloidx_t *

src/t8_cmesh_readmshfile.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@
2121
*/
2222

2323
/** \file t8_cmesh_readmshfile.h
24-
* We define function here that serve to open a mesh file generated by
25-
* GMSH and consructing a cmesh from it.
24+
* We define a function here that serves to open a mesh file generated by
25+
* GMSH and constructing a cmesh from it.
2626
*/
2727

2828
#ifndef T8_CMESH_READMSHFILE_H

0 commit comments

Comments
 (0)