SwshDerivatives.hpp
1 // Distributed under the MIT License.
2 // See LICENSE.txt for details.
3 
4 #pragma once
5 
6 #include <complex>
7 #include <cstddef>
8 
9 #include "DataStructures/ComplexDataVector.hpp" // IWYU pragma: keep
10 #include "DataStructures/ComplexDiagonalModalOperator.hpp"
11 #include "DataStructures/ComplexModalVector.hpp" // IWYU pragma: keep
12 #include "DataStructures/DataVector.hpp"
13 #include "DataStructures/SpinWeighted.hpp"
14 #include "DataStructures/TempBuffer.hpp" // IWYU pragma: keep
16 #include "NumericalAlgorithms/Spectral/ComplexDataView.hpp"
17 #include "NumericalAlgorithms/Spectral/SwshCoefficients.hpp"
18 #include "NumericalAlgorithms/Spectral/SwshCollocation.hpp"
19 #include "NumericalAlgorithms/Spectral/SwshSettings.hpp"
20 #include "NumericalAlgorithms/Spectral/SwshTags.hpp"
21 #include "NumericalAlgorithms/Spectral/SwshTransform.hpp"
23 #include "Utilities/Gsl.hpp"
24 #include "Utilities/TMPL.hpp"
25 
26 // IWYU pragma: no_forward_declare ComplexDataVector
27 // IWYU pragma: no_forward_declare SpinWeighted
28 // IWYU pragma: no_forward_declare Variables
29 
30 namespace Spectral {
31 namespace Swsh {
32 namespace detail {
33 
34 // Factors that appear in the modal representation of spin-weighted angular
35 // derivatives, needed for compute_coefficients_of_derivative
36 template <typename DerivativeKind>
37 SPECTRE_ALWAYS_INLINE std::complex<double> derivative_factor(int l,
38  int s) noexcept;
39 
40 template <>
41 SPECTRE_ALWAYS_INLINE std::complex<double> derivative_factor<Tags::Eth>(
42  const int l, const int s) noexcept {
43  return sqrt(static_cast<std::complex<double>>((l - s) * (l + s + 1)));
44 }
45 
46 template <>
47 SPECTRE_ALWAYS_INLINE std::complex<double> derivative_factor<Tags::Ethbar>(
48  const int l, const int s) noexcept {
49  return -sqrt(static_cast<std::complex<double>>((l + s) * (l - s + 1)));
50 }
51 
52 template <>
53 SPECTRE_ALWAYS_INLINE std::complex<double> derivative_factor<Tags::EthEth>(
54  const int l, const int s) noexcept {
55  return sqrt(static_cast<std::complex<double>>((l - s - 1) * (l + s + 2) *
56  (l - s) * (l + s + 1)));
57 }
58 
59 template <>
61 derivative_factor<Tags::EthbarEthbar>(const int l, const int s) noexcept {
62  return sqrt(static_cast<std::complex<double>>((l + s - 1) * (l - s + 2) *
63  (l + s) * (l - s + 1)));
64 }
65 
66 template <>
67 SPECTRE_ALWAYS_INLINE std::complex<double> derivative_factor<Tags::EthbarEth>(
68  const int l, const int s) noexcept {
69  return static_cast<std::complex<double>>(-(l - s) * (l + s + 1));
70 }
71 
72 template <>
73 SPECTRE_ALWAYS_INLINE std::complex<double> derivative_factor<Tags::EthEthbar>(
74  const int l, const int s) noexcept {
75  return static_cast<std::complex<double>>(-(l + s) * (l - s + 1));
76 }
77 
78 template <>
79 SPECTRE_ALWAYS_INLINE std::complex<double> derivative_factor<Tags::InverseEth>(
80  const int l, const int s) noexcept {
81  return (l - s + 1) * (l + s) == 0
82  ? 0.0
83  : 1.0 / sqrt(static_cast<std::complex<double>>((l - s + 1) *
84  (l + s)));
85 }
86 
87 template <>
89 derivative_factor<Tags::InverseEthbar>(const int l, const int s) noexcept {
90  return (l + s + 1) * (l - s) == 0
91  ? 0.0
92  : 1.0 / -sqrt(static_cast<std::complex<double>>((l + s + 1) *
93  (l - s)));
94 }
95 
96 // For a particular derivative represented by `DerivativeKind` and input spin
97 // `Spin`, multiplies the derivative spectral factors with
98 // `pre_derivative_modes`, returning by pointer via parameter `derivative_modes`
99 template <typename DerivativeKind, int Spin>
100 void compute_coefficients_of_derivative(
103  Spin + Tags::derivative_spin_weight<DerivativeKind>>*>
104  derivative_modes,
106  size_t l_max, size_t number_of_radial_points) noexcept;
107 
108 // Helper function for dealing with the parameter packs in the utilities which
109 // evaluate several spin-weighted derivatives at once. The `apply` function of
110 // this struct locates the appropriate mode buffer in the input tuple
111 // `pre_derivative_mode_tuple`, and calls `compute_coefficients_of_derivative`,
112 // deriving the coefficients for `DerivativeTag` and returning by pointer.
113 template <typename DerivativeTag, typename PreDerivativeTagList>
114 struct dispatch_to_compute_coefficients_of_derivative;
115 
116 template <typename DerivativeTag, typename... PreDerivativeTags>
117 struct dispatch_to_compute_coefficients_of_derivative<
118  DerivativeTag, tmpl::list<PreDerivativeTags...>> {
119  template <int Spin, typename... ModalTypes>
121  derivative_modes,
122  const std::tuple<ModalTypes...>& pre_derivative_mode_tuple,
123  const size_t l_max,
124  const size_t number_of_radial_points) noexcept {
125  compute_coefficients_of_derivative<typename DerivativeTag::derivative_kind>(
126  derivative_modes,
127  get<tmpl::position_of_first_v<tmpl::list<PreDerivativeTags...>,
128  typename DerivativeTag::derivative_of>>(
129  pre_derivative_mode_tuple),
130  l_max, number_of_radial_points);
131  }
132 };
133 
134 // Helper function for dealing with the parameter packs in the utilities which
135 // evaluate several spin-weighted derivatives at once. The `apply` function of
136 // this struct locates the like-spin set of paired modes and nodes, and calls
137 // the member function of `SwshTransform` or `InverseSwshTransform` to perform
138 // the spin-weighted transform. This function is a friend of both
139 // `SwshTransform` and `InverseSwshTransform` to gain access to the private
140 // `apply_to_vectors`.
141 // The calling code will pass as tuples a superset of the quantities to be
142 // transformed, in the same order as the tags provided to `TagList`. The
143 // `modal_tuple` must be the storage destinations of the transforms in the
144 // same order as the `nodal_tuple`. The set of nodal tags to be transformed are
145 // the `TransformTags...` determined by the `SwshTransform` or
146 // `InverseSwshTransform`. The reason for using `tuple`s rather than
147 // `TaggedTuple`s or similar is to pass around spin-weighted vectors directly,
148 // rather than `Scalar`s, which allows for more condensed forwarding code.
149 template <typename Transform, typename TagList>
150 struct dispatch_to_transform;
151 
152 template <ComplexRepresentation Representation, typename... TransformTags,
153  typename... Tags>
154 struct dispatch_to_transform<
155  SwshTransform<tmpl::list<TransformTags...>, Representation>,
156  tmpl::list<Tags...>> {
157  template <typename... ModalTypes, typename... NodalTypes>
158  static void apply(const gsl::not_null<std::tuple<ModalTypes...>*> modal_tuple,
159  const std::tuple<NodalTypes...>& nodal_tuple,
160  const size_t l_max,
161  const size_t number_of_radial_points) noexcept {
162  SwshTransform<tmpl::list<TransformTags...>, Representation>::
163  apply_to_vectors(
164  get<tmpl::position_of_first_v<tmpl::list<Tags...>, TransformTags>>(
165  *modal_tuple)...,
166  get<tmpl::position_of_first_v<tmpl::list<Tags...>, TransformTags>>(
167  nodal_tuple)...,
168  l_max, number_of_radial_points);
169  }
170 };
171 
172 template <ComplexRepresentation Representation, typename... TransformTags,
173  typename... Tags>
174 struct dispatch_to_transform<
175  InverseSwshTransform<tmpl::list<TransformTags...>, Representation>,
176  tmpl::list<Tags...>> {
177  template <typename... NodalTypes, typename... ModalTypes>
178  static void apply(const gsl::not_null<std::tuple<NodalTypes...>*> nodal_tuple,
179  const std::tuple<ModalTypes...>& modal_tuple,
180  const size_t l_max,
181  const size_t number_of_radial_points) noexcept {
182  InverseSwshTransform<tmpl::list<TransformTags...>, Representation>::
183  apply_to_vectors(
184  get<tmpl::position_of_first_v<tmpl::list<Tags...>, TransformTags>>(
185  *nodal_tuple)...,
186  *get<tmpl::position_of_first_v<tmpl::list<Tags...>, TransformTags>>(
187  modal_tuple)...,
188  l_max, number_of_radial_points);
189  }
190 };
191 
192 // template 'implementation' for the DataBox mutate-compatible interface to
193 // spin-weighted derivative evaluation. This impl version is needed to have easy
194 // access to the `UniqueDifferentiatedFromTagList` as a parameter pack
195 template <typename DerivativeTagList, typename UniqueDifferentiatedFromTagList,
196  ComplexRepresentation Representation>
197 struct AngularDerivativesImpl;
198 
199 template <typename... DerivativeTags, typename... UniqueDifferentiatedFromTags,
200  ComplexRepresentation Representation>
201 struct AngularDerivativesImpl<tmpl::list<DerivativeTags...>,
202  tmpl::list<UniqueDifferentiatedFromTags...>,
203  Representation> {
204  using return_tags =
205  tmpl::list<DerivativeTags..., Tags::SwshTransform<DerivativeTags>...,
206  Tags::SwshTransform<UniqueDifferentiatedFromTags>...>;
207  using argument_tags =
208  tmpl::list<UniqueDifferentiatedFromTags..., Tags::LMaxBase,
209  Tags::NumberOfRadialPointsBase>;
210 
211  static void apply(
212  const gsl::not_null<db::item_type<DerivativeTags>*>... derivative_scalars,
213  const gsl::not_null<db::item_type<Tags::SwshTransform<
214  DerivativeTags>>*>... transform_of_derivative_scalars,
215  const gsl::not_null<db::item_type<Tags::SwshTransform<
216  UniqueDifferentiatedFromTags>>*>... transform_of_input_scalars,
218  const size_t l_max, const size_t number_of_radial_points) noexcept {
219  apply_to_vectors(make_not_null(&get(*transform_of_derivative_scalars))...,
220  make_not_null(&get(*transform_of_input_scalars))...,
221  make_not_null(&get(*derivative_scalars))...,
222  get(input_scalars)..., l_max, number_of_radial_points);
223  }
224 
225  template <ComplexRepresentation FriendRepresentation,
226  typename... DerivativeKinds, typename... ArgumentTypes,
227  size_t... Is>
228  // NOLINTNEXTLINE(readability-redundant-declaratioon)
229  friend void angular_derivatives_impl(const std::tuple<ArgumentTypes...>&,
230  size_t, size_t,
232  tmpl::list<DerivativeKinds...>,
233  cpp17::bool_constant<true>) noexcept;
234 
235  private:
236  // note inputs reordered to accommodate the alternative tag-free functions
237  // which call into this function.
238  static void apply_to_vectors(
239  const gsl::not_null<typename db::item_type<Tags::SwshTransform<
240  DerivativeTags>>::type*>... transform_of_derivatives,
241  const gsl::not_null<typename db::item_type<Tags::SwshTransform<
242  UniqueDifferentiatedFromTags>>::type*>... transform_of_inputs,
243  const gsl::not_null<
244  typename db::const_item_type<DerivativeTags>::type*>... derivatives,
245  const typename db::const_item_type<
246  UniqueDifferentiatedFromTags>::type&... inputs,
247  const size_t l_max, const size_t number_of_radial_points) noexcept {
248  // perform the forward transform on the minimal set of input nodal
249  // quantities to obtain all of the requested derivatives
250  using ForwardTransformList =
252  tmpl::list<DerivativeTags...>>;
253 
254  tmpl::for_each<ForwardTransformList>(
255  [&number_of_radial_points, &l_max, &inputs...,
256  &transform_of_inputs...](auto transform_v) noexcept {
257  using transform = typename decltype(transform_v)::type;
258  auto input_transforms = std::make_tuple(transform_of_inputs...);
259  dispatch_to_transform<transform,
260  tmpl::list<UniqueDifferentiatedFromTags...>>::
261  apply(make_not_null(&input_transforms),
262  std::forward_as_tuple(inputs...), l_max,
263  number_of_radial_points);
264  });
265 
266  // apply the modal derivative factors and place the result in the
267  // `transform_of_derivatives`
269  dispatch_to_compute_coefficients_of_derivative<
270  DerivativeTags, tmpl::list<UniqueDifferentiatedFromTags...>>::
271  apply(transform_of_derivatives,
272  std::make_tuple(transform_of_inputs...), l_max,
273  number_of_radial_points));
274 
275  // perform the inverse transform on the derivative results, placing the
276  // result in the nodal `derivatives` passed by pointer.
277  using InverseTransformList =
278  make_inverse_transform_list<Representation,
279  tmpl::list<DerivativeTags...>>;
280 
281  tmpl::for_each<InverseTransformList>([&number_of_radial_points, &l_max,
282  &derivatives...,
283  &transform_of_derivatives...](
284  auto transform_v) noexcept {
285  using transform = typename decltype(transform_v)::type;
286  auto derivative_tuple = std::make_tuple(derivatives...);
287  dispatch_to_transform<transform, tmpl::list<DerivativeTags...>>::apply(
288  make_not_null(&derivative_tuple),
289  std::make_tuple(transform_of_derivatives...), l_max,
290  number_of_radial_points);
291  });
292  }
293 };
294 
295 // metafunction for determining the tags needed to evaluate the derivative tags
296 // in `DerivativeTagList`, removing all duplicate tags.
297 template <typename DerivativeTagList>
298 struct unique_derived_from_list;
299 
300 template <typename... DerivativeTags>
301 struct unique_derived_from_list<tmpl::list<DerivativeTags...>> {
302  using type = tmpl::remove_duplicates<
303  tmpl::list<typename DerivativeTags::derivative_of...>>;
304 };
305 } // namespace detail
306 
307 /*!
308  * \ingroup SpectralGroup
309  * \brief A \ref DataBoxGroup mutate-compatible computational struct for
310  * computing a set of spin-weighted spherical harmonic derivatives by
311  * grouping and batch-computing spin-weighted spherical harmonic transforms.
312  *
313  * \details A derivative is evaluated for each tag in `DerivativeTagList`. All
314  * entries in `DerivativeTagList` must be the tag
315  * `Spectral::Swsh::Tags::Derivative<Tag, DerivativeKind>` prefixing the `Tag`
316  * to be differentiated, and indicating the spin-weighted derivative
317  * `DerivativeKind` to be taken. A \ref DataBoxGroup on which this struct is
318  * invoked must contain:
319  * - each of the tags in `DerivativeTagList` (the results of the computation)
320  * - each of the tags `Tag` prefixed by `Spectral::Swsh::Tags::Derivative` in
321  * `DerivativeTagList` (the inputs of the computation).
322  * - each of the tags `Spectral::Swsh::Tags::SwshTransform<DerivativeTag>` for
323  * `DerivativeTag`in `DerivativeTagList` (the buffers for the derivative
324  * applied to the modes)
325  * - each of the tags `Spectral::Swsh::Tags::SwshTransform<Tag>` for `Tag`
326  * prefixed by any `DerivativeTag` in `DerivativeTagList` (the buffers for the
327  * transforms of the input data).
328  *
329  * This function optimizes the derivative taking process by clustering like
330  * spins of tags, forward-transforming each spin cluster together, applying the
331  * factor for the derivative to each modal vector, re-clustering according to
332  * the new spin weights (the derivatives alter the spin weights), and finally
333  * inverse-transforming in clusters.
334  */
335 template <typename DerivativeTagList, ComplexRepresentation Representation =
336  ComplexRepresentation::Interleaved>
337 using AngularDerivatives = detail::AngularDerivativesImpl<
338  DerivativeTagList,
339  typename detail::unique_derived_from_list<DerivativeTagList>::type,
340  Representation>;
341 
342 /*!
343  * \ingroup SpectralGroup
344  * \brief Produces a `SpinWeighted<ComplexModalVector, Spin>` of the appropriate
345  * size to be used as a modal buffer for `Spectral::Swsh::AngularDerivatives` or
346  * `Spectral::Swsh::angular_derivatives`.
347  *
348  * \details The `Spectral::Swsh::angular_derivatives` and
349  * `Spectral::Swsh::AngularDerivatives` interfaces require that calling code
350  * provides a buffer for the intermediate transform results, to ensure that
351  * callers are aware of the allocations and can suitably reuse buffers if
352  * possible. This utility eases the creation of those buffers.
353  */
354 template <int Spin>
355 auto swsh_buffer(const size_t l_max,
356  const size_t number_of_radial_points) noexcept {
358  size_of_libsharp_coefficient_vector(l_max) * number_of_radial_points};
359 }
360 
361 namespace detail {
362 // template 'implementation' for the `angular_derivatives` function below which
363 // evaluates an arbitrary number of derivatives, and places them in the set of
364 // nodal containers passed by pointer.
365 template <ComplexRepresentation Representation, typename... DerivativeKinds,
366  typename... ArgumentTypes, size_t... Is>
367 void angular_derivatives_impl(
368  const std::tuple<ArgumentTypes...>& argument_tuple, const size_t l_max,
369  const size_t number_of_radial_points, std::index_sequence<Is...> /*meta*/,
370  tmpl::list<DerivativeKinds...> /*meta*/,
371  cpp17::bool_constant<true> /*buffers_included_in_arguments*/) noexcept {
372  AngularDerivatives<
373  tmpl::list<Tags::Derivative<
377  int, std::decay_t<decltype(get<Is + 3 * sizeof...(Is)>(
378  argument_tuple))>::spin>>,
379  DerivativeKinds>...>,
380  Representation>::apply_to_vectors(get<Is>(argument_tuple)...,
381  get<Is + sizeof...(Is)>(
382  argument_tuple)...,
383  get<Is + 2 * sizeof...(Is)>(
384  argument_tuple)...,
385  get<Is + 3 * sizeof...(Is)>(
386  argument_tuple)...,
387  l_max, number_of_radial_points);
388 }
389 
390 template <ComplexRepresentation Representation, typename... DerivativeKinds,
391  typename... ArgumentTypes, size_t... Is>
392 void angular_derivatives_impl(
393  const std::tuple<ArgumentTypes...>& argument_tuple, const size_t l_max,
394  const size_t number_of_radial_points,
395  std::index_sequence<Is...> index_sequence,
396  tmpl::list<DerivativeKinds...> derivative_kinds,
397  cpp17::bool_constant<false> /*buffers_included_in_arguments*/) noexcept {
398  auto derivative_buffer_tuple = std::make_tuple(
399  swsh_buffer<std::decay_t<decltype(*get<Is>(argument_tuple))>::spin>(
400  l_max, number_of_radial_points)...);
401  auto input_buffer_tuple = std::make_tuple(
402  swsh_buffer<std::decay_t<decltype(get<Is + sizeof...(Is)>(
403  argument_tuple))>::spin>(l_max, number_of_radial_points)...);
404  angular_derivatives_impl<Representation>(
405  std::forward_as_tuple(make_not_null(&get<Is>(derivative_buffer_tuple))...,
406  make_not_null(&get<Is>(input_buffer_tuple))...,
407  get<Is>(argument_tuple)...,
408  get<Is + sizeof...(Is)>(argument_tuple)...),
409  l_max, number_of_radial_points, index_sequence, derivative_kinds,
411 }
412 } // namespace detail
413 
414 /*!
415  * \ingroup SpectralGroup
416  * \brief Evaluate all of the spin-weighted derivatives in `DerivKindList` on
417  * input `SpinWeighted<ComplexDataVector, Spin>` collocation data, returning by
418  * pointer.
419  *
420  * \details This function provides two interfaces, one in which the caller
421  * provides the intermediate coefficient buffers needed during the computation
422  * of the derivatives, and one in which those buffers are temporarily allocated
423  * during the derivative function calls.
424  *
425  * For the interface in which the caller does not provide buffers, the arguments
426  * must take the following structure (enforced by internal function calls):
427  *
428  * - `size_t l_max` : angular resolution for the spherical representation
429  * - `size_t number_of_radial_points` : radial resolution (number of consecutive
430  * blocks to evaluate derivatives, for each input vector )
431  * - for each `DerivKind` in `DerivKindList`, a
432  * `gsl::not_null<SpinWeighted<ComplexDataVector, Spin +
433  * Tags::derivative_spin_weight<DerivKind>>>` : the output of the derivative
434  * evaluation
435  * - for each `DerivKind` in `DerivKindList`, a `const
436  * SpinWeighted<ComplexDataVector, Spin>&` (where the `Spin` for these arguments
437  * matches the corresponding vector from the previous set) : the input to the
438  * derivative evaluation.
439  *
440  * For the interface in which the caller does provide buffers, the arguments
441  * must take the following structure (enforced by internal function calls):
442  *
443  * - `size_t l_max` : angular resolution for the spherical representation
444  * - `size_t number_of_radial_points` : radial resolution (number of consecutive
445  * blocks to evaluate derivatives, for each input vector )
446  * - for each `DerivKind` in `DerivKindList`, a
447  * `gsl::not_null<SpinWeighted<ComplexModalVector, Spin +
448  * Tags::derivative_spin_weight<DerivKind>>>` : the buffer for the spin-weighted
449  * spherical harmonic modes of the derivative quantities.
450  * - for each `DerivKind` in `DerivKindList`, a `const
451  * SpinWeighted<ComplexModalVector, Spin>` (where the `Spin` for these arguments
452  * matches the corresponding vector from the previous set) : the buffer for the
453  * spin-weighted spherical harmonic modes of the input quantities.
454  * - for each `DerivKind` in `DerivKindList`, a
455  * `gsl::not_null<SpinWeighted<ComplexDataVector, Spin +
456  * Tags::derivative_spin_weight<DerivKind>>>` : the output of the derivative
457  * evaluation
458  * - for each `DerivKind` in `DerivKindList`, a `const
459  * SpinWeighted<ComplexDataVector, Spin>` (where the `Spin` for these arguments
460  * matches the corresponding vector from the previous set) : the input to the
461  * derivative evaluation.
462  *
463  * The function `swsh_buffer` assists in generating the modal buffers of
464  * appropriate size.
465  */
466 template <
467  typename DerivativeKindList,
468  ComplexRepresentation Representation = ComplexRepresentation::Interleaved,
469  typename... ArgumentTypes>
470 void angular_derivatives(const size_t l_max, // NOLINT
471  const size_t number_of_radial_points, // NOLINT
472  const ArgumentTypes&... arguments) noexcept {
473  static_assert(
474  tmpl::size<DerivativeKindList>::value * 2 == sizeof...(ArgumentTypes) or
475  tmpl::size<DerivativeKindList>::value * 4 == sizeof...(ArgumentTypes),
476  "When using the tagless `angular_derivatives` interface, you must "
477  "provide either one nodal input and one nodal output per derivative "
478  "or one nodal input, one nodal output, and two appropriate "
479  "intermediate transform buffers per derivative.");
480 
481  detail::angular_derivatives_impl<Representation>(
482  std::forward_as_tuple(arguments...), l_max, number_of_radial_points,
484  DerivativeKindList{},
486  sizeof...(ArgumentTypes)>{});
487 }
488 
489 /*!
490  * \ingroup SpectralGroup
491  * \brief Evaluate the spin-weighted derivative `DerivKind` on the provided
492  * `SpinWeighted<ComplexDataVector, Spin>` collocation data, returning by value.
493  */
494 template <
495  typename DerivKind,
496  ComplexRepresentation Representation = ComplexRepresentation::Interleaved,
497  int Spin>
500  size_t l_max, size_t number_of_radial_points,
501  const SpinWeighted<ComplexDataVector, Spin>& to_differentiate) noexcept;
502 } // namespace Swsh
503 } // namespace Spectral
constexpr size_t size_of_libsharp_coefficient_vector(const size_t l_max) noexcept
Convenience function for determining the number of spin-weighted spherical harmonics coefficients tha...
Definition: SwshCoefficients.hpp:34
typename detail::make_inverse_transform_list_impl< -2, Representation, TagList, decltype(std::make_integer_sequence< int, 5 >{})>::type make_inverse_transform_list
Assemble a tmpl::list of SwshTransforms or InverseSwshTransforms given a list of tags TagList that ne...
Definition: SwshTransform.hpp:764
#define EXPAND_PACK_LEFT_TO_RIGHT(...)
Expand a parameter pack evaluating the terms from left to right.
Definition: TMPL.hpp:562
Definition: Digraph.hpp:11
void angular_derivatives(const size_t l_max, const size_t number_of_radial_points, const ArgumentTypes &... arguments) noexcept
Evaluate all of the spin-weighted derivatives in DerivKindList on input SpinWeighted<ComplexDataVecto...
Definition: SwshDerivatives.hpp:470
Prefix tag representing the spin-weighted derivative of a spin-weighted scalar.
Definition: SwshTags.hpp:152
detail::AngularDerivativesImpl< DerivativeTagList, typename detail::unique_derived_from_list< DerivativeTagList >::type, Representation > AngularDerivatives
A DataBox mutate-compatible computational struct for computing a set of spin-weighted spherical harmo...
Definition: SwshDerivatives.hpp:340
typename detail::make_transform_list_impl< -2, Representation, tmpl::transform< DerivativeTagList, tmpl::bind< db::remove_tag_prefix, tmpl::_1 > >, decltype(std::make_integer_sequence< int, 5 >{})>::type make_transform_list_from_derivative_tags
Assemble a tmpl::list of SwshTransforms given a list of Spectral::Swsh::Tags::Derivative<Tag, Derivative> that need to be computed. The SwshTransforms constructed by this type alias correspond to the Tags in the list.
Definition: SwshTransform.hpp:784
Definition: Variables.hpp:936
Definition: Determinant.hpp:11
Given a Tag with a type of Tensor<VectorType, ...>, acts as a new version of the tag with type of Ten...
Definition: Tags.hpp:59
Make a spin-weighted type T with spin-weight Spin. Mathematical operators are restricted to addition...
Definition: SpinWeighted.hpp:24
#define SPECTRE_ALWAYS_INLINE
Always inline a function. Only use this if you benchmarked the code.
Definition: ForceInline.hpp:16
SpinWeighted< ComplexDataVector, Tags::derivative_spin_weight< DerivKind >+Spin > angular_derivative(const size_t l_max, const size_t number_of_radial_points, const SpinWeighted< ComplexDataVector, Spin > &to_differentiate) noexcept
Evaluate the spin-weighted derivative DerivKind on the provided SpinWeighted<ComplexDataVector, Spin> collocation data, returning by value.
Definition: SwshDerivatives.cpp:92
A class for storing complex spectral coefficients on a spectral grid.
Definition: ComplexModalVector.hpp:39
Defines class Variables.
Defines macro to always inline a function.
Definition: DataBoxTag.hpp:27
constexpr auto apply(F &&f, const DataBox< BoxTags > &box, Args &&... args) noexcept
Apply the invokable f with argument Tags TagsList from DataBox box
Definition: DataBox.hpp:1444
auto swsh_buffer(const size_t l_max, const size_t number_of_radial_points) noexcept
Produces a SpinWeighted<ComplexModalVector, Spin> of the appropriate size to be used as a modal buffe...
Definition: SwshDerivatives.hpp:355
Wraps the template metaprogramming library used (brigand)
typename DataBox_detail::item_type_impl< TagList, Tag >::type item_type
Get the type that can be written to the Tag. If it is a base tag then a TagList must be passed as a s...
Definition: DataBoxTag.hpp:246
Defines functions and classes from the GSL.
gsl::not_null< T * > make_not_null(T *ptr) noexcept
Construct a not_null from a pointer. Often this will be done as an implicit conversion, but it may be necessary to perform the conversion explicitly when type deduction is desired.
Definition: Gsl.hpp:879
Functionality associated with a particular choice of basis functions and quadrature for spectral oper...
Definition: Chebyshev.cpp:19
T transform(T... args)
T sqrt(T... args)
ComplexRepresentation
A set of labels for the possible representations of complex numbers for the ComplexDataView and the c...
Definition: ComplexDataView.hpp:57
Require a pointer to not be a nullptr
Definition: Gsl.hpp:182