Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add function to replace coordinate inside domain #47

Open
PaulineVidal opened this issue Jan 17, 2025 · 0 comments
Open

Add function to replace coordinate inside domain #47

PaulineVidal opened this issue Jan 17, 2025 · 0 comments

Comments

@PaulineVidal
Copy link
Collaborator

See https://gitlab.maisondelasimulation.fr/gysela-developpers/gyselalibxx/-/merge_requests/670#note_66052.

Add next to this function https://gitlab.maisondelasimulation.fr/gysela-developpers/gyselalibxx/-/blob/main/src/utils/ddc_helper.hpp?ref_type=heads#L72-86, a function to replace a coordinate inside a domain for periodic case without giving an index range.

With the typical following code:

 template <class CoordType>
 KOKKOS_INLINE_FUNCTION void replace_periodic_coord_inside(CoordType& coord) const
 {
 using bsplines_1 = ...;
 using bsplines_2 = ...;

 using continuous_dim_1 = typename bsplines_1::continuous_dimension_type;
 using continuous_dim_2 = typename bsplines_2::continuous_dimension_type;

 if constexpr (bsplines_1::is_periodic()) {
 if (ddc::get<continuous_dim_1>(coord) < ddc::discrete_space<bsplines_1>().rmin()
 || ddc::get<Dim1>(coord) > ddc::discrete_space<bsplines_1>().rmax()) {
 ddc::get<continuous_dim_1>(coord) -= Kokkos::floor(
 (ddc::get<continuous_dim_1>(coord)
 - ddc::discrete_space<bsplines_1>().rmin())
 / ddc::discrete_space<bsplines_1>().length())
 AUTHORS bin build build_1 build_2 build_3 build_debug ci_tools CMakeFiles CMakeLists.txt DartConfiguration.tcl doc docker docs googletest kokkos LICENSE mdspan post-process prepare.gyselalibxx.sh README.md simulations spack.yaml src Testing tests toolchains transfer_issue.sh vendor voicexx.imp ddc::discrete_space<bsplines_1>().length();
 }
 }
 if constexpr (bsplines_2::is_periodic()) {
 if (ddc::get<continuous_dim_2>(coord) < ddc::discrete_space<bsplines_2>().rmin()
 || ddc::get<Dim2>(coord) > ddc::discrete_space<bsplines_2>().rmax()) {
 ddc::get<continuous_dim_2>(coord) -= Kokkos::floor(
 (ddc::get<continuous_dim_2>(coord)
 - ddc::discrete_space<bsplines_2>().rmin())
 / ddc::discrete_space<bsplines_2>().length())
 AUTHORS bin build build_1 build_2 build_3 build_debug ci_tools CMakeFiles CMakeLists.txt DartConfiguration.tcl doc docker docs googletest kokkos LICENSE mdspan post-process prepare.gyselalibxx.sh README.md simulations spack.yaml src Testing tests toolchains transfer_issue.sh vendor voicexx.imp ddc::discrete_space<bsplines_2>().length();
 }
 }
 }

and apply it to src/multipatch/spline/multipatch_spline_evaluator_2d.hpp.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant