aboutsummaryrefslogtreecommitdiff
path: root/Source/FieldSolver/SpectralSolver/SpectralData.H
diff options
context:
space:
mode:
Diffstat (limited to 'Source/FieldSolver/SpectralSolver/SpectralData.H')
-rw-r--r--Source/FieldSolver/SpectralSolver/SpectralData.H43
1 files changed, 43 insertions, 0 deletions
diff --git a/Source/FieldSolver/SpectralSolver/SpectralData.H b/Source/FieldSolver/SpectralSolver/SpectralData.H
new file mode 100644
index 000000000..e294287c5
--- /dev/null
+++ b/Source/FieldSolver/SpectralSolver/SpectralData.H
@@ -0,0 +1,43 @@
+#ifndef WARPX_PSATD_DATA_H_
+#define WARPX_PSATD_DATA_H_
+
+#include <WarpXComplex.H>
+#include <AMReX_MultiFab.H>
+
+using namespace amrex;
+
+// Declare spectral types
+using SpectralField = FabArray<BaseFab<Complex>>;
+
+/* Fields that will be stored in spectral space */
+struct SpectralFieldIndex{
+ enum { Ex=0, Ey, Ez, Bx, By, Bz, Jx, Jy, Jz, rho_old, rho_new };
+};
+
+/* \brief Class that stores the fields in spectral space
+ * and performs the spectral transforms to/from real space
+ */
+class SpectralData
+{
+#ifdef AMREX_USE_GPU
+// Add cuFFT-specific code
+#else
+ using FFTplans = LayoutData<fftw_plan>;
+#endif
+
+ public:
+ SpectralData( const BoxArray& realspace_ba,
+ const BoxArray& spectralspace_ba,
+ const DistributionMapping& dm );
+ ~SpectralData();
+ void ForwardTransform( const MultiFab& mf, const int field_index );
+ void InverseTransform( MultiFab& mf, const int field_index );
+
+ private:
+ SpectralField Ex, Ey, Ez, Bx, By, Bz, Jx, Jy, Jz, rho_old, rho_new;
+ SpectralField tmpRealField, tmpSpectralField; // Store fields before/after transform
+ FFTplans forward_plan, inverse_plan;
+ SpectralField& getSpectralField( const int field_index );
+};
+
+#endif // WARPX_PSATD_DATA_H_