From 37f932323e7e3381cf7eee72a9e45e0304754e10 Mon Sep 17 00:00:00 2001 From: Remi Lehe Date: Tue, 23 Apr 2019 13:19:08 -0700 Subject: Switch and rename the shift factors --- .../FieldSolver/SpectralSolver/SpectralKSpace.cpp | 58 ++++++++++++---------- 1 file changed, 31 insertions(+), 27 deletions(-) (limited to 'Source/FieldSolver/SpectralSolver/SpectralKSpace.cpp') diff --git a/Source/FieldSolver/SpectralSolver/SpectralKSpace.cpp b/Source/FieldSolver/SpectralSolver/SpectralKSpace.cpp index 111643197..4852c7d2b 100644 --- a/Source/FieldSolver/SpectralSolver/SpectralKSpace.cpp +++ b/Source/FieldSolver/SpectralSolver/SpectralKSpace.cpp @@ -16,10 +16,12 @@ SpectralKSpace::SpectralKSpace( const BoxArray& realspace_ba, BoxList spectral_bl; // Create empty box list // Loop over boxes and fill the box list for (int i=0; i < realspace_ba.size(); i++ ) { - // For local FFTs, each box in spectral space starts at 0 in each direction - // and has the same number of points as the real space box (including guard cells) + // For local FFTs, boxes in spectral space start at 0 in each direction + // and have the same number of points as the real space box + // TODO: this will be different for the hybrid FFT scheme Box realspace_bx = realspace_ba[i]; - Box bx = Box( IntVect::TheZeroVector(), realspace_bx.bigEnd() - realspace_bx.smallEnd() ); + Box bx = Box( IntVect::TheZeroVector(), + realspace_bx.bigEnd() - realspace_bx.smallEnd() ); spectral_bl.push_back( bx ); } spectralspace_ba.define( spectral_bl ); @@ -31,7 +33,8 @@ SpectralKSpace::SpectralKSpace( const BoxArray& realspace_ba, } KVectorComponent -SpectralKSpace::getKComponent( const DistributionMapping& dm, const int i_dim ) const +SpectralKSpace::getKComponent( const DistributionMapping& dm, + const int i_dim ) const { // Initialize an empty ManagedVector in each box KVectorComponent k_comp = KVectorComponent(spectralspace_ba, dm); @@ -58,17 +61,16 @@ SpectralKSpace::getKComponent( const DistributionMapping& dm, const int i_dim ) for (int i=(N+1)/2; i getFonbergStencilCoefficients( const int n_order, const bool nodal ) { - AMREX_ALWAYS_ASSERT_WITH_MESSAGE( n_order%2 == 0, "n_order should be even."); + AMREX_ALWAYS_ASSERT_WITH_MESSAGE( n_order%2 == 0, + "n_order should be even."); const int m = n_order/2; - Vector stencil_coef; - stencil_coef.resize( m+1 ); + Vector coefs; + coefs.resize( m+1 ); // Coefficients for nodal (a.k.a. centered) finite-difference if (nodal == true) { - stencil_coef[0] = -2.; // First coefficient + coefs[0] = -2.; // First coefficient for (int n=1; n