Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,6 @@
[submodule "extern/Kokkos"]
path = extern/Kokkos
url = https://github.com/kokkos/kokkos.git
[submodule "extern/entity-pgens"]
path = extern/entity-pgens
url = https://github.com/entity-toolkit/entity-pgens.git
2 changes: 1 addition & 1 deletion .vscode/.taplo.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
include = ["input.example.toml", "setups/**/*.toml"]
include = ["input.example.toml", "pgens/**/*.toml"]
exclude = [".taplo.toml"]

[formatting]
Expand Down
53 changes: 44 additions & 9 deletions cmake/config.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -18,25 +18,60 @@ endfunction()

# ---------------------------- Problem generator --------------------------- #
function(set_problem_generator pgen_name)
file(GLOB_RECURSE PGENS "${CMAKE_CURRENT_SOURCE_DIR}/setups/**/pgen.hpp"
"${CMAKE_CURRENT_SOURCE_DIR}/setups/pgen.hpp")
if(pgen_name STREQUAL ".")
message(FATAL_ERROR "Problem generator not specified")
endif()

file(GLOB_RECURSE PGENS "${CMAKE_CURRENT_SOURCE_DIR}/pgens/**/pgen.hpp")

foreach(PGEN ${PGENS})
get_filename_component(PGEN_NAME ${PGEN} DIRECTORY)
string(REPLACE "${CMAKE_CURRENT_SOURCE_DIR}/setups/" "" PGEN_NAME
${PGEN_NAME})
string(REPLACE "${CMAKE_CURRENT_SOURCE_DIR}/setups" "" PGEN_NAME
string(REPLACE "${CMAKE_CURRENT_SOURCE_DIR}/pgens/" "" PGEN_NAME
${PGEN_NAME})
list(APPEND PGEN_NAMES ${PGEN_NAME})
endforeach()

list(FIND PGEN_NAMES ${pgen_name} PGEN_FOUND)
if(NOT ${pgen_name} STREQUAL "." AND ${PGEN_FOUND} EQUAL -1)
message(FATAL_ERROR "Invalid problem generator: "
"${pgen_name}\nValid options are: ${PGEN_NAMES}")

file(GLOB_RECURSE EXTRA_PGENS
"${CMAKE_CURRENT_SOURCE_DIR}/extern/entity-pgens/**/pgen.hpp")
foreach(EXTRA_PGEN ${EXTRA_PGENS})
get_filename_component(EXTRA_PGEN_NAME ${EXTRA_PGEN} DIRECTORY)
string(REPLACE "${CMAKE_CURRENT_SOURCE_DIR}/extern/entity-pgens/" ""
EXTRA_PGEN_NAME ${EXTRA_PGEN_NAME})
list(APPEND PGEN_NAMES "pgens/${EXTRA_PGEN_NAME}")
endforeach()

if(${PGEN_FOUND} EQUAL -1)
if(${pgen_name} MATCHES "^pgens/")
get_filename_component(pgen_name ${pgen_name} NAME)
set(pgen_path
"${CMAKE_CURRENT_SOURCE_DIR}/extern/entity-pgens/${pgen_name}")
set(pgen_name "pgens/${pgen_name}")
else()
set(pgen_path ${pgen_name})
get_filename_component(pgen_path ${pgen_path} ABSOLUTE)
string(REGEX REPLACE ".*/" "" pgen_name ${pgen_name})
list(APPEND PGEN_NAMES ${pgen_name})
endif()
else()
set(pgen_path ${CMAKE_CURRENT_SOURCE_DIR}/pgens/${pgen_name})
endif()

file(GLOB_RECURSE PGEN_FILES "${pgen_path}/pgen.hpp")
if(NOT PGEN_FILES)
message(FATAL_ERROR "pgen.hpp file not found in ${pgen_path}")
endif()

add_library(ntt_pgen INTERFACE)
target_link_libraries(ntt_pgen INTERFACE ntt_global ntt_framework
ntt_archetypes ntt_kernels)

target_include_directories(ntt_pgen INTERFACE ${pgen_path})

set(PGEN
${pgen_name}
PARENT_SCOPE)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/setups/${pgen_name})
set(PGEN_FOUND
TRUE
PARENT_SCOPE)
Expand Down
2 changes: 1 addition & 1 deletion cmake/report.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ if(${PGEN_FOUND})
"pgen"
"${problem_generators}"
${PGEN}
${default_pgen}
""
"${Blue}"
PGEN_REPORT
0)
Expand Down
1 change: 1 addition & 0 deletions extern/entity-pgens
Submodule entity-pgens added at 386eef
13 changes: 1 addition & 12 deletions setups/CMakeLists.txt → pgens/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,7 @@
#
# @includes:
#
# * ../
#
# @depends:
#
# * ntt_pgen [required]
#
# @uses:
#
# * kokkos [required]
# * plog [required]
# * mpi [optional]
# * ../src/
# ------------------------------

add_library(ntt_pgen INTERFACE)
Expand All @@ -22,4 +12,3 @@ target_link_libraries(ntt_pgen INTERFACE ntt_global ntt_framework

target_include_directories(ntt_pgen
INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/${PGEN})

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
37 changes: 0 additions & 37 deletions setups/grpic/pgen_grpic_example.hpp

This file was deleted.

14 changes: 0 additions & 14 deletions setups/legacy/em_vacuum/em_vacuum.py

This file was deleted.

43 changes: 0 additions & 43 deletions setups/legacy/em_vacuum/em_vacuum.toml

This file was deleted.

108 changes: 0 additions & 108 deletions setups/legacy/em_vacuum/pgen.hpp

This file was deleted.

Loading