@@ -9,9 +9,12 @@ option(MeshFields_USE_Cabana "Build with the Cabana storage backend" OFF)
99
1010find_package (Kokkos REQUIRED)
1111find_package (Omega_h REQUIRED)
12- #Clear the omegah compilation flags that it passes to cuda. Using the
13- # kokkos target, and nvcc_wrapper, provide sufficient flags.
14- set_property (TARGET Omega_h::omega_h PROPERTY INTERFACE_COMPILE_OPTIONS "" )
12+ find_package (MPI REQUIRED)
13+
14+ # Verify Omega_h was built with Kokkos enabled
15+ if (NOT Omega_h_USE_Kokkos)
16+ message (FATAL_ERROR "Omega_h must be built with Kokkos enabled (Omega_h_USE_Kokkos=ON)" )
17+ endif ()
1518
1619if (MeshFields_USE_Cabana)
1720 find_package (Cabana 0.7.0 REQUIRED)
@@ -32,6 +35,7 @@ set(MESHFIELD_HEADERS
3235 src/MeshField_Scan.hpp
3336 src/MeshField_Field.hpp
3437 src/MeshField.hpp
38+ src/MeshField_SPR_ErrorEstimator.hpp
3539 "${CMAKE_CURRENT_BINARY_DIR} /MeshField_Config.hpp"
3640)
3741if (MeshFields_USE_Cabana)
@@ -112,8 +116,8 @@ endif()
112116enable_testing ()
113117include (CTest)
114118
115- option (IS_TESTING "Build for CTest" OFF )
116- message (STATUS "IS_TESTING : ${IS_TESTING } " )
119+ option (MeshFields_IS_TESTING "Build for CTest" OFF )
120+ message (STATUS "MeshFields_IS_TESTING : ${MeshFields_IS_TESTING } " )
117121
118122#check for valgrind
119123find_program (VALGRIND_CMD valgrind DOC "Location of the valgrind program" )
@@ -124,79 +128,125 @@ function(test_func_impl TEST_NAME)
124128 # need to run as a cmake script to capture assert and other 'system failures'
125129 # https://cmake.org/cmake/help/latest/prop_test/WILL_FAIL.html#prop_test:WILL_FAIL
126130 add_test (NAME ${TEST_NAME} COMMAND ${CMAKE_COMMAND} -E env ${TEST_STR} )
131+ if (TEST ${TEST_NAME} )
132+ set_property (TEST ${TEST_NAME} PROPERTY LABELS "meshfields::base" )
133+ endif ()
127134endfunction (test_func_impl)
128135
129- function (test_func TEST_NAME)
136+ #smoke tests that are always enabled
137+ function (smoke_test_func TEST_NAME)
130138 test_func_impl(${TEST_NAME} ${ARGN} )
131139 if (TEST ${TEST_NAME} )
132- set_property (TEST ${TEST_NAME} PROPERTY LABELS "base" )
140+ set_property (TEST ${TEST_NAME} PROPERTY LABELS "meshfields::smoke" )
141+ endif ()
142+ endfunction (smoke_test_func)
143+
144+ function (test_func TEST_NAME)
145+ if (MeshFields_IS_TESTING)
146+ test_func_impl(${TEST_NAME} ${ARGN} )
133147 endif ()
134148endfunction (test_func)
135149
150+ function (add_test_property TEST_NAME PROP)
151+ if (TEST ${TEST_NAME} )
152+ set_property (TEST ${TEST_NAME} PROPERTY ${PROP} ${ARGN} )
153+ endif ()
154+ endfunction (add_test_property)
155+
136156# Unlike test_func, will_fail_test_func assumes the command for the test will fail
137157function (will_fail_test_func TEST_NAME)
138- test_func_impl(${TEST_NAME} ${ARGN} )
139- set_property (TEST ${TEST_NAME} PROPERTY WILL_FAIL TRUE )
140- if (TEST ${TEST_NAME} )
141- set_property (TEST ${TEST_NAME} PROPERTY LABELS "base" )
158+ if (MeshFields_IS_TESTING)
159+ test_func_impl(${TEST_NAME} ${ARGN} )
160+ set_property (TEST ${TEST_NAME} PROPERTY WILL_FAIL TRUE )
142161 endif ()
143162endfunction ()
144163
145164function (will_fail_valgrind_test_func TEST_NAME)
146- if (VALGRIND_CMD)
147- test_func_impl(${TEST_NAME} ${VALGRIND_CMD} ${ARGN} )
148- set_property (TEST ${TEST_NAME} PROPERTY
149- FAIL_REGULAR_EXPRESSION "Invalid read;Invalid write"
150- )
151- set_property (TEST ${TEST_NAME} PROPERTY WILL_FAIL TRUE )
152- if (TEST ${TEST_NAME} )
153- set_property (TEST ${TEST_NAME} PROPERTY LABELS "base" )
165+ if (MeshFields_IS_TESTING)
166+ if (VALGRIND_CMD)
167+ test_func_impl(${TEST_NAME} ${VALGRIND_CMD} ${ARGN} )
168+ set_property (TEST ${TEST_NAME} PROPERTY
169+ FAIL_REGULAR_EXPRESSION "Invalid read;Invalid write"
170+ )
171+ set_property (TEST ${TEST_NAME} PROPERTY WILL_FAIL TRUE )
154172 endif ()
155173 endif ()
156174endfunction ()
157175
158- function (meshfields_add_exe EXE_NAME EXE_SRC)
176+ #smoke executables are always built
177+ function (meshfields_add_smoke_exe EXE_NAME EXE_SRC)
159178 add_executable (${EXE_NAME} ${EXE_SRC} )
160179 target_link_libraries (${EXE_NAME} PRIVATE meshfields)
161180endfunction ()
162181
163- # Creating minimal reproduction of error
164- meshfields_add_exe(KokkosTests test /testKokkos.cpp)
182+ function (meshfields_add_exe EXE_NAME EXE_SRC)
183+ if (MeshFields_IS_TESTING)
184+ add_executable (${EXE_NAME} ${EXE_SRC} )
185+ target_link_libraries (${EXE_NAME} PRIVATE meshfields)
186+ endif ()
187+ endfunction ()
188+
189+ meshfields_add_smoke_exe(KokkosTests test /testKokkos.cpp)
165190meshfields_add_exe(SerializationTests test /testSerialize.cpp)
166191meshfields_add_exe(ElementTests test /testElement.cpp)
167192meshfields_add_exe(ElementJacobian1d test /testElementJacobian1d.cpp)
168193meshfields_add_exe(ElementJacobian2d test /testElementJacobian2d.cpp)
169194meshfields_add_exe(ElementJacobian3d test /testElementJacobian3d.cpp)
170195meshfields_add_exe(CountIntegrator test /testCountIntegrator.cpp)
171- meshfields_add_exe (OmegahTriTests test /testOmegahTri.cpp)
196+ meshfields_add_smoke_exe (OmegahTriTests test /testOmegahTri.cpp)
172197meshfields_add_exe(ExceptionTest test /testExceptions.cpp)
173198meshfields_add_exe(PointMapping test /testPointMapping.cpp)
174199meshfields_add_exe(OmegahTetTest test /testOmegahTet.cpp)
200+ meshfields_add_exe(OmegahThwaitesSprAdapt test /testSprThwaitesAdapt.cpp)
175201
176202if (MeshFields_USE_Cabana)
177203 meshfields_add_exe(ControllerPerformance test /testControllerPerformance.cpp)
178- meshfields_add_exe (CabanaTests test /testCabana.cpp)
179- test_func (CabanaTests ./CabanaTests)
204+ meshfields_add_smoke_exe (CabanaTests test /testCabana.cpp)
205+ smoke_test_func (CabanaTests ./CabanaTests)
180206 test_func(ControllerPerformance ./ControllerPerformance)
181207endif ()
182208
183- test_func (KokkosTests ./KokkosTests)
209+ smoke_test_func (KokkosTests ./KokkosTests)
184210test_func(SerializationTests ./SerializationTests)
185211test_func(ElementTests ./ElementTests)
186212test_func(ElementJacobian1d ./ElementJacobian1d)
187213test_func(ElementJacobian2d ./ElementJacobian2d)
188214test_func(ElementJacobian3d ./ElementJacobian3d)
189215test_func(CountIntegrator ./CountIntegrator)
190- test_func (OmegahTriTests ./OmegahTriTests)
216+ smoke_test_func (OmegahTriTests ./OmegahTriTests)
191217test_func(PointMapping ./PointMapping)
192- test_func(OmegahTetTest, ./OmegahTetTest)
218+ test_func(OmegahTetTest ./OmegahTetTest)
193219if (MeshFields_USE_EXCEPTIONS)
194220 # exception caught - no error
195221 test_func(ExceptionTest ./ExceptionTest)
196222else ()
197223 will_fail_test_func(ExceptionTest ./ExceptionTest)
198224endif ()
199225
226+ meshfields_add_exe(OmegahSprAdapt test /testSprThwaitesAdapt.cpp)
227+ test_func(OmegahSprAdapt ./OmegahSprAdapt
228+ ${CMAKE_SOURCE_DIR} /meshes/thwaites_basal_effectiveStrain.osh/
229+ thwaitesAdapted #output prefix
230+ 0.1 # adapt ratio
231+ 1.0 # min size
232+ 16.0 # max size
233+ )
234+ add_test_property(OmegahSprAdapt
235+ PASS_REGULAR_EXPRESSION
236+ "afterAdapt nTri: 14439; solution_1 min -4084.78 max 213.322" )
237+
238+ test_func(OmegahSprAdapt_p2
239+ ${MPIEXEC_EXECUTABLE} ${MPIEXEC_NUMPROC_FLAG} 2 ${MPIEXEC_PREFLAGS}
240+ ./OmegahSprAdapt ${CMAKE_SOURCE_DIR} /meshes/thwaites_basal_effectiveStrain.osh/
241+ thwaitesAdapted_p2 #output prefix
242+ 0.1 # adapt ratio
243+ 1.0 # min size
244+ 16.0 # max size
245+ )
246+ add_test_property(OmegahSprAdapt_p2
247+ PASS_REGULAR_EXPRESSION
248+ "afterAdapt nTri: 14468; solution_1 min -4098.9 max 213.322" )
249+
200250#Code Coverage set up -------------------------------------------------------
201251
202252option (meshfields_ENABLE_COVERAGE_BUILD "Do a coverage build" OFF )
0 commit comments