Line data Source code
1 0 : // Distributed under the MIT License.
2 : // See LICENSE.txt for details.
3 :
4 : #pragma once
5 :
6 : /// Protocols related to observers
7 1 : namespace observers::protocols {
8 : /*!
9 : * \brief Conforming classes can create an informative message from reduction
10 : * data. The message will be printed to screen when the formatter is passed to a
11 : * reduction action such as `observers::Actions::ContributeReductionData`.
12 : *
13 : * Conforming classes must provide the following type aliases:
14 : * - `reduction_data`: The `Parallel::ReductionData` that the formatter is
15 : * applicable to.
16 : *
17 : * Conforming classes must implement the following member functions:
18 : * - `operator()`: A call operator that takes the values of the reduction data
19 : * and returns a `std::string`. The string should be an informative message
20 : * such as "Global minimum grid spacing at time 5.4 is: 0.1". It should end
21 : * with a newline character.
22 : * - `pup`: A PUP function for serialization.
23 : *
24 : * Here's an example for a formatter:
25 : *
26 : * \snippet Test_ReductionObserver.cpp formatter_example
27 : */
28 1 : struct ReductionDataFormatter {
29 : template <typename ConformingType>
30 0 : struct test {
31 0 : using reduction_data = typename ConformingType::reduction_data;
32 : };
33 : };
34 : } // namespace observers::protocols
|