Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release/v1.3.0 #143

Draft
wants to merge 7 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ContinuousIntegration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:
run: cmake -D CMAKE_Fortran_COMPILER=`which ${{matrix.vFortran}}` -D CMAKE_CXX_COMPILER=`which ${{matrix.cxx}}` -D CMAKE_BUILD_TYPE=${{matrix.build_type}} ..
working-directory: ./bin
- name: make
run: make -j2 VERBOSE=1
run: make -j2
working-directory: ./bin
- name: ctest
run: ctest -j2
Expand Down
8 changes: 5 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ enable_language( Fortran )
# Project-wide setup
########################################################################

find_package( Python3 3.5 REQUIRED )

set( CMAKE_CXX_STANDARD 17 )
set( CMAKE_CXX_STANDARD_REQUIRED YES )

Expand All @@ -33,11 +31,13 @@ set( debug_flags "-O0" "-g" )
# Dependencies
########################################################################

set( REPOSITORIES "release"
set( REPOSITORIES "develop"
CACHE STRING
"Options for where to fetch repositories: develop, release, local"
)

message( STATUS "Using ${REPOSITORIES} repositories" )

if( REPOSITORIES STREQUAL "develop" )
include( cmake/develop_dependencies.cmake )

Expand All @@ -61,12 +61,14 @@ target_include_directories( njoy21_library
src/
)
target_link_libraries( njoy21_library
INTERFACE leapr
INTERFACE ENDFtk
INTERFACE dimwits
INTERFACE lipservice
INTERFACE njoy_c_bindings
INTERFACE tclap-adapter
INTERFACE utility
INTERFACE nlohmann_json
INTERFACE catch-adapter
)

Expand Down
14 changes: 14 additions & 0 deletions ReleaseNotes.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,20 @@
# Release Notes—NJOY21
Given here are some release notes for NJOY21. Each release is made through a formal [Pull Request](https://github.com/njoy/NJOY21/pulls) made on GitHub. There are links in this document that point to each of those Pull Requests, where you can see in great details the changes that were made. Often the Pull Requests are made in response to an [issue](https://github.com/njoy/NJOY21/issues). In such cases, links to those issues are also given.

## [NJOY21 1.3.0](https://github.com/njoy/NJOY21/pull/143)

### LEAPR
See [Pull Request #127](https://github.com/njoy/NJOY21/pull/127)

### RECONR
See [Pull Request #118](https://github.com/njoy/NJOY21/pull/118)

### THERMR
See [Pull Request #144](https://github.com/njoy/NJOY21/pull/144)

### Regression Tests
There are a number of [regression tests](https://www.njoy21.io/NJOY2016/testDescription.html) with NJOY21. These are the same as used in NJOY2016. Some of them are no longer valid with NJOY21. With NJOY21, features that are not included in ENDF/B-VII.0 or later, are not going to be supported in NJOY21. There are some regression tests that are no going to be supported in NJOY21. They are:

## [NJOY21 1.2.2](https://github.com/njoy/NJOY21/pull/142)
- Updating Legacy NJOY to NJOY2016.61. See [release 2016.61](https://github.com/njoy/NJOY2016/releases/tag/2016.61) for more information
- Adding additional regression tests.
Expand Down
9 changes: 8 additions & 1 deletion cmake/develop_dependencies.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,15 @@ include( FetchContent )
# Declare project dependencies
#######################################################################

FetchContent_Declare( leapr
GIT_REPOSITORY https://github.com/njoy/leapr
GIT_TAG origin/master
GIT_SHALLOW TRUE
)

FetchContent_Declare( ENDFtk
GIT_REPOSITORY https://github.com/njoy/ENDFtk
GIT_TAG origin/master
GIT_TAG origin/develop
GIT_SHALLOW TRUE
)

Expand Down Expand Up @@ -57,6 +63,7 @@ FetchContent_Declare( utility
#######################################################################

FetchContent_MakeAvailable(
leapr
ENDFtk
dimwits
lipservice
Expand Down
8 changes: 7 additions & 1 deletion cmake/release_dependencies.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ include( FetchContent )
# Declare project dependencies
#######################################################################

FetchContent_Declare( leapr
GIT_REPOSITORY https://github.com/njoy/leapr
GIT_TAG ff2a1fa90f28e29b5eda100428c35150d1ff89f7
)

FetchContent_Declare( catch-adapter
GIT_REPOSITORY https://github.com/njoy/catch-adapter
GIT_TAG fb84b82ebf7a4789aa43cea560680cf745c6ee4f
Expand All @@ -22,7 +27,7 @@ FetchContent_Declare( disco

FetchContent_Declare( ENDFtk
GIT_REPOSITORY https://github.com/njoy/ENDFtk
GIT_TAG b6618b396f51e802b7ee19ba529533c27e6ac302 # tag: v0.1.0
GIT_TAG d72711722a269919321e3f3df8a8b0cfe23ba6c7
)

FetchContent_Declare( hana-adapter
Expand Down Expand Up @@ -85,6 +90,7 @@ FetchContent_Declare( utility
#######################################################################

FetchContent_MakeAvailable(
leapr
catch-adapter
dimwits
disco
Expand Down
7 changes: 4 additions & 3 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@ int main( int argc, char* argv[] ){
try{
Driver driver( argc, argv );
driver();
} catch( ... ){
njoy::Log::info( "Error while running NJOY21");
return 1;
} catch( std::exception& ex ){
njoy::Log::info( "Error while running NJOY21:");
njoy::Log::info( "\t{}", ex.what() );
return 1;
}
}
9 changes: 8 additions & 1 deletion src/njoy21.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,25 @@
#include <iomanip>
#include <regex>
#include <cstdlib>
#include <chrono>
#include <string>

#include "nlohmann/json.hpp"

#include "ENDFtk.hpp"
#include "dimwits.hpp"
#include "Log.hpp"
#include "utility.hpp"


#pragma GCC diagnostic push
#if !defined( __clang__ )
#pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
#endif
#include "lipservice.hpp"
#pragma GCC diagnostic pop

#include "njoy_c.h"
#include "leapr.hpp"

namespace njoy{
namespace njoy21{
Expand All @@ -38,6 +44,7 @@ struct CommandLine;
#include "njoy21/io.hpp"
#include "njoy21/interface.hpp"
#include "njoy21/legacy.hpp"
#include "njoy21/modern.hpp"
#include "njoy21/Version.hpp"

}
Expand Down
9 changes: 7 additions & 2 deletions src/njoy21/Driver.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,15 @@ class Driver {

std::unique_ptr< io::Manager > manager;
Queue queue;
nlohmann::json args;

Driver( std::unique_ptr< io::Manager >&& manager, Queue&& queue ) :
Driver( std::unique_ptr< io::Manager >&& manager,
Queue&& queue,
nlohmann::json&& args ) :
manager( std::move(manager) ),
queue( std::move(queue) ){}
queue( std::move(queue) ),
args( std::move( args ) )
{}

#include "njoy21/Driver/Factory.hpp"

Expand Down
14 changes: 3 additions & 11 deletions src/njoy21/Driver/Factory.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,13 @@ class Factory {

#include "njoy21/Driver/Factory/src/setupManager.hpp"
#include "njoy21/Driver/Factory/src/setupLegacyDirectory.hpp"
#include "njoy21/Driver/Factory/src/setupModernDirectory.hpp"

static Directory setupModernDirectory( CommandLine& commandLine ){
return ( commandLine.legacySwitch ) ? Directory() : Directory();
}

template< typename First, typename Second, typename... Args >
static void cycle( First&& first, Second&& second, Args&... args ){
while ( first( args... ) and second( args... ) ){}
}

public:
Factory( int argc, char* argv[] ) :
commandLine( argc, argv ),
manager( std::make_unique< io::Manager >
( setupManager( this->commandLine ) ) ),
manager(
std::make_unique< io::Manager > ( setupManager( this->commandLine ) ) ),
legacy( setupLegacyDirectory( this->commandLine ) ),
modern( setupModernDirectory( this->commandLine ) ){}

Expand Down
24 changes: 18 additions & 6 deletions src/njoy21/Driver/Factory/src/callOperator.hpp
Original file line number Diff line number Diff line change
@@ -1,16 +1,21 @@
Driver operator()(){

// For passing arbitrary arguments to modules
auto args = nlohmann::json::object();

auto outputPair = this->manager->output(
static_cast<modern::Sequence*>(nullptr) );
static_cast< modern::Sequence*>(nullptr) );
const auto& output = outputPair.first;
// const auto& error = outputPair.second;
(*output) << banner;
output->flush();

legacy::Sequence::Factory legacyFactory( *(this->manager), this->legacy );
legacy::Sequence::Factory modernFactory( *(this->manager), this->modern ); //placeholder
modern::Sequence::Factory modernFactory( *(this->manager), this->modern );

auto makeProcessor = []( auto& set, auto& factory ){
return [&]( auto& label, auto& queue ){
// If the label is among the allowed modules in factory
if ( set.count(label) ){
queue.push( factory( label ) );
return true;
Expand All @@ -20,12 +25,16 @@ Driver operator()(){
};
auto legacyProcessor = makeProcessor( this->legacy, legacyFactory );
auto modernProcessor = makeProcessor( this->modern, modernFactory );
Queue queue;

Queue queue;
auto label = lipservice::Label::extract( manager->input() );

auto cycle = [&]( auto& first, auto& second ){
while( first( label, queue ) and second( label, queue ) ){ }
};
this->legacy.count( label ) ?
cycle( legacyProcessor, modernProcessor, label, queue ) :
cycle( modernProcessor, legacyProcessor, label, queue );
cycle( legacyProcessor, modernProcessor ) :
cycle( modernProcessor, legacyProcessor );

if ( label != "STOP" ){
Log::error( "Unrecognized routine label on line {}",
Expand All @@ -35,5 +44,8 @@ Driver operator()(){
}

if ( this->commandLine.verifyOnly ){ queue = Queue(); }
return Driver( std::move(this->manager), std::move(queue) );

return Driver( std::move( this->manager ),
std::move( queue ),
std::move( args ) );
}
2 changes: 1 addition & 1 deletion src/njoy21/Driver/Factory/src/setupLegacyDirectory.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ static Directory setupLegacyDirectory( CommandLine& commandLine ){
return ( commandLine.legacySwitch ) ?
Directory( { "MODER", "RECONR", "BROADR", "PURR", "UNRESR", "ACER",
"GASPR", "HEATR", "GROUPR", "VIEWR", "MIXR", "DTFR",
"THERMR", "LEAPR", "RESXSR", "MATXSR", "GAMINR", "PLOTR",
"THERMR", "RESXSR", "MATXSR", "GAMINR", "PLOTR",
"COVR", "WIMSR", "POWR", "CCCCR", "ERRORR" } ):
Directory( { "MODER", "RECONR", "BROADR", "PURR", "UNRESR", "ACER",
"GASPR", "HEATR", "GROUPR", "VIEWR", "MIXR", "DTFR",
Expand Down
13 changes: 4 additions & 9 deletions src/njoy21/Driver/Factory/src/setupManager.hpp
Original file line number Diff line number Diff line change
@@ -1,14 +1,9 @@
static io::Manager setupManager( CommandLine& commandLine ){
io::Manager::Builder builder;

if ( commandLine.inputPath ){
builder.input( *(commandLine.inputPath) );
}
if ( commandLine.outputPath ){
builder.output( *(commandLine.outputPath) );
}
if ( commandLine.errorPath ){
builder.error( *(commandLine.errorPath) );
}
if ( commandLine.inputPath ){ builder.input( *(commandLine.inputPath) ); }
if ( commandLine.outputPath ){ builder.output( *(commandLine.outputPath) ); }
if ( commandLine.errorPath ){ builder.error( *(commandLine.errorPath) ); }

return builder.construct();
}
5 changes: 5 additions & 0 deletions src/njoy21/Driver/Factory/src/setupModernDirectory.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
static Directory setupModernDirectory( CommandLine& commandLine ){
return ( commandLine.legacySwitch ) ?
Directory() :
Directory( { "LEAPR" } );
}
2 changes: 1 addition & 1 deletion src/njoy21/Driver/src/callOperator.hpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
void operator()(){
while ( this->queue.size() ){
auto& routine = *( this->queue.front() );
routine();
routine( this->args );
this->queue.pop();
}
}
4 changes: 2 additions & 2 deletions src/njoy21/Driver/test/Driver.test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ using namespace njoy::njoy21;

SCENARIO("run a simple njoy problem"){
{
std::vector< std::string > args =
{ "./njoy21", "--input", "input.txt", "--output", "output.txt" };
std::vector< std::string > args = {
"./njoy21", "--input", "input.njoy", "--output", "output.txt" };
Driver driver( args.size(), argv(args) );
driver();
}
Expand Down
Empty file modified src/njoy21/Driver/test/resources/tape20
100755 → 100644
Empty file.
Loading