Line data Source code
1 0 : // Distributed under the MIT License.
2 : // See LICENSE.txt for details.
3 :
4 : #pragma once
5 :
6 : #include <optional>
7 : #include <tuple>
8 : #include <utility>
9 :
10 : #include "DataStructures/DataBox/DataBox.hpp"
11 : #include "Evolution/Systems/Cce/OptionTags.hpp"
12 : #include "Evolution/Systems/Cce/Tags.hpp"
13 : #include "NumericalAlgorithms/SpinWeightedSphericalHarmonics/SwshFiltering.hpp"
14 : #include "Parallel/AlgorithmExecution.hpp"
15 : #include "Parallel/GlobalCache.hpp"
16 : #include "Parallel/Invoke.hpp"
17 : #include "Utilities/Gsl.hpp"
18 :
19 : namespace Cce {
20 : namespace Actions {
21 :
22 : /*!
23 : * \ingroup ActionsGroup
24 : * \brief Filters the spherical volume data stored in `BondiTag` according to
25 : * the filter parameters in the `Parallel::GlobalCache`.
26 : *
27 : * \details This action dispatches to the function
28 : * `filter_swsh_volume_quantity()` to perform the mathematics of
29 : * the filtering
30 : *
31 : * Uses:
32 : * - DataBox:
33 : * - `Cce::Tags::LMax`
34 : * - GlobalCache:
35 : * - `InitializationTags::FilterLMax`
36 : * - `InitializationTags::RadialFilterAlpha`
37 : * - `InitializationTags::RadialFilterHalfPower`
38 : * \ref DataBoxGroup changes:
39 : * - Adds: nothing
40 : * - Removes: nothing
41 : * - Modifies: `BondiTag`
42 : */
43 : template <typename BondiTag>
44 1 : struct FilterSwshVolumeQuantity {
45 0 : using const_global_cache_tags =
46 : tmpl::list<Tags::FilterLMax, Tags::RadialFilterAlpha,
47 : Tags::RadialFilterHalfPower>;
48 : template <typename DbTags, typename... InboxTags, typename Metavariables,
49 : typename ArrayIndex, typename ActionList,
50 : typename ParallelComponent>
51 0 : static Parallel::iterable_action_return_t apply(
52 : db::DataBox<DbTags>& box,
53 : const tuples::TaggedTuple<InboxTags...>& /*inboxes*/,
54 : const Parallel::GlobalCache<Metavariables>& /*cache*/,
55 : const ArrayIndex& /*array_index*/, const ActionList /*meta*/,
56 : const ParallelComponent* const /*meta*/) {
57 : const size_t l_max = db::get<Tags::LMax>(box);
58 : const size_t l_filter_start = get<Tags::FilterLMax>(box);
59 : const double radial_filter_alpha = get<Tags::RadialFilterAlpha>(box);
60 : const size_t radial_filter_half_power =
61 : get<Tags::RadialFilterHalfPower>(box);
62 : db::mutate<BondiTag>(
63 : [&l_max, &l_filter_start, &radial_filter_alpha,
64 : &radial_filter_half_power](
65 : const gsl::not_null<typename BondiTag::type*> bondi_quantity) {
66 : Spectral::Swsh::filter_swsh_volume_quantity(
67 : make_not_null(&get(*bondi_quantity)), l_max, l_filter_start,
68 : radial_filter_alpha, radial_filter_half_power);
69 : },
70 : make_not_null(&box));
71 : return {Parallel::AlgorithmExecution::Continue, std::nullopt};
72 : }
73 : };
74 :
75 : } // namespace Actions
76 : } // namespace Cce
|