diff --git a/Source/BoundaryConditions/PML.cpp b/Source/BoundaryConditions/PML.cpp index 6634256b87a..d905bf64d1f 100644 --- a/Source/BoundaryConditions/PML.cpp +++ b/Source/BoundaryConditions/PML.cpp @@ -10,7 +10,7 @@ #include "BoundaryConditions/PML.H" #include "BoundaryConditions/PMLComponent.H" -#include "FieldSolver/Fields.H" +#include "Fields.H" #ifdef WARPX_USE_FFT # include "FieldSolver/SpectralSolver/SpectralFieldData.H" #endif diff --git a/Source/BoundaryConditions/PML_RZ.cpp b/Source/BoundaryConditions/PML_RZ.cpp index 0fc24bf8817..b8875be734f 100644 --- a/Source/BoundaryConditions/PML_RZ.cpp +++ b/Source/BoundaryConditions/PML_RZ.cpp @@ -8,7 +8,7 @@ #include "PML_RZ.H" #include "BoundaryConditions/PML_RZ.H" -#include "FieldSolver/Fields.H" +#include "Fields.H" #ifdef WARPX_USE_FFT # include "FieldSolver/SpectralSolver/SpectralFieldDataRZ.H" #endif diff --git a/Source/Diagnostics/BTDiagnostics.cpp b/Source/Diagnostics/BTDiagnostics.cpp index 3a7d27598c1..ab14dd3b86e 100644 --- a/Source/Diagnostics/BTDiagnostics.cpp +++ b/Source/Diagnostics/BTDiagnostics.cpp @@ -14,7 +14,7 @@ #include "Diagnostics/Diagnostics.H" #include "Diagnostics/FlushFormats/FlushFormat.H" #include "ComputeDiagFunctors/BackTransformParticleFunctor.H" -#include "FieldSolver/Fields.H" +#include "Fields.H" #include "Utils/Algorithms/IsIn.H" #include "Utils/Parser/ParserUtils.H" #include "Utils/TextMsg.H" diff --git a/Source/Diagnostics/ComputeDiagFunctors/JFunctor.cpp b/Source/Diagnostics/ComputeDiagFunctors/JFunctor.cpp index 41bea408326..7f532c79e13 100644 --- a/Source/Diagnostics/ComputeDiagFunctors/JFunctor.cpp +++ b/Source/Diagnostics/ComputeDiagFunctors/JFunctor.cpp @@ -6,7 +6,7 @@ #include "JFunctor.H" -#include "FieldSolver/Fields.H" +#include "Fields.H" #include "Particles/MultiParticleContainer.H" #include "WarpX.H" diff --git a/Source/Diagnostics/ComputeDiagFunctors/JdispFunctor.cpp b/Source/Diagnostics/ComputeDiagFunctors/JdispFunctor.cpp index 3c78bdf6d31..0e4a405c499 100644 --- a/Source/Diagnostics/ComputeDiagFunctors/JdispFunctor.cpp +++ b/Source/Diagnostics/ComputeDiagFunctors/JdispFunctor.cpp @@ -6,7 +6,7 @@ #include "JdispFunctor.H" #include "WarpX.H" -#include "FieldSolver/Fields.H" +#include "Fields.H" #include "FieldSolver/FiniteDifferenceSolver/HybridPICModel/HybridPICModel.H" #include "Particles/MultiParticleContainer.H" diff --git a/Source/Diagnostics/FlushFormats/FlushFormatCheckpoint.cpp b/Source/Diagnostics/FlushFormats/FlushFormatCheckpoint.cpp index 49d1e7e1ad0..2020be2d4b7 100644 --- a/Source/Diagnostics/FlushFormats/FlushFormatCheckpoint.cpp +++ b/Source/Diagnostics/FlushFormats/FlushFormatCheckpoint.cpp @@ -5,7 +5,7 @@ # include "BoundaryConditions/PML_RZ.H" #endif #include "Diagnostics/ParticleDiag/ParticleDiag.H" -#include "FieldSolver/Fields.H" +#include "Fields.H" #include "Particles/WarpXParticleContainer.H" #include "Utils/TextMsg.H" #include "Utils/WarpXProfilerWrapper.H" diff --git a/Source/Diagnostics/FlushFormats/FlushFormatPlotfile.cpp b/Source/Diagnostics/FlushFormats/FlushFormatPlotfile.cpp index d7cbbd98574..1731851dc3b 100644 --- a/Source/Diagnostics/FlushFormats/FlushFormatPlotfile.cpp +++ b/Source/Diagnostics/FlushFormats/FlushFormatPlotfile.cpp @@ -1,6 +1,6 @@ #include "FlushFormatPlotfile.H" -#include "FieldSolver/Fields.H" +#include "Fields.H" #include "Diagnostics/MultiDiagnostics.H" #include "Diagnostics/ParticleDiag/ParticleDiag.H" #include "Particles/Filter/FilterFunctors.H" diff --git a/Source/Diagnostics/FullDiagnostics.cpp b/Source/Diagnostics/FullDiagnostics.cpp index 95e1a04b40f..2b4c63880a8 100644 --- a/Source/Diagnostics/FullDiagnostics.cpp +++ b/Source/Diagnostics/FullDiagnostics.cpp @@ -12,7 +12,7 @@ #include "ComputeDiagFunctors/RhoFunctor.H" #include "Diagnostics/Diagnostics.H" #include "Diagnostics/ParticleDiag/ParticleDiag.H" -#include "FieldSolver/Fields.H" +#include "Fields.H" #include "FlushFormats/FlushFormat.H" #include "Particles/MultiParticleContainer.H" #include "Utils/Algorithms/IsIn.H" diff --git a/Source/Diagnostics/ParticleIO.cpp b/Source/Diagnostics/ParticleIO.cpp index 0ddab94d95a..51b28bc9a10 100644 --- a/Source/Diagnostics/ParticleIO.cpp +++ b/Source/Diagnostics/ParticleIO.cpp @@ -7,7 +7,7 @@ * License: BSD-3-Clause-LBNL */ -#include "FieldSolver/Fields.H" +#include "Fields.H" #include "Particles/ParticleIO.H" #include "Particles/MultiParticleContainer.H" #include "Particles/PhysicalParticleContainer.H" diff --git a/Source/Diagnostics/ReducedDiags/ChargeOnEB.cpp b/Source/Diagnostics/ReducedDiags/ChargeOnEB.cpp index d0638605612..d5cf391a254 100644 --- a/Source/Diagnostics/ReducedDiags/ChargeOnEB.cpp +++ b/Source/Diagnostics/ReducedDiags/ChargeOnEB.cpp @@ -9,7 +9,7 @@ #include "Diagnostics/ReducedDiags/ReducedDiags.H" #include "EmbeddedBoundary/Enabled.H" -#include "FieldSolver/Fields.H" +#include "Fields.H" #include "Utils/TextMsg.H" #include "Utils/WarpXConst.H" #include "Utils/Parser/ParserUtils.H" diff --git a/Source/Diagnostics/ReducedDiags/ColliderRelevant.cpp b/Source/Diagnostics/ReducedDiags/ColliderRelevant.cpp index addb7bdb873..463e6e160cd 100644 --- a/Source/Diagnostics/ReducedDiags/ColliderRelevant.cpp +++ b/Source/Diagnostics/ReducedDiags/ColliderRelevant.cpp @@ -8,7 +8,7 @@ #include "ColliderRelevant.H" #include "Diagnostics/ReducedDiags/ReducedDiags.H" -#include "FieldSolver/Fields.H" +#include "Fields.H" #if (defined WARPX_QED) # include "Particles/ElementaryProcess/QEDInternals/QedChiFunctions.H" #endif diff --git a/Source/Diagnostics/ReducedDiags/FieldEnergy.cpp b/Source/Diagnostics/ReducedDiags/FieldEnergy.cpp index ecc7ee2466e..84b6df87af8 100644 --- a/Source/Diagnostics/ReducedDiags/FieldEnergy.cpp +++ b/Source/Diagnostics/ReducedDiags/FieldEnergy.cpp @@ -7,7 +7,7 @@ #include "FieldEnergy.H" -#include "FieldSolver/Fields.H" +#include "Fields.H" #include "Diagnostics/ReducedDiags/ReducedDiags.H" #include "Utils/TextMsg.H" #include "Utils/WarpXConst.H" diff --git a/Source/Diagnostics/ReducedDiags/FieldMaximum.cpp b/Source/Diagnostics/ReducedDiags/FieldMaximum.cpp index f875e6c0415..276c7928b43 100644 --- a/Source/Diagnostics/ReducedDiags/FieldMaximum.cpp +++ b/Source/Diagnostics/ReducedDiags/FieldMaximum.cpp @@ -7,7 +7,7 @@ #include "FieldMaximum.H" -#include "FieldSolver/Fields.H" +#include "Fields.H" #include "Utils/TextMsg.H" #include "WarpX.H" diff --git a/Source/Diagnostics/ReducedDiags/FieldMomentum.cpp b/Source/Diagnostics/ReducedDiags/FieldMomentum.cpp index 016e222303d..f1857155457 100644 --- a/Source/Diagnostics/ReducedDiags/FieldMomentum.cpp +++ b/Source/Diagnostics/ReducedDiags/FieldMomentum.cpp @@ -7,7 +7,7 @@ #include "FieldMomentum.H" -#include "FieldSolver/Fields.H" +#include "Fields.H" #include "Utils/TextMsg.H" #include "Utils/WarpXConst.H" #include "WarpX.H" diff --git a/Source/Diagnostics/ReducedDiags/FieldProbe.cpp b/Source/Diagnostics/ReducedDiags/FieldProbe.cpp index 535c38b2aad..bf5c68c9d83 100644 --- a/Source/Diagnostics/ReducedDiags/FieldProbe.cpp +++ b/Source/Diagnostics/ReducedDiags/FieldProbe.cpp @@ -7,7 +7,7 @@ #include "FieldProbe.H" #include "FieldProbeParticleContainer.H" -#include "FieldSolver/Fields.H" +#include "Fields.H" #include "Particles/Gather/FieldGather.H" #include "Particles/Pusher/GetAndSetPosition.H" #include "Particles/Pusher/UpdatePosition.H" diff --git a/Source/Diagnostics/ReducedDiags/FieldReduction.H b/Source/Diagnostics/ReducedDiags/FieldReduction.H index bfc2f9aef9e..65455039394 100644 --- a/Source/Diagnostics/ReducedDiags/FieldReduction.H +++ b/Source/Diagnostics/ReducedDiags/FieldReduction.H @@ -9,7 +9,7 @@ #define WARPX_DIAGNOSTICS_REDUCEDDIAGS_FIELDREDUCTION_H_ #include "ReducedDiags.H" -#include "FieldSolver/Fields.H" +#include "Fields.H" #include "WarpX.H" #include diff --git a/Source/Diagnostics/ReducedDiags/LoadBalanceCosts.cpp b/Source/Diagnostics/ReducedDiags/LoadBalanceCosts.cpp index 7d5d26b5e0c..8ed3d21efc0 100644 --- a/Source/Diagnostics/ReducedDiags/LoadBalanceCosts.cpp +++ b/Source/Diagnostics/ReducedDiags/LoadBalanceCosts.cpp @@ -7,7 +7,7 @@ #include "LoadBalanceCosts.H" #include "Diagnostics/ReducedDiags/ReducedDiags.H" -#include "FieldSolver/Fields.H" +#include "Fields.H" #include "Particles/MultiParticleContainer.H" #include "Utils/TextMsg.H" #include "Utils/WarpXAlgorithmSelection.H" diff --git a/Source/Diagnostics/ReducedDiags/ParticleExtrema.cpp b/Source/Diagnostics/ReducedDiags/ParticleExtrema.cpp index ca88241568e..5b4ff2908a9 100644 --- a/Source/Diagnostics/ReducedDiags/ParticleExtrema.cpp +++ b/Source/Diagnostics/ReducedDiags/ParticleExtrema.cpp @@ -11,7 +11,7 @@ #if (defined WARPX_QED) # include "Particles/ElementaryProcess/QEDInternals/QedChiFunctions.H" #endif -#include "FieldSolver/Fields.H" +#include "Fields.H" #include "Particles/Gather/FieldGather.H" #include "Particles/Gather/GetExternalFields.H" #include "Particles/MultiParticleContainer.H" diff --git a/Source/Diagnostics/SliceDiagnostic.cpp b/Source/Diagnostics/SliceDiagnostic.cpp index 8e038e2bdf7..a9ebe4bf661 100644 --- a/Source/Diagnostics/SliceDiagnostic.cpp +++ b/Source/Diagnostics/SliceDiagnostic.cpp @@ -7,7 +7,7 @@ */ #include "SliceDiagnostic.H" -#include "FieldSolver/Fields.H" +#include "Fields.H" #include "Utils/TextMsg.H" #include "WarpX.H" diff --git a/Source/FieldSolver/Fields.H b/Source/FieldSolver/Fields.H deleted file mode 100644 index 8cc43306e6e..00000000000 --- a/Source/FieldSolver/Fields.H +++ /dev/null @@ -1,38 +0,0 @@ -/* Copyright 2024 Luca Fedeli - * - * This file is part of WarpX. - * - * License: BSD-3-Clause-LBNL - */ -#ifndef WARPX_FIELDS_H_ -#define WARPX_FIELDS_H_ - -#include -#include - -namespace warpx::fields -{ - enum struct FieldType : int - { - None, - Efield_fp, - Bfield_fp, - vector_potential_fp, - phi_fp - }; - - constexpr FieldType ArrayFieldTypes[] = { - FieldType::Efield_fp, - FieldType::Bfield_fp, - FieldType::vector_potential_fp }; - - inline bool - isFieldArray (const FieldType field_type) - { - return std::any_of( std::begin(ArrayFieldTypes), std::end(ArrayFieldTypes), - [field_type](const FieldType& f) { return f == field_type; }); - } - -} - -#endif //WARPX_FIELDS_H_ diff --git a/Source/FieldSolver/FiniteDifferenceSolver/HybridPICModel/HybridPICModel.cpp b/Source/FieldSolver/FiniteDifferenceSolver/HybridPICModel/HybridPICModel.cpp index 24f9e07d39c..dba8a7de3f9 100644 --- a/Source/FieldSolver/FiniteDifferenceSolver/HybridPICModel/HybridPICModel.cpp +++ b/Source/FieldSolver/FiniteDifferenceSolver/HybridPICModel/HybridPICModel.cpp @@ -10,7 +10,7 @@ #include "HybridPICModel.H" #include "EmbeddedBoundary/Enabled.H" -#include "FieldSolver/Fields.H" +#include "Fields.H" #include "WarpX.H" using namespace amrex; diff --git a/Source/FieldSolver/FiniteDifferenceSolver/MacroscopicProperties/MacroscopicProperties.cpp b/Source/FieldSolver/FiniteDifferenceSolver/MacroscopicProperties/MacroscopicProperties.cpp index a6a389fe056..ea1432dd1f9 100644 --- a/Source/FieldSolver/FiniteDifferenceSolver/MacroscopicProperties/MacroscopicProperties.cpp +++ b/Source/FieldSolver/FiniteDifferenceSolver/MacroscopicProperties/MacroscopicProperties.cpp @@ -1,6 +1,6 @@ #include "MacroscopicProperties.H" -#include "FieldSolver/Fields.H" +#include "Fields.H" #include "Utils/Parser/ParserUtils.H" #include "Utils/TextMsg.H" diff --git a/Source/FieldSolver/ImplicitSolvers/ThetaImplicitEM.cpp b/Source/FieldSolver/ImplicitSolvers/ThetaImplicitEM.cpp index 262a33848d8..42d016bb34a 100644 --- a/Source/FieldSolver/ImplicitSolvers/ThetaImplicitEM.cpp +++ b/Source/FieldSolver/ImplicitSolvers/ThetaImplicitEM.cpp @@ -4,7 +4,7 @@ * * License: BSD-3-Clause-LBNL */ -#include "FieldSolver/Fields.H" +#include "Fields.H" #include "ThetaImplicitEM.H" #include "WarpX.H" diff --git a/Source/FieldSolver/ImplicitSolvers/WarpXImplicitOps.cpp b/Source/FieldSolver/ImplicitSolvers/WarpXImplicitOps.cpp index 06ec79779dc..a393bae0eaf 100644 --- a/Source/FieldSolver/ImplicitSolvers/WarpXImplicitOps.cpp +++ b/Source/FieldSolver/ImplicitSolvers/WarpXImplicitOps.cpp @@ -11,7 +11,7 @@ #include "Diagnostics/ReducedDiags/MultiReducedDiags.H" #include "Evolve/WarpXDtType.H" #include "Evolve/WarpXPushType.H" -#include "FieldSolver/Fields.H" +#include "Fields.H" #include "FieldSolver/FiniteDifferenceSolver/FiniteDifferenceSolver.H" #include "Parallelization/GuardCellManager.H" #include "Particles/MultiParticleContainer.H" diff --git a/Source/FieldSolver/ImplicitSolvers/WarpXSolverVec.H b/Source/FieldSolver/ImplicitSolvers/WarpXSolverVec.H index b109229328e..29c808b48cd 100644 --- a/Source/FieldSolver/ImplicitSolvers/WarpXSolverVec.H +++ b/Source/FieldSolver/ImplicitSolvers/WarpXSolverVec.H @@ -8,7 +8,7 @@ #define WarpXSolverVec_H_ #include "Utils/TextMsg.H" -#include "FieldSolver/Fields.H" +#include "Fields.H" #include #include diff --git a/Source/Fields.H b/Source/Fields.H new file mode 100644 index 00000000000..e1a266069c9 --- /dev/null +++ b/Source/Fields.H @@ -0,0 +1,75 @@ +/* Copyright 2024 Luca Fedeli + * + * This file is part of WarpX. + * + * License: BSD-3-Clause-LBNL + */ +#ifndef WARPX_FIELDS_H_ +#define WARPX_FIELDS_H_ + +#include + +#include + +#include +#include + + +namespace warpx::fields +{ + AMREX_ENUM(FieldType, + None, + Efield_aux, + Bfield_aux, + Efield_fp, + Bfield_fp, + Efield_fp_external, + Bfield_fp_external, + current_fp, + current_fp_nodal, + rho_fp, + F_fp, + G_fp, + phi_fp, + vector_potential_fp, + Efield_cp, + Bfield_cp, + current_cp, + rho_cp, + F_cp, + G_cp, + edge_lengths, + face_areas, + Efield_avg_fp, + Bfield_avg_fp, + Efield_avg_cp, + Bfield_avg_cp + ); + + constexpr FieldType ArrayFieldTypes[] = { + FieldType::Efield_aux, + FieldType::Bfield_aux, + FieldType::Efield_fp, + FieldType::Bfield_fp, + FieldType::current_fp, + FieldType::current_fp_nodal, + FieldType::vector_potential_fp, + FieldType::Efield_cp, + FieldType::Bfield_cp, + FieldType::current_cp, + FieldType::Efield_avg_fp, + FieldType::Bfield_avg_fp, + FieldType::Efield_avg_cp, + FieldType::Bfield_avg_cp + }; + + inline bool + isFieldArray (const FieldType field_type) + { + return std::any_of( std::begin(ArrayFieldTypes), std::end(ArrayFieldTypes), + [field_type](const FieldType& f) { return f == field_type; }); + } + +} + +#endif //WARPX_FIELDS_H_ diff --git a/Source/Initialization/DivCleaner/ProjectionDivCleaner.H b/Source/Initialization/DivCleaner/ProjectionDivCleaner.H index f2414323f25..2fedb83cd36 100644 --- a/Source/Initialization/DivCleaner/ProjectionDivCleaner.H +++ b/Source/Initialization/DivCleaner/ProjectionDivCleaner.H @@ -35,7 +35,7 @@ #include #include -#include +#include "Fields.H" #include "Utils/Parser/ParserUtils.H" namespace warpx::initialization { diff --git a/Source/Initialization/DivCleaner/ProjectionDivCleaner.cpp b/Source/Initialization/DivCleaner/ProjectionDivCleaner.cpp index 9fc6fab656a..ee8fcf40b9c 100644 --- a/Source/Initialization/DivCleaner/ProjectionDivCleaner.cpp +++ b/Source/Initialization/DivCleaner/ProjectionDivCleaner.cpp @@ -19,7 +19,7 @@ #else #include #endif -#include +#include "Fields.H" #include #include #include diff --git a/Source/Initialization/WarpXInitData.cpp b/Source/Initialization/WarpXInitData.cpp index 8701b1a4023..0f950b3959d 100644 --- a/Source/Initialization/WarpXInitData.cpp +++ b/Source/Initialization/WarpXInitData.cpp @@ -17,7 +17,7 @@ #include "Diagnostics/MultiDiagnostics.H" #include "Diagnostics/ReducedDiags/MultiReducedDiags.H" #include "EmbeddedBoundary/Enabled.H" -#include "FieldSolver/Fields.H" +#include "Fields.H" #include "FieldSolver/ElectrostaticSolvers/ElectrostaticSolver.H" #include "FieldSolver/FiniteDifferenceSolver/MacroscopicProperties/MacroscopicProperties.H" #include "FieldSolver/FiniteDifferenceSolver/HybridPICModel/HybridPICModel.H" diff --git a/Source/Particles/MultiParticleContainer.cpp b/Source/Particles/MultiParticleContainer.cpp index 472461d3317..533ee574aba 100644 --- a/Source/Particles/MultiParticleContainer.cpp +++ b/Source/Particles/MultiParticleContainer.cpp @@ -11,7 +11,7 @@ */ #include "MultiParticleContainer.H" -#include "FieldSolver/Fields.H" +#include "Fields.H" #include "Particles/ElementaryProcess/Ionization.H" #ifdef WARPX_QED # include "Particles/ElementaryProcess/QEDInternals/BreitWheelerEngineWrapper.H" diff --git a/Source/WarpX.H b/Source/WarpX.H index 7b9b836aefc..5575ea2036f 100644 --- a/Source/WarpX.H +++ b/Source/WarpX.H @@ -39,7 +39,7 @@ #include "AcceleratorLattice/AcceleratorLattice.H" #include "Evolve/WarpXDtType.H" #include "Evolve/WarpXPushType.H" -#include "FieldSolver/Fields.H" +#include "Fields.H" #include "FieldSolver/MagnetostaticSolver/MagnetostaticSolver.H" #include "FieldSolver/ImplicitSolvers/ImplicitSolver.H" #include "FieldSolver/ImplicitSolvers/WarpXSolverVec.H"