Skip to content
Open
Show file tree
Hide file tree
Changes from 34 commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
0cd999e
build meshfields as TPL via FetchContent
cwsmith Oct 16, 2025
a04dca0
link against meshfields
cwsmith Oct 16, 2025
bf44b69
meshfields linking
cwsmith Oct 16, 2025
24dbece
no scope?
cwsmith Oct 16, 2025
6fdb697
link albanyLib against meshfields
cwsmith Oct 16, 2025
c6bdc4b
preprocessor symbol for meshfields
cwsmith Oct 16, 2025
054ee66
wrap in preprocessor macro
cwsmith Oct 16, 2025
32ae5cd
switch back to main
cwsmith Oct 16, 2025
6c2e22e
start adding spr calls
cwsmith Oct 29, 2025
232a0e6
use namespace
cwsmith Oct 29, 2025
ca31e0d
spr: adapt calls
cwsmith Oct 30, 2025
6cd9770
check for meshfields
cwsmith Oct 30, 2025
0c53c36
2d omegah adapt test
cwsmith Oct 30, 2025
44f703c
consistent names
cwsmith Oct 30, 2025
4d7f3b8
missed an Omegah
cwsmith Oct 30, 2025
16a1a9f
2d omegah adapt requires meshfields for spr
cwsmith Oct 30, 2025
c3c56ea
need to specify initial elm count
cwsmith Oct 30, 2025
b860884
2d supported
cwsmith Oct 30, 2025
1ff67ef
match function name
cwsmith Oct 30, 2025
4536651
missed one name mismatch
cwsmith Oct 30, 2025
a17e616
if adapt runs, but doesn't modify the mesh, the nodeset tag will exist
cwsmith Oct 30, 2025
03d9661
modify 1d and 2d yaml settings and use
cwsmith Oct 30, 2025
c42a729
min size for ~300 tris
cwsmith Oct 30, 2025
f4fc48e
better adapt parameter names
cwsmith Oct 31, 2025
4ca39ad
trigger adaptation when error is large
cwsmith Oct 31, 2025
238f9ed
spr: ctest passes
cwsmith Nov 3, 2025
e7393b6
spr: less scary if grepping for error
cwsmith Nov 3, 2025
114a8e9
spr: doc strings for yaml
cwsmith Nov 3, 2025
6f532e2
spr: meshfields requires omegah
cwsmith Nov 3, 2025
57de971
spr: requires meshfields
cwsmith Nov 3, 2025
8b5ca71
controls to silence output
cwsmith Nov 4, 2025
29779ad
need uvm to run on perlmutter gpu
cwsmith Nov 6, 2025
7612a3f
spr: append adapt count to pre-adapt vtk filenames
cwsmith Nov 6, 2025
15ef0cc
spr: loosen response tolerances for cuda uvm runs
cwsmith Nov 6, 2025
3678016
already linked to albanyLib
cwsmith Nov 7, 2025
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
17 changes: 17 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -715,6 +715,23 @@ else()
MESSAGE("-- Omega_h lib interface NOT Enabled.")
ENDIF()

# MeshFields
OPTION(ENABLE_MESHFIELDS "Flag to turn on the MeshFields field interface for
computing error indicators (via super convergent patch recovery) to
drive mesh adaptation" OFF)
IF (ENABLE_MESHFIELDS)
IF (NOT ENABLE_OMEGAH)
MESSAGE(FATAL_ERROR
"The MeshFields field interface requires Omega_h to be enabled. \
Reconfigure with -DENABLE_MESHFIELDS=ON and -DENABLE_OMEGAH=ON.")
ENDIF()
MESSAGE("-- MeshFields field interface Enabled.")
SET(ALBANY_MESHFIELDS TRUE)
include (GetOrInstallMeshFields)
else()
MESSAGE("-- MeshFields interface NOT Enabled.")
ENDIF()

# add a target to generate API documentation with Doxygen
option (DISABLE_DOXYGEN "Whether to disable doxygen" ON)
IF( NOT DISABLE_DOXYGEN )
Expand Down
96 changes: 96 additions & 0 deletions cmake/GetOrInstallMeshFields.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
set (tmpStr "Looking for valid MeshFields installation ...")
message (STATUS ${tmpStr})

# Get all propreties that cmake supports
if(NOT CMAKE_PROPERTY_LIST)
execute_process(COMMAND cmake --help-property-list OUTPUT_VARIABLE CMAKE_PROPERTY_LIST)

# Convert command output into a CMake list
string(REGEX REPLACE ";" "\\\\;" CMAKE_PROPERTY_LIST "${CMAKE_PROPERTY_LIST}")
string(REGEX REPLACE "\n" ";" CMAKE_PROPERTY_LIST "${CMAKE_PROPERTY_LIST}")
list(REMOVE_DUPLICATES CMAKE_PROPERTY_LIST)
endif()

function(print_properties)
message("CMAKE_PROPERTY_LIST = ${CMAKE_PROPERTY_LIST}")
endfunction()

function(print_target_properties target)
if(NOT TARGET ${target})
message(STATUS "There is no target named '${target}'")
return()
endif()

foreach(property ${CMAKE_PROPERTY_LIST})
string(REPLACE "<CONFIG>" "${CMAKE_BUILD_TYPE}" property ${property})

# Fix https://stackoverflow.com/questions/32197663/how-can-i-remove-the-the-location-property-may-not-be-read-from-target-error-i
if(property STREQUAL "LOCATION" OR property MATCHES "^LOCATION_" OR property MATCHES "_LOCATION$")
continue()
endif()

get_property(was_set TARGET ${target} PROPERTY ${property} SET)
if(was_set)
get_target_property(value ${target} ${property})
message("${target} ${property} = ${value}")
endif()
endforeach()
endfunction()

find_package(MeshFields CONFIG QUIET
# Avoid all defaults. Only check env/CMake var MeshFields_ROOT
NO_CMAKE_PATH
NO_CMAKE_ENVIRONMENT_PATH
NO_SYSTEM_ENVIRONMENT_PATH
NO_CMAKE_PACKAGE_REGISTRY
NO_CMAKE_SYSTEM_PATH
NO_CMAKE_INSTALL_PREFIX
NO_CMAKE_SYSTEM_PACKAGE_REGISTRY
)

# If we're building shared libs in Albany, we need MeshFields to be built with shared libs
# TODO: if CMake adds a "DYNAMYC=<value>" to find_package (to specify what variant
# of libs we want), then we can use it, and remove (some of) this snippet
if (MeshFields_FOUND)
message (STATUS "${tmpStr} Found.")
message (" -- MeshFields_DIR: ${MeshFields_DIR}")
message (" -- MeshFields_VERSION: ${MeshFields_VERSION}")
get_target_property(MeshFields_LIBTYPE MeshFields::meshfields TYPE)
if (BUILD_SHARED_LIBS AND NOT MeshFields_LIBTYPE STREQUAL SHARED_LIBRARY)
message (" -> Wrong lib variant: ${MeshFields_LIBTYPE} instead of SHARED_LIBRARY.")
message (" Please, point to a compatible MeshFields installation (or none at all to force a new install)")
message (FATAL_ERROR "Aborting...")
else()
foreach (opt IN ITEMS MeshFields_USE_Kokkos MeshFields_USE_MPI)
if (NOT ${opt})
message (" -> Wrong configuration: ${opt} is OFF (should be ON)")
message (" Please, point to a compatible MeshFields installation (or none at all to force local install)")
message (FATAL_ERROR "Aborting...")
endif()
endforeach()
endif()
else ()
message (STATUS "${tmpStr} NOT Found.")
message (STATUS " -> Downloading and building locally in ${CMAKE_BINARY_DIR}/tpls/meshfields")

include (FetchContent)

# Fetch and populate the external project
set (FETCHCONTENT_BASE_DIR ${CMAKE_BINARY_DIR}/tpls/meshfields)

FetchContent_Declare (
MeshFields
GIT_REPOSITORY git@github.com:SCOREC/meshFields
GIT_TAG origin/main
OVERRIDE_FIND_PACKAGE
)

# Set options for MeshFields before adding the subdirectory
get_target_property(Kokkos_INCLUDE_DIR Kokkos::kokkos INTERFACE_INCLUDE_DIRECTORIES)
string(REPLACE "include/kokkos" "" Kokkos_INSTALL_DIR ${Kokkos_INCLUDE_DIR})
set(Kokkos_PREFIX ${Kokkos_INSTALL_DIR} PATH "Path to Kokkos install")

message (STATUS " *** Begin of MeshFields configuration ***")
FetchContent_MakeAvailable (MeshFields)
message (STATUS " *** End of MeshFields configuration ***")
endif()
3 changes: 3 additions & 0 deletions cmake/GetOrInstallOmegah.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,9 @@ else ()
option (Omega_h_USE_Kokkos "Use Kokkos as a backend" ON)
option (Omega_h_USE_MPI "Use MPI for parallelism" ON)
set (MPIEXEC_EXECUTABLE ${Albany_CXX_COMPILER})
if (Kokkos_ENABLE_CUDA_UVM)
option (Omega_h_MEM_SPACE_SHARED "enabled shared memory space" ON)
endif()

message (STATUS " *** Begin of Omega_h configuration ***")
FetchContent_MakeAvailable (Omega_h)
Expand Down
3 changes: 3 additions & 0 deletions src/Albany_config.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@
// Whether the Omega_h interface is enabled
#cmakedefine ALBANY_OMEGAH

// Whether the MeshFields interface is enabled
#cmakedefine ALBANY_MESHFIELDS

// Whether this is a nightly test build
#cmakedefine ALBANY_NIGHTLY_TEST

Expand Down
4 changes: 4 additions & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -526,6 +526,10 @@ if (ALBANY_OMEGAH)
target_link_libraries(albanyLib Omega_h::omega_h)
endif()

if (ALBANY_MESHFIELDS)
target_link_libraries(albanyLib meshfields)
endif()

install(TARGETS albanyLib EXPORT albany-export
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
Expand Down
Loading