Skip to content

Commit

Permalink
A few corrections following discussions
Browse files Browse the repository at this point in the history
  • Loading branch information
whaeck committed Apr 23, 2024
1 parent 02f0bcc commit c0a1f89
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 14 deletions.
9 changes: 7 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,11 @@ cmake_dependent_option(
cmake_dependent_option(
NDItk.python
"Build NDItk python bindings" ON
"NOT ${subproject}" OFF
"NOT ${subproject} OR DEFINED requires.NDItk.python " OFF
)
if ( NDItk.python )
set( require.tools.python CACHE BOOL ON )
endif()

########################################################################
# Dependencies
Expand Down Expand Up @@ -102,7 +105,9 @@ if( NDItk.python )

list( APPEND NDItk_PYTHONPATH ${CMAKE_CURRENT_BINARY_DIR} )

include( cmake/unit_testing_python.cmake )
if( NDItk.tests )
include( cmake/unit_testing_python.cmake )
endif()

endif()

Expand Down
2 changes: 1 addition & 1 deletion src/NDItk/MultigroupTable.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ class MultigroupTable {

if ( this->metadata_.numberGroups().has_value() ) {

readRecord( this->weights_, iter, end, this->metadata_.numberGroups().value() + 1 );
readRecord( this->weights_, iter, end, this->metadata_.numberGroups().value() );
}
else {

Expand Down
5 changes: 2 additions & 3 deletions src/NDItk/MultigroupTable/test/MultigroupTable.test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ std::string chunk() {
" 10 5 1 1e-11\n"
"wgts\n"
" 0.1 0.2 0.25 0.05\n"
" 0.15 0.04 0.06 0.15\n"
" 0.15 0.04 0.06\n"
"sig_reac\n"
" 2 0\n"
" 10 20 30 40\n"
Expand Down Expand Up @@ -123,7 +123,7 @@ void verifyChunk( const MultigroupTable& chunk ) {
// flux weights
CHECK( "wgts" == chunk.flux().keyword() );
CHECK( true == chunk.flux().hasContent() );
CHECK( 8 == chunk.flux().weights().value().size() );
CHECK( 7 == chunk.flux().weights().value().size() );
CHECK( 7 == chunk.flux().numberGroups() );
CHECK_THAT( 0.10, WithinRel( chunk.flux().weights().value()[0] ) );
CHECK_THAT( 0.20, WithinRel( chunk.flux().weights().value()[1] ) );
Expand All @@ -132,7 +132,6 @@ void verifyChunk( const MultigroupTable& chunk ) {
CHECK_THAT( 0.15, WithinRel( chunk.flux().weights().value()[4] ) );
CHECK_THAT( 0.04, WithinRel( chunk.flux().weights().value()[5] ) );
CHECK_THAT( 0.06, WithinRel( chunk.flux().weights().value()[6] ) );
CHECK_THAT( 0.15, WithinRel( chunk.flux().weights().value()[7] ) );

// reaction cross sections
CHECK( true == chunk.crossSections().hasContent() );
Expand Down
2 changes: 1 addition & 1 deletion src/NDItk/multigroup/FluxWeights.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class FluxWeights : protected base::RealListRecord {

if ( this->hasContent() ) {

return this->weights().value().size() - 1;
return this->weights().value().size();
}
else {

Expand Down
9 changes: 4 additions & 5 deletions src/NDItk/multigroup/FluxWeights/test/FluxWeights.test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ SCENARIO( "FluxWeights" ) {

WHEN( "the data is given explicitly" ) {

std::vector< double > boundaries = { 0.1, 0.2, 0.25, 0.05, 0.15, 0.04, 0.06, 0.15 };
std::vector< double > boundaries = { 0.1, 0.2, 0.25, 0.05, 0.15, 0.04, 0.06 };

FluxWeights chunk( std::move( boundaries ) );

Expand All @@ -49,7 +49,7 @@ SCENARIO( "FluxWeights" ) {
auto end = record.end();

FluxWeights chunk;
chunk.read( iter, end, 8 );
chunk.read( iter, end, 7 );

THEN( "a FluxWeights can be constructed and members can "
"be tested" ) {
Expand All @@ -73,14 +73,14 @@ std::string chunk() {

return "wgts\n"
" 0.1 0.2 0.25 0.05\n"
" 0.15 0.04 0.06 0.15\n";
" 0.15 0.04 0.06\n";
}

void verifyChunk( const FluxWeights& chunk ) {

CHECK( "wgts" == chunk.keyword() );
CHECK( true == chunk.hasContent() );
CHECK( 8 == chunk.weights().value().size() );
CHECK( 7 == chunk.weights().value().size() );
CHECK( 7 == chunk.numberGroups() );
CHECK_THAT( 0.10, WithinRel( chunk.weights().value()[0] ) );
CHECK_THAT( 0.20, WithinRel( chunk.weights().value()[1] ) );
Expand All @@ -89,5 +89,4 @@ void verifyChunk( const FluxWeights& chunk ) {
CHECK_THAT( 0.15, WithinRel( chunk.weights().value()[4] ) );
CHECK_THAT( 0.04, WithinRel( chunk.weights().value()[5] ) );
CHECK_THAT( 0.06, WithinRel( chunk.weights().value()[6] ) );
CHECK_THAT( 0.15, WithinRel( chunk.weights().value()[7] ) );
}
4 changes: 2 additions & 2 deletions src/NDItk/multigroup/Structure.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@ class Structure : protected base::RealListRecord {

Structure() : RealListRecord( "e_bounds" ) {}
Structure( unsigned int particle ) :
RealListRecord( std::string( "e_bounds" ) + std::to_string( particle ) ) {}
RealListRecord( std::string( "e_bounds_" ) + std::to_string( particle ) ) {}

Structure( std::vector< double > boundaries ) :
RealListRecord( "e_bounds", std::move( boundaries ) ) {}
Structure( unsigned int particle, std::vector< double > boundaries ) :
RealListRecord( std::string( "e_bounds" ) + std::to_string( particle ),
RealListRecord( std::string( "e_bounds_" ) + std::to_string( particle ),
std::move( boundaries ) ) {}

using base::RealListRecord::keyword;
Expand Down

0 comments on commit c0a1f89

Please sign in to comment.