aboutsummaryrefslogtreecommitdiff
path: root/Source/FieldSolver/SpectralSolver/SpectralData.H
diff options
context:
space:
mode:
authorGravatar Remi Lehe <remi.lehe@normalesup.org> 2019-04-17 22:26:43 -0700
committerGravatar Remi Lehe <remi.lehe@normalesup.org> 2019-04-23 12:43:53 -0700
commita2c2f1a64c2208f64b795693d6a9b82561ffe3e6 (patch)
treefcc0aba778fb607ac0db2ccb08fd4c51d2f28137 /Source/FieldSolver/SpectralSolver/SpectralData.H
parent67b595e0ad4ac158072fa7e459a3cd5fae86703e (diff)
downloadWarpX-a2c2f1a64c2208f64b795693d6a9b82561ffe3e6.tar.gz
WarpX-a2c2f1a64c2208f64b795693d6a9b82561ffe3e6.tar.zst
WarpX-a2c2f1a64c2208f64b795693d6a9b82561ffe3e6.zip
Restructure directories
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_