aboutsummaryrefslogtreecommitdiff
path: root/Source/FieldSolver/SpectralSolver
diff options
context:
space:
mode:
Diffstat (limited to 'Source/FieldSolver/SpectralSolver')
-rw-r--r--Source/FieldSolver/SpectralSolver/SpectralAlgorithms/PsatdAlgorithmJConstantInTime.cpp27
-rw-r--r--Source/FieldSolver/SpectralSolver/SpectralHankelTransform/HankelTransform.cpp7
-rw-r--r--Source/FieldSolver/SpectralSolver/SpectralKSpace.cpp9
3 files changed, 9 insertions, 34 deletions
diff --git a/Source/FieldSolver/SpectralSolver/SpectralAlgorithms/PsatdAlgorithmJConstantInTime.cpp b/Source/FieldSolver/SpectralSolver/SpectralAlgorithms/PsatdAlgorithmJConstantInTime.cpp
index 72c2b7a28..11d9bbd94 100644
--- a/Source/FieldSolver/SpectralSolver/SpectralAlgorithms/PsatdAlgorithmJConstantInTime.cpp
+++ b/Source/FieldSolver/SpectralSolver/SpectralAlgorithms/PsatdAlgorithmJConstantInTime.cpp
@@ -452,15 +452,8 @@ void PsatdAlgorithmJConstantInTime::InitializeSpectralCoefficients (
}
// Auxiliary variable
- amrex::Real tmp;
- if (om_s != 0.)
- {
- tmp = (1._rt - C(i,j,k)) / (ep0 * om2_s);
- }
- else // om_s = 0
- {
- tmp = 0.5_rt * dt2 / ep0;
- }
+ const amrex::Real tmp = (om_s != 0.)?
+ ((1._rt - C(i,j,k)) / (ep0 * om2_s)):(0.5_rt * dt2 / ep0);
// T2
if (is_galilean)
@@ -606,18 +599,10 @@ void PsatdAlgorithmJConstantInTime::InitializeSpectralCoefficientsAveraging (
const amrex::Real C1 = std::cos(0.5_rt * om_s * dt);
const amrex::Real C3 = std::cos(1.5_rt * om_s * dt);
- // S1_om, S3_om
- amrex::Real S1_om, S3_om;
- if (om_s != 0.)
- {
- S1_om = std::sin(0.5_rt * om_s * dt) / om_s;
- S3_om = std::sin(1.5_rt * om_s * dt) / om_s;
- }
- else // om_s = 0
- {
- S1_om = 0.5_rt * dt;
- S3_om = 1.5_rt * dt;
- }
+ const amrex::Real S1_om = (om_s != 0.)?
+ (std::sin(0.5_rt * om_s * dt) / om_s) : (0.5_rt * dt);
+ const amrex::Real S3_om = (om_s != 0.)?
+ (std::sin(1.5_rt * om_s * dt) / om_s) : (1.5_rt * dt);
// Psi1 (multiplies E in the update equation for <E>)
// Psi1 (multiplies B in the update equation for <B>)
diff --git a/Source/FieldSolver/SpectralSolver/SpectralHankelTransform/HankelTransform.cpp b/Source/FieldSolver/SpectralSolver/SpectralHankelTransform/HankelTransform.cpp
index ddd07acad..5d49322b2 100644
--- a/Source/FieldSolver/SpectralSolver/SpectralHankelTransform/HankelTransform.cpp
+++ b/Source/FieldSolver/SpectralSolver/SpectralHankelTransform/HankelTransform.cpp
@@ -64,12 +64,7 @@ HankelTransform::HankelTransform (int const hankel_order,
// NB: When compared with the FBPIC article, all the matrices here
// are calculated in transposed form. This is done so as to use the
// `dot` and `gemm` functions, in the `transform` method.
- int p_denom;
- if (hankel_order == azimuthal_mode) {
- p_denom = hankel_order + 1;
- } else {
- p_denom = hankel_order;
- }
+ const int p_denom = (hankel_order == azimuthal_mode)?(hankel_order + 1):(hankel_order);
amrex::Vector<amrex::Real> denom(m_nk);
for (int ik=0 ; ik < m_nk ; ik++) {
diff --git a/Source/FieldSolver/SpectralSolver/SpectralKSpace.cpp b/Source/FieldSolver/SpectralSolver/SpectralKSpace.cpp
index 7320b7cf1..b8d81000c 100644
--- a/Source/FieldSolver/SpectralSolver/SpectralKSpace.cpp
+++ b/Source/FieldSolver/SpectralSolver/SpectralKSpace.cpp
@@ -68,14 +68,9 @@ SpectralKSpace::SpectralKSpace( const BoxArray& realspace_ba,
spectralspace_ba.define( spectral_bl );
// Allocate the components of the k vector: kx, ky (only in 3D), kz
- bool only_positive_k;
for (int i_dim=0; i_dim<AMREX_SPACEDIM; i_dim++) {
- if (i_dim==0) {
- // Real-to-complex FFTs: first axis contains only the positive k
- only_positive_k = true;
- } else {
- only_positive_k = false;
- }
+ // Real-to-complex FFTs: first axis contains only the positive k
+ const auto only_positive_k = (i_dim==0);
k_vec[i_dim] = getKComponent(dm, realspace_ba, i_dim, only_positive_k);
}
}