#include "MultiDiagnostics.H" #include "Diagnostics/BTDiagnostics.H" #include "Diagnostics/FullDiagnostics.H" #include "Diagnostics/BoundaryScrapingDiagnostics.H" #include "Utils/TextMsg.H" #include #include #include #include #include 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(i, diags_names[i]); } else if ( diags_types[i] == DiagTypes::BackTransformed ){ alldiags[i] = std::make_unique(i, diags_names[i]); } else if ( diags_types[i] == DiagTypes::BoundaryScraping ){ alldiags[i] = std::make_unique(i, diags_names[i]); } else { amrex::Abort(Utils::TextMsg::Err("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("diagnostics"); int enable_diags = 1; pp_diagnostics.query("enable", enable_diags); if (enable_diags == 1) { pp_diagnostics.queryarr("diags_names", diags_names); ndiags = static_cast(diags_names.size()); } diags_types.resize( ndiags ); for (int i=0; i.diag_type must be Full or BackTransformed or BoundaryScraping"); if (diag_type_str == "Full") diags_types[i] = DiagTypes::Full; if (diag_type_str == "BackTransformed") diags_types[i] = DiagTypes::BackTransformed; if (diag_type_str == "BoundaryScraping") diags_types[i] = DiagTypes::BoundaryScraping; } } void MultiDiagnostics::FilterComputePackFlush (int step, bool force_flush, bool BackTransform) { int i = 0; for (auto& diag : alldiags){ if (BackTransform == true) { if (diags_types[i] == DiagTypes::BackTransformed) diag->FilterComputePackFlush (step, force_flush); } else { if (diags_types[i] != DiagTypes::BackTransformed) diag->FilterComputePackFlush (step, force_flush); } ++i; } } void MultiDiagnostics::FilterComputePackFlushLastTimestep (int step) { for (auto& diag : alldiags){ if (diag->DoDumpLastTimestep()){ constexpr bool force_flush = true; diag->FilterComputePackFlush (step, force_flush); } } } void MultiDiagnostics::NewIteration () { for( auto& diag : alldiags ){ diag->NewIteration(); } }