aboutsummaryrefslogtreecommitdiff
path: root/Source
diff options
context:
space:
mode:
Diffstat (limited to 'Source')
-rw-r--r--Source/Diagnostics/SliceDiagnostic.H2
-rw-r--r--Source/Diagnostics/SliceDiagnostic.cpp25
-rw-r--r--Source/Diagnostics/WarpXIO.cpp10
-rw-r--r--Source/Evolve/WarpXEvolveEM.cpp4
-rw-r--r--Source/WarpX.cpp4
5 files changed, 24 insertions, 21 deletions
diff --git a/Source/Diagnostics/SliceDiagnostic.H b/Source/Diagnostics/SliceDiagnostic.H
index 1d7a67a85..4e60dc99e 100644
--- a/Source/Diagnostics/SliceDiagnostic.H
+++ b/Source/Diagnostics/SliceDiagnostic.H
@@ -20,7 +20,7 @@ using namespace amrex;
-std::unique_ptr<MultiFab> CreateSlice( const amrex::MultiFab *Ex, const amrex::Vector<Geometry> dom_geom, amrex::RealBox &slice_realbox, amrex::IntVect &slice_cr_ratio );
+std::unique_ptr<MultiFab> CreateSlice( const amrex::MultiFab& mf, const amrex::Vector<Geometry> &dom_geom, amrex::RealBox &slice_realbox, amrex::IntVect &slice_cr_ratio );
void CheckSliceInput(const RealBox real_box, RealBox &slice_cc_nd_box, RealBox &slice_realbox, IntVect &cr_ratio, IntVect slice_cr_ratio, Vector<Geometry> dom_geom, IntVect const SliceType, IntVect &slice_lo, IntVect &slice_hi, IntVect &interp_lo);
diff --git a/Source/Diagnostics/SliceDiagnostic.cpp b/Source/Diagnostics/SliceDiagnostic.cpp
index 5f6321cd2..9b8c89d2f 100644
--- a/Source/Diagnostics/SliceDiagnostic.cpp
+++ b/Source/Diagnostics/SliceDiagnostic.cpp
@@ -6,7 +6,7 @@
#include <WarpX.H>
using namespace amrex;
-std::unique_ptr<MultiFab> CreateSlice( const amrex::MultiFab *mf, const amrex::Vector<Geometry> dom_geom, amrex::RealBox &slice_realbox, amrex::IntVect &slice_cr_ratio )
+std::unique_ptr<MultiFab> CreateSlice( const amrex::MultiFab& mf, const amrex::Vector<Geometry> &dom_geom, amrex::RealBox &slice_realbox, amrex::IntVect &slice_cr_ratio )
{
std::unique_ptr<MultiFab> smf;
std::unique_ptr<MultiFab> cs_mf;
@@ -14,10 +14,10 @@ std::unique_ptr<MultiFab> CreateSlice( const amrex::MultiFab *mf, const amrex::V
Vector<int> slice_ncells(AMREX_SPACEDIM);
int nghost = 1;
int nlevels = dom_geom.size();
- int ncomp = (*mf).nComp();
+ int ncomp = (mf).nComp();
IntVect cr_ratio(AMREX_D_DECL(0,0,0));
- const auto conversionType = (*mf).ixType();
+ const auto conversionType = (mf).ixType();
IntVect SliceType(AMREX_D_DECL(0,0,0));
for (int idim = 0; idim < AMREX_SPACEDIM; ++idim )
@@ -43,7 +43,9 @@ std::unique_ptr<MultiFab> CreateSlice( const amrex::MultiFab *mf, const amrex::V
IntVect interp_lo(AMREX_D_DECL(0,0,0));
// If inheriting data type //
- CheckSliceInput(real_box, slice_cc_nd_box, slice_realbox, cr_ratio, slice_cr_ratio, dom_geom, SliceType, slice_lo, slice_hi, interp_lo);
+ CheckSliceInput(real_box, slice_cc_nd_box, slice_realbox, cr_ratio,
+ slice_cr_ratio, dom_geom, SliceType, slice_lo,
+ slice_hi, interp_lo);
// Determine if interpolation is required and number of cells in slice //
for (int idim = 0; idim < AMREX_SPACEDIM; ++idim) {
@@ -57,7 +59,8 @@ std::unique_ptr<MultiFab> CreateSlice( const amrex::MultiFab *mf, const amrex::V
slice_ncells[idim] = 1;
}
else {
- slice_ncells[idim] = ( slice_hi[idim] - slice_lo[idim] + 1 )/cr_ratio[idim];
+ slice_ncells[idim] = ( slice_hi[idim] - slice_lo[idim] + 1 )
+ / cr_ratio[idim];
int refined_ncells = (slice_hi[idim] - slice_lo[idim]) + 1 ;
if ( cr_ratio[idim] > 1) {
@@ -106,7 +109,7 @@ std::unique_ptr<MultiFab> CreateSlice( const amrex::MultiFab *mf, const amrex::V
// Copy data from domain to slice that has same cell size as that of the domain mf.
// src and dst have the same number of ghost cells //
- smf->ParallelCopy(*mf, 0, 0, ncomp,nghost,nghost);
+ smf->ParallelCopy(mf, 0, 0, ncomp,nghost,nghost);
// inteprolate if required on refined slice //
if (interpolate == 1 ) {
@@ -249,8 +252,11 @@ void CheckSliceInput(const RealBox real_box, RealBox &slice_cc_nd_box, RealBox &
else
{
// moving realbox.lo and reabox.hi to nearest coarsenable grid point //
- int index_lo = floor( ( (slice_realbox.lo(idim) - (real_box.lo(idim)) ) / dom_geom[0].CellSize(idim) ) +fac * 1E-10);
- int index_hi = ceil( ( (slice_realbox.hi(idim) - (real_box.lo(idim)) ) / dom_geom[0].CellSize(idim) ) - fac * 1E-10);
+ int index_lo = floor( ( (slice_realbox.lo(idim) - (real_box.lo(idim)) )
+ / dom_geom[0].CellSize(idim) ) +fac * 1E-10);
+ int index_hi = ceil( ( (slice_realbox.hi(idim) - (real_box.lo(idim)) )
+ / dom_geom[0].CellSize(idim) ) - fac * 1E-10);
+
bool modify_cr = true;
while ( modify_cr == true) {
@@ -304,13 +310,10 @@ void CheckSliceInput(const RealBox real_box, RealBox &slice_cc_nd_box, RealBox &
-//void InterpolateSliceValues( Vector<MultiFab*>smf, IntVect interp_lo, RealBox slice_realbox, Vector<Geometry> geom, int ncomp, int nghost, IntVect slice_lo, IntVect slice_hi, IntVect SliceType, const RealBox real_box)
void InterpolateSliceValues( MultiFab& smf, IntVect interp_lo, RealBox slice_realbox, Vector<Geometry> geom, int ncomp, int nghost, IntVect slice_lo, IntVect slice_hi, IntVect SliceType, const RealBox real_box)
{
for (MFIter mfi(smf); mfi.isValid(); ++mfi)
{
- //MultiFab &mfSrc= *smf[0];
-// MultiFab &mfSrc= smf;
const Box& bx = mfi.tilebox();
const auto IndType = smf.ixType();
const auto lo = amrex::lbound(bx);
diff --git a/Source/Diagnostics/WarpXIO.cpp b/Source/Diagnostics/WarpXIO.cpp
index af32cf133..22b09216a 100644
--- a/Source/Diagnostics/WarpXIO.cpp
+++ b/Source/Diagnostics/WarpXIO.cpp
@@ -824,16 +824,16 @@ WarpX::SliceGenerationForDiagnostics ()
dom_geom = Geom();
if (F_fp[0] ) {
- F_slice[0] = CreateSlice( F_fp[0].get(), dom_geom, slice_realbox, slice_cr_ratio );
+ F_slice[0] = CreateSlice( *F_fp[0].get(), dom_geom, slice_realbox, slice_cr_ratio );
}
if (rho_fp[0]) {
- rho_slice[0] = CreateSlice( rho_fp[0].get(), dom_geom, slice_realbox, slice_cr_ratio );
+ rho_slice[0] = CreateSlice( *rho_fp[0].get(), dom_geom, slice_realbox, slice_cr_ratio );
}
for (int idim = 0; idim < 3; ++idim) {
- Efield_slice[0][idim] = CreateSlice( Efield_fp[0][idim].get(), dom_geom, slice_realbox, slice_cr_ratio );
- Bfield_slice[0][idim] = CreateSlice( Bfield_fp[0][idim].get(), dom_geom, slice_realbox, slice_cr_ratio );
- current_slice[0][idim] = CreateSlice( current_fp[0][idim].get(), dom_geom, slice_realbox, slice_cr_ratio );
+ Efield_slice[0][idim] = CreateSlice( *Efield_fp[0][idim].get(), dom_geom, slice_realbox, slice_cr_ratio );
+ Bfield_slice[0][idim] = CreateSlice( *Bfield_fp[0][idim].get(), dom_geom, slice_realbox, slice_cr_ratio );
+ current_slice[0][idim] = CreateSlice( *current_fp[0][idim].get(), dom_geom, slice_realbox, slice_cr_ratio );
}
diff --git a/Source/Evolve/WarpXEvolveEM.cpp b/Source/Evolve/WarpXEvolveEM.cpp
index 2f5aca63a..34c8c098c 100644
--- a/Source/Evolve/WarpXEvolveEM.cpp
+++ b/Source/Evolve/WarpXEvolveEM.cpp
@@ -207,9 +207,7 @@ WarpX::EvolveEM (int numsteps)
if (do_insitu)
UpdateInSitu();
- }
-
- }
+ }
if (check_int > 0 && (step+1) % check_int == 0) {
last_check_file_step = step+1;
diff --git a/Source/WarpX.cpp b/Source/WarpX.cpp
index bad15f6d8..8ee7935d6 100644
--- a/Source/WarpX.cpp
+++ b/Source/WarpX.cpp
@@ -546,7 +546,9 @@ WarpX::ReadParameters ()
slice_cr_ratio = slice_loc_ratio;
for (int idim = 0; idim < AMREX_SPACEDIM; ++idim)
{
- slice_cr_ratio[idim] = slice_crse_ratio[idim];
+ if (slice_crse_ratio[idim] > 1 ) {
+ slice_cr_ratio[idim] = slice_crse_ratio[idim];
+ }
}
}