Skip to content

Commit ae1d2d3

Browse files
committed
Cleanup + add temporary coverage target
1 parent aeeaf4d commit ae1d2d3

File tree

3 files changed

+36
-480
lines changed

3 files changed

+36
-480
lines changed

agglomeration_poisson/CMakeLists.txt

Lines changed: 36 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,7 @@
22
SET(TARGET "agglomeration_poisson")
33

44
# Declare all source files the target consists of.
5-
SET(TARGET_SRC
6-
${TARGET}.cc
7-
source/agglomeration_handler.cc
8-
source/mapping_box.cc
9-
)
10-
11-
# Add include directory
12-
INCLUDE_DIRECTORIES(include)
13-
5+
FILE(GLOB TARGET_SRC CONFIGURE_DEPENDS ${TARGET}.cc ${CMAKE_CURRENT_SOURCE_DIR}/source/*.cc)
146

157
CMAKE_MINIMUM_REQUIRED(VERSION 3.13.4)
168

@@ -29,5 +21,38 @@ DEAL_II_INITIALIZE_CACHED_VARIABLES()
2921
PROJECT(${TARGET})
3022
DEAL_II_INVOKE_AUTOPILOT()
3123

32-
# Define SOURCE_DIR for mesh file paths
33-
target_compile_definitions(${TARGET} PRIVATE SOURCE_DIR="${CMAKE_SOURCE_DIR}")
24+
TARGET_INCLUDE_DIRECTORIES(${TARGET} PRIVATE include)
25+
TARGET_COMPILE_DEFINITIONS(${TARGET} PRIVATE SOURCE_DIR="${CMAKE_SOURCE_DIR}")
26+
27+
28+
29+
# -------------------------------------------------------------------
30+
# Coverage target: "make coverage"
31+
# -------------------------------------------------------------------
32+
target_compile_options(${TARGET} PRIVATE
33+
-O0
34+
-g
35+
--coverage
36+
-fprofile-arcs
37+
-fprofile-update=atomic
38+
-ftest-coverage
39+
)
40+
target_link_options(${TARGET} PRIVATE "--coverage")
41+
42+
find_program(LCOV_EXEC lcov)
43+
find_program(GENHTML_EXEC genhtml)
44+
45+
if(LCOV_EXEC AND GENHTML_EXEC)
46+
add_custom_target(coverage
47+
COMMAND ${CMAKE_COMMAND} -E echo "Generating coverage report..."
48+
COMMAND ${CMAKE_COMMAND} -E rm -rf coverage_report coverage.info
49+
COMMAND ${LCOV_EXEC} --capture --directory . --output-file coverage.info
50+
COMMAND ${LCOV_EXEC} --extract coverage.info "*${CMAKE_SOURCE_DIR}*" --output-file coverage.info
51+
COMMAND ${GENHTML_EXEC} --function-coverage --output-directory coverage_report coverage.info
52+
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
53+
COMMENT "Running LCOV + genhtml"
54+
VERBATIM
55+
)
56+
else()
57+
message(WARNING "lcov/genhtml not found - coverage target will not be available.")
58+
endif()

agglomeration_poisson/include/agglomeration_handler.h

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -378,21 +378,6 @@ class AgglomerationHandler : public Subscriptor
378378
const typename Triangulation<dim, spacedim>::active_cell_iterator
379379
&master_cell) const;
380380

381-
/**
382-
* Display the indices of the vector identifying which cell is agglomerated
383-
* with which master.
384-
*/
385-
template <class StreamType>
386-
void
387-
print_agglomeration(StreamType &out)
388-
{
389-
for (const auto &cell : tria->active_cell_iterators())
390-
out << "Cell with index: " << cell->active_cell_index()
391-
<< " has associated value: "
392-
<< master_slave_relationships[cell->global_active_cell_index()]
393-
<< std::endl;
394-
}
395-
396381
/**
397382
*
398383
* Return a constant reference to the DoFHandler underlying the

0 commit comments

Comments
 (0)