@@ -325,10 +325,10 @@ Diagnostics::BaseReadParameters ()
325
325
326
326
327
327
void
328
- Diagnostics::InitDataBeforeRestart ()
328
+ Diagnostics::InitDataBeforeRestart (const InitDiagnosticsParameters& params )
329
329
{
330
330
// initialize member variables and arrays in base class::Diagnostics
331
- InitBaseData ();
331
+ InitBaseData (params );
332
332
// initialize member variables and arrays specific to each derived class
333
333
// (FullDiagnostics, BTDiagnostics, etc.)
334
334
DerivedInitData ();
@@ -404,15 +404,10 @@ Diagnostics::InitDataAfterRestart ()
404
404
405
405
406
406
void
407
- Diagnostics::InitData ()
407
+ Diagnostics::InitData (const InitDiagnosticsParameters& params )
408
408
{
409
- auto & warpx = WarpX::GetInstance ();
410
-
411
- // Get current finest level available
412
- const int finest_level = warpx.finestLevel ();
413
-
414
409
// initialize member variables and arrays in base class::Diagnostics
415
- InitBaseData ();
410
+ InitBaseData (params );
416
411
// initialize member variables and arrays specific to each derived class
417
412
// (FullDiagnostics, BTDiagnostics, etc.)
418
413
DerivedInitData ();
@@ -421,7 +416,7 @@ Diagnostics::InitData ()
421
416
// This includes full diagnostics and BTD as well as cell-center functors for BTD.
422
417
// Note that the cell-centered data for BTD is computed for all levels and hence
423
418
// the corresponding functor is also initialized for all the levels
424
- for (int lev = 0 ; lev <= finest_level; ++lev) {
419
+ for (int lev = 0 ; lev <= params. finest_level ; ++lev) {
425
420
// allocate and initialize m_all_field_functors depending on diag type
426
421
InitializeFieldFunctors (lev);
427
422
}
@@ -484,24 +479,23 @@ Diagnostics::InitData ()
484
479
485
480
486
481
void
487
- Diagnostics::InitBaseData ()
482
+ Diagnostics::InitBaseData (const InitDiagnosticsParameters& params )
488
483
{
489
- auto & warpx = WarpX::GetInstance ();
490
484
// Number of levels in the simulation at the current timestep
491
- nlev = warpx. finestLevel () + 1 ;
485
+ nlev = params. finest_level + 1 ;
492
486
// default number of levels to be output = nlev
493
487
nlev_output = nlev;
494
488
// Maximum number of levels that will be allocated in the simulation
495
- nmax_lev = warpx. maxLevel () + 1 ;
489
+ nmax_lev = params. max_level + 1 ;
496
490
m_all_field_functors.resize ( nmax_lev );
497
491
498
492
// For restart, move the m_lo and m_hi of the diag consistent with the
499
493
// current moving_window location
500
- if (WarpX:: do_moving_window) {
501
- const int moving_dir = WarpX:: moving_window_dir;
502
- const int shift_num_base = static_cast <int >((warpx. getmoving_window_x () - m_lo[moving_dir]) / warpx. Geom ( 0 ). CellSize (moving_dir) );
503
- m_lo[moving_dir] += shift_num_base * warpx. Geom ( 0 ). CellSize (moving_dir) ;
504
- m_hi[moving_dir] += shift_num_base * warpx. Geom ( 0 ). CellSize (moving_dir) ;
494
+ if (params. do_moving_window ) {
495
+ const int moving_dir = params. moving_window_dir ;
496
+ const int shift_num_base = static_cast <int >((params. moving_window_x - m_lo[moving_dir]) / params. cell_size_lev0_mwdir );
497
+ m_lo[moving_dir] += shift_num_base * params. cell_size_lev0_mwdir ;
498
+ m_hi[moving_dir] += shift_num_base * params. cell_size_lev0_mwdir ;
505
499
}
506
500
// Construct Flush class.
507
501
if (m_format == " plotfile" ){
0 commit comments