Skip to content

Commit

Permalink
Fields.H: Reintroduce & Move
Browse files Browse the repository at this point in the history
- more central
- use `AMREX_ENUM`
  • Loading branch information
ax3l committed Sep 20, 2024
1 parent 4c2e507 commit a34a54b
Show file tree
Hide file tree
Showing 31 changed files with 104 additions and 67 deletions.
2 changes: 1 addition & 1 deletion Source/BoundaryConditions/PML.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion Source/BoundaryConditions/PML_RZ.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion Source/Diagnostics/BTDiagnostics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion Source/Diagnostics/ComputeDiagFunctors/JFunctor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

#include "JFunctor.H"

#include "FieldSolver/Fields.H"
#include "Fields.H"
#include "Particles/MultiParticleContainer.H"
#include "WarpX.H"

Expand Down
2 changes: 1 addition & 1 deletion Source/Diagnostics/ComputeDiagFunctors/JdispFunctor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down
2 changes: 1 addition & 1 deletion Source/Diagnostics/FlushFormats/FlushFormatCheckpoint.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion Source/Diagnostics/FlushFormats/FlushFormatPlotfile.cpp
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
2 changes: 1 addition & 1 deletion Source/Diagnostics/FullDiagnostics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion Source/Diagnostics/ParticleIO.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion Source/Diagnostics/ReducedDiags/ChargeOnEB.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion Source/Diagnostics/ReducedDiags/ColliderRelevant.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion Source/Diagnostics/ReducedDiags/FieldEnergy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion Source/Diagnostics/ReducedDiags/FieldMaximum.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

#include "FieldMaximum.H"

#include "FieldSolver/Fields.H"
#include "Fields.H"
#include "Utils/TextMsg.H"
#include "WarpX.H"

Expand Down
2 changes: 1 addition & 1 deletion Source/Diagnostics/ReducedDiags/FieldMomentum.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion Source/Diagnostics/ReducedDiags/FieldProbe.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion Source/Diagnostics/ReducedDiags/FieldReduction.H
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#define WARPX_DIAGNOSTICS_REDUCEDDIAGS_FIELDREDUCTION_H_

#include "ReducedDiags.H"
#include "FieldSolver/Fields.H"
#include "Fields.H"
#include "WarpX.H"

#include <ablastr/coarsen/sample.H>
Expand Down
2 changes: 1 addition & 1 deletion Source/Diagnostics/ReducedDiags/LoadBalanceCosts.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion Source/Diagnostics/ReducedDiags/ParticleExtrema.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion Source/Diagnostics/SliceDiagnostic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
*/
#include "SliceDiagnostic.H"

#include "FieldSolver/Fields.H"
#include "Fields.H"
#include "Utils/TextMsg.H"
#include "WarpX.H"

Expand Down
38 changes: 0 additions & 38 deletions Source/FieldSolver/Fields.H

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#include "HybridPICModel.H"

#include "EmbeddedBoundary/Enabled.H"
#include "FieldSolver/Fields.H"
#include "Fields.H"
#include "WarpX.H"

using namespace amrex;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include "MacroscopicProperties.H"

#include "FieldSolver/Fields.H"
#include "Fields.H"
#include "Utils/Parser/ParserUtils.H"
#include "Utils/TextMsg.H"

Expand Down
2 changes: 1 addition & 1 deletion Source/FieldSolver/ImplicitSolvers/ThetaImplicitEM.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
*
* License: BSD-3-Clause-LBNL
*/
#include "FieldSolver/Fields.H"
#include "Fields.H"
#include "ThetaImplicitEM.H"
#include "WarpX.H"

Expand Down
2 changes: 1 addition & 1 deletion Source/FieldSolver/ImplicitSolvers/WarpXImplicitOps.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion Source/FieldSolver/ImplicitSolvers/WarpXSolverVec.H
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#define WarpXSolverVec_H_

#include "Utils/TextMsg.H"
#include "FieldSolver/Fields.H"
#include "Fields.H"

#include <ablastr/utils/SignalHandling.H>
#include <ablastr/warn_manager/WarnManager.H>
Expand Down
75 changes: 75 additions & 0 deletions Source/Fields.H
Original file line number Diff line number Diff line change
@@ -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 <ablastr/fields/MultiFabRegister.H>

#include <AMReX_Enum.H>

#include <algorithm>
#include <iterator>


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_
2 changes: 1 addition & 1 deletion Source/Initialization/DivCleaner/ProjectionDivCleaner.H
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
#include <AMReX_SPACE.H>
#include <AMReX_Vector.H>

#include <FieldSolver/Fields.H>
#include "Fields.H"
#include "Utils/Parser/ParserUtils.H"

namespace warpx::initialization {
Expand Down
2 changes: 1 addition & 1 deletion Source/Initialization/DivCleaner/ProjectionDivCleaner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
#else
#include <FieldSolver/FiniteDifferenceSolver/FiniteDifferenceAlgorithms/CartesianYeeAlgorithm.H>
#endif
#include <FieldSolver/Fields.H>
#include "Fields.H"
#include <Initialization/ExternalField.H>
#include <ablastr/utils/Communication.H>
#include <Utils/WarpXProfilerWrapper.H>
Expand Down
2 changes: 1 addition & 1 deletion Source/Initialization/WarpXInitData.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion Source/Particles/MultiParticleContainer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion Source/WarpX.H
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit a34a54b

Please sign in to comment.