Skip to content

Commit

Permalink
Changing name of Structure
Browse files Browse the repository at this point in the history
  • Loading branch information
whaeck committed May 1, 2024
1 parent dcd89f4 commit 18e978f
Show file tree
Hide file tree
Showing 12 changed files with 32 additions and 34 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
)

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
3 changes: 1 addition & 2 deletions cmake/unit_testing_python.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@ 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.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 )

8 changes: 4 additions & 4 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;

Expand All @@ -33,13 +33,13 @@ void wrapMultigroupTable( python::module& module, python::module& ) {
table
.def(

python::init< std::string, std::string, std::string, std::string,
python::init< std::string, std::string, std::string, std::string,
double, double, double, double,
Structure, FluxWeights,
EnergyGroupStructure, FluxWeights,
ReactionCrossSections >(),
python::arg( "zaid" ), python::arg( "libname" ), python::arg( "source" ),
python::arg( "process" ), python::arg( "awr" ), python::arg( "weight" ),
python::arg( "temperature" ), python::arg( "dilution" ),
python::arg( "temperature" ), python::arg( "dilution" ),
python::arg( "structure" ), python::arg( "flux" ), python::arg( "xs" ),
"Initialise the table\n\n"
"Arguments:\n"
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& );
}

Expand All @@ -29,6 +29,6 @@ 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 );
}
8 changes: 4 additions & 4 deletions python/src/multigroup/EnergyGroupStructure.python.cpp
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
9 changes: 4 additions & 5 deletions python/test/Test_NDItk_MultigroupTable.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

# local imports
from NDItk import MultigroupTable
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 @@ -103,15 +103,14 @@ 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. ] ),
xs = ReactionCrossSections(
xs = [ CrossSection( 2, 0., [ 10., 20., 30., 40., 50., 60., 70. ] ),
CrossSection( 16, 1.1234567, [ 1., 2., 3., 4., 5., 6., 7. ] ) ] ) )

verify_chunk( self, chunk )

if __name__ == '__main__' :

unittest.main()

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"

Expand All @@ -21,7 +21,7 @@ class MultigroupTable {
/* fields */

multigroup::Metadata metadata_;
multigroup::Structure structure_;
multigroup::EnergyGroupStructure structure_;
multigroup::FluxWeights weights_;
multigroup::ReactionCrossSections xs_;

Expand All @@ -46,7 +46,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 @@ -22,7 +22,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 ) :
metadata_( std::move( zaid ), std::move( libname ), std::move( source ),
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 @@ -92,7 +92,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
8 changes: 4 additions & 4 deletions src/NDItk/multigroup/EnergyGroupStructure/src/ctor.hpp
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

0 comments on commit 18e978f

Please sign in to comment.