Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dist None: Set to Zero #465

Merged
merged 1 commit into from
Nov 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/source/usage/python.rst
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,7 @@ This module provides particle beam distributions that can be used to initialize

.. py:class:: impactx.distribution.None

This distribution does nothing.
This distribution sets all values to zero.

.. py:class:: impactx.distribution.Semigaussian(sigx, sigy, sigt, sigpx, sigpy, sigpt, muxpx=0.0, muypy=0.0, mutpt=0.0)

Expand Down
1 change: 1 addition & 0 deletions src/initialization/InitDistribution.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#include <AMReX_Print.H>

#include <string>
#include <variant>


namespace impactx
Expand Down
25 changes: 16 additions & 9 deletions src/particles/distribution/None.H
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@ namespace impactx::distribution
{
struct None
{
/** This distribution does nothing
/** This distribution sets all values to zero.
*/
None()
{
}

/** Return 1 6D particle coordinate
*
* Does nothing to the parameters.
* Sets all values to zero.
*
* @param x particle position in x
* @param y particle position in y
Expand All @@ -38,15 +38,22 @@ namespace impactx::distribution
*/
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
void operator() (
[[maybe_unused]] amrex::ParticleReal & x,
[[maybe_unused]] amrex::ParticleReal & y,
[[maybe_unused]] amrex::ParticleReal & t,
[[maybe_unused]] amrex::ParticleReal & px,
[[maybe_unused]] amrex::ParticleReal & py,
[[maybe_unused]] amrex::ParticleReal & pt,
amrex::ParticleReal & x,
amrex::ParticleReal & y,
amrex::ParticleReal & t,
amrex::ParticleReal & px,
amrex::ParticleReal & py,
amrex::ParticleReal & pt,
[[maybe_unused]] amrex::RandomEngine const& engine) const
{
/* nothing to do */
using namespace amrex::literals;

x = 0_prt;
y = 0_prt;
t = 0_prt;
px = 0_prt;
py = 0_prt;
pt = 0_prt;
}
};

Expand Down
2 changes: 1 addition & 1 deletion src/python/distribution.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ void init_distribution(py::module& m)

py::class_<distribution::None>(md, "None")
.def(py::init<>(),
"This distribution does nothing"
"Sets all values to zero."
);

py::class_<distribution::Semigaussian>(md, "Semigaussian")
Expand Down
Loading