Skip to content

Commit

Permalink
Change class names from NeutronElasticModel/Executor/Interactor to Ch…
Browse files Browse the repository at this point in the history
…ipsNeutronElasticModel/Executor/Interactor
  • Loading branch information
whokion committed Feb 23, 2024
1 parent fbb04f0 commit df3dde6
Show file tree
Hide file tree
Showing 9 changed files with 57 additions and 55 deletions.
2 changes: 1 addition & 1 deletion src/celeritas/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ celeritas_polysource(global/alongstep/AlongStepGeneralLinearAction)
celeritas_polysource(global/alongstep/AlongStepNeutralAction)
celeritas_polysource(global/alongstep/AlongStepUniformMscAction)
celeritas_polysource(global/alongstep/AlongStepRZMapFieldMscAction)
celeritas_polysource(neutron/model/NeutronElasticModel)
celeritas_polysource(neutron/model/ChipsNeutronElasticModel)
celeritas_polysource(phys/detail/DiscreteSelectAction)
celeritas_polysource(phys/detail/PreStepAction)
celeritas_polysource(random/RngReseed)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// See the top-level COPYRIGHT file for details.
// SPDX-License-Identifier: (Apache-2.0 OR MIT)
//---------------------------------------------------------------------------//
//! \file celeritas/neutron/executor/NeutronElasticExecutor.hh
//! \file celeritas/neutron/executor/ChipsNeutronElasticExecutor.hh
//---------------------------------------------------------------------------//
#pragma once

Expand All @@ -14,14 +14,14 @@
#include "celeritas/mat/IsotopeSelector.hh"
#include "celeritas/mat/IsotopeView.hh"
#include "celeritas/neutron/data/NeutronElasticData.hh"
#include "celeritas/neutron/interactor/NeutronElasticInteractor.hh"
#include "celeritas/neutron/interactor/ChipsNeutronElasticInteractor.hh"
#include "celeritas/neutron/xs/NeutronElasticMicroXsCalculator.hh"
#include "celeritas/phys/Interaction.hh"

namespace celeritas
{
//---------------------------------------------------------------------------//
struct NeutronElasticExecutor
struct ChipsNeutronElasticExecutor
{
inline CELER_FUNCTION Interaction
operator()(celeritas::CoreTrackView const& track);
Expand All @@ -34,7 +34,7 @@ struct NeutronElasticExecutor
* Apply the NeutronElasticInteractor to the current track.
*/
CELER_FUNCTION Interaction
NeutronElasticExecutor::operator()(CoreTrackView const& track)
ChipsNeutronElasticExecutor::operator()(CoreTrackView const& track)
{
auto particle = track.make_particle_view();
auto const& dir = track.make_geo_view().dir();
Expand All @@ -61,7 +61,7 @@ NeutronElasticExecutor::operator()(CoreTrackView const& track)
IsotopeView target = element.make_isotope_view(iso_select(rng));

// Construct the interactor
NeutronElasticInteractor interact(params, particle, dir, target);
ChipsNeutronElasticInteractor interact(params, particle, dir, target);

// Execute the interactor
return interact(rng);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// See the top-level COPYRIGHT file for details.
// SPDX-License-Identifier: (Apache-2.0 OR MIT)
//---------------------------------------------------------------------------//
//! \file celeritas/neutron/interactor/NeutronElasticInteractor.hh
//! \file celeritas/neutron/interactor/ChipsNeutronElasticInteractor.hh
//---------------------------------------------------------------------------//
#pragma once

Expand Down Expand Up @@ -32,7 +32,7 @@ namespace celeritas
* G4ChipsElasticModel and G4ChipsNeutronElasticXS, as partly documented
* in section 21.1.3 of the Geant4 Physics Reference (release 11.2).
*/
class NeutronElasticInteractor
class ChipsNeutronElasticInteractor
{
//!@{
//! \name Type aliases
Expand All @@ -44,10 +44,10 @@ class NeutronElasticInteractor
public:
// Construct from shared and state data
inline CELER_FUNCTION
NeutronElasticInteractor(NeutronElasticRef const& shared,
ParticleTrackView const& particle,
Real3 const& inc_direction,
IsotopeView const& target);
ChipsNeutronElasticInteractor(NeutronElasticRef const& shared,
ParticleTrackView const& particle,
Real3 const& inc_direction,
IsotopeView const& target);

// Sample an interaction with the given RNG
template<class Engine>
Expand Down Expand Up @@ -84,7 +84,7 @@ class NeutronElasticInteractor
/*!
* Construct with shared and state data, and a target nucleus.
*/
CELER_FUNCTION NeutronElasticInteractor::NeutronElasticInteractor(
CELER_FUNCTION ChipsNeutronElasticInteractor::ChipsNeutronElasticInteractor(
NeutronElasticRef const& shared,
ParticleTrackView const& particle,
Real3 const& inc_direction,
Expand All @@ -106,7 +106,7 @@ CELER_FUNCTION NeutronElasticInteractor::NeutronElasticInteractor(
* Sample the final state of the neutron-nucleus elastic scattering.
*/
template<class Engine>
CELER_FUNCTION Interaction NeutronElasticInteractor::operator()(Engine& rng)
CELER_FUNCTION Interaction ChipsNeutronElasticInteractor::operator()(Engine& rng)
{
// Scattered neutron with respect to the axis of incident direction
Interaction result;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
// See the top-level COPYRIGHT file for details.
// SPDX-License-Identifier: (Apache-2.0 OR MIT)
//---------------------------------------------------------------------------//
//! \file celeritas/neutron/model/NeutronElasticModel.cc
//! \file celeritas/neutron/model/ChipsNeutronElasticModel.cc
//---------------------------------------------------------------------------//
#include "NeutronElasticModel.hh"
#include "ChipsNeutronElasticModel.hh"

#include "corecel/math/Quantity.hh"
#include "celeritas/global/ActionLauncher.hh"
Expand All @@ -15,7 +15,7 @@
#include "celeritas/io/ImportPhysicsTable.hh"
#include "celeritas/io/ImportPhysicsVector.hh"
#include "celeritas/mat/MaterialParams.hh"
#include "celeritas/neutron/executor/NeutronElasticExecutor.hh"
#include "celeritas/neutron/executor/ChipsNeutronElasticExecutor.hh"
#include "celeritas/phys/InteractionApplier.hh"
#include "celeritas/phys/PDGNumber.hh"
#include "celeritas/phys/ParticleParams.hh"
Expand All @@ -27,10 +27,11 @@ namespace celeritas
/*!
* Construct from model ID and other necessary data.
*/
NeutronElasticModel::NeutronElasticModel(ActionId id,
ParticleParams const& particles,
MaterialParams const& materials,
ReadData load_data)
ChipsNeutronElasticModel::ChipsNeutronElasticModel(
ActionId id,
ParticleParams const& particles,
MaterialParams const& materials,
ReadData load_data)
{
CELER_EXPECT(id);
CELER_EXPECT(load_data);
Expand Down Expand Up @@ -75,7 +76,7 @@ NeutronElasticModel::NeutronElasticModel(ActionId id,
/*!
* Particle types and energy ranges that this model applies to.
*/
auto NeutronElasticModel::applicability() const -> SetApplicability
auto ChipsNeutronElasticModel::applicability() const -> SetApplicability
{
Applicability neutron_applic;
neutron_applic.particle = this->host_ref().ids.neutron;
Expand All @@ -89,7 +90,7 @@ auto NeutronElasticModel::applicability() const -> SetApplicability
/*!
* Get the microscopic cross sections for the given particle and material.
*/
auto NeutronElasticModel::micro_xs(Applicability) const -> MicroXsBuilders
auto ChipsNeutronElasticModel::micro_xs(Applicability) const -> MicroXsBuilders
{
// Cross sections are calculated on the fly
return {};
Expand All @@ -100,20 +101,20 @@ auto NeutronElasticModel::micro_xs(Applicability) const -> MicroXsBuilders
/*!
* Apply the interaction kernel.
*/
void NeutronElasticModel::execute(CoreParams const& params,
CoreStateHost& state) const
void ChipsNeutronElasticModel::execute(CoreParams const& params,
CoreStateHost& state) const
{
auto execute = make_action_track_executor(
params.ptr<MemSpace::native>(),
state.ptr(),
this->action_id(),
InteractionApplier{NeutronElasticExecutor{this->host_ref()}});
InteractionApplier{ChipsNeutronElasticExecutor{this->host_ref()}});
return launch_action(*this, params, state, execute);
}

//---------------------------------------------------------------------------//
#if !CELER_USE_DEVICE
void NeutronElasticModel::execute(CoreParams const&, CoreStateDevice&) const
void ChipsNeutronElasticModel::execute(CoreParams const&, CoreStateDevice&) const
{
CELER_NOT_CONFIGURED("CUDA OR HIP");
}
Expand All @@ -123,7 +124,7 @@ void NeutronElasticModel::execute(CoreParams const&, CoreStateDevice&) const
/*!
* Get the model ID for this model.
*/
ActionId NeutronElasticModel::action_id() const
ActionId ChipsNeutronElasticModel::action_id() const
{
return this->host_ref().ids.action;
}
Expand All @@ -132,8 +133,8 @@ ActionId NeutronElasticModel::action_id() const
/*!
* Construct interaction cross section data for a single element.
*/
void NeutronElasticModel::append_xs(ImportPhysicsVector const& inp,
HostXsData* xs) const
void ChipsNeutronElasticModel::append_xs(ImportPhysicsVector const& inp,
HostXsData* xs) const
{
auto reals = make_builder(&xs->reals);
GenericGridData data;
Expand Down Expand Up @@ -164,8 +165,8 @@ void NeutronElasticModel::append_xs(ImportPhysicsVector const& inp,
* Eur. Phys. J. A8, 217 (2000); P.V. Degtyarenko, M.V. Kossov and H.P.
* Wellisch, Eur. Phys. J. A9 (2001).
*/
void NeutronElasticModel::append_coeffs(AtomicMassNumber A,
HostDiffXsData* data) const
void ChipsNeutronElasticModel::append_coeffs(AtomicMassNumber A,
HostDiffXsData* data) const
{
ChipsDiffXsCoefficients coeffs;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@
// See the top-level COPYRIGHT file for details.
// SPDX-License-Identifier: (Apache-2.0 OR MIT)
//---------------------------------------------------------------------------//
//! \file celeritas/neutron/model/NeutronElasticModel.cu
//! \file celeritas/neutron/model/ChipsNeutronElasticModel.cu
//---------------------------------------------------------------------------//
#include "NeutronElasticModel.hh"
#include "ChipsNeutronElasticModel.hh"

#include "celeritas/global/ActionLauncher.device.hh"
#include "celeritas/global/CoreParams.hh"
#include "celeritas/global/CoreState.hh"
#include "celeritas/global/TrackExecutor.hh"
#include "celeritas/neutron/executor/NeutronElasticExecutor.hh"
#include "celeritas/neutron/executor/ChipsNeutronElasticExecutor.hh"
#include "celeritas/phys/InteractionApplier.hh"

namespace celeritas
Expand All @@ -20,14 +20,14 @@ namespace celeritas
/*!
* Interact with device data.
*/
void NeutronElasticModel::execute(CoreParams const& params,
CoreStateDevice& state) const
void ChipsNeutronElasticModel::execute(CoreParams const& params,
CoreStateDevice& state) const
{
auto execute = make_action_track_executor(
params.ptr<MemSpace::native>(),
state.ptr(),
this->action_id(),
InteractionApplier{NeutronElasticExecutor{this->device_ref()}});
InteractionApplier{ChipsNeutronElasticExecutor{this->device_ref()}});
static ActionLauncher<decltype(execute)> const launch_kernel(*this);
launch_kernel(params, state, *this, execute);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// See the top-level COPYRIGHT file for details.
// SPDX-License-Identifier: (Apache-2.0 OR MIT)
//---------------------------------------------------------------------------//
//! \file celeritas/neutron/model/NeutronElasticModel.hh
//! \file celeritas/neutron/model/ChipsNeutronElasticModel.hh
//---------------------------------------------------------------------------//
#pragma once

Expand All @@ -27,7 +27,7 @@ class ParticleParams;
/*!
* Set up and launch the neutron elastic CHIPS model interaction.
*/
class NeutronElasticModel final : public Model
class ChipsNeutronElasticModel final : public Model
{
public:
//!@{
Expand All @@ -40,10 +40,10 @@ class NeutronElasticModel final : public Model

public:
// Construct from model ID and other necessary data
NeutronElasticModel(ActionId id,
ParticleParams const& particles,
MaterialParams const& materials,
ReadData load_data);
ChipsNeutronElasticModel(ActionId id,
ParticleParams const& particles,
MaterialParams const& materials,
ReadData load_data);

// Particle types and energy ranges that this model applies to
SetApplicability applicability() const final;
Expand Down
4 changes: 2 additions & 2 deletions src/celeritas/neutron/process/NeutronElasticProcess.cc
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

#include "corecel/Assert.hh"
#include "celeritas/grid/ValueGridBuilder.hh"
#include "celeritas/neutron/model/NeutronElasticModel.hh"
#include "celeritas/neutron/model/ChipsNeutronElasticModel.hh"
#include "celeritas/phys/PDGNumber.hh"

namespace celeritas
Expand Down Expand Up @@ -38,7 +38,7 @@ NeutronElasticProcess::NeutronElasticProcess(SPConstParticles particles,
*/
auto NeutronElasticProcess::build_models(ActionIdIter id) const -> VecModel
{
return {std::make_shared<NeutronElasticModel>(
return {std::make_shared<ChipsNeutronElasticModel>(
*id++, *particles_, *materials_, load_data_)};
}

Expand Down
4 changes: 2 additions & 2 deletions src/celeritas/phys/PhysicsParams.cc
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
#include "celeritas/mat/MaterialParams.hh"
#include "celeritas/mat/MaterialView.hh"
#include "celeritas/neutron/data/NeutronElasticData.hh"
#include "celeritas/neutron/model/NeutronElasticModel.hh"
#include "celeritas/neutron/model/ChipsNeutronElasticModel.hh"

#include "Model.hh"
#include "ParticleParams.hh"
Expand Down Expand Up @@ -398,7 +398,7 @@ void PhysicsParams::build_ids(ParticleParams const& particles,
data->hardwired.eplusgg_data = epgg_model->device_ref();
}
else if (auto* ne_model
= dynamic_cast<NeutronElasticModel const*>(&model))
= dynamic_cast<ChipsNeutronElasticModel const*>(&model))
{
data->hardwired.neutron_elastic = process_id;
data->hardwired.chips = ModelId{model_idx};
Expand Down
15 changes: 8 additions & 7 deletions test/celeritas/neutron/NeutronElastic.test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
#include "celeritas/io/NeutronXsReader.hh"
#include "celeritas/mat/MaterialTrackView.hh"
#include "celeritas/neutron/NeutronTestBase.hh"
#include "celeritas/neutron/interactor/NeutronElasticInteractor.hh"
#include "celeritas/neutron/model/NeutronElasticModel.hh"
#include "celeritas/neutron/interactor/ChipsNeutronElasticInteractor.hh"
#include "celeritas/neutron/model/ChipsNeutronElasticModel.hh"
#include "celeritas/neutron/xs/NeutronElasticMacroXsCalculator.hh"
#include "celeritas/neutron/xs/NeutronElasticMicroXsCalculator.hh"

Expand All @@ -31,7 +31,8 @@ class NeutronElasticTest : public NeutronTestBase
{
protected:
using MevEnergy = units::MevEnergy;
using SPConstNElasticModel = std::shared_ptr<NeutronElasticModel const>;
using SPConstNElasticModel
= std::shared_ptr<ChipsNeutronElasticModel const>;

void SetUp() override
{
Expand All @@ -48,7 +49,7 @@ class NeutronElasticTest : public NeutronTestBase

// Set up the default material
this->set_material("HeCu");
model_ = std::make_shared<NeutronElasticModel>(
model_ = std::make_shared<ChipsNeutronElasticModel>(
ActionId{0}, particles, *this->material_params(), read_el_data);
}

Expand Down Expand Up @@ -169,7 +170,7 @@ TEST_F(NeutronElasticTest, basic)
// Sample interaction
NeutronElasticRef shared = model_->host_ref();
RandomEngine& rng_engine = this->rng();
NeutronElasticInteractor interact(
ChipsNeutronElasticInteractor interact(
shared, this->particle_track(), this->direction(), isotope_cu63);

// Produce four samples from the original incident energy/dir
Expand Down Expand Up @@ -236,7 +237,7 @@ TEST_F(NeutronElasticTest, extended)
for (auto i : range(expected_energy.size()))
{
this->set_inc_particle(pdg::neutron(), MevEnergy{energy});
NeutronElasticInteractor interact(
ChipsNeutronElasticInteractor interact(
shared, this->particle_track(), this->direction(), isotope_he4);
Interaction result = interact(rng_engine);

Expand Down Expand Up @@ -283,7 +284,7 @@ TEST_F(NeutronElasticTest, stress_test)
for (auto i : range(inc_energy.size()))
{
this->set_inc_particle(pdg::neutron(), MevEnergy{inc_energy[i]});
NeutronElasticInteractor interact(
ChipsNeutronElasticInteractor interact(
shared, this->particle_track(), this->direction(), isotope);

double sum_energy{0.};
Expand Down

0 comments on commit df3dde6

Please sign in to comment.