-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
552 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 48 additions & 0 deletions
48
src/dryad/format/endf/createLegendreAngularDistribution.hpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
#ifndef NJOY_DRYAD_FORMAT_ENDF_CREATELEGENDREANGULARDISTRIBUTION | ||
#define NJOY_DRYAD_FORMAT_ENDF_CREATELEGENDREANGULARDISTRIBUTION | ||
|
||
// system includes | ||
#include <vector> | ||
|
||
// other includes | ||
#include "tools/Log.hpp" | ||
#include "dryad/format/createVector.hpp" | ||
#include "dryad/format/endf/createBoundaries.hpp" | ||
#include "dryad/format/endf/createInterpolants.hpp" | ||
#include "dryad/LegendreAngularDistribution.hpp" | ||
#include "ENDFtk/section/6.hpp" | ||
|
||
namespace njoy { | ||
namespace dryad { | ||
namespace format { | ||
namespace endf { | ||
|
||
/** | ||
* @brief Create a LegendreAngularDistribution from a range of coefficients | ||
*/ | ||
template < typename Range > | ||
LegendreAngularDistribution createLegendreAngularDistribution( const Range& range, bool addOrderZero ) { | ||
|
||
try { | ||
|
||
auto coefficients = createVector( range ); | ||
if ( addOrderZero ) { coefficients.insert( coefficients.begin(), 1. ); } | ||
for ( std::size_t index = 0; index < coefficients.size(); ++index ) { | ||
|
||
coefficients[index] *= 0.5 * ( 2 * index + 1 ); | ||
} | ||
return LegendreAngularDistribution( std::move( coefficients ) ); | ||
} | ||
catch ( ... ) { | ||
|
||
Log::info( "Error encountered while creating an energy distribution table" ); | ||
throw; | ||
} | ||
} | ||
|
||
} // endf namespace | ||
} // format namespace | ||
} // dryad namespace | ||
} // njoy namespace | ||
|
||
#endif |
56 changes: 56 additions & 0 deletions
56
src/dryad/format/endf/createLegendreAngularDistributions.hpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
#ifndef NJOY_DRYAD_FORMAT_ENDF_CREATELEGENDREANGULARDISTRIBUTIONS | ||
#define NJOY_DRYAD_FORMAT_ENDF_CREATELEGENDREANGULARDISTRIBUTIONS | ||
|
||
// system includes | ||
#include <vector> | ||
|
||
// other includes | ||
#include "tools/Log.hpp" | ||
#include "dryad/format/createVector.hpp" | ||
#include "dryad/format/endf/createBoundaries.hpp" | ||
#include "dryad/format/endf/createInterpolants.hpp" | ||
#include "dryad/format/endf/createLegendreAngularDistribution.hpp" | ||
#include "dryad/LegendreAngularDistributions.hpp" | ||
#include "ENDFtk/section/4.hpp" | ||
|
||
namespace njoy { | ||
namespace dryad { | ||
namespace format { | ||
namespace endf { | ||
|
||
/** | ||
* @brief Create a LegendreAngularDistributions instance from a parsed | ||
* ENDF MF4 section | ||
*/ | ||
LegendreAngularDistributions | ||
createLegendreAngularDistributions( | ||
const ENDFtk::section::Type< 4 >::LegendreDistributions& distribution ) { | ||
|
||
try { | ||
|
||
auto energies = createVector( distribution.incidentEnergies() ); | ||
std::vector< LegendreAngularDistribution > distributions; | ||
distributions.reserve( energies.size() ); | ||
for ( auto&& entry : distribution.angularDistributions() ) { | ||
|
||
distributions.emplace_back( createLegendreAngularDistribution( entry.coefficients(), true ) ); | ||
} | ||
auto boundaries = createBoundaries( distribution.boundaries() ); | ||
auto interpolants = createInterpolants( distribution.interpolants() ); | ||
return LegendreAngularDistributions( | ||
std::move( energies ), std::move( distributions ), | ||
std::move( boundaries ), std::move( interpolants ) ); | ||
} | ||
catch ( ... ) { | ||
|
||
Log::info( "Error encountered while creating a Legendre angular distribution table" ); | ||
throw; | ||
} | ||
} | ||
|
||
} // endf namespace | ||
} // format namespace | ||
} // dryad namespace | ||
} // njoy namespace | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.