diff --git a/config.cmake.in b/config.cmake.in index 9d75e1c6..7309a5c3 100644 --- a/config.cmake.in +++ b/config.cmake.in @@ -16,6 +16,8 @@ if(@PCMS_ENABLE_OMEGA_H@) find_dependency(Omega_h CONFIG HINTS @Omega_h_DIR@) endif() +include("${CMAKE_CURRENT_LIST_DIR}/pcms_utility-targets.cmake") +include("${CMAKE_CURRENT_LIST_DIR}/pcms_localization-targets.cmake") include("${CMAKE_CURRENT_LIST_DIR}/pcms_core-targets.cmake") include("${CMAKE_CURRENT_LIST_DIR}/pcms_interpolator-targets.cmake") diff --git a/examples/external-usage-example/main.cpp b/examples/external-usage-example/main.cpp index 522fb8c6..51c8127f 100644 --- a/examples/external-usage-example/main.cpp +++ b/examples/external-usage-example/main.cpp @@ -1,5 +1,5 @@ #include -#include +#include int main() { diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 0d174940..61c4c98d 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -2,10 +2,6 @@ set( PCMS_HEADERS pcms.h - pcms/arrays.h - pcms/assert.h - pcms/bounding_box.h - pcms/common.h pcms/coordinate.h pcms/coordinate_systems.h pcms/coordinate_transform.h @@ -14,12 +10,6 @@ set( pcms/field_communicator.h pcms/field_communicator2.h pcms/field_evaluation_methods.h - pcms/memory_spaces.h - pcms/types.h - pcms/array_mask.h - pcms/inclusive_scan.h - pcms/profile.h - pcms/print.h pcms/partition.h pcms/coupler.h pcms/coordinate_system.h @@ -33,8 +23,6 @@ set( set( PCMS_SOURCES pcms.cpp - pcms/assert.cpp - pcms/print.cpp pcms/create_field.cpp pcms/adapter/xgc/xgc_field_adapter.h pcms/adapter/point_cloud/point_cloud_layout.cpp @@ -48,21 +36,22 @@ configure_file(pcms/version.h.in pcms/version.h) configure_file(pcms/configuration.h.in pcms/configuration.h) list(APPEND PCMS_HEADERS ${CMAKE_CURRENT_BINARY_DIR}/pcms/version.h ${CMAKE_CURRENT_BINARY_DIR}/pcms/configuration.h) +add_subdirectory(pcms/utility) + +add_subdirectory(pcms/localization) + if(PCMS_ENABLE_XGC) list(APPEND PCMS_SOURCES pcms/adapter/xgc/xgc_reverse_classification.cpp) list(APPEND PCMS_HEADERS pcms/adapter/xgc/xgc_reverse_classification.h) endif() if(PCMS_ENABLE_OMEGA_H) - list(APPEND PCMS_SOURCES pcms/point_search.cpp) list( APPEND PCMS_HEADERS pcms/adapter/omega_h/omega_h_field.h pcms/transfer_field.h pcms/transfer_field2.h - pcms/uniform_grid.h - pcms/point_search.h ) endif() @@ -78,7 +67,7 @@ add_library(pcms::core ALIAS pcms_core) target_compile_features(pcms_core PUBLIC cxx_std_17) target_link_libraries( pcms_core PUBLIC meshfields::meshfields redev::redev - MPI::MPI_CXX Kokkos::kokkos perfstubs + MPI::MPI_CXX Kokkos::kokkos perfstubs pcms::utility pcms::localization ) if(PCMS_ENABLE_OMEGA_H) target_link_libraries(pcms_core PUBLIC Omega_h::omega_h) @@ -91,10 +80,6 @@ if(PCMS_HAS_ASAN) ) endif() -if(PCMS_ENABLE_SPDLOG) - target_link_libraries(pcms_core PUBLIC spdlog::spdlog) -endif() - # export the library set_target_properties(pcms_core PROPERTIES PUBLIC_HEADER "${PCMS_HEADERS}") target_include_directories( @@ -147,9 +132,11 @@ if(PCMS_ENABLE_Fortran) target_link_libraries(pcms_pcms INTERFACE pcms::fortranapi) endif() + add_subdirectory(pcms/interpolator) target_link_libraries(pcms_pcms INTERFACE pcms::interpolator) + install( TARGETS pcms_pcms EXPORT pcms-targets diff --git a/src/pcms.cpp b/src/pcms.cpp index 664bd710..44d42911 100644 --- a/src/pcms.cpp +++ b/src/pcms.cpp @@ -1,5 +1,5 @@ #include "pcms.h" -#include "pcms/types.h" +#include "pcms/utility/types.h" namespace pcms { diff --git a/src/pcms.h b/src/pcms.h index 7b8591f4..20b0e87d 100644 --- a/src/pcms.h +++ b/src/pcms.h @@ -2,10 +2,10 @@ #define PCMS_H_ #include "pcms/configuration.h" -#include "pcms/common.h" +#include "pcms/utility/common.h" +#include "pcms/utility/profile.h" #include "pcms/field_communicator.h" #include "pcms/adapter/omega_h/omega_h_field.h" -#include "pcms/profile.h" #include "pcms/coupler.h" #endif diff --git a/src/pcms/adapter/omega_h/omega_h_field.h b/src/pcms/adapter/omega_h/omega_h_field.h index c0aaa17e..f1e56257 100644 --- a/src/pcms/adapter/omega_h/omega_h_field.h +++ b/src/pcms/adapter/omega_h/omega_h_field.h @@ -1,21 +1,21 @@ #ifndef PCMS_COUPLING_OMEGA_H_FIELD_H #define PCMS_COUPLING_OMEGA_H_FIELD_H -#include "pcms/types.h" +#include "pcms/utility/types.h" #include #include "pcms/field.h" #include "pcms/coordinate_systems.h" #include #include -#include +#include #include -#include "pcms/arrays.h" -#include "pcms/array_mask.h" -#include "pcms/point_search.h" +#include "pcms/utility/arrays.h" +#include "pcms/utility/array_mask.h" +#include "pcms/localization/point_search.h" #include #include #include "pcms/transfer_field.h" -#include "pcms/memory_spaces.h" -#include "pcms/profile.h" +#include "pcms/utility/memory_spaces.h" +#include "pcms/utility/profile.h" #include "pcms/partition.h" #include diff --git a/src/pcms/adapter/omega_h/omega_h_field2.h b/src/pcms/adapter/omega_h/omega_h_field2.h index 2c3365c8..fe3622cb 100644 --- a/src/pcms/adapter/omega_h/omega_h_field2.h +++ b/src/pcms/adapter/omega_h/omega_h_field2.h @@ -6,10 +6,10 @@ #include #include "pcms/adapter/omega_h/omega_h_field_layout.h" -#include "pcms/types.h" +#include "pcms/utility/types.h" #include "pcms/field.h" #include "pcms/coordinate_system.h" -#include "pcms/point_search.h" +#include "pcms/localization/point_search.h" namespace pcms { diff --git a/src/pcms/adapter/omega_h/omega_h_field_layout.cpp b/src/pcms/adapter/omega_h/omega_h_field_layout.cpp index 1a1099c9..26695afd 100644 --- a/src/pcms/adapter/omega_h/omega_h_field_layout.cpp +++ b/src/pcms/adapter/omega_h/omega_h_field_layout.cpp @@ -2,8 +2,8 @@ #include "omega_h_field2.h" #include "pcms/adapter/omega_h/omega_h_field_layout.h" #include "omega_h_field_layout.h" -#include "pcms/inclusive_scan.h" -#include "pcms/profile.h" +#include "pcms/utility/inclusive_scan.h" +#include "pcms/utility/profile.h" #include namespace pcms diff --git a/src/pcms/adapter/omega_h/omega_h_field_layout.h b/src/pcms/adapter/omega_h/omega_h_field_layout.h index 69b0a020..ff2a7094 100644 --- a/src/pcms/adapter/omega_h/omega_h_field_layout.h +++ b/src/pcms/adapter/omega_h/omega_h_field_layout.h @@ -3,7 +3,7 @@ #include -#include "pcms/arrays.h" +#include "pcms/utility/arrays.h" #include "pcms/field_layout.h" #include "pcms/coordinate_system.h" #include "pcms/field.h" diff --git a/src/pcms/adapter/point_cloud/point_cloud.cpp b/src/pcms/adapter/point_cloud/point_cloud.cpp index bfe15202..d46f8a80 100644 --- a/src/pcms/adapter/point_cloud/point_cloud.cpp +++ b/src/pcms/adapter/point_cloud/point_cloud.cpp @@ -1,6 +1,6 @@ #include "point_cloud.h" -#include "pcms/profile.h" -#include "pcms/assert.h" +#include "pcms/utility/profile.h" +#include "pcms/utility/assert.h" namespace pcms { diff --git a/src/pcms/adapter/point_cloud/point_cloud.h b/src/pcms/adapter/point_cloud/point_cloud.h index 516756f0..f19298c4 100644 --- a/src/pcms/adapter/point_cloud/point_cloud.h +++ b/src/pcms/adapter/point_cloud/point_cloud.h @@ -2,7 +2,7 @@ #define POINT_CLOUD_H_ #include "pcms/field.h" -#include "pcms/arrays.h" +#include "pcms/utility/arrays.h" #include "point_cloud_layout.h" namespace pcms diff --git a/src/pcms/adapter/xgc/xgc_field_adapter.h b/src/pcms/adapter/xgc/xgc_field_adapter.h index 18dded47..b9bce3be 100644 --- a/src/pcms/adapter/xgc/xgc_field_adapter.h +++ b/src/pcms/adapter/xgc/xgc_field_adapter.h @@ -1,15 +1,15 @@ #ifndef PCMS_COUPLING_XGC_FIELD_ADAPTER_H #define PCMS_COUPLING_XGC_FIELD_ADAPTER_H #include "pcms/adapter/omega_h/omega_h_field.h" -#include "pcms/types.h" -#include "pcms/memory_spaces.h" +#include "pcms/utility/types.h" +#include "pcms/utility/memory_spaces.h" #include "pcms/field.h" #include #include #include "xgc_reverse_classification.h" -#include "pcms/assert.h" -#include "pcms/array_mask.h" -#include "pcms/profile.h" +#include "pcms/utility/assert.h" +#include "pcms/utility/array_mask.h" +#include "pcms/utility/profile.h" namespace pcms { diff --git a/src/pcms/adapter/xgc/xgc_reverse_classification.cpp b/src/pcms/adapter/xgc/xgc_reverse_classification.cpp index 33b4c69a..930568d5 100644 --- a/src/pcms/adapter/xgc/xgc_reverse_classification.cpp +++ b/src/pcms/adapter/xgc/xgc_reverse_classification.cpp @@ -1,7 +1,7 @@ #include "xgc_reverse_classification.h" #include "mpi.h" #include -#include "pcms/assert.h" +#include "pcms/utility/assert.h" #include namespace pcms { diff --git a/src/pcms/adapter/xgc/xgc_reverse_classification.h b/src/pcms/adapter/xgc/xgc_reverse_classification.h index b163c707..fc865ac8 100644 --- a/src/pcms/adapter/xgc/xgc_reverse_classification.h +++ b/src/pcms/adapter/xgc/xgc_reverse_classification.h @@ -2,17 +2,17 @@ #define PCMS_COUPLING_XGC_REVERSE_CLASSIFICATION_H #include #include -#include "pcms/types.h" +#include "pcms/utility/types.h" #include #include #include "mdspan/mdspan.hpp" -#include "pcms/arrays.h" -#include "pcms/memory_spaces.h" +#include "pcms/utility/arrays.h" +#include "pcms/utility/memory_spaces.h" #include "pcms/configuration.h" // #include #ifdef PCMS_ENABLE_OMEGA_H #include -#include "pcms/assert.h" +#include "pcms/utility/assert.h" #endif namespace pcms diff --git a/src/pcms/capi/client.cpp b/src/pcms/capi/client.cpp index 2cc4ee96..124a995d 100644 --- a/src/pcms/capi/client.cpp +++ b/src/pcms/capi/client.cpp @@ -6,7 +6,7 @@ #include #include "pcms/adapter/xgc/xgc_reverse_classification.h" #include "pcms/adapter/dummy_field_adapter.h" -#include "pcms/assert.h" +#include "pcms/utility/assert.h" namespace pcms { // Note that we have a closed set of types that can be used in the C interface diff --git a/src/pcms/capi/interpolator.cpp b/src/pcms/capi/interpolator.cpp index b4ec1f4e..d3cbb4c7 100644 --- a/src/pcms/capi/interpolator.cpp +++ b/src/pcms/capi/interpolator.cpp @@ -7,7 +7,7 @@ #include #include #include -#include +#include //[[nodiscard]] PcmsInterpolatorHandle pcms_create_interpolator(PcmsOmegaHMeshHandle oh_mesh, diff --git a/src/pcms/coordinate.h b/src/pcms/coordinate.h index 5e978172..0bea892c 100644 --- a/src/pcms/coordinate.h +++ b/src/pcms/coordinate.h @@ -1,7 +1,7 @@ #ifndef PCMS_COUPLING_COORDINATE_H #define PCMS_COUPLING_COORDINATE_H #include -#include "pcms/types.h" +#include "pcms/utility/types.h" #include namespace pcms { diff --git a/src/pcms/coordinate_system.h b/src/pcms/coordinate_system.h index f7f207ea..68e6f619 100644 --- a/src/pcms/coordinate_system.h +++ b/src/pcms/coordinate_system.h @@ -1,6 +1,6 @@ #ifndef PCMS_COORDINATE_SYSTEM_H #define PCMS_COORDINATE_SYSTEM_H -#include "arrays.h" +#include "pcms/utility/arrays.h" namespace pcms { diff --git a/src/pcms/coordinate_transform.h b/src/pcms/coordinate_transform.h index 7497d3ba..acc5a7b4 100644 --- a/src/pcms/coordinate_transform.h +++ b/src/pcms/coordinate_transform.h @@ -2,6 +2,7 @@ #define PCMS_COUPLING_COORDINATE_TRANSFORM_H #include "coordinate.h" #include "coordinate_systems.h" +#include namespace pcms { template diff --git a/src/pcms/coupler.h b/src/pcms/coupler.h index 020b0cab..43aec33a 100644 --- a/src/pcms/coupler.h +++ b/src/pcms/coupler.h @@ -1,13 +1,16 @@ #ifndef PCMS_COUPLER_H #define PCMS_COUPLER_H -#include "pcms/common.h" +#include "pcms/utility/common.h" #include "pcms/field_communicator.h" #include "pcms/adapter/omega_h/omega_h_field.h" -#include "pcms/profile.h" +#include "pcms/utility/profile.h" namespace pcms { +// to avoid having any redev:: types in the user interface +using ProcessType = redev::ProcessType; + class CoupledField { public: diff --git a/src/pcms/field.h b/src/pcms/field.h index 15b40c18..fa952577 100644 --- a/src/pcms/field.h +++ b/src/pcms/field.h @@ -1,9 +1,9 @@ #ifndef PCMS_COUPLING_FIELD_H #define PCMS_COUPLING_FIELD_H #include "field_layout.h" -#include "pcms/types.h" -#include "pcms/arrays.h" -#include "pcms/memory_spaces.h" +#include "pcms/utility/types.h" +#include "pcms/utility/arrays.h" +#include "pcms/utility/memory_spaces.h" #include #include #include diff --git a/src/pcms/field_communicator.h b/src/pcms/field_communicator.h index 1246467c..4a3c84be 100644 --- a/src/pcms/field_communicator.h +++ b/src/pcms/field_communicator.h @@ -3,8 +3,8 @@ #include #include "pcms/field.h" #include -#include "pcms/inclusive_scan.h" -#include "pcms/profile.h" +#include "pcms/utility/inclusive_scan.h" +#include "pcms/utility/profile.h" #include "pcms/partition.h" namespace pcms diff --git a/src/pcms/field_communicator2.h b/src/pcms/field_communicator2.h index 2e0ec729..08dc0290 100644 --- a/src/pcms/field_communicator2.h +++ b/src/pcms/field_communicator2.h @@ -4,10 +4,10 @@ #include "field_layout_communicator.h" #include "pcms/field_layout.h" #include "pcms/field.h" -#include "pcms/profile.h" -#include "pcms/assert.h" -#include "pcms/inclusive_scan.h" -#include "pcms/arrays.h" +#include "pcms/utility/profile.h" +#include "pcms/utility/assert.h" +#include "pcms/utility/inclusive_scan.h" +#include "pcms/utility/arrays.h" #include namespace pcms diff --git a/src/pcms/field_layout.h b/src/pcms/field_layout.h index 16eeb110..606bc52a 100644 --- a/src/pcms/field_layout.h +++ b/src/pcms/field_layout.h @@ -3,7 +3,7 @@ #include #include #include "pcms/field.h" -#include "pcms/arrays.h" +#include "pcms/utility/arrays.h" #include "pcms/coordinate_system.h" namespace pcms diff --git a/src/pcms/field_layout_communicator.h b/src/pcms/field_layout_communicator.h index 33c13930..d2629a1f 100644 --- a/src/pcms/field_layout_communicator.h +++ b/src/pcms/field_layout_communicator.h @@ -4,10 +4,10 @@ #include "field_layout.h" #include "pcms/field_layout.h" #include "pcms/field.h" -#include "pcms/profile.h" -#include "pcms/assert.h" -#include "pcms/inclusive_scan.h" -#include "pcms/arrays.h" +#include "pcms/utility/profile.h" +#include "pcms/utility/assert.h" +#include "pcms/utility/inclusive_scan.h" +#include "pcms/utility/arrays.h" #include namespace pcms diff --git a/src/pcms/interpolator/adj_search.hpp b/src/pcms/interpolator/adj_search.hpp index f740fbdc..428ab035 100644 --- a/src/pcms/interpolator/adj_search.hpp +++ b/src/pcms/interpolator/adj_search.hpp @@ -1,8 +1,8 @@ #ifndef ADJ_SEARCH_HPP #define ADJ_SEARCH_HPP -#include -#include +#include +#include #include "interpolation_helpers.h" // for helper functions #include "queue_visited.hpp" diff --git a/src/pcms/interpolator/interpolation_base.h b/src/pcms/interpolator/interpolation_base.h index 185ded4c..c891d458 100644 --- a/src/pcms/interpolator/interpolation_base.h +++ b/src/pcms/interpolator/interpolation_base.h @@ -16,7 +16,7 @@ #include "adj_search.hpp" #include "interpolation_helpers.h" #include -#include +#include "pcms/utility/arrays.h" #include /** diff --git a/src/pcms/interpolator/interpolation_helpers.h b/src/pcms/interpolator/interpolation_helpers.h index c470c996..bc76b1a8 100644 --- a/src/pcms/interpolator/interpolation_helpers.h +++ b/src/pcms/interpolator/interpolation_helpers.h @@ -4,7 +4,8 @@ #ifndef PCMS_INTERPOLATION_HELPERS_H #define PCMS_INTERPOLATION_HELPERS_H -#include +#include "pcms/utility/arrays.h" +#include "pcms/utility/memory_spaces.h" #include #include diff --git a/src/pcms/interpolator/mls_interpolation_impl.hpp b/src/pcms/interpolator/mls_interpolation_impl.hpp index bf569788..ab3b9751 100644 --- a/src/pcms/interpolator/mls_interpolation_impl.hpp +++ b/src/pcms/interpolator/mls_interpolation_impl.hpp @@ -15,8 +15,8 @@ #include #include #include -#include -#include +#include +#include #include #include diff --git a/src/pcms/interpolator/pcms_interpolator_aliases.hpp b/src/pcms/interpolator/pcms_interpolator_aliases.hpp index 2e2cebe6..5aef1d63 100644 --- a/src/pcms/interpolator/pcms_interpolator_aliases.hpp +++ b/src/pcms/interpolator/pcms_interpolator_aliases.hpp @@ -2,7 +2,7 @@ #define PCMS_INTERPOLATOR_ALIASES_HPP #include -#include "pcms/arrays.h" +#include "pcms/utility/arrays.h" namespace pcms { diff --git a/src/pcms/interpolator/spline_interpolator.hpp b/src/pcms/interpolator/spline_interpolator.hpp index 85520536..503351c3 100644 --- a/src/pcms/interpolator/spline_interpolator.hpp +++ b/src/pcms/interpolator/spline_interpolator.hpp @@ -2,10 +2,10 @@ #define MLS_RBF_OPTIONS_HPP #include "mdspan/mdspan.hpp" -#include "pcms/arrays.h" -#include "pcms/assert.h" -#include "pcms/memory_spaces.h" -#include "pcms/types.h" +#include "pcms/utility/arrays.h" +#include "pcms/utility/assert.h" +#include "pcms/utility/memory_spaces.h" +#include "pcms/utility/types.h" #include #include #include diff --git a/src/pcms/localization/CMakeLists.txt b/src/pcms/localization/CMakeLists.txt new file mode 100644 index 00000000..c46aaad4 --- /dev/null +++ b/src/pcms/localization/CMakeLists.txt @@ -0,0 +1,50 @@ +set( + PCMS_LOCALIZATION_HEADERS + point_search.h +) + +set( + PCMS_LOCALIZATION_SOURCES + point_search.cpp +) +add_library(pcms_localization ${PCMS_LOCALIZATION_SOURCES}) +add_library(pcms::localization ALIAS pcms_localization) +target_include_directories( + pcms_localization + PUBLIC + # include path should be pcms/localization/ + "$" + # include path to search for pcms/config.h + "$" + "$") +target_link_libraries(pcms_localization PUBLIC Kokkos::kokkos pcms::utility Omega_h::omega_h) +target_compile_features(pcms_localization PUBLIC cxx_std_17) + +set_target_properties( + pcms_localization PROPERTIES OUTPUT_NAME pcmslocalization EXPORT_NAME + localization +) + +if (PCMS_ENABLE_SPDLOG) + target_link_libraries(pcms_localization PUBLIC spdlog::spdlog) +endif () + +## export the library +set_target_properties(pcms_localization PROPERTIES PUBLIC_HEADER "${PCMS_LOCALIZATION_HEADERS}") + +install( + TARGETS pcms_localization + EXPORT pcms_localization-targets + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} + INCLUDES + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} + PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/pcms/localization +) + +install( + EXPORT pcms_localization-targets + NAMESPACE pcms:: + DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/pcms +) \ No newline at end of file diff --git a/src/pcms/point_search.cpp b/src/pcms/localization/point_search.cpp similarity index 100% rename from src/pcms/point_search.cpp rename to src/pcms/localization/point_search.cpp diff --git a/src/pcms/point_search.h b/src/pcms/localization/point_search.h similarity index 94% rename from src/pcms/point_search.h rename to src/pcms/localization/point_search.h index 05aff657..aeeb0010 100644 --- a/src/pcms/point_search.h +++ b/src/pcms/localization/point_search.h @@ -3,11 +3,11 @@ #include #include #include -#include "types.h" +#include "pcms/utility/types.h" #include #include -#include "pcms/uniform_grid.h" -#include "pcms/bounding_box.h" +#include "pcms/utility/uniform_grid.h" +#include "pcms/utility/bounding_box.h" namespace pcms { diff --git a/src/pcms/partition.h b/src/pcms/partition.h index 3ecc48b3..d18b68f3 100644 --- a/src/pcms/partition.h +++ b/src/pcms/partition.h @@ -1,7 +1,9 @@ #ifndef PCMS_PARTITION_H #define PCMS_PARTITION_H -#include "pcms/common.h" -#include "pcms/profile.h" +#include "pcms/utility/common.h" +#include "pcms/utility/profile.h" +#include "pcms/utility/types.h" +#include namespace pcms { diff --git a/src/pcms/transfer_field.h b/src/pcms/transfer_field.h index 3a827352..e92be53b 100644 --- a/src/pcms/transfer_field.h +++ b/src/pcms/transfer_field.h @@ -1,10 +1,10 @@ #ifndef PCMS_COUPLING_TRANSFER_FIELD_H #define PCMS_COUPLING_TRANSFER_FIELD_H #include -#include "pcms/arrays.h" +#include "pcms/utility/arrays.h" #include "pcms/field_evaluation_methods.h" #include "pcms/field.h" -#include "pcms/profile.h" +#include "pcms/utility/profile.h" namespace pcms { diff --git a/src/pcms/transfer_field2.h b/src/pcms/transfer_field2.h index b1f40f64..32ea8039 100644 --- a/src/pcms/transfer_field2.h +++ b/src/pcms/transfer_field2.h @@ -2,11 +2,11 @@ #define PCMS_TRANSFER_FIELD2_H_ #include #include -#include "arrays.h" +#include "pcms/utility/arrays.h" #include "field.h" -#include "pcms/arrays.h" +#include "pcms/utility/arrays.h" #include "pcms/field_evaluation_methods.h" -#include "pcms/profile.h" +#include "pcms/utility/profile.h" #include "pcms/field.h" namespace pcms diff --git a/src/pcms/utility/CMakeLists.txt b/src/pcms/utility/CMakeLists.txt new file mode 100644 index 00000000..cbfbe80d --- /dev/null +++ b/src/pcms/utility/CMakeLists.txt @@ -0,0 +1,61 @@ +set( + PCMS_UTILITY_HEADERS + arrays.h + assert.h + bounding_box.h + common.h + memory_spaces.h + types.h + array_mask.h + inclusive_scan.h + profile.h + print.h + uniform_grid.h +) + +set( + PCMS_UTILITY_SOURCES + assert.cpp + print.cpp +) +add_library(pcms_utility ${PCMS_UTILITY_SOURCES}) +add_library(pcms::utility ALIAS pcms_utility) +target_include_directories( + pcms_utility + PUBLIC + # include path should be pcms/utility/ + "$" + # include path to search for pcms/config.h + "$" + "$") +target_link_libraries(pcms_utility PUBLIC Kokkos::kokkos perfstubs) +target_compile_features(pcms_utility PUBLIC cxx_std_17) + +set_target_properties( + pcms_utility PROPERTIES OUTPUT_NAME pcmsutility EXPORT_NAME + utility +) + +if (PCMS_ENABLE_SPDLOG) + target_link_libraries(pcms_utility PUBLIC spdlog::spdlog) +endif () + +## export the library +set_target_properties(pcms_utility PROPERTIES PUBLIC_HEADER "${PCMS_UTILITY_HEADERS}") + +install( + TARGETS pcms_utility + EXPORT pcms_utility-targets + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} + INCLUDES + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} + PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/pcms/utility +) + +install( + EXPORT pcms_utility-targets + NAMESPACE pcms:: + DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/pcms +) \ No newline at end of file diff --git a/src/pcms/array_mask.h b/src/pcms/utility/array_mask.h similarity index 98% rename from src/pcms/array_mask.h rename to src/pcms/utility/array_mask.h index 249aaed5..94e03bef 100644 --- a/src/pcms/array_mask.h +++ b/src/pcms/utility/array_mask.h @@ -1,7 +1,7 @@ #ifndef PCMS_COUPLING_ARRAY_MASK_H #define PCMS_COUPLING_ARRAY_MASK_H -#include "pcms/arrays.h" -#include "pcms/assert.h" +#include "pcms/utility/arrays.h" +#include "pcms/utility/assert.h" #include namespace pcms { diff --git a/src/pcms/arrays.h b/src/pcms/utility/arrays.h similarity index 98% rename from src/pcms/arrays.h rename to src/pcms/utility/arrays.h index 7307241b..3155cf47 100644 --- a/src/pcms/arrays.h +++ b/src/pcms/utility/arrays.h @@ -1,8 +1,8 @@ #ifndef PCMS_COUPLING_ARRAYS_H #define PCMS_COUPLING_ARRAYS_H #include "mdspan/mdspan.hpp" -#include "pcms/types.h" -#include "pcms/memory_spaces.h" +#include "pcms/utility/types.h" +#include "pcms/utility/memory_spaces.h" namespace pcms { diff --git a/src/pcms/assert.cpp b/src/pcms/utility/assert.cpp similarity index 57% rename from src/pcms/assert.cpp rename to src/pcms/utility/assert.cpp index abd3e449..306dbf4c 100644 --- a/src/pcms/assert.cpp +++ b/src/pcms/utility/assert.cpp @@ -1,7 +1,5 @@ -#include "pcms/assert.h" -#include "pcms/print.h" -#include -#include +#include "pcms/utility/print.h" + namespace pcms { void Pcms_Assert_Fail(const char* msg) diff --git a/src/pcms/assert.h b/src/pcms/utility/assert.h similarity index 88% rename from src/pcms/assert.h rename to src/pcms/utility/assert.h index 8565aec9..edb5e691 100644 --- a/src/pcms/assert.h +++ b/src/pcms/utility/assert.h @@ -1,18 +1,19 @@ #ifndef PCMS_COUPLING_ASSERT_H #define PCMS_COUPLING_ASSERT_H -#include #include // https://stackoverflow.com/questions/16683146/can-macros-be-overloaded-by-number-of-arguments -#define CAT(A, B) A##B -#define SELECT(NAME, NUM) CAT(NAME##_, NUM) +#define PCMS_CAT(A, B) A##B +#define PCMS_SELECT(NAME, NUM) PCMS_CAT(NAME##_, NUM) -#define GET_COUNT(_1, _2, _3, _4, _5, _6 /* ad nauseam */, COUNT, ...) COUNT -#define VA_SIZE(...) GET_COUNT(__VA_ARGS__, 6, 5, 4, 3, 2, 1) +#define PCMS_GET_COUNT(_1, _2, _3, _4, _5, _6 /* ad nauseam */, COUNT, ...) \ + COUNT +#define PCMS_VA_SIZE(...) PCMS_GET_COUNT(__VA_ARGS__, 6, 5, 4, 3, 2, 1) -#define VA_SELECT(NAME, ...) SELECT(NAME, VA_SIZE(__VA_ARGS__))(__VA_ARGS__) +#define PCMS_VA_SELECT(NAME, ...) \ + PCMS_SELECT(NAME, PCMS_VA_SIZE(__VA_ARGS__))(__VA_ARGS__) -#define PCMS_ALWAYS_ASSERT(...) VA_SELECT(PCMS_ALWAYS_ASSERT, __VA_ARGS__) +#define PCMS_ALWAYS_ASSERT(...) PCMS_VA_SELECT(PCMS_ALWAYS_ASSERT, __VA_ARGS__) #define PCMS_ALWAYS_ASSERT_1(cond) PCMS_ALWAYS_ASSERT_2(cond, MPI_COMM_WORLD) #define PCMS_ALWAYS_ASSERT_2(pcms_macro_cond, pcms_macro_comm) \ /* NOLINTBEGIN(modernize-avoid-c-arrays,cppcoreguidelines-avoid-do-while,cppcoreguidelines-avoid-c-arrays)*/ \ diff --git a/src/pcms/bounding_box.h b/src/pcms/utility/bounding_box.h similarity index 95% rename from src/pcms/bounding_box.h rename to src/pcms/utility/bounding_box.h index 230ebc5b..9bc7ca0b 100644 --- a/src/pcms/bounding_box.h +++ b/src/pcms/utility/bounding_box.h @@ -1,6 +1,6 @@ #ifndef PCMS_COUPLING_BOUNDING_BOX_H #define PCMS_COUPLING_BOUNDING_BOX_H -#include "pcms/types.h" +#include "pcms/utility/types.h" #include #include namespace pcms diff --git a/src/pcms/common.h b/src/pcms/utility/common.h similarity index 92% rename from src/pcms/common.h rename to src/pcms/utility/common.h index 7015a673..e23a16e7 100644 --- a/src/pcms/common.h +++ b/src/pcms/utility/common.h @@ -1,12 +1,13 @@ #ifndef PCMS_COUPLING_COMMON_H #define PCMS_COUPLING_COMMON_H -#include -#include "pcms/transfer_field.h" -#include "pcms/assert.h" +#include "pcms/utility/assert.h" #include +#include +#include +#include + namespace pcms { -using ProcessType = redev::ProcessType; namespace detail { diff --git a/src/pcms/inclusive_scan.h b/src/pcms/utility/inclusive_scan.h similarity index 100% rename from src/pcms/inclusive_scan.h rename to src/pcms/utility/inclusive_scan.h diff --git a/src/pcms/memory_spaces.h b/src/pcms/utility/memory_spaces.h similarity index 100% rename from src/pcms/memory_spaces.h rename to src/pcms/utility/memory_spaces.h diff --git a/src/pcms/print.cpp b/src/pcms/utility/print.cpp similarity index 82% rename from src/pcms/print.cpp rename to src/pcms/utility/print.cpp index c103671e..04ef4336 100644 --- a/src/pcms/print.cpp +++ b/src/pcms/utility/print.cpp @@ -1,4 +1,7 @@ -#include "print.h" +#include "pcms/utility/print.h" + +#include +#include namespace pcms { diff --git a/src/pcms/print.h b/src/pcms/utility/print.h similarity index 96% rename from src/pcms/print.h rename to src/pcms/utility/print.h index 2cc295df..d8b8fd82 100644 --- a/src/pcms/print.h +++ b/src/pcms/utility/print.h @@ -1,5 +1,7 @@ #ifndef PCMS_PRINT_H #define PCMS_PRINT_H +#include "pcms/configuration.h" +#include #ifdef PCMS_ENABLE_SPDLOG #include "spdlog/spdlog.h" diff --git a/src/pcms/profile.h b/src/pcms/utility/profile.h similarity index 100% rename from src/pcms/profile.h rename to src/pcms/utility/profile.h diff --git a/src/pcms/types.h b/src/pcms/utility/types.h similarity index 94% rename from src/pcms/types.h rename to src/pcms/utility/types.h index a92a2c12..97f9bbdc 100644 --- a/src/pcms/types.h +++ b/src/pcms/utility/types.h @@ -1,6 +1,8 @@ #ifndef PCMS_COUPLING_TYPES_H #define PCMS_COUPLING_TYPES_H -#include +#include +#include + namespace pcms { enum class Type diff --git a/src/pcms/uniform_grid.h b/src/pcms/utility/uniform_grid.h similarity index 98% rename from src/pcms/uniform_grid.h rename to src/pcms/utility/uniform_grid.h index 5ec13d19..4dabdbd4 100644 --- a/src/pcms/uniform_grid.h +++ b/src/pcms/utility/uniform_grid.h @@ -1,6 +1,6 @@ #ifndef PCMS_COUPLING_UNIFORM_GRID_H #define PCMS_COUPLING_UNIFORM_GRID_H -#include "pcms/bounding_box.h" +#include "pcms/utility/bounding_box.h" #include "Omega_h_vector.hpp" #include namespace pcms diff --git a/test/test_bounding_box.cpp b/test/test_bounding_box.cpp index bda75d9b..f29f9567 100644 --- a/test/test_bounding_box.cpp +++ b/test/test_bounding_box.cpp @@ -1,5 +1,5 @@ #include -#include +#include using pcms::AABBox; using pcms::intersects; diff --git a/test/test_coordinate.cpp b/test/test_coordinate.cpp index 9d5df728..b016d3b3 100644 --- a/test/test_coordinate.cpp +++ b/test/test_coordinate.cpp @@ -3,7 +3,7 @@ #include #include #include "mdspan/mdspan.hpp" -#include +#include using pcms::Cartesian; using pcms::Coordinate; diff --git a/test/test_interpolation_class.cpp b/test/test_interpolation_class.cpp index d24691a3..5d9e459e 100644 --- a/test/test_interpolation_class.cpp +++ b/test/test_interpolation_class.cpp @@ -8,7 +8,7 @@ #include #include #include -#include +#include #include #include diff --git a/test/test_interpolation_on_ltx_mesh.cpp b/test/test_interpolation_on_ltx_mesh.cpp index 72eafeee..14608243 100644 --- a/test/test_interpolation_on_ltx_mesh.cpp +++ b/test/test_interpolation_on_ltx_mesh.cpp @@ -14,7 +14,7 @@ #include #include #include -#include +#include #include #include diff --git a/test/test_point_search.cpp b/test/test_point_search.cpp index 06bacf48..feb2950e 100644 --- a/test/test_point_search.cpp +++ b/test/test_point_search.cpp @@ -1,6 +1,6 @@ #include #include -#include +#include #include #include diff --git a/test/test_proxy_coupling.cpp b/test/test_proxy_coupling.cpp index 48549c3f..7f4f9683 100644 --- a/test/test_proxy_coupling.cpp +++ b/test/test_proxy_coupling.cpp @@ -1,7 +1,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/test/test_proxy_coupling_xgc_server.cpp b/test/test_proxy_coupling_xgc_server.cpp index 07a60cb3..69085764 100644 --- a/test/test_proxy_coupling_xgc_server.cpp +++ b/test/test_proxy_coupling_xgc_server.cpp @@ -1,6 +1,6 @@ #include #include -#include +#include #include #include #include "test_support.h" diff --git a/test/test_support.h b/test/test_support.h index 02ddbeba..8338253a 100644 --- a/test/test_support.h +++ b/test/test_support.h @@ -8,7 +8,7 @@ #include #include #include -#include +#include #include "pcms/adapter/omega_h/omega_h_field.h" #include diff --git a/test/test_uniform_grid.cpp b/test/test_uniform_grid.cpp index 9cdc3f39..1f7e848b 100644 --- a/test/test_uniform_grid.cpp +++ b/test/test_uniform_grid.cpp @@ -1,6 +1,6 @@ #include #include -#include +#include using pcms::Uniform2DGrid; diff --git a/test/xgc_n0_coupling_server.cpp b/test/xgc_n0_coupling_server.cpp index 9fbabe86..09873bb9 100644 --- a/test/xgc_n0_coupling_server.cpp +++ b/test/xgc_n0_coupling_server.cpp @@ -1,5 +1,5 @@ #include -#include +#include #include #include #include "test_support.h" diff --git a/tools/CpnFromOsh.cpp b/tools/CpnFromOsh.cpp index 9bcd33be..c51be067 100644 --- a/tools/CpnFromOsh.cpp +++ b/tools/CpnFromOsh.cpp @@ -4,7 +4,7 @@ #include #include #include -#include "pcms/print.h" +#include "pcms/utility/print.h" int main(int argc, char** argv) { diff --git a/tools/XgcRCfromOsh.cpp b/tools/XgcRCfromOsh.cpp index 591ffc04..2b66a344 100644 --- a/tools/XgcRCfromOsh.cpp +++ b/tools/XgcRCfromOsh.cpp @@ -1,6 +1,6 @@ #include #include "pcms/adapter/xgc/xgc_reverse_classification.h" -#include "pcms/print.h" +#include "pcms/utility/print.h" #include #include