Skip to content

Commit bb17f21

Browse files
authored
Add interface for per element operations (#35)
support user interface using omegah mesh This includes: - definition of linear and quadratic shape functions for simplicies (edges, triangles, and tets) - support for user/application element-to-dof ordering and the subsequent index into the arrays holding field data - i.e., the user/application has a different definition of the ordering/numbering of dof holders in a triangle/tet than what MeshFields uses. Note, this PR does not yet include programmatic access to the built-in/native MeshFields canonical ordering for each type of element+shape function combination. - tests using dummy mesh and Omega_h data to exercise the APIs Details: add test for tetrahedrons e118072 add test that creates a field over an omegah mesh and evaluates the field d49551c add tests that check the results of the evaluate operation using linear shape function @ centroid d49551c linear shape function @ interior 82f3a4f quadratic shape function @ centroid 34b26b3 quadratic shape function @ interior 34b26b3 quadratic shape function with linear analytic function @ interior 34b26b3 add helper method that writes the field to Omega_h tags for rendering/etc. bug in serialize see #39 extend evaluate to accept a multiple points per element 2535f17 documentation - class/struct interaction documents - nomenclature add mesh+fields interface and implement with omegah a87c33c
1 parent 94ac58e commit bb17f21

28 files changed

+7907
-702
lines changed

.github/workflows/coverage.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@ jobs:
3030
3131
- name: Install additional dependencies
3232
run: |
33-
sudo apt-get install doxygen
34-
sudo apt-get install graphviz
35-
sudo apt-get install libhdf5-mpi-dev
33+
sudo apt-get install -yq doxygen
34+
sudo apt-get install -yq graphviz
35+
sudo apt-get install -yq libhdf5-mpi-dev
3636
3737
## Kokkos
3838
- name: Kokkos Checkout repo
@@ -108,7 +108,7 @@ jobs:
108108

109109
- name: Install lcov 1.16
110110
shell: bash
111-
run: sudo apt-get install lcov
111+
run: sudo apt-get install -yq lcov
112112

113113
- name: MeshFields Configure CMake
114114
shell: bash

CMakeLists.txt

Lines changed: 76 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -20,23 +20,50 @@ set(MESHFIELD_HEADERS
2020
src/MeshField_Utility.hpp
2121
src/MeshField_Macros.hpp
2222
src/KokkosController.hpp
23+
src/MeshField_Element.hpp
24+
src/MeshField_Shape.hpp
25+
src/MeshField_Fail.hpp
26+
src/MeshField_For.hpp
27+
src/MeshField_Reduce.hpp
28+
src/MeshField_Scan.hpp
29+
src/MeshField_Field.hpp
2330
src/MeshField.hpp
31+
"${CMAKE_CURRENT_BINARY_DIR}/MeshField_Config.hpp"
2432
)
25-
2633
if(MeshFields_USE_Cabana)
27-
list(APPEND MESHFIELD_HEADERS src/CabanaController.hpp)
34+
list(APPEND MESHFIELD_HEADERS
35+
src/CabanaController.hpp
36+
src/MeshField_SimdFor.hpp)
2837
endif()
2938

30-
#create header only library
31-
add_library(meshFields INTERFACE)
39+
set(MESHFIELD_SOURCES
40+
src/MeshField_Fail.cpp
41+
)
42+
43+
add_library(meshFields ${MESHFIELD_SOURCES})
44+
3245
target_compile_features(meshFields INTERFACE cxx_std_17)
3346
target_include_directories(meshFields
34-
INTERFACE
47+
PUBLIC
48+
"$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}>" # for MeshField_Config.hpp
3549
"$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/src>"
3650
"$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>")
3751
target_link_libraries(meshFields INTERFACE Omega_h::omega_h)
52+
target_compile_definitions(meshFields INTERFACE ENABLE_CABANA)
53+
if(Kokkos_ENABLE_CUDA)
54+
target_compile_options(meshFields INTERFACE "--expt-relaxed-constexpr")
55+
endif()
56+
57+
#enable/disable exceptions
58+
option(MeshFields_USE_EXCEPTIONS "Enable throwing exceptions" ON)
59+
message(STATUS "Exceptions: ${MeshFields_USE_EXCEPTIONS}")
60+
61+
#pass cmake options to the source
62+
configure_file(
63+
"${CMAKE_CURRENT_SOURCE_DIR}/src/MeshField_Config.hpp.in"
64+
"${CMAKE_CURRENT_BINARY_DIR}/MeshField_Config.hpp")
65+
3866
if(MeshFields_USE_Cabana)
39-
message(STATUS "Cabana found")
4067
target_link_libraries(meshFields INTERFACE Cabana::Core)
4168
target_compile_definitions(meshFields INTERFACE MESHFIELDS_ENABLE_CABANA)
4269
endif()
@@ -54,6 +81,29 @@ if(MeshFields_USE_CTAGS)
5481
add_dependencies(meshFields tags)
5582
endif()
5683

84+
# Set options for doxygen documentation
85+
find_package(Doxygen)
86+
if(DOXYGEN_FOUND)
87+
configure_file(
88+
${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile.in
89+
${CMAKE_CURRENT_BINARY_DIR}/Doxyfile @ONLY
90+
)
91+
add_custom_target(doc
92+
${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile
93+
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
94+
COMMENT "Generating API documentation with Doxygen" VERBATIM
95+
)
96+
configure_file(
97+
${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile_internal.in
98+
${CMAKE_CURRENT_BINARY_DIR}/Doxyfile_internal @ONLY
99+
)
100+
add_custom_target(docInternal
101+
${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile_internal
102+
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
103+
COMMENT "Generating Internal API documentation with Doxygen" VERBATIM
104+
)
105+
endif()
106+
57107
#Settings options for testing
58108
enable_testing()
59109
include(CTest)
@@ -101,22 +151,35 @@ function(will_fail_valgrind_test_func TEST_NAME)
101151
endif()
102152
endfunction()
103153

154+
function(meshfields_add_exe EXE_NAME EXE_SRC)
155+
add_executable(${EXE_NAME} ${EXE_SRC})
156+
target_link_libraries(${EXE_NAME} PRIVATE meshFields)
157+
endfunction()
104158

105159
# Creating minimal reproduction of error
106-
add_executable(KokkosTests test/testKokkos.cpp)
107-
target_link_libraries(KokkosTests PRIVATE meshFields)
160+
meshfields_add_exe(KokkosTests test/testKokkos.cpp)
161+
meshfields_add_exe(SerializationTests test/testSerialize.cpp)
162+
meshfields_add_exe(ElementTests test/testElement.cpp)
163+
meshfields_add_exe(OmegahElementTests test/testOmegahElement.cpp)
164+
meshfields_add_exe(OmegahCoordFieldTest test/testOmegahCoordField.cpp)
165+
meshfields_add_exe(ExceptionTest test/testExceptions.cpp)
108166

109167
if(MeshFields_USE_Cabana)
110-
add_executable(CabanaTests test/testCabana.cpp)
111-
target_link_libraries(CabanaTests PRIVATE meshFields)
168+
meshfields_add_exe(CabanaTests test/testCabana.cpp)
112169
test_func(CabanaTests ./CabanaTests)
113170
endif()
114171

115-
add_executable(SerializationTests test/testSerialize.cpp)
116-
target_link_libraries(SerializationTests PRIVATE meshFields)
117-
118172
test_func(KokkosTests ./KokkosTests)
119173
test_func(SerializationTests ./SerializationTests)
174+
test_func(ElementTests ./ElementTests)
175+
test_func(OmegahElementTests ./OmegahElementTests)
176+
test_func(OmegahCoordFieldTest ./OmegahCoordFieldTest)
177+
if(MeshFields_USE_EXCEPTIONS)
178+
# exception caught - no error
179+
test_func(ExceptionTest ./ExceptionTest)
180+
else()
181+
will_fail_test_func(ExceptionTest ./ExceptionTest)
182+
endif()
120183

121184
#Code Coverage set up -------------------------------------------------------
122185

0 commit comments

Comments
 (0)