#ifndef WARPX_FINITE_DIFFERENCE_SOLVER_H_ #define WARPX_FINITE_DIFFERENCE_SOLVER_H_ /** * \brief Top-level class for the electromagnetic finite-difference solver * * TODO */ class FiniteDifferenceSolver { public: using VectorField = std::array< std::unique_ptr, 3 >; using ConstVectorField = std::array< std::unique_ptr, 3 >; // Constructor void FiniteDifferenceSolver::FiniteDifferenceSolver ( std::array cell_size ) { // Select algorithm (The choice of algorithm is a runtime option, // but we compile code for each algorithm, using templates) if (fdtd_algo == MaxwellSolverAlgo::Yee){ YeeAlgorithm::InitializeStencilCoefficients( cell_size, stencil_coefs_x, stencil_coefs_y, stencil_coefs_z ); } else if (fdtd_algo == MaxwellSolverAlgo::CKC) { CKCAlgorithm::InitializeStencilCoefficients( cell_size, stencil_coefs_x, stencil_coefs_y, stencil_coefs_z ); } else { amrex::Abort("Unknown algorithm"); } }; void EvolveB ( VectorField Bfield, ConstVectorField Efield, amrex::Real dt ) const; }; private: int fdtd_algo; amrex::Gpu::ManagedVector stencil_coefs_x; amrex::Gpu::ManagedVector stencil_coefs_y; amrex::Gpu::ManagedVector stencil_coefs_z; template< typename fdtd_algo > void EvolveBwithAlgo ( VectorField Bfield, ConstVectorField Efield, amrex::Real dt ) const; }; #endif // WARPX_FINITE_DIFFERENCE_SOLVER_H_