blob: 2a66c9b25b787e03b58c916e395735d3ed1dae47 (
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
53
54
55
56
57
58
59
60
61
62
63
|
#include "MultiDiagnostics.H"
#include <AMReX_ParmParse.H>
using namespace amrex;
MultiDiagnostics::MultiDiagnostics ()
{
ReadParameters();
/** Resize alldiags and initialize each element to a pointer to a
* diagnostics. Calls the corresponding diagnostics constructor.
*/
alldiags.resize( ndiags );
for (int i=0; i<ndiags; i++){
if ( diags_types[i] == DiagTypes::Full ){
alldiags[i].reset( new FullDiagnostics(i, diags_names[i]) );
} else {
amrex::Abort("Unknown diagnostic type");
}
}
}
void
MultiDiagnostics::InitData ()
{
for( auto& diag : alldiags ){
diag->InitData();
}
}
void
MultiDiagnostics::InitializeFieldFunctors ( int lev )
{
for( auto& diag : alldiags ){
// Initialize functors to store pointers to fields.
diag->InitializeFieldFunctors( lev );
}
}
void
MultiDiagnostics::ReadParameters ()
{
ParmParse pp("diagnostics");
pp.query("ndiags", ndiags);
diags_types.resize( ndiags );
if (ndiags > 0) pp.getarr("diags_names", diags_names);
for (int i=0; i<ndiags; i++){
ParmParse ppd(diags_names[i]);
std::string diag_type_str;
ppd.get("diag_type", diag_type_str);
if (diag_type_str == "Full") diags_types[i] = DiagTypes::Full;
}
}
void
MultiDiagnostics::FilterComputePackFlush (int step, bool force_flush)
{
for (auto& diag : alldiags){
if ( !diag->DoDump( step, force_flush ) ) return;
diag->ComputeAndPack();
diag->Flush();
diag->FlushRaw();
}
}
|