diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 61d6d303d..c232855a5 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -104,7 +104,7 @@ documentation: script: | rm -rf build || true # Make docs - cmake -DGYSELALIBXX_COMPILE_SOURCE=OFF -DBUILD_DOCUMENTATION=1 -B build-docs . + cmake -DGYSELALIBXX_COMPILE_SOURCE=OFF -DGYSELALIBXX_BUILD_DOCUMENTATION=1 -B build-docs . cmake --build build-docs # Get files which have changed in this merge request git diff origin/${CI_MERGE_REQUEST_TARGET_BRANCH_NAME}..HEAD --no-indent-heuristic --unified=0 --output=pull_diff.txt --no-color diff --git a/vendor/sll/include/sll/mapping/circular_to_cartesian.hpp b/vendor/sll/include/sll/mapping/circular_to_cartesian.hpp index 1a4a97a23..0ced85c0f 100644 --- a/vendor/sll/include/sll/mapping/circular_to_cartesian.hpp +++ b/vendor/sll/include/sll/mapping/circular_to_cartesian.hpp @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: MIT #pragma once #include @@ -8,6 +9,7 @@ #include "coordinate_converter.hpp" #include "curvilinear2d_to_cartesian.hpp" #include "jacobian.hpp" +#include "mapping_tools.hpp" #include "pseudo_cartesian_compatible_mapping.hpp" /** @@ -321,3 +323,11 @@ class CircularToCartesian return 1.; } }; + + +namespace detail { +template +struct MappingAccessibility> : std::true_type +{ +}; +} // namespace detail diff --git a/vendor/sll/include/sll/mapping/czarny_to_cartesian.hpp b/vendor/sll/include/sll/mapping/czarny_to_cartesian.hpp index 09b7174d8..223503e6b 100644 --- a/vendor/sll/include/sll/mapping/czarny_to_cartesian.hpp +++ b/vendor/sll/include/sll/mapping/czarny_to_cartesian.hpp @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: MIT #pragma once #include @@ -9,6 +10,7 @@ #include "coordinate_converter.hpp" #include "curvilinear2d_to_cartesian.hpp" #include "jacobian.hpp" +#include "mapping_tools.hpp" #include "pseudo_cartesian_compatible_mapping.hpp" @@ -480,3 +482,10 @@ class CzarnyToCartesian return (2 - Kokkos::sqrt(1 + m_epsilon * m_epsilon)) / m_e / xi; } }; + +namespace detail { +template +struct MappingAccessibility> : std::true_type +{ +}; +} // namespace detail diff --git a/vendor/sll/include/sll/mapping/discrete_to_cartesian.hpp b/vendor/sll/include/sll/mapping/discrete_to_cartesian.hpp index e22125d87..a8c8f6958 100644 --- a/vendor/sll/include/sll/mapping/discrete_to_cartesian.hpp +++ b/vendor/sll/include/sll/mapping/discrete_to_cartesian.hpp @@ -9,6 +9,7 @@ #include "coordinate_converter.hpp" #include "curvilinear2d_to_cartesian.hpp" #include "jacobian.hpp" +#include "mapping_tools.hpp" #include "pseudo_cartesian_compatible_mapping.hpp" /** @@ -446,3 +447,21 @@ class DiscreteToCartesian return ddc::Coordinate(m_x_spline_representation(el), m_y_spline_representation(el)); } }; + + +namespace detail { +template < + class X, + class Y, + class SplineEvaluator, + class R, + class Theta, + class MemorySpace, + class ExecSpace> +struct MappingAccessibility< + ExecSpace, + DiscreteToCartesian> +{ + static constexpr bool value = Kokkos::SpaceAccessibility::accessible; +}; +} // namespace detail diff --git a/vendor/sll/include/sll/mapping/mapping_tools.hpp b/vendor/sll/include/sll/mapping/mapping_tools.hpp new file mode 100644 index 000000000..af68c411b --- /dev/null +++ b/vendor/sll/include/sll/mapping/mapping_tools.hpp @@ -0,0 +1,14 @@ +// SPDX-License-Identifier: MIT +#pragma once + +#include + +namespace detail { +template +struct MappingAccessibility : std::false_type +{ +}; +} // namespace detail + +template +static constexpr bool is_accessible_v = detail::MappingAccessibility::value; diff --git a/vendor/sll/tests/mapping_execution_space_access.cpp b/vendor/sll/tests/mapping_execution_space_access.cpp index ee527b6ca..6f32a1c38 100644 --- a/vendor/sll/tests/mapping_execution_space_access.cpp +++ b/vendor/sll/tests/mapping_execution_space_access.cpp @@ -167,6 +167,7 @@ double check_logical_to_physical_coord_converter( CoordXY const& coord_xy) { DeviceExecSpace exec; + static_assert(is_accessible_v); double max_error = 0; Kokkos::parallel_reduce( @@ -188,6 +189,7 @@ double check_physical_to_logical_coord_converter( CoordXY const& coord_xy) { DeviceExecSpace exec; + static_assert(is_accessible_v); double max_error = 0; Kokkos::parallel_reduce( @@ -210,14 +212,17 @@ TEST_F(MappingMemoryAccess, HostCircularCoordConverter) { // Mapping CircularToCartesian const mapping; + static_assert(is_accessible_v< + Kokkos::DefaultHostExecutionSpace, + CircularToCartesian>); // Test coordinates double const r = .75; double const theta = 1 / 3. * M_PI; CoordRTheta const coord_rtheta(r, theta); - double const x = r * Kokkos::cos(theta); - double const y = r * Kokkos::sin(theta); + double const x = r * std::cos(theta); + double const y = r * std::sin(theta); CoordXY const coord_xy(x, y); // Coord converter: logical -> physical. @@ -238,16 +243,18 @@ TEST_F(MappingMemoryAccess, HostCzarnyCoordConverter) double const epsilon = 0.3; double const e = 1.4; CzarnyToCartesian const mapping(epsilon, e); + static_assert( + is_accessible_v>); // Test coordinates double const r = .75; double const theta = 1 / 3. * M_PI; CoordRTheta const coord_rtheta(r, theta); - const double tmp1 = Kokkos::sqrt(epsilon * (epsilon + 2.0 * r * Kokkos::cos(theta)) + 1.0); + const double tmp1 = std::sqrt(epsilon * (epsilon + 2.0 * r * std::cos(theta)) + 1.0); const double x = (1.0 - tmp1) / epsilon; - const double y = e * r * Kokkos::sin(theta) - / (Kokkos::sqrt(1.0 - 0.25 * epsilon * epsilon) * (2.0 - tmp1)); + const double y + = e * r * std::sin(theta) / (std::sqrt(1.0 - 0.25 * epsilon * epsilon) * (2.0 - tmp1)); CoordXY const coord_xy(x, y); // Coord converter: logical -> physical. @@ -268,6 +275,8 @@ TEST_F(MappingMemoryAccess, HostDiscreteCoordConverter) double const epsilon = 0.3; double const e = 1.4; CzarnyToCartesian const analytical_mapping(epsilon, e); + static_assert( + is_accessible_v>); SplineRThetaBuilder builder(interpolation_idx_range_rtheta); @@ -286,16 +295,17 @@ TEST_F(MappingMemoryAccess, HostDiscreteCoordConverter) SplineRThetaEvaluator> mapping_builder(HostExecSpace(), analytical_mapping, builder, evaluator); DiscreteToCartesian mapping = mapping_builder(); + static_assert(is_accessible_v); // Test coordinates double const r = .75; double const theta = 1 / 3. * M_PI; CoordRTheta const coord_rtheta(r, theta); - const double tmp1 = Kokkos::sqrt(epsilon * (epsilon + 2.0 * r * Kokkos::cos(theta)) + 1.0); + const double tmp1 = std::sqrt(epsilon * (epsilon + 2.0 * r * std::cos(theta)) + 1.0); const double x = (1.0 - tmp1) / epsilon; - const double y = e * r * Kokkos::sin(theta) - / (Kokkos::sqrt(1.0 - 0.25 * epsilon * epsilon) * (2.0 - tmp1)); + const double y + = e * r * std::sin(theta) / (std::sqrt(1.0 - 0.25 * epsilon * epsilon) * (2.0 - tmp1)); CoordXY const coord_xy(x, y); // Coord converter: logical -> physical. @@ -310,14 +320,16 @@ TEST_F(MappingMemoryAccess, DeviceCircularCoordConverter) { // Mapping CircularToCartesian const mapping; + static_assert( + is_accessible_v>); // Test coordinates double const r = .75; double const theta = 1 / 3. * M_PI; CoordRTheta const coord_rtheta(r, theta); - double const x = r * Kokkos::cos(theta); - double const y = r * Kokkos::sin(theta); + double const x = r * std::cos(theta); + double const y = r * std::sin(theta); CoordXY const coord_xy(x, y); // Coord converter: logical -> physical. @@ -336,16 +348,18 @@ TEST_F(MappingMemoryAccess, DeviceCzarnyCoordConverter) double const epsilon = 0.3; double const e = 1.4; CzarnyToCartesian const mapping(epsilon, e); + static_assert( + is_accessible_v>); // Test coordinates double const r = .75; double const theta = 1 / 3. * M_PI; CoordRTheta const coord_rtheta(r, theta); - const double tmp1 = Kokkos::sqrt(epsilon * (epsilon + 2.0 * r * Kokkos::cos(theta)) + 1.0); + const double tmp1 = std::sqrt(epsilon * (epsilon + 2.0 * r * std::cos(theta)) + 1.0); const double x = (1.0 - tmp1) / epsilon; - const double y = e * r * Kokkos::sin(theta) - / (Kokkos::sqrt(1.0 - 0.25 * epsilon * epsilon) * (2.0 - tmp1)); + const double y + = e * r * std::sin(theta) / (std::sqrt(1.0 - 0.25 * epsilon * epsilon) * (2.0 - tmp1)); CoordXY const coord_xy(x, y); // Coord converter: logical -> physical. @@ -364,6 +378,8 @@ TEST_F(MappingMemoryAccess, DeviceDiscreteCoordConverter) double const epsilon = 0.3; double const e = 1.4; CzarnyToCartesian const analytical_mapping(epsilon, e); + static_assert( + is_accessible_v>); SplineRThetaBuilder builder(interpolation_idx_range_rtheta); @@ -382,16 +398,17 @@ TEST_F(MappingMemoryAccess, DeviceDiscreteCoordConverter) SplineRThetaEvaluator> mapping_builder(DeviceExecSpace(), analytical_mapping, builder, evaluator); DiscreteToCartesian mapping = mapping_builder(); + static_assert(is_accessible_v); // Test coordinates double const r = .75; double const theta = 1 / 3. * M_PI; CoordRTheta const coord_rtheta(r, theta); - const double tmp1 = Kokkos::sqrt(epsilon * (epsilon + 2.0 * r * Kokkos::cos(theta)) + 1.0); + const double tmp1 = std::sqrt(epsilon * (epsilon + 2.0 * r * std::cos(theta)) + 1.0); const double x = (1.0 - tmp1) / epsilon; - const double y = e * r * Kokkos::sin(theta) - / (Kokkos::sqrt(1.0 - 0.25 * epsilon * epsilon) * (2.0 - tmp1)); + const double y + = e * r * std::sin(theta) / (std::sqrt(1.0 - 0.25 * epsilon * epsilon) * (2.0 - tmp1)); CoordXY const coord_xy(x, y); // Coord converter: logical -> physical.