Skip to content

Commit

Permalink
Merge pull request #11 from njoy/fix/binaryTapes
Browse files Browse the repository at this point in the history
Adding error message for negative tapes.
  • Loading branch information
jlconlin committed Feb 3, 2021
2 parents aeb484c + 446f793 commit 894b183
Show file tree
Hide file tree
Showing 7 changed files with 76 additions and 135 deletions.
79 changes: 0 additions & 79 deletions cmake/RECONR_dependencies.cmake

This file was deleted.

12 changes: 6 additions & 6 deletions cmake/develop_dependencies.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ include( FetchContent )
# Declare project dependencies
#######################################################################

FetchContent_Declare( nlohmann_json
GIT_REPOSITORY https://github.com/nlohmann/json
GIT_TAG v3.7.3
)
set(JSON_BuildTests OFF CACHE INTERNAL "")

FetchContent_Declare( ENDFtk
GIT_REPOSITORY https://github.com/njoy/ENDFtk
GIT_TAG origin/develop
Expand Down Expand Up @@ -41,12 +47,6 @@ FetchContent_Declare( twig
GIT_SHALLOW TRUE
)

FetchContent_Declare( nlohmann_json
GIT_REPOSITORY https://github.com/nlohmann/json
GIT_TAG v3.7.3
)
set(JSON_BuildTests OFF CACHE INTERNAL "")

FetchContent_Declare( interpolation
GIT_REPOSITORY https://github.com/njoy/interpolation
GIT_TAG origin/master
Expand Down
16 changes: 9 additions & 7 deletions cmake/release_dependencies.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ include( FetchContent )
# Declare project dependencies
#######################################################################

FetchContent_Declare( nlohmann_json
GIT_REPOSITORY https://github.com/nlohmann/json
GIT_TAG v3.7.3
)
set(JSON_BuildTests OFF CACHE INTERNAL "")

FetchContent_Declare( catch-adapter
GIT_REPOSITORY https://github.com/njoy/catch-adapter
GIT_TAG fb84b82ebf7a4789aa43cea560680cf745c6ee4f
Expand All @@ -29,6 +35,7 @@ FetchContent_Declare( eigen
GIT_REPOSITORY https://gitlab.com/libeigen/eigen.git
GIT_TAG dc252fbf00079ccab57948a164b1421703fe4361 # tag: 3.3.8
)
set(BUILD_TESTING OFF CACHE BOOL OFF )

FetchContent_Declare( elementary
GIT_REPOSITORY https://github.com/njoy/elementary
Expand All @@ -37,7 +44,7 @@ FetchContent_Declare( elementary

FetchContent_Declare( ENDFtk
GIT_REPOSITORY https://github.com/njoy/ENDFtk
GIT_TAG ba3d29c58d6531ababb765822ca8e78fcf658b71
GIT_TAG 65f70e1b771a167b912b2a091f80b891b1b64d27
)

FetchContent_Declare( hana-adapter
Expand All @@ -60,11 +67,6 @@ FetchContent_Declare( Log
GIT_TAG 52962b7796afe37ef1d8f7edb4bf9ecb1b868d15
)

FetchContent_Declare( nlohmann_json
GIT_REPOSITORY https://github.com/nlohmann/json
GIT_TAG e7b3b40b5a95bc74b9a7f662830a27c49ffc01b4 # tag: v3.7.3
)

FetchContent_Declare( pybind11
GIT_REPOSITORY https://github.com/pybind/pybind11
GIT_TAG f1abf5d9159b805674197f6bc443592e631c9130 # tag: v2.6.1
Expand All @@ -77,7 +79,7 @@ FetchContent_Declare( range-v3-adapter

FetchContent_Declare( resonanceReconstruction
GIT_REPOSITORY https://github.com/njoy/resonanceReconstruction
GIT_TAG 7d780b80afea4ab828eacd07f520c391a291da01
GIT_TAG 5c728c70ad5ca36bc42761f709d0501e237137b5
)

FetchContent_Declare( spdlog
Expand Down
9 changes: 9 additions & 0 deletions src/RECONR/RECONR/src/call.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,15 @@ void operator()( const nlohmann::json& njoyArgs,
Logger logger{ output, error };

output << "Input arguments:\n" << njoyArgs.dump( 2 ) << std::endl;
int nendf = njoyArgs[ "nendf" ];
int npend = njoyArgs[ "npend" ];
if( ( nendf < 0 ) or ( npend < 0 ) ){
Log::error( "RECONR input tape numbers must be positive." );
Log::info( "nendf: {}, npend: {}", nendf, npend );
Log::info( "Binary ENDF tapes are not supported at this time." );
throw std::exception();

}
std::string inputFilename = "tape" +
std::to_string( njoyArgs[ "nendf" ].get< int >() );
auto outputFilename = "tape" +
Expand Down
42 changes: 26 additions & 16 deletions src/RECONR/RECONR/test/constructor.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,25 @@ SCENARIO( "Testing creation of RECONR class" ){
}
]
})"_json};
nlohmann::json binInput{R"({
"nendf": -20, "npend": 22,
"tlabel": "Modern RECONR Testing",
"sequence": [
{
"mat": 125, "ncards": 1, "ngrid": 3,
"err": 0.001, "tempr": 0, "errmax": 0.1, "errint": 5E-7,
"cards": [ "Material 125 processed with modern RECONR" ],
"enode": [ 1.0, 2.0, 3.0 ]
},
{
"mat": 2631, "ncards": 2, "ngrid": 0,
"err": 0.001, "tempr": 0.0, "errmax": 2.1, "errint": 8E-7,
"cards": [ "Material 2631 processed with modern RECONR",
"For testing purposes only." ],
"enode": [ ]
}
]
})"_json};
nlohmann::json Fe56Input{R"({
"nendf": 20, "npend": 23,
"tlabel": "Modern RECONR Testing",
Expand Down Expand Up @@ -75,28 +94,19 @@ SCENARIO( "Testing creation of RECONR class" ){
auto args = nlohmann::json::object();

WHEN( "a RECONR object is called" ){
CHECK_NOTHROW( tRECONR()( input,
std::cout,
std::cerr,
args ) );
CHECK_NOTHROW( tRECONR()( input, std::cout, std::cerr, args ) );
} // WHEN
WHEN( "binary tapes are used as input" ){
CHECK_THROWS( tRECONR()( binInput, std::cout, std::cerr, args ) );
} // WHEN
WHEN( "processing one ENDF Material in a Tape" ){
CHECK_NOTHROW( tRECONR()( Fe56Input,
std::cout,
std::cerr,
args ) );
CHECK_NOTHROW( tRECONR()( Fe56Input, std::cout, std::cerr, args ) );
} // WHEN
WHEN( "processing H-1, Fe-56, and U-235" ){
CHECK_NOTHROW( tRECONR()( inputWithU235,
std::cout,
std::cerr,
args ) );
CHECK_NOTHROW( tRECONR()( inputWithU235, std::cout, std::cerr, args ) );
} // WHEN
WHEN( "processing U-235 with large tolerances" ){
CHECK_NOTHROW( tRECONR()( fastU235,
std::cout,
std::cerr,
args ) );
CHECK_NOTHROW( tRECONR()( fastU235, std::cout, std::cerr, args ) );
} // WHEN
} // GIVEN

Expand Down
30 changes: 14 additions & 16 deletions src/RECONR/ReferenceGrid/test/call.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,11 @@ SCENARIO( "Extracting the reference grid" ){
GIVEN( "an Isotope" ){

const std::vector< double > resonanceEnergies {
1e-05, 0.986069, 1.0253, 1.06453, 2.98607,
3.0253, 3.06453, 7.5, 15000, 17906.6,
21376.5, 25518.8, 30463.8, 36366.9, 43414,
51826.6, 61869.4, 73858.2, 88170.2, 100000
1e-05, 0.986069, 1.0253, 1.06453, 2.98607,
3.0253, 3.06453, 7.5, 15000, 17000,
20000, 25000, 30000, 35000, 40000,
50000, 60000, 70000, 80000, 90000,
100000
};
RP::Isotope iso = isotope();

Expand Down Expand Up @@ -132,11 +133,10 @@ SCENARIO( "Extracting the reference grid" ){
auto& parameters = std::get< RP::CaseA >( ca.parameters() );

std::vector<double> refEnergies{
23000, 23000, 25000, 29844.4, 35000, 40000,
47751.1, 57004.1, 68050.2, 81236.7, 96978.5
23000, 25000, 30000, 35000, 40000,
50000, 60000, 72000, 85000, 100000
};
auto energies = referenceGrid( parameters, ca, target, proj );

details::checkRanges( refEnergies, energies );
}

Expand All @@ -145,12 +145,11 @@ SCENARIO( "Extracting the reference grid" ){
auto& parameters = std::get< RP::CaseB >( cb.parameters() );

std::vector<double> refEnergies{
5700, 6804.53, 8000, 9000, 10000,
11937.8, 14000, 16000, 18000, 20000,
23875.5, 28502.1, 34025.1, 40000
5700, 7000, 8000, 9000, 10000,
12000, 14000, 16000, 18000, 20000,
25000, 30000, 35000, 40000
};
auto energies = referenceGrid( parameters, cb, target, proj );

details::checkRanges( refEnergies, energies );
}

Expand All @@ -159,13 +158,12 @@ SCENARIO( "Extracting the reference grid" ){
auto& parameters = std::get< RP::CaseC >( cc.parameters() );

std::vector<double> refEnergies{
6000, 7000, 8000, 9550.21, 11400.8,
13610, 16247.3, 19395.7, 23154.1, 27640.9,
32997, 39391.1, 47024.1, 56136.3, 67014.2,
80000, 95502.1
6000, 7000, 8000, 10000, 12500,
15000, 17000, 20000, 25000, 30000,
35000, 40000, 50000, 60000, 70000,
80000, 100000
};
auto energies = referenceGrid( parameters, cc, target, proj );

details::checkRanges( refEnergies, energies );
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,11 @@ SCENARIO( "Testing R2D2" ){
THEN( "the pieces can be verified" ){

const std::vector< double > resonanceEnergies {
1e-05, 0.986069, 1.0253, 1.06453, 2.98607,
3.0253, 3.06453, 7.5, 15000, 17906.6,
21376.5, 25518.8, 30463.8, 36366.9, 43414,
51826.6, 61869.4, 73858.2, 88170.2, 100000
1e-05, 0.986069, 1.0253, 1.06453, 2.98607,
3.0253, 3.06453, 7.5, 15000, 17000,
20000, 25000, 30000, 35000, 40000,
50000, 60000, 70000, 80000, 90000,
100000
};
auto trial = r2d2.resonanceReferenceGrid();
details::checkRanges( resonanceEnergies, trial );
Expand All @@ -41,9 +42,9 @@ SCENARIO( "Testing R2D2" ){
2.0361, 2.05111, 2.74827, 2.7767, 2.80513,
3.14517, 3.1566, 3.16803, 3.60111, 3.6208,
3.64049, 4.8336, 4.8508, 4.868, 5.24932,
5.4497, 5.5, 15000, 17906.6, 21376.5,
25518.8, 30463.8, 36366.9, 43414, 51826.6,
61869.4, 73858.2, 88170.2, 100000
5.4497, 5.5, 15000, 17000, 20000,
25000, 30000, 35000, 40000, 50000,
60000, 70000, 80000, 90000, 100000
};
auto trial = r2d2.resonanceReferenceGrid();
details::checkRanges( resonanceEnergies, trial );
Expand All @@ -57,10 +58,10 @@ SCENARIO( "Testing R2D2" ){
THEN( "the pieces can be verified" ){

const std::vector< double > resonanceEnergies {
1e-05, 7193.6, 7788, 8382.4, 15000,
17906.6, 21376.5, 25518.8, 30463.8, 36366.9,
43414, 51826.6, 61869.4, 73858.2, 88170.2,
100000
1e-05, 7193.6, 7788, 8382.4, 15000,
17000, 20000, 25000, 30000, 35000,
40000, 50000, 60000, 70000, 80000,
90000, 100000
};
auto trial = r2d2.resonanceReferenceGrid();
details::checkRanges( resonanceEnergies, trial );
Expand Down

0 comments on commit 894b183

Please sign in to comment.