diff --git a/classddc_1_1SplineBuilder.html b/classddc_1_1SplineBuilder.html index 356543105..6652aef29 100644 --- a/classddc_1_1SplineBuilder.html +++ b/classddc_1_1SplineBuilder.html @@ -997,7 +997,7 @@

Definition at line 753 of file spline_builder.hpp.

+

Definition at line 752 of file spline_builder.hpp.

@@ -1033,7 +1033,7 @@

Returns
A tuple containing the three Chunks containing the quadrature coefficients (if HERMITE is not used, first and third are empty).
-

Definition at line 942 of file spline_builder.hpp.

+

Definition at line 941 of file spline_builder.hpp.

diff --git a/constant__extrapolation__rule_8hpp_source.html b/constant__extrapolation__rule_8hpp_source.html index 3eb079ea9..1bebfca5e 100644 --- a/constant__extrapolation__rule_8hpp_source.html +++ b/constant__extrapolation__rule_8hpp_source.html @@ -166,184 +166,173 @@
37 *
38 * The boundary value will be the same as at the coordinate eval_pos given.
39 *
-
40 * @param[in] eval_pos
-
41 * Coordinate inside the domain where we will evaluate each points outside the domain.
-
42 */
-
43 explicit ConstantExtrapolationRule(ddc::Coordinate<DimI> eval_pos) : m_eval_pos(eval_pos) {}
-
44
-
45 /**
-
46 * @brief Get the value of the function on B-splines at a coordinate outside the domain.
-
47 *
-
48 * @param[in] pos
-
49 * The coordinate where we want to evaluate the function on B-splines.
-
50 * @param[in] spline_coef
-
51 * The coefficients of the function on B-splines.
-
52 *
-
53 * @return A double with the value of the function on B-splines evaluated at the coordinate.
-
54 */
-
55 template <class CoordType, class BSplines, class Layout, class MemorySpace>
- -
57 [[maybe_unused]] CoordType pos,
-
58 ddc::ChunkSpan<double const, ddc::DiscreteDomain<BSplines>, Layout, MemorySpace> const
-
59 spline_coef) const
-
60 {
-
61 static_assert(in_tags_v<DimI, to_type_seq_t<CoordType>>);
-
62
-
63 std::array<double, BSplines::degree() + 1> vals_ptr;
-
64 Kokkos::mdspan<double, Kokkos::extents<std::size_t, BSplines::degree() + 1>> const vals(
-
65 vals_ptr.data());
+
40 * @param[in] eval_pos Coordinate inside the domain where we will evaluate each points outside the domain.
+
41 */
+
42 explicit ConstantExtrapolationRule(ddc::Coordinate<DimI> eval_pos) : m_eval_pos(eval_pos) {}
+
43
+
44 /**
+
45 * @brief Get the value of the function on B-splines at a coordinate outside the domain.
+
46 *
+
47 * @param[in] pos The coordinate where we want to evaluate the function on B-splines.
+
48 * @param[in] spline_coef The coefficients of the function on B-splines.
+
49 *
+
50 * @return A double with the value of the function on B-splines evaluated at the coordinate.
+
51 */
+
52 template <class CoordType, class BSplines, class Layout, class MemorySpace>
+ +
54 [[maybe_unused]] CoordType pos,
+
55 ddc::ChunkSpan<double const, ddc::DiscreteDomain<BSplines>, Layout, MemorySpace> const
+
56 spline_coef) const
+
57 {
+
58 static_assert(in_tags_v<DimI, to_type_seq_t<CoordType>>);
+
59
+
60 std::array<double, BSplines::degree() + 1> vals_ptr;
+
61 Kokkos::mdspan<double, Kokkos::extents<std::size_t, BSplines::degree() + 1>> const vals(
+
62 vals_ptr.data());
+
63
+
64 ddc::DiscreteElement<BSplines> const idx
+
65 = ddc::discrete_space<BSplines>().eval_basis(vals, m_eval_pos);
66
-
67 ddc::DiscreteElement<BSplines> const idx
-
68 = ddc::discrete_space<BSplines>().eval_basis(vals, m_eval_pos);
-
69
-
70 double y = 0.0;
-
71 for (std::size_t i = 0; i < BSplines::degree() + 1; ++i) {
-
72 y += spline_coef(idx + i) * vals[i];
-
73 }
-
74 return y;
-
75 }
-
76};
-
77
-
78/**
-
79 * @brief A functor for describing a spline boundary value by a constant extrapolation for 2D evaluator.
-
80 *
-
81 * To define the value of a function on B-splines out of the domain, we here use a constant
-
82 * extrapolation on the edge.
-
83 */
-
84template <class DimI, class DimNI>
-
85struct ConstantExtrapolationRule<DimI, DimNI>
-
86{
-
87private:
-
88 ddc::Coordinate<DimI> m_eval_pos;
-
89 ddc::Coordinate<DimNI> m_eval_pos_not_interest_min;
-
90 ddc::Coordinate<DimNI> m_eval_pos_not_interest_max;
-
91
-
92public:
-
93 /**
-
94 * @brief Instantiate a ConstantExtrapolationRule.
-
95 *
-
96 * The boundary value will be the same as at the coordinate given in a dimension given.
-
97 * The dimension of the input defines the dimension of the boundary condition.
-
98 * The second and the third parameters are needed in case of non-periodic splines on the
-
99 * dimension off-interest (the complementary dimension of the boundary condition),
-
100 * because the evaluator can receive coordinates outside the domain in both dimension.
-
101 *
-
102 * @param[in] eval_pos
-
103 * Coordinate in the dimension given inside the domain where we will evaluate
-
104 * each points outside the domain.
-
105 * @param[in] eval_pos_not_interest_min
-
106 * The minimum coordinate inside the domain on the complementary dimension of the boundary condition.
-
107 * @param[in] eval_pos_not_interest_max
-
108 * The maximum coordinate inside the domain on the complementary dimension of the boundary condition.
-
109 */
- -
111 ddc::Coordinate<DimI> eval_pos,
-
112 ddc::Coordinate<DimNI> eval_pos_not_interest_min,
-
113 ddc::Coordinate<DimNI> eval_pos_not_interest_max)
-
114 : m_eval_pos(eval_pos)
-
115 , m_eval_pos_not_interest_min(eval_pos_not_interest_min)
-
116 , m_eval_pos_not_interest_max(eval_pos_not_interest_max)
-
117 {
-
118 }
-
119
-
120 /**
-
121 * @brief Instantiate a ConstantExtrapolationRule.
-
122 *
-
123 * The boundary value will be the same as at the coordinate given in a dimension given.
-
124 * The dimension of the input defines the dimension of the boundary condition.
-
125 * No second and third parameters are needed in case of periodic splines on the
-
126 * dimension off-interest (the complementary dimension of the boundary condition).
-
127 *
-
128 * @param[in] eval_pos
-
129 * Coordinate in the dimension given inside the domain where we will evaluate
-
130 * each points outside the domain.
-
131 */
-
132 template <class DimNI_sfinae = DimNI, std::enable_if_t<DimNI_sfinae::PERIODIC, int> = 0>
-
133 explicit ConstantExtrapolationRule(ddc::Coordinate<DimI> eval_pos)
-
134 : m_eval_pos(eval_pos)
-
135 , m_eval_pos_not_interest_min(0.)
-
136 , m_eval_pos_not_interest_max(0.)
-
137 {
-
138 }
-
139
-
140 /**
-
141 * @brief Get the value of the function on B-splines at a coordinate outside the domain.
-
142 *
-
143 * In the dimension defined in the constructor Dim1 (or Dim2), it sets the coordinate pos_1 (or pos_2)
-
144 * given at the m_eval_pos coordinate if it is outside the domain.
-
145 * If the coordinate on the complementary dimension of the boundary condition dimension ddc::Coordinate<DimNI>(coord_extrap) is
-
146 * outside the domain, then it also sets the coordinate at eval_pos_not_interest_min
-
147 * (if ddc::Coordinate<DimNI>(coord_extrap) @f$ < @f$ eval_pos_not_interest_min) or
-
148 * at eval_pos_not_interest_max (if ddc::Coordinate<DimNI>(coord_extrap) @f$ > @f$ eval_pos_not_interest_max).
-
149 *
-
150 * @param[in] coord_extrap
-
151 * The coordinates where we want to evaluate the function on B-splines
-
152 * @param[in] spline_coef
-
153 * The coefficients of the function on B-splines.
-
154 *
-
155 *@return A double with the value of the function on B-splines evaluated at the coordinate.
-
156 */
-
157 template <class CoordType, class BSplines1, class BSplines2, class Layout, class MemorySpace>
-
158 KOKKOS_FUNCTION double operator()(
-
159 CoordType coord_extrap,
-
160 ddc::ChunkSpan<
-
161 double const,
-
162 ddc::DiscreteDomain<BSplines1, BSplines2>,
-
163 Layout,
-
164 MemorySpace> const spline_coef) const
-
165 {
-
166 static_assert(
-
167 in_tags_v<DimI, to_type_seq_t<CoordType>>
-
168 && in_tags_v<DimNI, to_type_seq_t<CoordType>>);
-
169
-
170 ddc::Coordinate<DimI, DimNI> eval_pos;
-
171 if constexpr (DimNI::PERIODIC) {
-
172 eval_pos = ddc::
-
173 Coordinate<DimI, DimNI>(m_eval_pos, ddc::Coordinate<DimNI>(coord_extrap));
-
174 } else {
-
175 eval_pos = ddc::Coordinate<DimI, DimNI>(
-
176 m_eval_pos,
-
177 Kokkos::
-
178 clamp(ddc::Coordinate<DimNI>(coord_extrap),
-
179 m_eval_pos_not_interest_min,
-
180 m_eval_pos_not_interest_max));
-
181 }
-
182
-
183 std::array<double, BSplines1::degree() + 1> vals1_ptr;
-
184 Kokkos::mdspan<double, Kokkos::extents<std::size_t, BSplines1::degree() + 1>> const vals1(
-
185 vals1_ptr.data());
-
186 std::array<double, BSplines2::degree() + 1> vals2_ptr;
-
187 Kokkos::mdspan<double, Kokkos::extents<std::size_t, BSplines2::degree() + 1>> const vals2(
-
188 vals2_ptr.data());
-
189
-
190 ddc::DiscreteElement<BSplines1> const idx1 = ddc::discrete_space<BSplines1>().eval_basis(
-
191 vals1,
-
192 ddc::Coordinate<typename BSplines1::continuous_dimension_type>(eval_pos));
-
193 ddc::DiscreteElement<BSplines2> const idx2 = ddc::discrete_space<BSplines2>().eval_basis(
-
194 vals2,
-
195 ddc::Coordinate<typename BSplines2::continuous_dimension_type>(eval_pos));
+
67 double y = 0.0;
+
68 for (std::size_t i = 0; i < BSplines::degree() + 1; ++i) {
+
69 y += spline_coef(idx + i) * vals[i];
+
70 }
+
71 return y;
+
72 }
+
73};
+
74
+
75/**
+
76 * @brief A functor for describing a spline boundary value by a constant extrapolation for 2D evaluator.
+
77 *
+
78 * To define the value of a function on B-splines out of the domain, we here use a constant
+
79 * extrapolation on the edge.
+
80 */
+
81template <class DimI, class DimNI>
+
82struct ConstantExtrapolationRule<DimI, DimNI>
+
83{
+
84private:
+
85 ddc::Coordinate<DimI> m_eval_pos;
+
86 ddc::Coordinate<DimNI> m_eval_pos_not_interest_min;
+
87 ddc::Coordinate<DimNI> m_eval_pos_not_interest_max;
+
88
+
89public:
+
90 /**
+
91 * @brief Instantiate a ConstantExtrapolationRule.
+
92 *
+
93 * The boundary value will be the same as at the coordinate given in a dimension given.
+
94 * The dimension of the input defines the dimension of the boundary condition.
+
95 * The second and the third parameters are needed in case of non-periodic splines on the
+
96 * dimension off-interest (the complementary dimension of the boundary condition),
+
97 * because the evaluator can receive coordinates outside the domain in both dimension.
+
98 *
+
99 * @param[in] eval_pos Coordinate in the dimension given inside the domain where we will evaluate each points outside the domain.
+
100 * @param[in] eval_pos_not_interest_min The minimum coordinate inside the domain on the complementary dimension of the boundary condition.
+
101 * @param[in] eval_pos_not_interest_max The maximum coordinate inside the domain on the complementary dimension of the boundary condition.
+
102 */
+ +
104 ddc::Coordinate<DimI> eval_pos,
+
105 ddc::Coordinate<DimNI> eval_pos_not_interest_min,
+
106 ddc::Coordinate<DimNI> eval_pos_not_interest_max)
+
107 : m_eval_pos(eval_pos)
+
108 , m_eval_pos_not_interest_min(eval_pos_not_interest_min)
+
109 , m_eval_pos_not_interest_max(eval_pos_not_interest_max)
+
110 {
+
111 }
+
112
+
113 /**
+
114 * @brief Instantiate a ConstantExtrapolationRule.
+
115 *
+
116 * The boundary value will be the same as at the coordinate given in a dimension given.
+
117 * The dimension of the input defines the dimension of the boundary condition.
+
118 * No second and third parameters are needed in case of periodic splines on the
+
119 * dimension off-interest (the complementary dimension of the boundary condition).
+
120 *
+
121 * @param[in] eval_pos Coordinate in the dimension given inside the domain where we will evaluate each points outside the domain.
+
122 */
+
123 template <class DimNI_sfinae = DimNI, std::enable_if_t<DimNI_sfinae::PERIODIC, int> = 0>
+
124 explicit ConstantExtrapolationRule(ddc::Coordinate<DimI> eval_pos)
+
125 : m_eval_pos(eval_pos)
+
126 , m_eval_pos_not_interest_min(0.)
+
127 , m_eval_pos_not_interest_max(0.)
+
128 {
+
129 }
+
130
+
131 /**
+
132 * @brief Get the value of the function on B-splines at a coordinate outside the domain.
+
133 *
+
134 * In the dimension defined in the constructor Dim1 (or Dim2), it sets the coordinate pos_1 (or pos_2)
+
135 * given at the m_eval_pos coordinate if it is outside the domain.
+
136 * If the coordinate on the complementary dimension of the boundary condition dimension ddc::Coordinate<DimNI>(coord_extrap) is
+
137 * outside the domain, then it also sets the coordinate at eval_pos_not_interest_min
+
138 * (if ddc::Coordinate<DimNI>(coord_extrap) @f$ < @f$ eval_pos_not_interest_min) or
+
139 * at eval_pos_not_interest_max (if ddc::Coordinate<DimNI>(coord_extrap) @f$ > @f$ eval_pos_not_interest_max).
+
140 *
+
141 * @param[in] coord_extrap The coordinates where we want to evaluate the function on B-splines
+
142 * @param[in] spline_coef The coefficients of the function on B-splines.
+
143 *
+
144 *@return A double with the value of the function on B-splines evaluated at the coordinate.
+
145 */
+
146 template <class CoordType, class BSplines1, class BSplines2, class Layout, class MemorySpace>
+
147 KOKKOS_FUNCTION double operator()(
+
148 CoordType coord_extrap,
+
149 ddc::ChunkSpan<
+
150 double const,
+
151 ddc::DiscreteDomain<BSplines1, BSplines2>,
+
152 Layout,
+
153 MemorySpace> const spline_coef) const
+
154 {
+
155 static_assert(
+
156 in_tags_v<DimI, to_type_seq_t<CoordType>>
+
157 && in_tags_v<DimNI, to_type_seq_t<CoordType>>);
+
158
+
159 ddc::Coordinate<DimI, DimNI> eval_pos;
+
160 if constexpr (DimNI::PERIODIC) {
+
161 eval_pos = ddc::
+
162 Coordinate<DimI, DimNI>(m_eval_pos, ddc::Coordinate<DimNI>(coord_extrap));
+
163 } else {
+
164 eval_pos = ddc::Coordinate<DimI, DimNI>(
+
165 m_eval_pos,
+
166 Kokkos::
+
167 clamp(ddc::Coordinate<DimNI>(coord_extrap),
+
168 m_eval_pos_not_interest_min,
+
169 m_eval_pos_not_interest_max));
+
170 }
+
171
+
172 std::array<double, BSplines1::degree() + 1> vals1_ptr;
+
173 Kokkos::mdspan<double, Kokkos::extents<std::size_t, BSplines1::degree() + 1>> const vals1(
+
174 vals1_ptr.data());
+
175 std::array<double, BSplines2::degree() + 1> vals2_ptr;
+
176 Kokkos::mdspan<double, Kokkos::extents<std::size_t, BSplines2::degree() + 1>> const vals2(
+
177 vals2_ptr.data());
+
178
+
179 ddc::DiscreteElement<BSplines1> const idx1 = ddc::discrete_space<BSplines1>().eval_basis(
+
180 vals1,
+
181 ddc::Coordinate<typename BSplines1::continuous_dimension_type>(eval_pos));
+
182 ddc::DiscreteElement<BSplines2> const idx2 = ddc::discrete_space<BSplines2>().eval_basis(
+
183 vals2,
+
184 ddc::Coordinate<typename BSplines2::continuous_dimension_type>(eval_pos));
+
185
+
186 double y = 0.0;
+
187 for (std::size_t i = 0; i < BSplines1::degree() + 1; ++i) {
+
188 for (std::size_t j = 0; j < BSplines2::degree() + 1; ++j) {
+
189 y += spline_coef(idx1 + i, idx2 + j) * vals1[i] * vals2[j];
+
190 }
+
191 }
+
192
+
193 return y;
+
194 }
+
195};
196
-
197 double y = 0.0;
-
198 for (std::size_t i = 0; i < BSplines1::degree() + 1; ++i) {
-
199 for (std::size_t j = 0; j < BSplines2::degree() + 1; ++j) {
-
200 y += spline_coef(idx1 + i, idx2 + j) * vals1[i] * vals2[j];
-
201 }
-
202 }
-
203
-
204 return y;
-
205 }
-
206};
-
207
-
208} // namespace ddc
+
197} // namespace ddc
friend class DiscreteDomain
The top-level namespace of DDC.
-
ConstantExtrapolationRule(ddc::Coordinate< DimI > eval_pos, ddc::Coordinate< DimNI > eval_pos_not_interest_min, ddc::Coordinate< DimNI > eval_pos_not_interest_max)
Instantiate a ConstantExtrapolationRule.
-
KOKKOS_FUNCTION double operator()(CoordType coord_extrap, ddc::ChunkSpan< double const, ddc::DiscreteDomain< BSplines1, BSplines2 >, Layout, MemorySpace > const spline_coef) const
Get the value of the function on B-splines at a coordinate outside the domain.
-
ConstantExtrapolationRule(ddc::Coordinate< DimI > eval_pos)
Instantiate a ConstantExtrapolationRule.
-
KOKKOS_FUNCTION double operator()(CoordType pos, ddc::ChunkSpan< double const, ddc::DiscreteDomain< BSplines >, Layout, MemorySpace > const spline_coef) const
Get the value of the function on B-splines at a coordinate outside the domain.
-
ConstantExtrapolationRule(ddc::Coordinate< DimI > eval_pos)
Instantiate a ConstantExtrapolationRule.
+
ConstantExtrapolationRule(ddc::Coordinate< DimI > eval_pos, ddc::Coordinate< DimNI > eval_pos_not_interest_min, ddc::Coordinate< DimNI > eval_pos_not_interest_max)
Instantiate a ConstantExtrapolationRule.
+
KOKKOS_FUNCTION double operator()(CoordType coord_extrap, ddc::ChunkSpan< double const, ddc::DiscreteDomain< BSplines1, BSplines2 >, Layout, MemorySpace > const spline_coef) const
Get the value of the function on B-splines at a coordinate outside the domain.
+
ConstantExtrapolationRule(ddc::Coordinate< DimI > eval_pos)
Instantiate a ConstantExtrapolationRule.
+
KOKKOS_FUNCTION double operator()(CoordType pos, ddc::ChunkSpan< double const, ddc::DiscreteDomain< BSplines >, Layout, MemorySpace > const spline_coef) const
Get the value of the function on B-splines at a coordinate outside the domain.
+
ConstantExtrapolationRule(ddc::Coordinate< DimI > eval_pos)
Instantiate a ConstantExtrapolationRule.