Line data Source code
1 0 : // Distributed under the MIT License.
2 : // See LICENSE.txt for details.
3 :
4 : #pragma once
5 :
6 : #include "ControlSystem/Tags/SystemTags.hpp"
7 : #include "DataStructures/DataBox/DataBox.hpp"
8 : #include "Parallel/GlobalCache.hpp"
9 : #include "Parallel/Printf/Printf.hpp"
10 : #include "Utilities/PrettyType.hpp"
11 :
12 : namespace control_system::Actions {
13 : /*!
14 : * \brief Simple action that will print the
15 : * `control_system::Tags::CurrentNumberOfMeasurements` for whatever control
16 : * system it is run on.
17 : */
18 1 : struct PrintCurrentMeasurement {
19 : template <typename ParallelComponent, typename DbTags, typename Metavariables,
20 : typename ArrayIndex>
21 0 : static void apply(db::DataBox<DbTags>& box,
22 : const Parallel::GlobalCache<Metavariables>& /*cache*/,
23 : const ArrayIndex& /*array_index*/,
24 : const std::string& file_name) {
25 : const int current_measurement =
26 : db::get<control_system::Tags::CurrentNumberOfMeasurements>(box);
27 :
28 : Parallel::fprintf(file_name, "%s: Current measurement = %d\n",
29 : pretty_type::name<ParallelComponent>(),
30 : current_measurement);
31 : }
32 : };
33 : } // namespace control_system::Actions
|