aboutsummaryrefslogtreecommitdiff
path: root/Source/FieldSolver/SpectralSolver/SpectralSolver.H
diff options
context:
space:
mode:
authorGravatar Revathi Jambunathan <revanathan@login5.summit.olcf.ornl.gov> 2019-05-08 18:24:12 -0400
committerGravatar Revathi Jambunathan <revanathan@login5.summit.olcf.ornl.gov> 2019-05-08 18:24:12 -0400
commitce1ee07a91bd6d2d82f5394149aac88b3aad0491 (patch)
tree8d52bcd2d1b24585ff7ba4165a37bdd112b90d34 /Source/FieldSolver/SpectralSolver/SpectralSolver.H
parenteb76cadbc5e76111679f6189e6728e462af41f66 (diff)
parentc6335ccaf604b1713449a500eb56559d7c678d7c (diff)
downloadWarpX-ce1ee07a91bd6d2d82f5394149aac88b3aad0491.tar.gz
WarpX-ce1ee07a91bd6d2d82f5394149aac88b3aad0491.tar.zst
WarpX-ce1ee07a91bd6d2d82f5394149aac88b3aad0491.zip
merged with upstream dev
Diffstat (limited to 'Source/FieldSolver/SpectralSolver/SpectralSolver.H')
-rw-r--r--Source/FieldSolver/SpectralSolver/SpectralSolver.H34
1 files changed, 14 insertions, 20 deletions
diff --git a/Source/FieldSolver/SpectralSolver/SpectralSolver.H b/Source/FieldSolver/SpectralSolver/SpectralSolver.H
index 7444452af..d4019a9a3 100644
--- a/Source/FieldSolver/SpectralSolver/SpectralSolver.H
+++ b/Source/FieldSolver/SpectralSolver/SpectralSolver.H
@@ -1,8 +1,7 @@
#ifndef WARPX_SPECTRAL_SOLVER_H_
#define WARPX_SPECTRAL_SOLVER_H_
-#include <SpectralKSpace.H>
-#include <PsatdAlgorithm.H>
+#include <SpectralBaseAlgorithm.H>
#include <SpectralFieldData.H>
/* \brief Top-level class for the electromagnetic spectral solver
@@ -14,28 +13,17 @@
class SpectralSolver
{
public:
- // Inline definition of the member functions of `SpectralSolver`
+ // Inline definition of the member functions of `SpectralSolver`,
+ // except the constructor (see `SpectralSolver.cpp`)
// The body of these functions is short, since the work is done in the
// underlying classes `SpectralFieldData` and `PsatdAlgorithm`
- /* \brief Initialize the spectral solver */
+ // Constructor
SpectralSolver( const amrex::BoxArray& realspace_ba,
const amrex::DistributionMapping& dm,
const int norder_x, const int norder_y,
const int norder_z, const bool nodal,
- const amrex::RealVect dx, const amrex::Real dt ) {
- // Initialize all structures using the same distribution mapping dm
-
- // - Initialize k space object (Contains info about the size of
- // the spectral space corresponding to each box in `realspace_ba`,
- // as well as the value of the corresponding k coordinates)
- const SpectralKSpace k_space= SpectralKSpace(realspace_ba, dm, dx);
- // - Initialize the algorithm (coefficients) over this space
- algorithm = PsatdAlgorithm( k_space, dm, norder_x, norder_y,
- norder_z, nodal, dt );
- // - Initialize arrays for fields in Fourier space + FFT plans
- field_data = SpectralFieldData( realspace_ba, k_space, dm );
- };
+ const amrex::RealVect dx, const amrex::Real dt );
/* \brief Transform the component `i_comp` of MultiFab `mf`
* to spectral space, and store the corresponding result internally
@@ -59,14 +47,20 @@ class SpectralSolver
/* \brief Update the fields in spectral space, over one timestep */
void pushSpectralFields(){
BL_PROFILE("SpectralSolver::pushSpectralFields");
- algorithm.pushSpectralFields( field_data );
+ // Virtual function: the actual function used here depends
+ // on the sub-class of `SpectralBaseAlgorithm` that was
+ // initialized in the constructor of `SpectralSolver`
+ 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
+ std::unique_ptr<SpectralBaseAlgorithm> algorithm;
+ // Defines field update equation in spectral space,
+ // and the associated coefficients.
+ // SpectralBaseAlgorithm is a base class ; this pointer is meant
+ // to point an instance of a *sub-class* defining a specific algorithm
};
#endif // WARPX_SPECTRAL_SOLVER_H_