Skip to content

Commit

Permalink
Updating ...
Browse files Browse the repository at this point in the history
  • Loading branch information
whaeck committed May 1, 2024
2 parents 27bd2d7 + 18e978f commit 891c907
Show file tree
Hide file tree
Showing 19 changed files with 57 additions and 58 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ if( NDItk.python )
python/src/multigroup/Metadata.python.cpp
python/src/multigroup/CrossSection.python.cpp
python/src/multigroup/FluxWeights.python.cpp
python/src/multigroup/Structure.python.cpp
python/src/multigroup/EnergyGroupStructure.python.cpp
python/src/multigroup/ReactionCrossSections.python.cpp
python/src/multigroup/AverageFissionEnergyRelease.python.cpp
)
Expand Down
2 changes: 1 addition & 1 deletion cmake/unit_testing.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ add_subdirectory( src/NDItk/base/IntegerListRecord/test )
add_subdirectory( src/NDItk/base/RealListRecord/test )

add_subdirectory( src/NDItk/multigroup/Metadata/test )
add_subdirectory( src/NDItk/multigroup/Structure/test )
add_subdirectory( src/NDItk/multigroup/EnergyGroupStructure/test )
add_subdirectory( src/NDItk/multigroup/FluxWeights/test )
add_subdirectory( src/NDItk/multigroup/CrossSection/test )
add_subdirectory( src/NDItk/multigroup/ReactionCrossSections/test )
Expand Down
11 changes: 5 additions & 6 deletions cmake/unit_testing_python.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,10 @@ endfunction()

message( STATUS "Adding NDItk Python unit testing" )

add_python_test( multigroup.Metadata multigroup/Test_NDItk_multigroup_Metadata.py )
add_python_test( multigroup.CrossSection multigroup/Test_NDItk_multigroup_CrossSection.py )
add_python_test( multigroup.FluxWeights multigroup/Test_NDItk_multigroup_FluxWeights.py )
add_python_test( multigroup.Structure multigroup/Test_NDItk_multigroup_Structure.py )
add_python_test( multigroup.ReactionCrossSections multigroup/Test_NDItk_multigroup_ReactionCrossSections.py )
add_python_test( multigroup.AverageFissionEnergyRelease multigroup/Test_NDItk_multigroup_AverageFissionEnergyRelease.py )
add_python_test( multigroup.Metadata multigroup/Test_NDItk_multigroup_Metadata.py )
add_python_test( multigroup.CrossSection multigroup/Test_NDItk_multigroup_CrossSection.py )
add_python_test( multigroup.FluxWeights multigroup/Test_NDItk_multigroup_FluxWeights.py )
add_python_test( multigroup.EnergyGroupStructure multigroup/Test_NDItk_multigroup_EnergyGroupStructure.py )
add_python_test( multigroup.ReactionCrossSections multigroup/Test_NDItk_multigroup_ReactionCrossSections.py )

add_python_test( MultigroupTable Test_NDItk_MultigroupTable.py )
4 changes: 2 additions & 2 deletions python/src/MultigroupTable.python.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ void wrapMultigroupTable( python::module& module, python::module& ) {
// type aliases
using Table = njoy::NDItk::MultigroupTable;
using Metadata = njoy::NDItk::multigroup::Metadata;
using Structure = njoy::NDItk::multigroup::Structure;
using EnergyGroupStructure = njoy::NDItk::multigroup::EnergyGroupStructure;
using FluxWeights = njoy::NDItk::multigroup::FluxWeights;
using ReactionCrossSections = njoy::NDItk::multigroup::ReactionCrossSections;
using AverageFissionEnergyRelease = njoy::NDItk::multigroup::AverageFissionEnergyRelease;
Expand All @@ -36,7 +36,7 @@ void wrapMultigroupTable( python::module& module, python::module& ) {

python::init< std::string, std::string, std::string, std::string,
double, double, double, double,
Structure, FluxWeights,
EnergyGroupStructure, FluxWeights,
ReactionCrossSections,
std::optional< AverageFissionEnergyRelease > >(),
python::arg( "zaid" ), python::arg( "libname" ), python::arg( "source" ),
Expand Down
4 changes: 2 additions & 2 deletions python/src/multigroup.python.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ namespace multigroup {
void wrapMetadata( python::module&, python::module& );
void wrapCrossSection( python::module&, python::module& );
void wrapFluxWeights( python::module&, python::module& );
void wrapStructure( python::module&, python::module& );
void wrapEnergyGroupStructure( python::module&, python::module& );
void wrapReactionCrossSections( python::module&, python::module& );
void wrapAverageFissionEnergyRelease( python::module&, python::module& );
}
Expand All @@ -30,7 +30,7 @@ void wrapMultigroup( python::module& module, python::module& viewmodule ) {
multigroup::wrapMetadata( submodule, viewmodule );
multigroup::wrapCrossSection( submodule, viewmodule );
multigroup::wrapFluxWeights( submodule, viewmodule );
multigroup::wrapStructure( submodule, viewmodule );
multigroup::wrapEnergyGroupStructure( submodule, viewmodule );
multigroup::wrapReactionCrossSections( submodule, viewmodule );
multigroup::wrapAverageFissionEnergyRelease( submodule, viewmodule );
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#include <pybind11/stl.h>

// local includes
#include "NDItk/multigroup/Structure.hpp"
#include "NDItk/multigroup/EnergyGroupStructure.hpp"
#include "tools/views/views-python.hpp"
#include "definitions.hpp"
#include "read.hpp"
Expand All @@ -13,18 +13,18 @@ namespace python = pybind11;

namespace multigroup {

void wrapStructure( python::module& module, python::module& ) {
void wrapEnergyGroupStructure( python::module& module, python::module& ) {

// type aliases
using Record = njoy::NDItk::multigroup::Structure;
using Record = njoy::NDItk::multigroup::EnergyGroupStructure;

// wrap views created by this record

// create the record
python::class_< Record > record(

module,
"Structure",
"EnergyGroupStructure",
"A group structure record for multigroup neutron and photon data"
);

Expand Down
4 changes: 2 additions & 2 deletions python/test/Test_NDItk_MultigroupTable.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# local imports
from NDItk import MultigroupTable
from NDItk.multigroup import AverageFissionEnergyRelease
from NDItk.multigroup import Structure
from NDItk.multigroup import EnergyGroupStructure
from NDItk.multigroup import FluxWeights
from NDItk.multigroup import ReactionCrossSections
from NDItk.multigroup import CrossSection
Expand Down Expand Up @@ -116,7 +116,7 @@ def verify_chunk( self, chunk ) :
chunk = MultigroupTable( zaid = '92235.711nm', libname = 'mendf71x', source = '12/22/2011',
process = '08/07/2013', awr = 233.0248, weight = 235.043937521619,
temperature = 2.53e-8, dilution = 1e+10,
structure = Structure( [ 20., 18., 16., 14., 10., 5, 1, 1e-11 ] ),
structure = EnergyGroupStructure( [ 20., 18., 16., 14., 10., 5, 1, 1e-11 ] ),
flux = FluxWeights( [ 0.1, 0.2, 0.25, 0.05, 0.15, 0.04, 0.06 ] ),
xs = ReactionCrossSections(
xs = [ CrossSection( 2, 0., [ 10., 20., 30., 40., 50., 60., 70. ] ),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
# third party imports

# local imports
from NDItk.multigroup import Structure
from NDItk.multigroup import EnergyGroupStructure

class Test_NDItk_multigroup_Structure( unittest.TestCase ) :
"""Unit test for the Structure class."""
class Test_NDItk_multigroup_EnergyGroupStructure( unittest.TestCase ) :
"""Unit test for the EnergyGroupStructure class."""

chunk_values = [ 20, 18, 16, 14, 10, 5, 1, 1e-11 ]
chunk_string = ( 'e_bounds\n'
Expand Down Expand Up @@ -42,12 +42,12 @@ def verify_chunk( self, chunk ) :
self.assertAlmostEqual( self.chunk_values[index], values[index] )

# the data is given explicitly
chunk = Structure( boundaries = [ 20., 18., 16., 14., 10., 5, 1, 1e-11 ] )
chunk = EnergyGroupStructure( boundaries = [ 20., 18., 16., 14., 10., 5, 1, 1e-11 ] )

verify_chunk( self, chunk )

# the data is read from a string
chunk = Structure.from_string( self.chunk_string, 8 )
chunk = EnergyGroupStructure.from_string( self.chunk_string, 8 )

verify_chunk( self, chunk )

Expand Down
6 changes: 3 additions & 3 deletions src/NDItk/MultigroupTable.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
// other includes
#include "tools/Log.hpp"
#include "NDItk/multigroup/Metadata.hpp"
#include "NDItk/multigroup/Structure.hpp"
#include "NDItk/multigroup/EnergyGroupStructure.hpp"
#include "NDItk/multigroup/FluxWeights.hpp"
#include "NDItk/multigroup/ReactionCrossSections.hpp"
#include "NDItk/multigroup/AverageFissionEnergyRelease.hpp"
Expand All @@ -22,7 +22,7 @@ class MultigroupTable {
/* fields */

multigroup::Metadata metadata_;
multigroup::Structure structure_;
multigroup::EnergyGroupStructure structure_;
multigroup::FluxWeights weights_;
multigroup::ReactionCrossSections xs_;
multigroup::AverageFissionEnergyRelease release_;
Expand All @@ -48,7 +48,7 @@ class MultigroupTable {
/**
* @brief Return the primary group structure record
*/
const multigroup::Structure& structure() const { return this->structure_; }
const multigroup::EnergyGroupStructure& structure() const { return this->structure_; }

/**
* @brief Return the flux weight record
Expand Down
2 changes: 1 addition & 1 deletion src/NDItk/MultigroupTable/src/ctor.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ MultigroupTable() : metadata_(), structure_(), weights_(), xs_(),
MultigroupTable( std::string zaid, std::string libname, std::string source,
std::string process, double awr, double weight, double temperature,
double dilution,
multigroup::Structure structure,
multigroup::EnergyGroupStructure structure,
multigroup::FluxWeights weigths,
multigroup::ReactionCrossSections xs,
std::optional< multigroup::AverageFissionEnergyRelease > release = std::nullopt ) :
Expand Down
4 changes: 2 additions & 2 deletions src/NDItk/MultigroupTable/test/MultigroupTable.test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ SCENARIO( "MultigroupTable" ) {
double weight = 235.043937521619;
double temperature = 2.53e-8;
double dilution = 1e+10;
multigroup::Structure structure( { 20., 18., 16., 14., 10., 5, 1, 1e-11 } );
multigroup::EnergyGroupStructure structure( { 20., 18., 16., 14., 10., 5, 1, 1e-11 } );
multigroup::FluxWeights weights( { 0.1, 0.2, 0.25, 0.05, 0.15, 0.04, 0.06 } );
multigroup::ReactionCrossSections xs( { { 2, 0.0, { 10., 20., 30., 40., 50., 60., 70. } },
{ 16, 1.1234567, { 1., 2., 3., 4., 5., 6., 7. } } } );
Expand Down Expand Up @@ -95,7 +95,7 @@ SCENARIO( "MultigroupTable" ) {
double weight = 235.043937521619;
double temperature = 2.53e-8;
double dilution = 1e+10;
multigroup::Structure structure( { 20., 18., 16., 14., 10., 5, 1, 1e-11 } ); // <-- 7 groups
multigroup::EnergyGroupStructure structure( { 20., 18., 16., 14., 10., 5, 1, 1e-11 } ); // <-- 7 groups
multigroup::FluxWeights weights( { 0.1, 0.2, 0.25, 0.05, 0.15, 0.04 } ); // <-- 6 groups
multigroup::ReactionCrossSections xs( { { 2, 0.0, { 10., 20., 30., 40., 50., 60., 70., 80. } }, // <-- 8 groups
{ 16, 1.1234567, { 1., 2., 3., 4., 5., 6., 7., 8. } } } );
Expand Down
2 changes: 1 addition & 1 deletion src/NDItk/fromFile.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ namespace NDItk {
auto end = content.end();

// read over the first line of the file
while ( ! *iter == '\n' ) {
while ( *iter != '\n' ) {

++iter;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,21 @@ namespace NDItk {
namespace multigroup {

/**
* @brief A group structure record for multigroup neutron and photon data
* @brief An energy group structure record for multigroup neutron and photon data
*/
class Structure : protected base::RealListRecord {
class EnergyGroupStructure : protected base::RealListRecord {

/* fields */

/* auxiliary functions */

#include "NDItk/multigroup/Structure/src/verify.hpp"
#include "NDItk/multigroup/EnergyGroupStructure/src/verify.hpp"

public:

/* constructor */

#include "NDItk/multigroup/Structure/src/ctor.hpp"
#include "NDItk/multigroup/EnergyGroupStructure/src/ctor.hpp"

/* methods */

Expand All @@ -51,7 +51,7 @@ class Structure : protected base::RealListRecord {
using base::RealListRecord::end;
using base::RealListRecord::print;

#include "NDItk/multigroup/Structure/src/read.hpp"
#include "NDItk/multigroup/EnergyGroupStructure/src/read.hpp"
};

} // multigroup namespace
Expand Down
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
/**
* @brief Default constructor for the primary group structure
*/
Structure() : RealListRecord( "e_bounds" ) {}
EnergyGroupStructure() : RealListRecord( "e_bounds" ) {}

/**
* @brief Default constructor for a secondary particle group structure
*
* @param[in] particle the secondary particle ID
*/
Structure( unsigned int particle ) :
EnergyGroupStructure( unsigned int particle ) :
RealListRecord( std::string( "e_bounds_" ) + std::to_string( particle ) ) {}

/**
* @brief Constructor for the primary group structure
*
* @param[in] boundaries the group structure boundaries
*/
Structure( std::vector< double > boundaries ) :
EnergyGroupStructure( std::vector< double > boundaries ) :
RealListRecord( "e_bounds", std::move( boundaries ) ) {

verify( this->values() );
Expand All @@ -28,7 +28,7 @@ Structure( std::vector< double > boundaries ) :
* @param[in] particle the secondary particle ID
* @param[in] boundaries the group structure boundaries
*/
Structure( unsigned int particle, std::vector< double > boundaries ) :
EnergyGroupStructure( unsigned int particle, std::vector< double > boundaries ) :
RealListRecord( std::string( "e_bounds_" ) + std::to_string( particle ),
std::move( boundaries ) ) {

Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
add_cpp_test( multigroup.EnergyGroupStructure EnergyGroupStructure.test.cpp )
Loading

0 comments on commit 891c907

Please sign in to comment.