Line data Source code
1 0 : // Distributed under the MIT License.
2 : // See LICENSE.txt for details.
3 :
4 : #pragma once
5 :
6 : #include <cstddef>
7 :
8 : #include "DataStructures/DataBox/DataBox.hpp"
9 : #include "Evolution/Systems/GeneralizedHarmonic/Bbh/CompletionCriteria.hpp"
10 : #include "Evolution/Systems/GeneralizedHarmonic/Bbh/CompletionSingleton.hpp"
11 : #include "NumericalAlgorithms/Strahlkorper/Tags.hpp"
12 : #include "Parallel/GlobalCache.hpp"
13 : #include "Parallel/Invoke.hpp"
14 : #include "ParallelAlgorithms/ApparentHorizonFinder/FastFlow.hpp"
15 : #include "ParallelAlgorithms/ApparentHorizonFinder/Protocols/Callback.hpp"
16 : #include "ParallelAlgorithms/ApparentHorizonFinder/Tags.hpp"
17 : #include "Utilities/ErrorHandling/Assert.hpp"
18 : #include "Utilities/ProtocolHelpers.hpp"
19 : #include "Utilities/TMPL.hpp"
20 :
21 0 : namespace gh::bbh::callbacks {
22 : /*!
23 : * \brief Apparent-horizon callback that updates binary-black-hole completion
24 : * criteria from successful common-horizon finds.
25 : *
26 : * \details This callback forwards each successful AhC find (`temporal_id`,
27 : * `LMax`) to `gh::bbh::CompletionSingleton`, where completion criteria are
28 : * evaluated in a temporally robust, centralized way.
29 : */
30 : template <typename HorizonMetavars>
31 1 : struct UpdateCompletionCriteria : tt::ConformsTo<ah::protocols::Callback> {
32 0 : using const_global_cache_tags = tmpl::list<>;
33 0 : using mutable_global_cache_tags = tmpl::list<>;
34 :
35 : template <typename DbTags, typename Metavariables>
36 0 : static void apply(const db::DataBox<DbTags>& box,
37 : Parallel::GlobalCache<Metavariables>& cache,
38 : const FastFlow::Status /*status*/) {
39 : const auto& current_time = db::get<ah::Tags::CurrentTime>(box);
40 : ASSERT(current_time.has_value(),
41 : "AhC completion callback requires a current temporal id.");
42 : const size_t l_max =
43 : db::get<ylm::Tags::Strahlkorper<typename HorizonMetavars::frame>>(box)
44 : .l_max();
45 : Parallel::simple_action<gh::bbh::Actions::RecordCommonHorizonSuccess>(
46 : Parallel::get_parallel_component<
47 : gh::bbh::CompletionSingleton<Metavariables>>(cache),
48 : *current_time, l_max);
49 : }
50 : };
51 : } // namespace gh::bbh::callbacks
|