aboutsummaryrefslogtreecommitdiff
path: root/Source/FieldSolver/SpectralSolver
diff options
context:
space:
mode:
authorGravatar Luca Fedeli <luca.fedeli@cea.fr> 2021-06-25 04:34:32 +0200
committerGravatar GitHub <noreply@github.com> 2021-06-24 19:34:32 -0700
commit0b6ddad4ce039277025b80ba81ff2692b3a80724 (patch)
treee41003ab090527544e313036b1adc436bba6b9e9 /Source/FieldSolver/SpectralSolver
parent78ebf77e84f458eb6eb8917f333196acaa84e1c0 (diff)
downloadWarpX-0b6ddad4ce039277025b80ba81ff2692b3a80724.tar.gz
WarpX-0b6ddad4ce039277025b80ba81ff2692b3a80724.tar.zst
WarpX-0b6ddad4ce039277025b80ba81ff2692b3a80724.zip
Use "Include What You Use" on WarpX (#1947)
* initial tests with IWYU * added a couple of forward declarations * used iwyu on more files * progress * used iwyu on more files * progress with iwyu * progress with iwyu * fixed bug * progress with iwyu * progress with IWYU * progress with IWYU * fixed bug * fixed bug * progress with IWYU * progress with IWYU + use forward declarations in WarpX.H * first try with .def files * fix bugs * progress with IWYU * progress with IWYU * progress with iwyu * correct copyright * fixed bug * fixed bugs * fix missing include * fixed bug * fix bug * fix bug introduced during last bugfix * use iwyu on newly added files * add space * fix bug * fix missing include * fix missing include * fix missing include * fixed bugs * fixed bug * attempt at fixing issue with math functions * added missing include * fixed missing include * using _fwd.H * fixed bug * progress with iwyu * update AMReX branch * enforce alphabetic order * progress with iwyu * use right version of amrex * use right version of amrex for tests * fixed bug * fix another bug * fix missing include * fix missing include * fix missing include * updated amrex * initial work to document new include strategy * updated documentation * Fix rst & private includes * Remove accidentially added files * Fix rst code blocks * one more rst block Co-authored-by: Axel Huebl <axel.huebl@plasma.ninja>
Diffstat (limited to 'Source/FieldSolver/SpectralSolver')
-rw-r--r--Source/FieldSolver/SpectralSolver/AnyFFT.H3
-rw-r--r--Source/FieldSolver/SpectralSolver/SpectralAlgorithms/ComovingPsatdAlgorithm.H11
-rw-r--r--Source/FieldSolver/SpectralSolver/SpectralAlgorithms/ComovingPsatdAlgorithm.cpp15
-rw-r--r--Source/FieldSolver/SpectralSolver/SpectralAlgorithms/GalileanPsatdAlgorithmRZ.cpp2
-rw-r--r--Source/FieldSolver/SpectralSolver/SpectralAlgorithms/PMLPsatdAlgorithm.H14
-rw-r--r--Source/FieldSolver/SpectralSolver/SpectralAlgorithms/PMLPsatdAlgorithm.cpp20
-rw-r--r--Source/FieldSolver/SpectralSolver/SpectralAlgorithms/PsatdAlgorithm.H11
-rw-r--r--Source/FieldSolver/SpectralSolver/SpectralAlgorithms/PsatdAlgorithm.cpp13
-rw-r--r--Source/FieldSolver/SpectralSolver/SpectralAlgorithms/PsatdAlgorithmRZ.cpp2
-rw-r--r--Source/FieldSolver/SpectralSolver/SpectralAlgorithms/SpectralBaseAlgorithm.H33
-rw-r--r--Source/FieldSolver/SpectralSolver/SpectralAlgorithms/SpectralBaseAlgorithm.cpp38
-rw-r--r--Source/FieldSolver/SpectralSolver/SpectralBinomialFilter.cpp1
-rw-r--r--Source/FieldSolver/SpectralSolver/SpectralFieldData.H16
-rw-r--r--Source/FieldSolver/SpectralSolver/SpectralFieldData.cpp20
-rw-r--r--Source/FieldSolver/SpectralSolver/SpectralFieldDataRZ.H5
-rw-r--r--Source/FieldSolver/SpectralSolver/SpectralFieldData_fwd.H12
-rw-r--r--Source/FieldSolver/SpectralSolver/SpectralHankelTransform/BesselRoots.H2
-rw-r--r--Source/FieldSolver/SpectralSolver/SpectralHankelTransform/HankelTransform.cpp5
-rw-r--r--Source/FieldSolver/SpectralSolver/SpectralHankelTransform/SpectralHankelTransformer.H3
-rw-r--r--Source/FieldSolver/SpectralSolver/SpectralHankelTransform/SpectralHankelTransformer.cpp3
-rw-r--r--Source/FieldSolver/SpectralSolver/SpectralKSpace.H7
-rw-r--r--Source/FieldSolver/SpectralSolver/SpectralKSpace.cpp16
-rw-r--r--Source/FieldSolver/SpectralSolver/SpectralKSpace_fwd.H10
-rw-r--r--Source/FieldSolver/SpectralSolver/SpectralSolver.H10
-rw-r--r--Source/FieldSolver/SpectralSolver/SpectralSolver.cpp10
-rw-r--r--Source/FieldSolver/SpectralSolver/SpectralSolverRZ.H2
-rw-r--r--Source/FieldSolver/SpectralSolver/SpectralSolverRZ.cpp6
-rw-r--r--Source/FieldSolver/SpectralSolver/SpectralSolverRZ_fwd.H8
-rw-r--r--Source/FieldSolver/SpectralSolver/SpectralSolver_fwd.H8
-rw-r--r--Source/FieldSolver/SpectralSolver/WrapFFTW.cpp6
30 files changed, 267 insertions, 45 deletions
diff --git a/Source/FieldSolver/SpectralSolver/AnyFFT.H b/Source/FieldSolver/SpectralSolver/AnyFFT.H
index 6ba77e13b..23cadd30f 100644
--- a/Source/FieldSolver/SpectralSolver/AnyFFT.H
+++ b/Source/FieldSolver/SpectralSolver/AnyFFT.H
@@ -9,6 +9,7 @@
#define ANYFFT_H_
#include <AMReX_Config.H>
+#include <AMReX_LayoutData.H>
#if defined(AMREX_USE_CUDA)
# include <cufft.h>
@@ -18,8 +19,6 @@
# include <fftw3.h>
#endif
-#include <AMReX_LayoutData.H>
-
/**
* Wrapper around FFT libraries. The header file defines the API and the base types
* (Complex and VendorFFTPlan), and the implementation for different FFT libraries is
diff --git a/Source/FieldSolver/SpectralSolver/SpectralAlgorithms/ComovingPsatdAlgorithm.H b/Source/FieldSolver/SpectralSolver/SpectralAlgorithms/ComovingPsatdAlgorithm.H
index 76526024f..ecbc1578b 100644
--- a/Source/FieldSolver/SpectralSolver/SpectralAlgorithms/ComovingPsatdAlgorithm.H
+++ b/Source/FieldSolver/SpectralSolver/SpectralAlgorithms/ComovingPsatdAlgorithm.H
@@ -1,8 +1,19 @@
#ifndef WARPX_COMOVING_PSATD_ALGORITHM_H_
#define WARPX_COMOVING_PSATD_ALGORITHM_H_
+#include "FieldSolver/SpectralSolver/SpectralFieldData.H"
+#include "FieldSolver/SpectralSolver/SpectralKSpace.H"
#include "SpectralBaseAlgorithm.H"
+#include <AMReX_Array.H>
+#include <AMReX_Config.H>
+#include <AMReX_REAL.H>
+
+#include <AMReX_BaseFwd.H>
+
+#include <array>
+#include <memory>
+
#if WARPX_USE_PSATD
/* \brief Class that updates the field in spectral space and stores the coefficients
diff --git a/Source/FieldSolver/SpectralSolver/SpectralAlgorithms/ComovingPsatdAlgorithm.cpp b/Source/FieldSolver/SpectralSolver/SpectralAlgorithms/ComovingPsatdAlgorithm.cpp
index eb4f13bb4..64920d325 100644
--- a/Source/FieldSolver/SpectralSolver/SpectralAlgorithms/ComovingPsatdAlgorithm.cpp
+++ b/Source/FieldSolver/SpectralSolver/SpectralAlgorithms/ComovingPsatdAlgorithm.cpp
@@ -1,5 +1,20 @@
#include "ComovingPsatdAlgorithm.H"
+
#include "Utils/WarpXConst.H"
+#include "Utils/WarpX_Complex.H"
+
+#include <AMReX.H>
+#include <AMReX_Array4.H>
+#include <AMReX_BLProfiler.H>
+#include <AMReX_BaseFab.H>
+#include <AMReX_BoxArray.H>
+#include <AMReX_GpuComplex.H>
+#include <AMReX_GpuLaunch.H>
+#include <AMReX_GpuQualifiers.H>
+#include <AMReX_MFIter.H>
+#include <AMReX_PODVector.H>
+
+#include <cmath>
#if WARPX_USE_PSATD
diff --git a/Source/FieldSolver/SpectralSolver/SpectralAlgorithms/GalileanPsatdAlgorithmRZ.cpp b/Source/FieldSolver/SpectralSolver/SpectralAlgorithms/GalileanPsatdAlgorithmRZ.cpp
index a76311db3..ce6d5b933 100644
--- a/Source/FieldSolver/SpectralSolver/SpectralAlgorithms/GalileanPsatdAlgorithmRZ.cpp
+++ b/Source/FieldSolver/SpectralSolver/SpectralAlgorithms/GalileanPsatdAlgorithmRZ.cpp
@@ -4,10 +4,10 @@
*
* License: BSD-3-Clause-LBNL
*/
-#include "WarpX.H"
#include "GalileanPsatdAlgorithmRZ.H"
#include "Utils/WarpXConst.H"
#include "Utils/WarpXProfilerWrapper.H"
+#include "WarpX.H"
#include <cmath>
diff --git a/Source/FieldSolver/SpectralSolver/SpectralAlgorithms/PMLPsatdAlgorithm.H b/Source/FieldSolver/SpectralSolver/SpectralAlgorithms/PMLPsatdAlgorithm.H
index 1b9755826..7e17eda07 100644
--- a/Source/FieldSolver/SpectralSolver/SpectralAlgorithms/PMLPsatdAlgorithm.H
+++ b/Source/FieldSolver/SpectralSolver/SpectralAlgorithms/PMLPsatdAlgorithm.H
@@ -9,6 +9,16 @@
#include "SpectralBaseAlgorithm.H"
+#include "FieldSolver/SpectralSolver/SpectralFieldData_fwd.H"
+#include "FieldSolver/SpectralSolver/SpectralKSpace_fwd.H"
+
+#include <AMReX_REAL.H>
+
+#include <AMReX_BaseFwd.H>
+
+#include <array>
+#include <memory>
+
#if WARPX_USE_PSATD
/* \brief Class that updates the field in spectral space
@@ -32,9 +42,7 @@ class PMLPsatdAlgorithm : public SpectralBaseAlgorithm
// Redefine functions from base class
virtual void pushSpectralFields(SpectralFieldData& f) const override final;
- virtual int getRequiredNumberOfFields() const override final {
- return SpectralPMLIndex::n_fields;
- }
+ virtual int getRequiredNumberOfFields() const override final;
/**
* \brief Virtual function for current correction in Fourier space
diff --git a/Source/FieldSolver/SpectralSolver/SpectralAlgorithms/PMLPsatdAlgorithm.cpp b/Source/FieldSolver/SpectralSolver/SpectralAlgorithms/PMLPsatdAlgorithm.cpp
index 3c1526357..d28b5218a 100644
--- a/Source/FieldSolver/SpectralSolver/SpectralAlgorithms/PMLPsatdAlgorithm.cpp
+++ b/Source/FieldSolver/SpectralSolver/SpectralAlgorithms/PMLPsatdAlgorithm.cpp
@@ -5,11 +5,25 @@
* License: BSD-3-Clause-LBNL
*/
#include "PMLPsatdAlgorithm.H"
+
+#include "FieldSolver/SpectralSolver/SpectralFieldData.H"
+#include "FieldSolver/SpectralSolver/SpectralKSpace.H"
#include "Utils/WarpXConst.H"
+#include "Utils/WarpX_Complex.H"
+
+#include <AMReX.H>
+#include <AMReX_Array4.H>
+#include <AMReX_BaseFab.H>
+#include <AMReX_BoxArray.H>
+#include <AMReX_Config.H>
+#include <AMReX_GpuComplex.H>
+#include <AMReX_GpuLaunch.H>
+#include <AMReX_GpuQualifiers.H>
+#include <AMReX_MFIter.H>
+#include <AMReX_PODVector.H>
#include <cmath>
-
#if WARPX_USE_PSATD
using namespace amrex;
@@ -401,4 +415,8 @@ PMLPsatdAlgorithm::VayDeposition (const int /*lev*/,
amrex::Abort("Vay deposition not implemented for PML PSATD");
}
+int PMLPsatdAlgorithm::getRequiredNumberOfFields() const {
+ return SpectralPMLIndex::n_fields;
+}
+
#endif // WARPX_USE_PSATD
diff --git a/Source/FieldSolver/SpectralSolver/SpectralAlgorithms/PsatdAlgorithm.H b/Source/FieldSolver/SpectralSolver/SpectralAlgorithms/PsatdAlgorithm.H
index 973265cdf..7b917284b 100644
--- a/Source/FieldSolver/SpectralSolver/SpectralAlgorithms/PsatdAlgorithm.H
+++ b/Source/FieldSolver/SpectralSolver/SpectralAlgorithms/PsatdAlgorithm.H
@@ -7,8 +7,19 @@
#ifndef WARPX_PSATD_ALGORITHM_H_
#define WARPX_PSATD_ALGORITHM_H_
+#include "FieldSolver/SpectralSolver/SpectralFieldData.H"
+#include "FieldSolver/SpectralSolver/SpectralKSpace.H"
#include "SpectralBaseAlgorithm.H"
+#include <AMReX_Array.H>
+#include <AMReX_Config.H>
+#include <AMReX_REAL.H>
+
+#include <AMReX_BaseFwd.H>
+
+#include <array>
+#include <memory>
+
#if WARPX_USE_PSATD
/* \brief Class that updates the field in spectral space
* and stores the coefficients of the corresponding update equation.
diff --git a/Source/FieldSolver/SpectralSolver/SpectralAlgorithms/PsatdAlgorithm.cpp b/Source/FieldSolver/SpectralSolver/SpectralAlgorithms/PsatdAlgorithm.cpp
index 01a2cfe94..8a5b791ab 100644
--- a/Source/FieldSolver/SpectralSolver/SpectralAlgorithms/PsatdAlgorithm.cpp
+++ b/Source/FieldSolver/SpectralSolver/SpectralAlgorithms/PsatdAlgorithm.cpp
@@ -5,7 +5,20 @@
* License: BSD-3-Clause-LBNL
*/
#include "PsatdAlgorithm.H"
+
#include "Utils/WarpXConst.H"
+#include "Utils/WarpX_Complex.H"
+
+#include <AMReX_Array4.H>
+#include <AMReX_BLProfiler.H>
+#include <AMReX_BaseFab.H>
+#include <AMReX_BoxArray.H>
+#include <AMReX_GpuComplex.H>
+#include <AMReX_GpuLaunch.H>
+#include <AMReX_GpuQualifiers.H>
+#include <AMReX_IntVect.H>
+#include <AMReX_MFIter.H>
+#include <AMReX_PODVector.H>
#include <cmath>
diff --git a/Source/FieldSolver/SpectralSolver/SpectralAlgorithms/PsatdAlgorithmRZ.cpp b/Source/FieldSolver/SpectralSolver/SpectralAlgorithms/PsatdAlgorithmRZ.cpp
index 86d9f9696..cb055a27b 100644
--- a/Source/FieldSolver/SpectralSolver/SpectralAlgorithms/PsatdAlgorithmRZ.cpp
+++ b/Source/FieldSolver/SpectralSolver/SpectralAlgorithms/PsatdAlgorithmRZ.cpp
@@ -4,10 +4,10 @@
*
* License: BSD-3-Clause-LBNL
*/
-#include "WarpX.H"
#include "PsatdAlgorithmRZ.H"
#include "Utils/WarpXConst.H"
#include "Utils/WarpXProfilerWrapper.H"
+#include "WarpX.H"
#include <cmath>
diff --git a/Source/FieldSolver/SpectralSolver/SpectralAlgorithms/SpectralBaseAlgorithm.H b/Source/FieldSolver/SpectralSolver/SpectralAlgorithms/SpectralBaseAlgorithm.H
index 598046042..624d7870c 100644
--- a/Source/FieldSolver/SpectralSolver/SpectralAlgorithms/SpectralBaseAlgorithm.H
+++ b/Source/FieldSolver/SpectralSolver/SpectralAlgorithms/SpectralBaseAlgorithm.H
@@ -8,9 +8,19 @@
#define WARPX_SPECTRAL_BASE_ALGORITHM_H_
#include "FieldSolver/SpectralSolver/SpectralKSpace.H"
-#include "FieldSolver/SpectralSolver/SpectralFieldData.H"
+#include "Utils/WarpX_Complex.H"
-#include <AMReX.H>
+#include "FieldSolver/SpectralSolver/SpectralFieldData_fwd.H"
+
+#include <AMReX_BaseFab.H>
+#include <AMReX_Config.H>
+#include <AMReX_FabArray.H>
+#include <AMReX_REAL.H>
+
+#include <AMReX_BaseFwd.H>
+
+#include <array>
+#include <memory>
#if WARPX_USE_PSATD
@@ -75,24 +85,13 @@ class SpectralBaseAlgorithm
using SpectralComplexCoefficients = \
amrex::FabArray< amrex::BaseFab <Complex> >;
- // Constructor
+ /**
+ * \brief Constructor
+ */
SpectralBaseAlgorithm(const SpectralKSpace& spectral_kspace,
const amrex::DistributionMapping& dm,
const int norder_x, const int norder_y,
- const int norder_z, const bool 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))
-#else
- modified_kz_vec(spectral_kspace.getModifiedKComponent(dm,1,norder_z,nodal))
-#endif
- {
-#if (AMREX_SPACEDIM!=3)
- amrex::ignore_unused(norder_y);
-#endif
- }
+ const int norder_z, const bool nodal);
// Modified finite-order vectors
KVectorComponent modified_kx_vec;
diff --git a/Source/FieldSolver/SpectralSolver/SpectralAlgorithms/SpectralBaseAlgorithm.cpp b/Source/FieldSolver/SpectralSolver/SpectralAlgorithms/SpectralBaseAlgorithm.cpp
index 46fe83900..e57302cc4 100644
--- a/Source/FieldSolver/SpectralSolver/SpectralAlgorithms/SpectralBaseAlgorithm.cpp
+++ b/Source/FieldSolver/SpectralSolver/SpectralAlgorithms/SpectralBaseAlgorithm.cpp
@@ -5,11 +5,47 @@
* License: BSD-3-Clause-LBNL
*/
#include "SpectralBaseAlgorithm.H"
-#include <cmath>
+
+#include "FieldSolver/SpectralSolver/SpectralFieldData.H"
+#include "Utils/WarpX_Complex.H"
+
+#include <AMReX_Array4.H>
+#include <AMReX_BaseFab.H>
+#include <AMReX_Config.H>
+#include <AMReX_GpuComplex.H>
+#include <AMReX_GpuLaunch.H>
+#include <AMReX_GpuQualifiers.H>
+#include <AMReX_MFIter.H>
+#include <AMReX_PODVector.H>
+#include <AMReX_REAL.H>
+
+#include <array>
+#include <memory>
using namespace amrex;
/**
+ * \brief Constructor
+ */
+SpectralBaseAlgorithm::SpectralBaseAlgorithm(const SpectralKSpace& spectral_kspace,
+ const amrex::DistributionMapping& dm,
+ const int norder_x, const int norder_y,
+ const int norder_z, const bool 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))
+#else
+ modified_kz_vec(spectral_kspace.getModifiedKComponent(dm,1,norder_z,nodal))
+#endif
+ {
+#if (AMREX_SPACEDIM!=3)
+ amrex::ignore_unused(norder_y);
+#endif
+ }
+
+/**
* \brief Compute spectral divergence of E
*/
void
diff --git a/Source/FieldSolver/SpectralSolver/SpectralBinomialFilter.cpp b/Source/FieldSolver/SpectralSolver/SpectralBinomialFilter.cpp
index e0ac3e886..14246b5be 100644
--- a/Source/FieldSolver/SpectralSolver/SpectralBinomialFilter.cpp
+++ b/Source/FieldSolver/SpectralSolver/SpectralBinomialFilter.cpp
@@ -6,6 +6,7 @@
*/
#include "SpectralBinomialFilter.H"
+
#include <AMReX_REAL.H>
#include <cmath>
diff --git a/Source/FieldSolver/SpectralSolver/SpectralFieldData.H b/Source/FieldSolver/SpectralSolver/SpectralFieldData.H
index 4fc734853..a1fed5cce 100644
--- a/Source/FieldSolver/SpectralSolver/SpectralFieldData.H
+++ b/Source/FieldSolver/SpectralSolver/SpectralFieldData.H
@@ -8,13 +8,23 @@
#ifndef WARPX_SPECTRAL_FIELD_DATA_H_
#define WARPX_SPECTRAL_FIELD_DATA_H_
-#include "Utils/WarpX_Complex.H"
-#include "SpectralKSpace.H"
+#include "SpectralFieldData_fwd.H"
+
#include "AnyFFT.H"
+#include "SpectralKSpace.H"
+#include "Utils/WarpX_Complex.H"
+#include <AMReX_BaseFab.H>
+#include <AMReX_Config.H>
+#include <AMReX_Extension.H>
+#include <AMReX_FabArray.H>
+#include <AMReX_IndexType.H>
#include <AMReX_MultiFab.H>
+#include <AMReX_Vector.H>
+
+#include <AMReX_BaseFwd.H>
-#include <string>
+#include <vector>
// Declare type for spectral fields
using SpectralField = amrex::FabArray< amrex::BaseFab <Complex> >;
diff --git a/Source/FieldSolver/SpectralSolver/SpectralFieldData.cpp b/Source/FieldSolver/SpectralSolver/SpectralFieldData.cpp
index 138476f88..bdb631063 100644
--- a/Source/FieldSolver/SpectralSolver/SpectralFieldData.cpp
+++ b/Source/FieldSolver/SpectralSolver/SpectralFieldData.cpp
@@ -6,9 +6,27 @@
* License: BSD-3-Clause-LBNL
*/
#include "SpectralFieldData.H"
+
+#include "Utils/WarpXAlgorithmSelection.H"
#include "WarpX.H"
-#include <map>
+#include <AMReX_Array4.H>
+#include <AMReX_BLassert.H>
+#include <AMReX_Box.H>
+#include <AMReX_BoxArray.H>
+#include <AMReX_Dim3.H>
+#include <AMReX_FArrayBox.H>
+#include <AMReX_GpuAtomic.H>
+#include <AMReX_GpuComplex.H>
+#include <AMReX_GpuDevice.H>
+#include <AMReX_GpuLaunch.H>
+#include <AMReX_GpuQualifiers.H>
+#include <AMReX_IntVect.H>
+#include <AMReX_LayoutData.H>
+#include <AMReX_MFIter.H>
+#include <AMReX_PODVector.H>
+#include <AMReX_REAL.H>
+#include <AMReX_Utility.H>
#if WARPX_USE_PSATD
diff --git a/Source/FieldSolver/SpectralSolver/SpectralFieldDataRZ.H b/Source/FieldSolver/SpectralSolver/SpectralFieldDataRZ.H
index 8484d7174..85aa41d3b 100644
--- a/Source/FieldSolver/SpectralSolver/SpectralFieldDataRZ.H
+++ b/Source/FieldSolver/SpectralSolver/SpectralFieldDataRZ.H
@@ -7,10 +7,11 @@
#ifndef WARPX_SPECTRAL_FIELD_DATA_RZ_H_
#define WARPX_SPECTRAL_FIELD_DATA_RZ_H_
-#include "SpectralKSpaceRZ.H"
+#include "SpectralBinomialFilter.H"
#include "SpectralFieldData.H"
#include "SpectralHankelTransform/SpectralHankelTransformer.H"
-#include "SpectralBinomialFilter.H"
+#include "SpectralKSpaceRZ.H"
+
#include <AMReX_MultiFab.H>
/* \brief Class that stores the fields in spectral space, and performs the
diff --git a/Source/FieldSolver/SpectralSolver/SpectralFieldData_fwd.H b/Source/FieldSolver/SpectralSolver/SpectralFieldData_fwd.H
new file mode 100644
index 000000000..631dd3b06
--- /dev/null
+++ b/Source/FieldSolver/SpectralSolver/SpectralFieldData_fwd.H
@@ -0,0 +1,12 @@
+/* Copyright 2021 Luca Fedeli
+ *
+ * This file is part of WarpX.
+ *
+ * License: BSD-3-Clause-LBNL
+ */
+
+struct SpectralFieldIndex;
+struct SpectralAvgFieldIndex;
+struct SpectralPMLIndex;
+
+class SpectralFieldData;
diff --git a/Source/FieldSolver/SpectralSolver/SpectralHankelTransform/BesselRoots.H b/Source/FieldSolver/SpectralSolver/SpectralHankelTransform/BesselRoots.H
index 6465d119e..64ffc80ac 100644
--- a/Source/FieldSolver/SpectralSolver/SpectralHankelTransform/BesselRoots.H
+++ b/Source/FieldSolver/SpectralSolver/SpectralHankelTransform/BesselRoots.H
@@ -32,6 +32,8 @@
! (www.jpmoreau.fr)
! ------------------------------------------------------------------------ */
+#include "Utils/WarpXConst.H"
+
#include <AMReX_REAL.H>
#include <cmath>
diff --git a/Source/FieldSolver/SpectralSolver/SpectralHankelTransform/HankelTransform.cpp b/Source/FieldSolver/SpectralSolver/SpectralHankelTransform/HankelTransform.cpp
index 24e9d7f81..d6a357b7f 100644
--- a/Source/FieldSolver/SpectralSolver/SpectralHankelTransform/HankelTransform.cpp
+++ b/Source/FieldSolver/SpectralSolver/SpectralHankelTransform/HankelTransform.cpp
@@ -4,10 +4,11 @@
*
* License: BSD-3-Clause-LBNL
*/
-#include "WarpX.H"
-
#include "HankelTransform.H"
+
#include "BesselRoots.H"
+#include "Utils/WarpXConst.H"
+#include "WarpX.H"
#include <blas.hh>
#include <lapack.hh>
diff --git a/Source/FieldSolver/SpectralSolver/SpectralHankelTransform/SpectralHankelTransformer.H b/Source/FieldSolver/SpectralSolver/SpectralHankelTransform/SpectralHankelTransformer.H
index 82cf48fe4..e6dddf60e 100644
--- a/Source/FieldSolver/SpectralSolver/SpectralHankelTransform/SpectralHankelTransformer.H
+++ b/Source/FieldSolver/SpectralSolver/SpectralHankelTransform/SpectralHankelTransformer.H
@@ -7,9 +7,10 @@
#ifndef WARPX_SPECTRALHANKELTRANSFORMER_H_
#define WARPX_SPECTRALHANKELTRANSFORMER_H_
-#include <AMReX_FArrayBox.H>
#include "HankelTransform.H"
+#include <AMReX_FArrayBox.H>
+
/* \brief Object that allows to transform the fields back and forth between the
* spectral and interpolation grid.
*
diff --git a/Source/FieldSolver/SpectralSolver/SpectralHankelTransform/SpectralHankelTransformer.cpp b/Source/FieldSolver/SpectralSolver/SpectralHankelTransform/SpectralHankelTransformer.cpp
index 884ee5f45..a40e62f0d 100644
--- a/Source/FieldSolver/SpectralSolver/SpectralHankelTransform/SpectralHankelTransformer.cpp
+++ b/Source/FieldSolver/SpectralSolver/SpectralHankelTransform/SpectralHankelTransformer.cpp
@@ -4,9 +4,10 @@
*
* License: BSD-3-Clause-LBNL
*/
-#include "Utils/WarpXConst.H"
#include "SpectralHankelTransformer.H"
+#include "Utils/WarpXConst.H"
+
#include <memory>
SpectralHankelTransformer::SpectralHankelTransformer (int const nr,
diff --git a/Source/FieldSolver/SpectralSolver/SpectralKSpace.H b/Source/FieldSolver/SpectralSolver/SpectralKSpace.H
index b009b0ea6..acd58cdb6 100644
--- a/Source/FieldSolver/SpectralSolver/SpectralKSpace.H
+++ b/Source/FieldSolver/SpectralSolver/SpectralKSpace.H
@@ -8,13 +8,20 @@
#ifndef WARPX_SPECTRAL_K_SPACE_H_
#define WARPX_SPECTRAL_K_SPACE_H_
+#include "SpectralKSpace_fwd.H"
+
#include "Utils/WarpX_Complex.H"
+#include <AMReX_Array.H>
#include <AMReX_BoxArray.H>
+#include <AMReX_Config.H>
+#include <AMReX_GpuContainers.H>
#include <AMReX_LayoutData.H>
#include <AMReX_REAL.H>
#include <AMReX_RealVect.H>
+#include <AMReX_Vector.H>
+#include <AMReX_BaseFwd.H>
// `KVectorComponent` and `SpectralShiftFactor` hold one 1D array
// ("DeviceVector") for each box ("LayoutData"). The arrays are
diff --git a/Source/FieldSolver/SpectralSolver/SpectralKSpace.cpp b/Source/FieldSolver/SpectralSolver/SpectralKSpace.cpp
index d04d238ad..2f11f84ca 100644
--- a/Source/FieldSolver/SpectralSolver/SpectralKSpace.cpp
+++ b/Source/FieldSolver/SpectralSolver/SpectralKSpace.cpp
@@ -5,10 +5,24 @@
*
* License: BSD-3-Clause-LBNL
*/
-#include "Utils/WarpXConst.H"
#include "SpectralKSpace.H"
+#include "Utils/WarpXConst.H"
+
+#include <AMReX_BLassert.H>
+#include <AMReX_Box.H>
+#include <AMReX_BoxList.H>
+#include <AMReX_GpuComplex.H>
+#include <AMReX_GpuDevice.H>
+#include <AMReX_GpuLaunch.H>
+#include <AMReX_GpuQualifiers.H>
+#include <AMReX_IndexType.H>
+#include <AMReX_IntVect.H>
+#include <AMReX_MFIter.H>
+
+#include <array>
#include <cmath>
+#include <vector>
using namespace amrex;
diff --git a/Source/FieldSolver/SpectralSolver/SpectralKSpace_fwd.H b/Source/FieldSolver/SpectralSolver/SpectralKSpace_fwd.H
new file mode 100644
index 000000000..32417ff5c
--- /dev/null
+++ b/Source/FieldSolver/SpectralSolver/SpectralKSpace_fwd.H
@@ -0,0 +1,10 @@
+/* Copyright 2021 Luca Fedeli
+ *
+ * This file is part of WarpX.
+ *
+ * License: BSD-3-Clause-LBNL
+ */
+
+struct ShiftType;
+
+class SpectralKSpace;
diff --git a/Source/FieldSolver/SpectralSolver/SpectralSolver.H b/Source/FieldSolver/SpectralSolver/SpectralSolver.H
index d5c7725fe..996053a88 100644
--- a/Source/FieldSolver/SpectralSolver/SpectralSolver.H
+++ b/Source/FieldSolver/SpectralSolver/SpectralSolver.H
@@ -7,9 +7,19 @@
#ifndef WARPX_SPECTRAL_SOLVER_H_
#define WARPX_SPECTRAL_SOLVER_H_
+#include "SpectralSolver_fwd.H"
+
#include "SpectralAlgorithms/SpectralBaseAlgorithm.H"
#include "SpectralFieldData.H"
+#include <AMReX_Array.H>
+#include <AMReX_REAL.H>
+#include <AMReX_RealVect.H>
+
+#include <AMReX_BaseFwd.H>
+
+#include <array>
+#include <memory>
#ifdef WARPX_USE_PSATD
/**
diff --git a/Source/FieldSolver/SpectralSolver/SpectralSolver.cpp b/Source/FieldSolver/SpectralSolver/SpectralSolver.cpp
index ae631ba6c..d04961c5f 100644
--- a/Source/FieldSolver/SpectralSolver/SpectralSolver.cpp
+++ b/Source/FieldSolver/SpectralSolver/SpectralSolver.cpp
@@ -4,14 +4,14 @@
*
* License: BSD-3-Clause-LBNL
*/
+#include "FieldSolver/SpectralSolver/SpectralAlgorithms/SpectralBaseAlgorithm.H"
+#include "FieldSolver/SpectralSolver/SpectralFieldData.H"
+#include "SpectralAlgorithms/ComovingPsatdAlgorithm.H"
+#include "SpectralAlgorithms/PMLPsatdAlgorithm.H"
+#include "SpectralAlgorithms/PsatdAlgorithm.H"
#include "SpectralKSpace.H"
#include "SpectralSolver.H"
-#include "SpectralAlgorithms/PsatdAlgorithm.H"
-#include "SpectralAlgorithms/PMLPsatdAlgorithm.H"
-#include "SpectralAlgorithms/ComovingPsatdAlgorithm.H"
-#include "WarpX.H"
#include "Utils/WarpXProfilerWrapper.H"
-#include "Utils/WarpXUtil.H"
#include <memory>
diff --git a/Source/FieldSolver/SpectralSolver/SpectralSolverRZ.H b/Source/FieldSolver/SpectralSolver/SpectralSolverRZ.H
index 7fe4bd00c..114d199c5 100644
--- a/Source/FieldSolver/SpectralSolver/SpectralSolverRZ.H
+++ b/Source/FieldSolver/SpectralSolver/SpectralSolverRZ.H
@@ -7,6 +7,8 @@
#ifndef WARPX_SPECTRAL_SOLVER_RZ_H_
#define WARPX_SPECTRAL_SOLVER_RZ_H_
+#include "SpectralSolverRZ_fwd.H"
+
#include "SpectralAlgorithms/SpectralBaseAlgorithmRZ.H"
#include "SpectralFieldDataRZ.H"
diff --git a/Source/FieldSolver/SpectralSolver/SpectralSolverRZ.cpp b/Source/FieldSolver/SpectralSolver/SpectralSolverRZ.cpp
index f59b99752..ee4e5fd6d 100644
--- a/Source/FieldSolver/SpectralSolver/SpectralSolverRZ.cpp
+++ b/Source/FieldSolver/SpectralSolver/SpectralSolverRZ.cpp
@@ -4,12 +4,12 @@
*
* License: BSD-3-Clause-LBNL
*/
+#include "SpectralAlgorithms/GalileanPsatdAlgorithmRZ.H"
+#include "SpectralAlgorithms/PsatdAlgorithmRZ.H"
#include "SpectralKSpaceRZ.H"
#include "SpectralSolverRZ.H"
-#include "SpectralAlgorithms/PsatdAlgorithmRZ.H"
-#include "SpectralAlgorithms/GalileanPsatdAlgorithmRZ.H"
-#include "WarpX.H"
#include "Utils/WarpXProfilerWrapper.H"
+#include "WarpX.H"
/* \brief Initialize the spectral Maxwell solver
*
diff --git a/Source/FieldSolver/SpectralSolver/SpectralSolverRZ_fwd.H b/Source/FieldSolver/SpectralSolver/SpectralSolverRZ_fwd.H
new file mode 100644
index 000000000..bfe332fe7
--- /dev/null
+++ b/Source/FieldSolver/SpectralSolver/SpectralSolverRZ_fwd.H
@@ -0,0 +1,8 @@
+/* Copyright 2021 Luca Fedeli
+ *
+ * This file is part of WarpX.
+ *
+ * License: BSD-3-Clause-LBNL
+ */
+
+class SpectralSolverRZ;
diff --git a/Source/FieldSolver/SpectralSolver/SpectralSolver_fwd.H b/Source/FieldSolver/SpectralSolver/SpectralSolver_fwd.H
new file mode 100644
index 000000000..fecd3bd8b
--- /dev/null
+++ b/Source/FieldSolver/SpectralSolver/SpectralSolver_fwd.H
@@ -0,0 +1,8 @@
+/* Copyright 2021 Luca Fedeli
+ *
+ * This file is part of WarpX.
+ *
+ * License: BSD-3-Clause-LBNL
+ */
+
+class SpectralSolver;
diff --git a/Source/FieldSolver/SpectralSolver/WrapFFTW.cpp b/Source/FieldSolver/SpectralSolver/WrapFFTW.cpp
index b4999380b..a4dfc8b29 100644
--- a/Source/FieldSolver/SpectralSolver/WrapFFTW.cpp
+++ b/Source/FieldSolver/SpectralSolver/WrapFFTW.cpp
@@ -7,6 +7,12 @@
#include "AnyFFT.H"
+#include <AMReX.H>
+#include <AMReX_IntVect.H>
+#include <AMReX_REAL.H>
+
+#include <fftw3.h>
+
namespace AnyFFT
{
#ifdef AMREX_USE_FLOAT