aboutsummaryrefslogtreecommitdiff
path: root/Source/FieldSolver/SpectralSolver
diff options
context:
space:
mode:
Diffstat (limited to 'Source/FieldSolver/SpectralSolver')
-rw-r--r--Source/FieldSolver/SpectralSolver/PsatdAlgorithm.cpp15
-rw-r--r--Source/FieldSolver/SpectralSolver/SpectralKSpace.cpp6
-rw-r--r--Source/FieldSolver/SpectralSolver/SpectralSolver.H11
-rw-r--r--Source/FieldSolver/SpectralSolver/WarpX_Complex.H27
4 files changed, 16 insertions, 43 deletions
diff --git a/Source/FieldSolver/SpectralSolver/PsatdAlgorithm.cpp b/Source/FieldSolver/SpectralSolver/PsatdAlgorithm.cpp
index 60e9d58c0..900b542be 100644
--- a/Source/FieldSolver/SpectralSolver/PsatdAlgorithm.cpp
+++ b/Source/FieldSolver/SpectralSolver/PsatdAlgorithm.cpp
@@ -9,17 +9,16 @@ PsatdAlgorithm::PsatdAlgorithm(const SpectralKSpace& spectral_kspace,
const DistributionMapping& dm,
const int norder_x, const int norder_y,
const int norder_z, const bool nodal, const Real dt)
-{
- const BoxArray& ba = spectral_kspace.spectralspace_ba;
-
- // Allocate the 1D vectors
- modified_kx_vec = spectral_kspace.getModifiedKComponent(dm, 0, norder_x, nodal);
+// Compute and assign the modified k vectors
+: modified_kx_vec(spectral_kspace.getModifiedKComponent(dm, 0, norder_x, nodal))
#if (AMREX_SPACEDIM==3)
- modified_ky_vec = spectral_kspace.getModifiedKComponent(dm, 1, norder_y, nodal);
- modified_kz_vec = spectral_kspace.getModifiedKComponent(dm, 2, norder_z, nodal);
+ modified_ky_vec(spectral_kspace.getModifiedKComponent(dm, 1, norder_y, nodal))
+ modified_kz_vec(spectral_kspace.getModifiedKComponent(dm, 2, norder_z, nodal))
#else
- modified_kz_vec = spectral_kspace.getModifiedKComponent(dm, 1, norder_z, nodal);
+ modified_kz_vec(spectral_kspace.getModifiedKComponent(dm, 1, norder_z, nodal))
#endif
+{
+ const BoxArray& ba = spectral_kspace.spectralspace_ba;
// Allocate the arrays of coefficients
C_coef = SpectralCoefficients(ba, dm, 1, 0);
diff --git a/Source/FieldSolver/SpectralSolver/SpectralKSpace.cpp b/Source/FieldSolver/SpectralSolver/SpectralKSpace.cpp
index 6df3ea8fa..d91891a30 100644
--- a/Source/FieldSolver/SpectralSolver/SpectralKSpace.cpp
+++ b/Source/FieldSolver/SpectralSolver/SpectralKSpace.cpp
@@ -53,7 +53,7 @@ SpectralKSpace::getKComponent( const DistributionMapping& dm,
const int i_dim ) const
{
// Initialize an empty ManagedVector in each box
- KVectorComponent k_comp = KVectorComponent(spectralspace_ba, dm);
+ KVectorComponent k_comp(spectralspace_ba, dm);
// Loop over boxes and allocate the corresponding ManagedVector
// for each box owned by the local MPI proc
for ( MFIter mfi(spectralspace_ba, dm); mfi.isValid(); ++mfi ){
@@ -100,7 +100,7 @@ SpectralKSpace::getSpectralShiftFactor( const DistributionMapping& dm,
const int shift_type ) const
{
// Initialize an empty ManagedVector in each box
- SpectralShiftFactor shift_factor = SpectralShiftFactor( spectralspace_ba, dm );
+ SpectralShiftFactor shift_factor( spectralspace_ba, dm );
// Loop over boxes and allocate the corresponding ManagedVector
// for each box owned by the local MPI proc
for ( MFIter mfi(spectralspace_ba, dm); mfi.isValid(); ++mfi ){
@@ -144,7 +144,7 @@ SpectralKSpace::getModifiedKComponent( const DistributionMapping& dm,
const bool nodal ) const
{
// Initialize an empty ManagedVector in each box
- KVectorComponent modified_k_comp = KVectorComponent(spectralspace_ba, dm);
+ KVectorComponent modified_k_comp(spectralspace_ba, dm);
// Compute real-space stencil coefficients
Vector<Real> stencil_coef = getFonbergStencilCoefficients(n_order, nodal);
diff --git a/Source/FieldSolver/SpectralSolver/SpectralSolver.H b/Source/FieldSolver/SpectralSolver/SpectralSolver.H
index 4ed44cb9f..7444452af 100644
--- a/Source/FieldSolver/SpectralSolver/SpectralSolver.H
+++ b/Source/FieldSolver/SpectralSolver/SpectralSolver.H
@@ -13,11 +13,6 @@
*/
class SpectralSolver
{
- private:
- SpectralFieldData field_data; // Store field in spectral space
- // and perform the Fourier transforms
- PsatdAlgorithm algorithm; // Contains Psatd coefficients
- // and field update equation
public:
// Inline definition of the member functions of `SpectralSolver`
// The body of these functions is short, since the work is done in the
@@ -66,6 +61,12 @@ class SpectralSolver
BL_PROFILE("SpectralSolver::pushSpectralFields");
algorithm.pushSpectralFields( field_data );
};
+
+ private:
+ SpectralFieldData field_data; // Store field in spectral space
+ // and perform the Fourier transforms
+ PsatdAlgorithm algorithm; // Contains Psatd coefficients
+ // and field update equation
};
#endif // WARPX_SPECTRAL_SOLVER_H_
diff --git a/Source/FieldSolver/SpectralSolver/WarpX_Complex.H b/Source/FieldSolver/SpectralSolver/WarpX_Complex.H
deleted file mode 100644
index c898c5baa..000000000
--- a/Source/FieldSolver/SpectralSolver/WarpX_Complex.H
+++ /dev/null
@@ -1,27 +0,0 @@
-#ifndef WARPX_COMPLEX_H_
-#define WARPX_COMPLEX_H_
-
-#include <AMReX_REAL.H>
-
-// Define complex type on GPU/CPU
-#ifdef AMREX_USE_GPU
-
-#include <thrust/complex.h>
-#include <cufft.h>
-using Complex = thrust::complex<amrex::Real>;
-static_assert( sizeof(Complex) == sizeof(cuDoubleComplex),
- "The complex types in WarpX and cuFFT do not match.");
-
-#else
-
-#include <complex>
-#include <fftw3.h>
-using Complex = std::complex<amrex::Real>;
-static_assert( sizeof(Complex) == sizeof(fftw_complex),
- "The complex types in WarpX and FFTW do not match.");
-
-#endif
-static_assert(sizeof(Complex) == sizeof(amrex::Real[2]),
- "Unexpected complex type.");
-
-#endif //WARPX_COMPLEX_H_