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 // For a particular derivative represented by `DerivativeKind` and input spin
79 // `Spin`, multiplies the derivative spectral factors with
80 // `pre_derivative_modes`, returning by pointer via parameter `derivative_modes`
81 template <typename DerivativeKind, int Spin>
82 void compute_coefficients_of_derivative(
85  Spin + Tags::derivative_spin_weight<DerivativeKind>>*>
86  derivative_modes,
88  size_t l_max, size_t number_of_radial_points) noexcept;
89 
90 // Helper function for dealing with the parameter packs in the utilities which
91 // evaluate several spin-weighted derivatives at once. The `apply` function of
92 // this struct locates the appropriate mode buffer in the input tuple
93 // `pre_derivative_mode_tuple`, and calls `compute_coefficients_of_derivative`,
94 // deriving the coefficients for `DerivativeTag` and returning by pointer.
95 template <typename DerivativeTag, typename PreDerivativeTagList>
96 struct dispatch_to_compute_coefficients_of_derivative;
97 
98 template <typename DerivativeTag, typename... PreDerivativeTags>
99 struct dispatch_to_compute_coefficients_of_derivative<
100  DerivativeTag, tmpl::list<PreDerivativeTags...>> {
101  template <int Spin, typename... ModalTypes>
103  derivative_modes,
104  const std::tuple<ModalTypes...>& pre_derivative_mode_tuple,
105  const size_t l_max,
106  const size_t number_of_radial_points) noexcept {
107  compute_coefficients_of_derivative<typename DerivativeTag::derivative_kind>(
108  derivative_modes,
109  get<tmpl::position_of_first_v<tmpl::list<PreDerivativeTags...>,
110  typename DerivativeTag::derivative_of>>(
111  pre_derivative_mode_tuple),
112  l_max, number_of_radial_points);
113  }
114 };
115 
116 // Helper function for dealing with the parameter packs in the utilities which
117 // evaluate several spin-weighted derivatives at once. The `apply` function of
118 // this struct locates the like-spin set of paired modes and nodes, and calls
119 // the member function of `SwshTransform` or `InverseSwshTransform` to perform
120 // the spin-weighted transform. This function is a friend of both
121 // `SwshTransform` and `InverseSwshTransform` to gain access to the private
122 // `apply_to_vectors`.
123 // The calling code will pass as tuples a superset of the quantities to be
124 // transformed, in the same order as the tags provided to `TagList`. The
125 // `modal_tuple` must be the storage destinations of the transforms in the
126 // same order as the `nodal_tuple`. The set of nodal tags to be transformed are
127 // the `TransformTags...` determined by the `SwshTransform` or
128 // `InverseSwshTransform`. The reason for using `tuple`s rather than
129 // `TaggedTuple`s or similar is to pass around spin-weighted vectors directly,
130 // rather than `Scalar`s, which allows for more condensed forwarding code.
131 template <typename Transform, typename TagList>
132 struct dispatch_to_transform;
133 
134 template <ComplexRepresentation Representation, typename... TransformTags,
135  typename... Tags>
136 struct dispatch_to_transform<
137  SwshTransform<tmpl::list<TransformTags...>, Representation>,
138  tmpl::list<Tags...>> {
139  template <typename... ModalTypes, typename... NodalTypes>
140  static void apply(const gsl::not_null<std::tuple<ModalTypes...>*> modal_tuple,
141  const std::tuple<NodalTypes...>& nodal_tuple,
142  const size_t l_max,
143  const size_t number_of_radial_points) noexcept {
144  SwshTransform<tmpl::list<TransformTags...>, Representation>::
145  apply_to_vectors(
146  get<tmpl::position_of_first_v<tmpl::list<Tags...>, TransformTags>>(
147  *modal_tuple)...,
148  get<tmpl::position_of_first_v<tmpl::list<Tags...>, TransformTags>>(
149  nodal_tuple)...,
150  l_max, number_of_radial_points);
151  }
152 };
153 
154 template <ComplexRepresentation Representation, typename... TransformTags,
155  typename... Tags>
156 struct dispatch_to_transform<
157  InverseSwshTransform<tmpl::list<TransformTags...>, Representation>,
158  tmpl::list<Tags...>> {
159  template <typename... NodalTypes, typename... ModalTypes>
160  static void apply(const gsl::not_null<std::tuple<NodalTypes...>*> nodal_tuple,
161  const std::tuple<ModalTypes...>& modal_tuple,
162  const size_t l_max,
163  const size_t number_of_radial_points) noexcept {
164  InverseSwshTransform<tmpl::list<TransformTags...>, Representation>::
165  apply_to_vectors(
166  get<tmpl::position_of_first_v<tmpl::list<Tags...>, TransformTags>>(
167  *nodal_tuple)...,
168  *get<tmpl::position_of_first_v<tmpl::list<Tags...>, TransformTags>>(
169  modal_tuple)...,
170  l_max, number_of_radial_points);
171  }
172 };
173 
174 // template 'implementation' for the DataBox mutate-compatible interface to
175 // spin-weighted derivative evaluation. This impl version is needed to have easy
176 // access to the `DeDuplicatedDifferentiatedFromTagList` as a parameter pack
177 template <typename DerivativeTagList,
178  typename DeDuplicatedDifferentiatedFromTagList,
179  ComplexRepresentation Representation>
180 struct AngularDerivativesImpl;
181 
182 template <typename... DerivativeTags,
183  typename... DeDuplicatedDifferentiatedFromTags,
184  ComplexRepresentation Representation>
185 struct AngularDerivativesImpl<tmpl::list<DerivativeTags...>,
186  tmpl::list<DeDuplicatedDifferentiatedFromTags...>,
187  Representation> {
188  using return_tags =
189  tmpl::list<DerivativeTags..., Tags::SwshTransform<DerivativeTags>...,
190  Tags::SwshTransform<DeDuplicatedDifferentiatedFromTags>...>;
191  using argument_tags = tmpl::list<DeDuplicatedDifferentiatedFromTags...,
192  Tags::LMax, Tags::NumberOfRadialPoints>;
193 
194  static void apply(
195  const gsl::not_null<db::item_type<DerivativeTags>*>... derivative_scalars,
196  const gsl::not_null<db::item_type<Tags::SwshTransform<
197  DerivativeTags>>*>... transform_of_derivative_scalars,
198  const gsl::not_null<db::item_type<Tags::SwshTransform<
199  DeDuplicatedDifferentiatedFromTags>>*>... transform_of_input_scalars,
201  input_scalars,
202  const size_t l_max, const size_t number_of_radial_points) noexcept {
203  apply_to_vectors(make_not_null(&get(*transform_of_derivative_scalars))...,
204  make_not_null(&get(*transform_of_input_scalars))...,
205  make_not_null(&get(*derivative_scalars))...,
206  get(input_scalars)..., l_max, number_of_radial_points);
207  }
208 
209  template <ComplexRepresentation FriendRepresentation,
210  typename... DerivativeKinds, typename... ArgumentTypes,
211  size_t... Is>
212  // NOLINTNEXTLINE(readability-redundant-declaratioon)
213  friend void angular_derivatives_impl(const std::tuple<ArgumentTypes...>&,
214  size_t, size_t,
216  tmpl::list<DerivativeKinds...>,
217  cpp17::bool_constant<true>) noexcept;
218 
219  private:
220  // note inputs reordered to accommodate the alternative tag-free functions
221  // which call into this function.
222  static void apply_to_vectors(
223  const gsl::not_null<typename db::item_type<Tags::SwshTransform<
224  DerivativeTags>>::type*>... transform_of_derivatives,
225  const gsl::not_null<typename db::item_type<Tags::SwshTransform<
226  DeDuplicatedDifferentiatedFromTags>>::type*>... transform_of_inputs,
227  const gsl::not_null<
228  typename db::const_item_type<DerivativeTags>::type*>... derivatives,
229  const typename db::const_item_type<
230  DeDuplicatedDifferentiatedFromTags>::type&... inputs,
231  const size_t l_max, const size_t number_of_radial_points) noexcept {
232  // perform the forward transform on the minimal set of input nodal
233  // quantities to obtain all of the requested derivatives
234  using ForwardTransformList =
236  tmpl::list<DerivativeTags...>>;
237 
238  tmpl::for_each<ForwardTransformList>([
239  &number_of_radial_points, &l_max, &inputs..., &transform_of_inputs...
240  ](auto transform_v) noexcept {
241  using transform = typename decltype(transform_v)::type;
242  auto input_transforms = std::make_tuple(transform_of_inputs...);
243  dispatch_to_transform<transform,
244  tmpl::list<DeDuplicatedDifferentiatedFromTags...>>::
245  apply(make_not_null(&input_transforms),
246  std::forward_as_tuple(inputs...), l_max,
247  number_of_radial_points);
248  });
249 
250  // apply the modal derivative factors and place the result in the
251  // `transform_of_derivatives`
253  dispatch_to_compute_coefficients_of_derivative<
254  DerivativeTags, tmpl::list<DeDuplicatedDifferentiatedFromTags...>>::
255  apply(transform_of_derivatives,
256  std::make_tuple(transform_of_inputs...), l_max,
257  number_of_radial_points));
258 
259  // perform the inverse transform on the derivative results, placing the
260  // result in the nodal `derivatives` passed by pointer.
261  using InverseTransformList =
262  make_inverse_transform_list<Representation,
263  tmpl::list<DerivativeTags...>>;
264 
265  tmpl::for_each<InverseTransformList>([
266  &number_of_radial_points, &l_max, &derivatives...,
267  &transform_of_derivatives...
268  ](auto transform_v) noexcept {
269  using transform = typename decltype(transform_v)::type;
270  auto derivative_tuple = std::make_tuple(derivatives...);
271  dispatch_to_transform<transform, tmpl::list<DerivativeTags...>>::apply(
272  make_not_null(&derivative_tuple),
273  std::make_tuple(transform_of_derivatives...), l_max,
274  number_of_radial_points);
275  });
276  }
277 };
278 
279 // metafunction for determining the tags needed to evaluate the derivative tags
280 // in `DerivativeTagList`, removing all duplicate tags.
281 template <typename DerivativeTagList>
282 struct unique_derived_from_list;
283 
284 template <typename... DerivativeTags>
285 struct unique_derived_from_list<tmpl::list<DerivativeTags...>> {
286  using type = tmpl::remove_duplicates<
287  tmpl::list<typename DerivativeTags::derivative_of...>>;
288 };
289 } // namespace detail
290 
291 /*!
292  * \ingroup SpectralGroup
293  * \brief A \ref DataBoxGroup mutate-compatible computational struct for
294  * computing a set of spin-weighted spherical harmonic derivatives by
295  * grouping and batch-computing spin-weighted spherical harmonic transforms.
296  *
297  * \details A derivative is evaluated for each tag in `DerivativeTagList`. All
298  * entries in `DerivativeTagList` must be the tag
299  * `Spectral::Swsh::Tags::Derivative<Tag, DerivativeKind>` prefixing the `Tag`
300  * to be differentiated, and indicating the spin-weighted derivative
301  * `DerivativeKind` to be taken. A \ref DataBoxGroup on which this struct is
302  * invoked must contain:
303  * - each of the tags in `DerivativeTagList` (the results of the computation)
304  * - each of the tags `Tag` prefixed by `Spectral::Swsh::Tags::Derivative` in
305  * `DerivativeTagList` (the inputs of the computation).
306  * - each of the tags `Spectral::Swsh::Tags::SwshTransform<DerivativeTag>` for
307  * `DerivativeTag`in `DerivativeTagList` (the buffers for the derivative
308  * applied to the modes)
309  * - each of the tags `Spectral::Swsh::Tags::SwshTransform<Tag>` for `Tag`
310  * prefixed by any `DerivativeTag` in `DerivativeTagList` (the buffers for the
311  * transforms of the input data).
312  *
313  * This function optimizes the derivative taking process by clustering like
314  * spins of tags, forward-transforming each spin cluster together, applying the
315  * factor for the derivative to each modal vector, re-clustering according to
316  * the new spin weights (the derivatives alter the spin weights), and finally
317  * inverse-transforming in clusters.
318  */
319 template <typename DerivativeTagList, ComplexRepresentation Representation =
320  ComplexRepresentation::Interleaved>
321 using AngularDerivatives = detail::AngularDerivativesImpl<
322  DerivativeTagList,
323  typename detail::unique_derived_from_list<DerivativeTagList>::type,
324  Representation>;
325 
326 /*!
327  * \ingroup SpectralGroup
328  * \brief Produces a `SpinWeighted<ComplexModalVector, Spin>` of the appropriate
329  * size to be used as a modal buffer for `Spectral::Swsh::AngularDerivatives` or
330  * `Spectral::Swsh::angular_derivatives`.
331  *
332  * \details The `Spectral::Swsh::angular_derivatives` and
333  * `Spectral::Swsh::AngularDerivatives` interfaces require that calling code
334  * provides a buffer for the intermediate transform results, to ensure that
335  * callers are aware of the allocations and can suitably reuse buffers if
336  * possible. This utility eases the creation of those buffers.
337  */
338 template <int Spin>
339 auto swsh_buffer(const size_t l_max,
340  const size_t number_of_radial_points) noexcept {
342  size_of_libsharp_coefficient_vector(l_max) * number_of_radial_points};
343 }
344 
345 namespace detail {
346 // template 'implementation' for the `angular_derivatives` function below which
347 // evaluates an arbitrary number of derivatives, and places them in the set of
348 // nodal containers passed by pointer.
349 template <ComplexRepresentation Representation, typename... DerivativeKinds,
350  typename... ArgumentTypes, size_t... Is>
351 void angular_derivatives_impl(
352  const std::tuple<ArgumentTypes...>& argument_tuple, const size_t l_max,
353  const size_t number_of_radial_points, std::index_sequence<Is...> /*meta*/,
354  tmpl::list<DerivativeKinds...> /*meta*/,
355  cpp17::bool_constant<true> /*buffers_included_in_arguments*/) noexcept {
356  AngularDerivatives<
357  tmpl::list<Tags::Derivative<
361  int, std::decay_t<decltype(get<Is + 3 * sizeof...(Is)>(
362  argument_tuple))>::spin>>,
363  DerivativeKinds>...>,
364  Representation>::apply_to_vectors(get<Is>(argument_tuple)...,
365  get<Is + sizeof...(Is)>(
366  argument_tuple)...,
367  get<Is + 2 * sizeof...(Is)>(
368  argument_tuple)...,
369  get<Is + 3 * sizeof...(Is)>(
370  argument_tuple)...,
371  l_max, number_of_radial_points);
372 }
373 
374 template <ComplexRepresentation Representation, typename... DerivativeKinds,
375  typename... ArgumentTypes, size_t... Is>
376 void angular_derivatives_impl(
377  const std::tuple<ArgumentTypes...>& argument_tuple, const size_t l_max,
378  const size_t number_of_radial_points,
379  std::index_sequence<Is...> index_sequence,
380  tmpl::list<DerivativeKinds...> derivative_kinds,
381  cpp17::bool_constant<false> /*buffers_included_in_arguments*/) noexcept {
382  auto derivative_buffer_tuple = std::make_tuple(
383  swsh_buffer<std::decay_t<decltype(*get<Is>(argument_tuple))>::spin>(
384  l_max, number_of_radial_points)...);
385  auto input_buffer_tuple = std::make_tuple(
386  swsh_buffer<std::decay_t<decltype(get<Is + sizeof...(Is)>(
387  argument_tuple))>::spin>(l_max, number_of_radial_points)...);
388  angular_derivatives_impl<Representation>(
389  std::forward_as_tuple(make_not_null(&get<Is>(derivative_buffer_tuple))...,
390  make_not_null(&get<Is>(input_buffer_tuple))...,
391  get<Is>(argument_tuple)...,
392  get<Is + sizeof...(Is)>(argument_tuple)...),
393  l_max, number_of_radial_points, index_sequence, derivative_kinds,
395 }
396 } // namespace detail
397 
398 /*!
399  * \ingroup SpectralGroup
400  * \brief Evaluate all of the spin-weighted derivatives in `DerivKindList` on
401  * input `SpinWeighted<ComplexDataVector, Spin>` collocation data, returning by
402  * pointer.
403  *
404  * \details This function provides two interfaces, one in which the caller
405  * provides the intermediate coefficient buffers needed during the computation
406  * of the derivatives, and one in which those buffers are temporarily allocated
407  * during the derivative function calls.
408  *
409  * For the interface in which the caller does not provide buffers, the arguments
410  * must take the following structure (enforced by internal function calls):
411  *
412  * - `size_t l_max` : angular resolution for the spherical representation
413  * - `size_t number_of_radial_points` : radial resolution (number of consecutive
414  * blocks to evaluate derivatives, for each input vector )
415  * - for each `DerivKind` in `DerivKindList`, a
416  * `gsl::not_null<SpinWeighted<ComplexDataVector, Spin +
417  * Tags::derivative_spin_weight<DerivKind>>>` : the output of the derivative
418  * evaluation
419  * - for each `DerivKind` in `DerivKindList`, a `const
420  * SpinWeighted<ComplexDataVector, Spin>&` (where the `Spin` for these arguments
421  * matches the corresponding vector from the previous set) : the input to the
422  * derivative evaluation.
423  *
424  * For the interface in which the caller does provide buffers, the arguments
425  * must take the following structure (enforced by internal function calls):
426  *
427  * - `size_t l_max` : angular resolution for the spherical representation
428  * - `size_t number_of_radial_points` : radial resolution (number of consecutive
429  * blocks to evaluate derivatives, for each input vector )
430  * - for each `DerivKind` in `DerivKindList`, a
431  * `gsl::not_null<SpinWeighted<ComplexModalVector, Spin +
432  * Tags::derivative_spin_weight<DerivKind>>>` : the buffer for the spin-weighted
433  * spherical harmonic modes of the derivative quantities.
434  * - for each `DerivKind` in `DerivKindList`, a `const
435  * SpinWeighted<ComplexModalVector, Spin>` (where the `Spin` for these arguments
436  * matches the corresponding vector from the previous set) : the buffer for the
437  * spin-weighted spherical harmonic modes of the input quantities.
438  * - for each `DerivKind` in `DerivKindList`, a
439  * `gsl::not_null<SpinWeighted<ComplexDataVector, Spin +
440  * Tags::derivative_spin_weight<DerivKind>>>` : the output of the derivative
441  * evaluation
442  * - for each `DerivKind` in `DerivKindList`, a `const
443  * SpinWeighted<ComplexDataVector, Spin>` (where the `Spin` for these arguments
444  * matches the corresponding vector from the previous set) : the input to the
445  * derivative evaluation.
446  *
447  * The function `swsh_buffer` assists in generating the modal buffers of
448  * appropriate size.
449  */
450 template <
451  typename DerivativeKindList,
452  ComplexRepresentation Representation = ComplexRepresentation::Interleaved,
453  typename... ArgumentTypes>
454 void angular_derivatives(const size_t l_max,
455  const size_t number_of_radial_points,
456  const ArgumentTypes&... arguments) noexcept {
457  static_assert(
458  tmpl::size<DerivativeKindList>::value * 2 == sizeof...(ArgumentTypes) or
459  tmpl::size<DerivativeKindList>::value * 4 == sizeof...(ArgumentTypes),
460  "When using the tagless `angular_derivatives` interface, you must "
461  "provide either one nodal input and one nodal output per derivative "
462  "or one nodal input, one nodal output, and two appropriate "
463  "intermediate transform buffers per derivative.");
464 
465  detail::angular_derivatives_impl<Representation>(
466  std::forward_as_tuple(arguments...), l_max, number_of_radial_points,
468  DerivativeKindList{},
470  sizeof...(ArgumentTypes)>{});
471 }
472 
473 /*!
474  * \ingroup SpectralGroup
475  * \brief Evaluate the spin-weighted derivative `DerivKind` on the provided
476  * `SpinWeighted<ComplexDataVector, Spin>` collocation data, returning by value.
477  */
478 template <
479  typename DerivKind,
480  ComplexRepresentation Representation = ComplexRepresentation::Interleaved,
481  int Spin>
484  size_t l_max, size_t number_of_radial_points,
485  const SpinWeighted<ComplexDataVector, Spin>& to_differentiate) noexcept;
486 } // namespace Swsh
487 } // 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:762
#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:454
Prefix tag representing the spin-weighted derivative of a spin-weighted scalar.
Definition: SwshTags.hpp:130
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:324
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:782
Definition: Variables.hpp:909
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:58
Make a spin-weighted type T with spin-weight Spin. Mathematical operators are restricted to addition...
Definition: SpinWeighted.hpp:25
#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:29
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:1623
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:339
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:461
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: ConservativeFromPrimitive.hpp:12