Skip to content

Commit

Permalink
Modify the constructor with the neutron xs data type
Browse files Browse the repository at this point in the history
  • Loading branch information
whokion committed Apr 1, 2024
1 parent 611dec6 commit def2b2e
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 11 deletions.
4 changes: 2 additions & 2 deletions src/celeritas/io/NeutronXsReader.cc
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ NeutronXsReader::NeutronXsReader(NeutronXsType type) : type_(type)
/*!
* Construct the reader with the path to the directory containing the data.
*/
NeutronXsReader::NeutronXsReader(char const* path, NeutronXsType type)
: path_(path), type_(type)
NeutronXsReader::NeutronXsReader(NeutronXsType type, char const* path)
: type_(type), path_(path)
{
CELER_EXPECT(!path_.empty());
if (path_.back() == '/')
Expand Down
9 changes: 3 additions & 6 deletions src/celeritas/io/NeutronXsReader.hh
Original file line number Diff line number Diff line change
Expand Up @@ -51,18 +51,15 @@ class NeutronXsReader
explicit NeutronXsReader(NeutronXsType type);

// Construct the reader from the path to the data directory and the type
explicit NeutronXsReader(char const* path, NeutronXsType type);
NeutronXsReader(NeutronXsType type, char const* path);

// Read the data for the given element
result_type operator()(AtomicNumber atomic_number) const;

private:
// Get the string value for the cross section data type

private:
// Directory containing the neutron elastic cross section data
std::string path_;
// Type and directory containing the neutron elastic cross section data
NeutronXsType type_;
std::string path_;
};

//---------------------------------------------------------------------------//
Expand Down
2 changes: 1 addition & 1 deletion test/celeritas/neutron/NeutronElastic.test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class NeutronElasticTest : public NeutronTestBase

// Load neutron elastic cross section data
std::string data_path = this->test_data_path("celeritas", "");
NeutronXsReader read_el_data(data_path.c_str(), NeutronXsType::el);
NeutronXsReader read_el_data(NeutronXsType::el, data_path.c_str());

// Set up the default particle: 100 MeV neutron along +z direction
auto const& particles = *this->particle_params();
Expand Down
4 changes: 2 additions & 2 deletions test/celeritas/neutron/NeutronInelastic.test.cc
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/NeutronBertini.test.cc
//! \file celeritas/neutron/NeutronInelastic.test.cc
//---------------------------------------------------------------------------//
#include <memory>

Expand Down Expand Up @@ -39,7 +39,7 @@ class NeutronInelasticTest : public NeutronTestBase

// Load neutron elastic cross section data
std::string data_path = this->test_data_path("celeritas", "");
NeutronXsReader read_el_data(data_path.c_str(), NeutronXsType::inel);
NeutronXsReader read_el_data(NeutronXsType::inel, data_path.c_str());

// Set up the default particle: 100 MeV neutron along +z direction
auto const& particles = *this->particle_params();
Expand Down

0 comments on commit def2b2e

Please sign in to comment.