From d1c2a7086348d49eee1175960ab68ebf83807721 Mon Sep 17 00:00:00 2001 From: Dave Grote Date: Tue, 3 Oct 2023 16:42:53 -0700 Subject: [PATCH] Broke vector into separate reals --- .../ReducedDiags/ColliderRelevant.cpp | 20 ++++++---- .../ReducedDiags/ParticleExtrema.cpp | 20 ++++++---- .../Particles/ElementaryProcess/Ionization.H | 20 ++++++---- .../ElementaryProcess/Ionization.cpp | 8 +++- .../ElementaryProcess/QEDPairGeneration.H | 20 ++++++---- .../ElementaryProcess/QEDPairGeneration.cpp | 8 +++- .../ElementaryProcess/QEDPhotonEmission.H | 20 ++++++---- .../ElementaryProcess/QEDPhotonEmission.cpp | 8 +++- Source/Particles/PhotonParticleContainer.cpp | 20 ++++++---- .../Particles/PhysicalParticleContainer.cpp | 40 +++++++++++-------- .../RigidInjectedParticleContainer.cpp | 20 ++++++---- 11 files changed, 126 insertions(+), 78 deletions(-) diff --git a/Source/Diagnostics/ReducedDiags/ColliderRelevant.cpp b/Source/Diagnostics/ReducedDiags/ColliderRelevant.cpp index 82235c95b72..79c9db9eccc 100644 --- a/Source/Diagnostics/ReducedDiags/ColliderRelevant.cpp +++ b/Source/Diagnostics/ReducedDiags/ColliderRelevant.cpp @@ -465,8 +465,12 @@ void ColliderRelevant::ComputeDiags (int step) // declare external fields const int offset = 0; const auto getExternalEB = GetExternalEBField(pti, offset); - const amrex::Vector E_external_particle = myspc.m_E_external_particle; - const amrex::Vector B_external_particle = myspc.m_B_external_particle; + const amrex::ParticleReal Ex_external_particle = myspc.m_E_external_particle[0]; + const amrex::ParticleReal Ey_external_particle = myspc.m_E_external_particle[0]; + const amrex::ParticleReal Ez_external_particle = myspc.m_E_external_particle[0]; + const amrex::ParticleReal Bx_external_particle = myspc.m_B_external_particle[0]; + const amrex::ParticleReal By_external_particle = myspc.m_B_external_particle[0]; + const amrex::ParticleReal Bz_external_particle = myspc.m_B_external_particle[0]; // define variables in preparation for field gathering amrex::Box box = pti.tilebox(); @@ -494,12 +498,12 @@ void ColliderRelevant::ComputeDiags (int step) // get external fields amrex::ParticleReal xp, yp, zp; GetPosition(i, xp, yp, zp); - amrex::ParticleReal ex = E_external_particle[0]; - amrex::ParticleReal ey = E_external_particle[1]; - amrex::ParticleReal ez = E_external_particle[2]; - amrex::ParticleReal bx = B_external_particle[0]; - amrex::ParticleReal by = B_external_particle[1]; - amrex::ParticleReal bz = B_external_particle[2]; + amrex::ParticleReal ex = Ex_external_particle; + amrex::ParticleReal ey = Ey_external_particle; + amrex::ParticleReal ez = Ez_external_particle; + amrex::ParticleReal bx = Bx_external_particle; + amrex::ParticleReal by = By_external_particle; + amrex::ParticleReal bz = Bz_external_particle; getExternalEB(i, ex, ey, ez, bx, by, bz); diff --git a/Source/Diagnostics/ReducedDiags/ParticleExtrema.cpp b/Source/Diagnostics/ReducedDiags/ParticleExtrema.cpp index 87fbec4663a..5cc52b4258f 100644 --- a/Source/Diagnostics/ReducedDiags/ParticleExtrema.cpp +++ b/Source/Diagnostics/ReducedDiags/ParticleExtrema.cpp @@ -396,8 +396,12 @@ void ParticleExtrema::ComputeDiags (int step) // declare external fields const int offset = 0; const auto getExternalEB = GetExternalEBField(pti, offset); - const amrex::Vector E_external_particle = myspc.m_E_external_particle; - const amrex::Vector B_external_particle = myspc.m_B_external_particle; + const amrex::ParticleReal Ex_external_particle = myspc.m_E_external_particle[0]; + const amrex::ParticleReal Ey_external_particle = myspc.m_E_external_particle[0]; + const amrex::ParticleReal Ez_external_particle = myspc.m_E_external_particle[0]; + const amrex::ParticleReal Bx_external_particle = myspc.m_B_external_particle[0]; + const amrex::ParticleReal By_external_particle = myspc.m_B_external_particle[0]; + const amrex::ParticleReal Bz_external_particle = myspc.m_B_external_particle[0]; // define variables in preparation for field gathering amrex::Box box = pti.tilebox(); @@ -425,12 +429,12 @@ void ParticleExtrema::ComputeDiags (int step) // get external fields ParticleReal xp, yp, zp; GetPosition(i, xp, yp, zp); - amrex::ParticleReal ex = E_external_particle[0]; - amrex::ParticleReal ey = E_external_particle[1]; - amrex::ParticleReal ez = E_external_particle[2]; - amrex::ParticleReal bx = B_external_particle[0]; - amrex::ParticleReal by = B_external_particle[1]; - amrex::ParticleReal bz = B_external_particle[2]; + amrex::ParticleReal ex = Ex_external_particle; + amrex::ParticleReal ey = Ey_external_particle; + amrex::ParticleReal ez = Ez_external_particle; + amrex::ParticleReal bx = Bx_external_particle; + amrex::ParticleReal by = By_external_particle; + amrex::ParticleReal bz = Bz_external_particle; getExternalEB(i, ex, ey, ez, bx, by, bz); diff --git a/Source/Particles/ElementaryProcess/Ionization.H b/Source/Particles/ElementaryProcess/Ionization.H index b3eafb18794..fb6acf1f304 100644 --- a/Source/Particles/ElementaryProcess/Ionization.H +++ b/Source/Particles/ElementaryProcess/Ionization.H @@ -39,8 +39,12 @@ struct IonizationFilterFunc GetParticlePosition m_get_position; GetExternalEBField m_get_externalEB; - amrex::Vector m_E_external_particle; - amrex::Vector m_B_external_particle; + amrex::ParticleReal m_Ex_external_particle; + amrex::ParticleReal m_Ey_external_particle; + amrex::ParticleReal m_Ez_external_particle; + amrex::ParticleReal m_Bx_external_particle; + amrex::ParticleReal m_By_external_particle; + amrex::ParticleReal m_Bz_external_particle; amrex::Array4 m_ex_arr; amrex::Array4 m_ey_arr; @@ -98,12 +102,12 @@ struct IonizationFilterFunc amrex::ParticleReal xp, yp, zp; m_get_position(i, xp, yp, zp); - amrex::ParticleReal ex = m_E_external_particle[0]; - amrex::ParticleReal ey = m_E_external_particle[1]; - amrex::ParticleReal ez = m_E_external_particle[2]; - amrex::ParticleReal bx = m_B_external_particle[0]; - amrex::ParticleReal by = m_B_external_particle[1]; - amrex::ParticleReal bz = m_B_external_particle[2]; + amrex::ParticleReal ex = m_Ex_external_particle; + amrex::ParticleReal ey = m_Ey_external_particle; + amrex::ParticleReal ez = m_Ez_external_particle; + amrex::ParticleReal bx = m_Bx_external_particle; + amrex::ParticleReal by = m_By_external_particle; + amrex::ParticleReal bz = m_Bz_external_particle; m_get_externalEB(i, ex, ey, ez, bx, by, bz); doGatherShapeN(xp, yp, zp, ex, ey, ez, bx, by, bz, diff --git a/Source/Particles/ElementaryProcess/Ionization.cpp b/Source/Particles/ElementaryProcess/Ionization.cpp index 660314aa711..00a6928e0a8 100644 --- a/Source/Particles/ElementaryProcess/Ionization.cpp +++ b/Source/Particles/ElementaryProcess/Ionization.cpp @@ -46,8 +46,12 @@ IonizationFilterFunc::IonizationFilterFunc (const WarpXParIter& a_pti, int lev, m_get_position = GetParticlePosition(a_pti, a_offset); m_get_externalEB = GetExternalEBField(a_pti, a_offset); - m_E_external_particle = E_external_particle; - m_B_external_particle = B_external_particle; + m_Ex_external_particle = E_external_particle[0]; + m_Ey_external_particle = E_external_particle[1]; + m_Ez_external_particle = E_external_particle[2]; + m_Bx_external_particle = B_external_particle[0]; + m_By_external_particle = B_external_particle[1]; + m_Bz_external_particle = B_external_particle[2]; m_ex_arr = exfab.array(); m_ey_arr = eyfab.array(); diff --git a/Source/Particles/ElementaryProcess/QEDPairGeneration.H b/Source/Particles/ElementaryProcess/QEDPairGeneration.H index 3b150ad3b73..4e71014ea79 100644 --- a/Source/Particles/ElementaryProcess/QEDPairGeneration.H +++ b/Source/Particles/ElementaryProcess/QEDPairGeneration.H @@ -132,12 +132,12 @@ public: amrex::ParticleReal xp, yp, zp; m_get_position(i_src, xp, yp, zp); - amrex::ParticleReal ex = m_E_external_particle[0]; - amrex::ParticleReal ey = m_E_external_particle[1]; - amrex::ParticleReal ez = m_E_external_particle[2]; - amrex::ParticleReal bx = m_B_external_particle[0]; - amrex::ParticleReal by = m_B_external_particle[1]; - amrex::ParticleReal bz = m_B_external_particle[2]; + amrex::ParticleReal ex = m_Ex_external_particle; + amrex::ParticleReal ey = m_Ey_external_particle; + amrex::ParticleReal ez = m_Ez_external_particle; + amrex::ParticleReal bx = m_Bx_external_particle; + amrex::ParticleReal by = m_By_external_particle; + amrex::ParticleReal bz = m_Bz_external_particle; m_get_externalEB(i_src, ex, ey, ez, bx, by, bz); @@ -177,8 +177,12 @@ private: GetParticlePosition m_get_position; GetExternalEBField m_get_externalEB; - amrex::Vector m_E_external_particle; - amrex::Vector m_B_external_particle; + amrex::ParticleReal m_Ex_external_particle; + amrex::ParticleReal m_Ey_external_particle; + amrex::ParticleReal m_Ez_external_particle; + amrex::ParticleReal m_Bx_external_particle; + amrex::ParticleReal m_By_external_particle; + amrex::ParticleReal m_Bz_external_particle; amrex::Array4 m_ex_arr; amrex::Array4 m_ey_arr; diff --git a/Source/Particles/ElementaryProcess/QEDPairGeneration.cpp b/Source/Particles/ElementaryProcess/QEDPairGeneration.cpp index d778ef6074c..15772cf027f 100644 --- a/Source/Particles/ElementaryProcess/QEDPairGeneration.cpp +++ b/Source/Particles/ElementaryProcess/QEDPairGeneration.cpp @@ -36,8 +36,12 @@ PairGenerationTransformFunc (BreitWheelerGeneratePairs const generate_functor, m_get_position = GetParticlePosition(a_pti, a_offset); m_get_externalEB = GetExternalEBField(a_pti, a_offset); - m_E_external_particle = E_external_particle; - m_B_external_particle = B_external_particle; + m_Ex_external_particle = E_external_particle[0]; + m_Ey_external_particle = E_external_particle[1]; + m_Ez_external_particle = E_external_particle[2]; + m_Bx_external_particle = B_external_particle[0]; + m_By_external_particle = B_external_particle[1]; + m_Bz_external_particle = B_external_particle[2]; m_ex_arr = exfab.array(); m_ey_arr = eyfab.array(); diff --git a/Source/Particles/ElementaryProcess/QEDPhotonEmission.H b/Source/Particles/ElementaryProcess/QEDPhotonEmission.H index d3fba2a2d95..d4e62acebaa 100644 --- a/Source/Particles/ElementaryProcess/QEDPhotonEmission.H +++ b/Source/Particles/ElementaryProcess/QEDPhotonEmission.H @@ -143,12 +143,12 @@ public: amrex::ParticleReal xp, yp, zp; m_get_position(i_src, xp, yp, zp); - amrex::ParticleReal ex = m_E_external_particle[0]; - amrex::ParticleReal ey = m_E_external_particle[1]; - amrex::ParticleReal ez = m_E_external_particle[2]; - amrex::ParticleReal bx = m_B_external_particle[0]; - amrex::ParticleReal by = m_B_external_particle[1]; - amrex::ParticleReal bz = m_B_external_particle[2]; + amrex::ParticleReal ex = m_Ex_external_particle; + amrex::ParticleReal ey = m_Ey_external_particle; + amrex::ParticleReal ez = m_Ez_external_particle; + amrex::ParticleReal bx = m_Bx_external_particle; + amrex::ParticleReal by = m_By_external_particle; + amrex::ParticleReal bz = m_Bz_external_particle; m_get_externalEB(i_src, ex, ey, ez, bx, by, bz); @@ -187,8 +187,12 @@ private: GetParticlePosition m_get_position; GetExternalEBField m_get_externalEB; - amrex::Vector m_E_external_particle; - amrex::Vector m_B_external_particle; + amrex::ParticleReal m_Ex_external_particle; + amrex::ParticleReal m_Ey_external_particle; + amrex::ParticleReal m_Ez_external_particle; + amrex::ParticleReal m_Bx_external_particle; + amrex::ParticleReal m_By_external_particle; + amrex::ParticleReal m_Bz_external_particle; amrex::Array4 m_ex_arr; amrex::Array4 m_ey_arr; diff --git a/Source/Particles/ElementaryProcess/QEDPhotonEmission.cpp b/Source/Particles/ElementaryProcess/QEDPhotonEmission.cpp index 22f414ffb46..a2c1b2bb18e 100644 --- a/Source/Particles/ElementaryProcess/QEDPhotonEmission.cpp +++ b/Source/Particles/ElementaryProcess/QEDPhotonEmission.cpp @@ -39,8 +39,12 @@ PhotonEmissionTransformFunc (QuantumSynchrotronGetOpticalDepth opt_depth_functor m_get_position = GetParticlePosition(a_pti, a_offset); m_get_externalEB = GetExternalEBField(a_pti, a_offset); - m_E_external_particle = E_external_particle; - m_B_external_particle = B_external_particle; + m_Ex_external_particle = E_external_particle[0]; + m_Ey_external_particle = E_external_particle[1]; + m_Ez_external_particle = E_external_particle[2]; + m_Bx_external_particle = B_external_particle[0]; + m_By_external_particle = B_external_particle[1]; + m_Bz_external_particle = B_external_particle[2]; m_ex_arr = exfab.array(); m_ey_arr = eyfab.array(); diff --git a/Source/Particles/PhotonParticleContainer.cpp b/Source/Particles/PhotonParticleContainer.cpp index 533a1703a73..7901a04e64e 100644 --- a/Source/Particles/PhotonParticleContainer.cpp +++ b/Source/Particles/PhotonParticleContainer.cpp @@ -134,8 +134,12 @@ PhotonParticleContainer::PushPX (WarpXParIter& pti, const auto getExternalEB = GetExternalEBField(pti, offset); - const amrex::Vector E_external_particle = m_E_external_particle; - const amrex::Vector B_external_particle = m_B_external_particle; + const amrex::ParticleReal Ex_external_particle = m_E_external_particle[0]; + const amrex::ParticleReal Ey_external_particle = m_E_external_particle[1]; + const amrex::ParticleReal Ez_external_particle = m_E_external_particle[2]; + const amrex::ParticleReal Bx_external_particle = m_B_external_particle[0]; + const amrex::ParticleReal By_external_particle = m_B_external_particle[1]; + const amrex::ParticleReal Bz_external_particle = m_B_external_particle[2]; // Lower corner of tile box physical domain (take into account Galilean shift) const std::array& xyzmin = WarpX::LowerCorner(box, gather_lev, 0._rt); @@ -185,12 +189,12 @@ PhotonParticleContainer::PushPX (WarpXParIter& pti, ParticleReal x, y, z; GetPosition(i, x, y, z); - amrex::ParticleReal Exp = E_external_particle[0]; - amrex::ParticleReal Eyp = E_external_particle[1]; - amrex::ParticleReal Ezp = E_external_particle[2]; - amrex::ParticleReal Bxp = B_external_particle[0]; - amrex::ParticleReal Byp = B_external_particle[1]; - amrex::ParticleReal Bzp = B_external_particle[2]; + amrex::ParticleReal Exp = Ex_external_particle; + amrex::ParticleReal Eyp = Ey_external_particle; + amrex::ParticleReal Ezp = Ez_external_particle; + amrex::ParticleReal Bxp = Bx_external_particle; + amrex::ParticleReal Byp = By_external_particle; + amrex::ParticleReal Bzp = Bz_external_particle; if(!t_do_not_gather){ // first gather E and B to the particle positions diff --git a/Source/Particles/PhysicalParticleContainer.cpp b/Source/Particles/PhysicalParticleContainer.cpp index b30bfb8e35f..cee7b654a9c 100644 --- a/Source/Particles/PhysicalParticleContainer.cpp +++ b/Source/Particles/PhysicalParticleContainer.cpp @@ -2499,8 +2499,12 @@ PhysicalParticleContainer::PushP (int lev, Real dt, const auto getExternalEB = GetExternalEBField(pti); - const amrex::Vector E_external_particle = m_E_external_particle; - const amrex::Vector B_external_particle = m_B_external_particle; + const amrex::ParticleReal Ex_external_particle = m_E_external_particle[0]; + const amrex::ParticleReal Ey_external_particle = m_E_external_particle[1]; + const amrex::ParticleReal Ez_external_particle = m_E_external_particle[2]; + const amrex::ParticleReal Bx_external_particle = m_B_external_particle[0]; + const amrex::ParticleReal By_external_particle = m_B_external_particle[1]; + const amrex::ParticleReal Bz_external_particle = m_B_external_particle[2]; const std::array& xyzmin = WarpX::LowerCorner(box, lev, 0._rt); @@ -2557,12 +2561,12 @@ PhysicalParticleContainer::PushP (int lev, Real dt, amrex::ParticleReal xp, yp, zp; getPosition(ip, xp, yp, zp); - amrex::ParticleReal Exp = E_external_particle[0]; - amrex::ParticleReal Eyp = E_external_particle[1]; - amrex::ParticleReal Ezp = E_external_particle[2]; - amrex::ParticleReal Bxp = B_external_particle[0]; - amrex::ParticleReal Byp = B_external_particle[1]; - amrex::ParticleReal Bzp = B_external_particle[2]; + amrex::ParticleReal Exp = Ex_external_particle; + amrex::ParticleReal Eyp = Ey_external_particle; + amrex::ParticleReal Ezp = Ez_external_particle; + amrex::ParticleReal Bxp = Bx_external_particle; + amrex::ParticleReal Byp = By_external_particle; + amrex::ParticleReal Bzp = Bz_external_particle; if (!t_do_not_gather){ // first gather E and B to the particle positions @@ -2683,8 +2687,12 @@ PhysicalParticleContainer::PushPX (WarpXParIter& pti, const auto getExternalEB = GetExternalEBField(pti, offset); - const amrex::Vector E_external_particle = m_E_external_particle; - const amrex::Vector B_external_particle = m_B_external_particle; + const amrex::ParticleReal Ex_external_particle = m_E_external_particle[0]; + const amrex::ParticleReal Ey_external_particle = m_E_external_particle[1]; + const amrex::ParticleReal Ez_external_particle = m_E_external_particle[2]; + const amrex::ParticleReal Bx_external_particle = m_B_external_particle[0]; + const amrex::ParticleReal By_external_particle = m_B_external_particle[1]; + const amrex::ParticleReal Bz_external_particle = m_B_external_particle[2]; // Lower corner of tile box physical domain (take into account Galilean shift) const std::array& xyzmin = WarpX::LowerCorner(box, gather_lev, 0._rt); @@ -2800,12 +2808,12 @@ PhysicalParticleContainer::PushPX (WarpXParIter& pti, z_old[ip] = zp; } - amrex::ParticleReal Exp = E_external_particle[0]; - amrex::ParticleReal Eyp = E_external_particle[1]; - amrex::ParticleReal Ezp = E_external_particle[2]; - amrex::ParticleReal Bxp = B_external_particle[0]; - amrex::ParticleReal Byp = B_external_particle[1]; - amrex::ParticleReal Bzp = B_external_particle[2]; + amrex::ParticleReal Exp = Ex_external_particle; + amrex::ParticleReal Eyp = Ey_external_particle; + amrex::ParticleReal Ezp = Ez_external_particle; + amrex::ParticleReal Bxp = Bx_external_particle; + amrex::ParticleReal Byp = By_external_particle; + amrex::ParticleReal Bzp = Bz_external_particle; if(!t_do_not_gather){ // first gather E and B to the particle positions diff --git a/Source/Particles/RigidInjectedParticleContainer.cpp b/Source/Particles/RigidInjectedParticleContainer.cpp index 11af2792e9c..1abed096c4d 100644 --- a/Source/Particles/RigidInjectedParticleContainer.cpp +++ b/Source/Particles/RigidInjectedParticleContainer.cpp @@ -361,8 +361,12 @@ RigidInjectedParticleContainer::PushP (int lev, Real dt, const auto getExternalEB = GetExternalEBField(pti); - const amrex::Vector E_external_particle = m_E_external_particle; - const amrex::Vector B_external_particle = m_B_external_particle; + const amrex::ParticleReal Ex_external_particle = m_E_external_particle[0]; + const amrex::ParticleReal Ey_external_particle = m_E_external_particle[1]; + const amrex::ParticleReal Ez_external_particle = m_E_external_particle[2]; + const amrex::ParticleReal Bx_external_particle = m_B_external_particle[0]; + const amrex::ParticleReal By_external_particle = m_B_external_particle[1]; + const amrex::ParticleReal Bz_external_particle = m_B_external_particle[2]; const std::array& xyzmin = WarpX::LowerCorner(box, lev, 0._rt); @@ -429,12 +433,12 @@ RigidInjectedParticleContainer::PushP (int lev, Real dt, amrex::ParticleReal xp, yp, zp; getPosition(ip, xp, yp, zp); - amrex::ParticleReal Exp = E_external_particle[0]; - amrex::ParticleReal Eyp = E_external_particle[1]; - amrex::ParticleReal Ezp = E_external_particle[2]; - amrex::ParticleReal Bxp = B_external_particle[0]; - amrex::ParticleReal Byp = B_external_particle[1]; - amrex::ParticleReal Bzp = B_external_particle[2]; + amrex::ParticleReal Exp = Ex_external_particle; + amrex::ParticleReal Eyp = Ey_external_particle; + amrex::ParticleReal Ezp = Ez_external_particle; + amrex::ParticleReal Bxp = Bx_external_particle; + amrex::ParticleReal Byp = By_external_particle; + amrex::ParticleReal Bzp = Bz_external_particle; // first gather E and B to the particle positions doGatherShapeN(xp, yp, zp, Exp, Eyp, Ezp, Bxp, Byp, Bzp,