aboutsummaryrefslogtreecommitdiff
path: root/Source/Diagnostics/MultiDiagnostics.H
blob: f9907b8bdc626ee75d1d77ab7290f20b0ddde734 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#ifndef WARPX_MULTIDIAGNOSTICS_H_
#define WARPX_MULTIDIAGNOSTICS_H_

#include "Diagnostics.H"

#include "MultiDiagnostics_fwd.H"

#include <AMReX_Vector.H>

#include <memory>
#include <string>
#include <vector>

/** All types of diagnostics. */
enum struct DiagTypes {Full, BackTransformed, BoundaryScraping};

/**
 * \brief This class contains a vector of all diagnostics in the simulation.
 */
class MultiDiagnostics
{
public:
    MultiDiagnostics ();
    /** \brief Read Input parameters. Called in constructor. */
    void ReadParameters ();
    /** \brief Loop over diags in alldiags and call their InitDiags */
    void InitData ();
    /** \brief Called at each iteration. Compute diags and flush. */
    void FilterComputePackFlush (int step, bool force_flush=false, bool BackTransform=false);
    /** \brief Called only at the last iteration. Loop over each diag and if m_dump_last_timestep
     *         is true, compute diags and flush with force_flush=true. */
    void FilterComputePackFlushLastTimestep (int step);
    /** \brief Loop over diags in all diags and call their InitializeFieldFunctors.
               Called when a new partitioning is generated at level, lev.
      * \param[in] lev level at this the field functors are initialized.
      */
    void InitializeFieldFunctors (int lev);
    /** Start a new iteration, i.e., dump has not been done yet. */
    void NewIteration ();
    Diagnostics& GetDiag(int idiag) {return *alldiags[idiag]; }
    int GetTotalDiags() {return ndiags;}
    DiagTypes diagstypes(int idiag) {return diags_types[idiag];}
private:
    /** Vector of pointers to all diagnostics */
    amrex::Vector<std::unique_ptr<Diagnostics> > alldiags;
    int ndiags = 0; /**< number of different diagnostics */
    std::vector<std::string> diags_names;
    /**Type of each diagnostics*/
    std::vector<DiagTypes> diags_types;
};

#endif // WARPX_MULTIDIAGNOSTICS_H_