From 361bbf97a395f7ae4ea368a435127105d95fce89 Mon Sep 17 00:00:00 2001 From: Axel Huebl Date: Thu, 26 Sep 2024 00:26:39 -0700 Subject: [PATCH] Cleaning & Member Variable Convention --- Source/Diagnostics/BTDiagnostics.H | 4 ++-- Source/Diagnostics/BTDiagnostics.cpp | 24 ++++++++++++------------ 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/Source/Diagnostics/BTDiagnostics.H b/Source/Diagnostics/BTDiagnostics.H index 36d0dda1812..d11db98276b 100644 --- a/Source/Diagnostics/BTDiagnostics.H +++ b/Source/Diagnostics/BTDiagnostics.H @@ -241,7 +241,7 @@ private: * will be used by all snapshots to obtain lab-frame data at the respective * z slice location. */ - std::string const cell_centered_data_name; + std::string const m_cell_centered_data_name; /** Vector of pointers to compute cell-centered data, per level, per component * using the coarsening-ratio provided by the user. */ @@ -346,7 +346,7 @@ private: * \param[in] i_buffer snapshot index */ void SetSnapshotFullStatus (int i_buffer); - /** Vector of field-data stored in the cell-centered multifab, cell_centered_data. + /** Vector of field-data stored in the cell-centered MultiFab. * All the fields are stored regardless of the specific fields to plot selected * by the user. */ diff --git a/Source/Diagnostics/BTDiagnostics.cpp b/Source/Diagnostics/BTDiagnostics.cpp index b0da71d1a4b..d76ddcdaf0e 100644 --- a/Source/Diagnostics/BTDiagnostics.cpp +++ b/Source/Diagnostics/BTDiagnostics.cpp @@ -57,7 +57,7 @@ namespace BTDiagnostics::BTDiagnostics (int i, const std::string& name) : Diagnostics{i, name}, - cell_centered_data_name("BTD_cell_centered_data_"+name) + m_cell_centered_data_name("BTD_cell_centered_data_" + name) { ReadParameters(); } @@ -521,7 +521,7 @@ BTDiagnostics::DefineCellCenteredMultiFab(int lev) #endif bool const remake = false; bool const redistribute_on_remake = false; - warpx.m_fields.alloc_init(cell_centered_data_name, lev, ba, dmap, ncomps, amrex::IntVect(ngrow), 0.0_rt, + warpx.m_fields.alloc_init(m_cell_centered_data_name, lev, ba, dmap, ncomps, amrex::IntVect(ngrow), 0.0_rt, remake, redistribute_on_remake); } @@ -548,7 +548,7 @@ BTDiagnostics::InitializeFieldFunctors (int lev) // to the correct field-data pointers m_all_field_functors[lev].clear(); // For back-transformed data, all the components are cell-centered and stored - // in a single multifab, cell_centered_data. + // in a single multifab. // Therefore, size of functors at all levels is 1. const int num_BT_functors = 1; m_all_field_functors[lev].resize(num_BT_functors); @@ -557,11 +557,11 @@ BTDiagnostics::InitializeFieldFunctors (int lev) // Create an object of class BackTransformFunctor for (int i = 0; i < num_BT_functors; ++i) { - // coarsening ratio is not provided since the source MultiFab, cell_centered_data + // coarsening ratio is not provided since the source MultiFab // is coarsened based on the user-defined m_crse_ratio const int nvars = static_cast(m_varnames.size()); m_all_field_functors[lev][i] = std::make_unique( - warpx.m_fields.get(cell_centered_data_name, lev), lev, + warpx.m_fields.get(m_cell_centered_data_name, lev), lev, nvars, m_num_buffers, m_varnames, m_varnames_fields); } @@ -673,14 +673,14 @@ BTDiagnostics::InitializeFieldFunctorsRZopenPMD (int lev) // to the correct field-data pointers m_all_field_functors[lev].clear(); // For back-transformed data, all the components are cell-centered and stored - // in a single multifab, cell_centered_data. + // in a single MultiFab. // Therefore, size of functors at all levels is 1 const int num_BT_functors = 1; m_all_field_functors[lev].resize(num_BT_functors); for (int i = 0; i < num_BT_functors; ++i) { const int nvars = static_cast(m_varnames.size()); m_all_field_functors[lev][i] = std::make_unique( - warpx.m_fields.get(cell_centered_data_name, lev), lev, + warpx.m_fields.get(m_cell_centered_data_name, lev), lev, nvars, m_num_buffers, m_varnames, m_varnames_fields); } @@ -807,23 +807,23 @@ BTDiagnostics::PrepareFieldDataForOutput () for (int icomp = 0; icompoperator()(*warpx.m_fields.get(cell_centered_data_name, lev), icomp_dst); + // stores it in cell-centered MultiFab. + m_cell_center_functors[lev][icomp]->operator()(*warpx.m_fields.get(m_cell_centered_data_name, lev), icomp_dst); icomp_dst += m_cell_center_functors[lev][icomp]->nComp(); } // Check that the proper number of user-requested components are cell-centered AMREX_ALWAYS_ASSERT( icomp_dst == m_cellcenter_varnames.size() ); // fill boundary call is required to average_down (flatten) data to // the coarsest level. - ablastr::utils::communication::FillBoundary(*warpx.m_fields.get(cell_centered_data_name, lev), + ablastr::utils::communication::FillBoundary(*warpx.m_fields.get(m_cell_centered_data_name, lev), WarpX::do_single_precision_comms, warpx.Geom(lev).periodicity()); } // Flattening out MF over levels for (int lev = warpx.finestLevel(); lev > 0; --lev) { - ablastr::coarsen::sample::Coarsen(*warpx.m_fields.get(cell_centered_data_name, lev - 1), - *warpx.m_fields.get(cell_centered_data_name, lev), 0, 0, + ablastr::coarsen::sample::Coarsen(*warpx.m_fields.get(m_cell_centered_data_name, lev - 1), + *warpx.m_fields.get(m_cell_centered_data_name, lev), 0, 0, static_cast(m_cellcenter_varnames.size()), 0, WarpX::RefRatio(lev-1) ); }