Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
  • Loading branch information
ax3l authored Jan 2, 2024
1 parent 6ddd678 commit 23a24be
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 19 deletions.
2 changes: 0 additions & 2 deletions examples/epac2004_benchmarks/plot_bithermal.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,8 @@
from math import pi

import matplotlib.pyplot as plt
from matplotlib.ticker import MaxNLocator
import numpy as np
import openpmd_api as io
import pandas as pd

# options to run this script
parser = argparse.ArgumentParser(description="Plot the Bithermal benchmark.")
Expand Down
30 changes: 15 additions & 15 deletions src/particles/distribution/Thermal.H
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ namespace distribution
{
struct ThermalData
{
amrex::ParticleReal const tolerance = 1.0e-3; ///< tolerance for matching condition
amrex::ParticleReal const rin = 1.0e-10; ///< initial r value for numerical integration
amrex::ParticleReal const rout = 10.0; ///< final r value for numerical integration
int const nsteps = 2000; ///< number of radial steps for numerical integration
static constexpr amrex::ParticleReal tolerance = 1.0e-3; ///< tolerance for matching condition
static constexpr amrex::ParticleReal rin = 1.0e-10; ///< initial r value for numerical integration
static constexpr amrex::ParticleReal rout = 10.0; ///< final r value for numerical integration
static constexpr int nsteps = 2000; ///< number of radial steps for numerical integration

struct Rprofile
{
Expand Down Expand Up @@ -242,11 +242,11 @@ namespace distribution
* @param w weight of the secondary (halo) population
* @param data radial profile of the stationary beam
*/
Thermal([[maybe_unused]] amrex::ParticleReal const k,
[[maybe_unused]] amrex::ParticleReal const T1,
[[maybe_unused]] amrex::ParticleReal const T2,
[[maybe_unused]] amrex::ParticleReal const w,
ThermalData::Rprofile const data
Thermal(amrex::ParticleReal k,
amrex::ParticleReal T1,
amrex::ParticleReal T2,
amrex::ParticleReal w,
ThermalData::Rprofile data

Check notice

Code scanning / CodeQL

Large object passed by value Note

This parameter of type
Rprofile
is 32136 bytes - consider passing a const pointer/reference instead.
)
: m_k(k),m_T1(T1),m_T2(T2),m_w(w),m_data(data)
{
Expand All @@ -264,12 +264,12 @@ namespace distribution
*/
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
void operator() (
amrex::ParticleReal & x,
amrex::ParticleReal & y,
amrex::ParticleReal & t,
amrex::ParticleReal & px,
amrex::ParticleReal & py,
amrex::ParticleReal & pt,
amrex::ParticleReal & AMREX_RESTRICT x,
amrex::ParticleReal & AMREX_RESTRICT y,
amrex::ParticleReal & AMREX_RESTRICT t,
amrex::ParticleReal & AMREX_RESTRICT px,
amrex::ParticleReal & AMREX_RESTRICT py,
amrex::ParticleReal & AMREX_RESTRICT pt,
amrex::RandomEngine const& engine) {

using namespace amrex::literals; // for _rt and _prt
Expand Down
4 changes: 2 additions & 2 deletions src/python/distribution.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,8 @@ void init_distribution(py::module& m)

py::class_<distribution::Thermal>(md, "Thermal")
.def(py::init<
amrex::ParticleReal const, amrex::ParticleReal const, amrex::ParticleReal const,
amrex::ParticleReal const, distribution::ThermalData::Rprofile const
amrex::ParticleReal, amrex::ParticleReal, amrex::ParticleReal,
amrex::ParticleReal, distribution::ThermalData::Rprofile
>(),
py::arg("k"), py::arg("kT"), py::arg("kT_halo"),
py::arg("halo")=0.0, py::arg("data"),
Expand Down

0 comments on commit 23a24be

Please sign in to comment.