Gyselalib++
 
Loading...
Searching...
No Matches
volume_quadrature_nd.hpp
Go to the documentation of this file.
1// SPDX-License-Identifier: MIT
8#pragma once
9#include <ddc/ddc.hpp>
10
11#include <sll/mapping/mapping_tools.hpp>
12
13#include "ddc_alias_inline_functions.hpp"
14#include "ddc_aliases.hpp"
15#include "quadrature.hpp"
16
17
18
45template <class Mapping, class IdxRangeCoeffs, class ExecSpace>
46DFieldMem<IdxRangeCoeffs, typename ExecSpace::memory_space> compute_coeffs_on_mapping(
47 ExecSpace exec_space,
48 Mapping& mapping,
49 DFieldMem<IdxRangeCoeffs, typename ExecSpace::memory_space>&& coefficients_alloc)
50{
51 static_assert(is_curvilinear_2d_mapping_v<Mapping>);
52
53 using R = typename Mapping::curvilinear_tag_r;
54 using Theta = typename Mapping::curvilinear_tag_theta;
55
56 static_assert(has_2d_jacobian_v<Mapping, Coord<R, Theta>>);
57
58 using IdxCoeffs = typename IdxRangeCoeffs::discrete_element_type;
59 IdxRangeCoeffs grid = get_idx_range(coefficients_alloc);
60 DField<IdxRangeCoeffs, typename ExecSpace::memory_space> coefficients(coefficients_alloc);
61 ddc::parallel_for_each(
62 exec_space,
63 grid,
64 KOKKOS_LAMBDA(IdxCoeffs const idx) {
65 Coord<R, Theta> coord(ddc::coordinate(idx));
66 coefficients(idx) *= fabs(mapping.jacobian(coord));
67 });
68 return std::move(coefficients_alloc);
69}
Define non periodic real R dimension.
Definition geometry.hpp:31
Define periodic real Theta dimension.
Definition geometry.hpp:42
DFieldMem< IdxRangeCoeffs, typename ExecSpace::memory_space > compute_coeffs_on_mapping(ExecSpace exec_space, Mapping &mapping, DFieldMem< IdxRangeCoeffs, typename ExecSpace::memory_space > &&coefficients_alloc)
Add the Jacobian determinant to the coefficients.
Definition volume_quadrature_nd.hpp:46