-
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
5 changed files
with
216 additions
and
5 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
#ifndef NJOY_DRYAD_FORMAT_ENDF_CREATETABULATEDAVERAGEENERGY | ||
#define NJOY_DRYAD_FORMAT_ENDF_CREATETABULATEDAVERAGEENERGY | ||
|
||
// system includes | ||
#include <vector> | ||
|
||
// other includes | ||
#include "tools/Log.hpp" | ||
#include "dryad/id/ParticleID.hpp" | ||
#include "dryad/format/createVector.hpp" | ||
#include "dryad/format/endf/createBoundaries.hpp" | ||
#include "dryad/format/endf/createInterpolants.hpp" | ||
#include "dryad/TabulatedAverageEnergy.hpp" | ||
#include "ENDFtk/section/26.hpp" | ||
|
||
namespace njoy { | ||
namespace dryad { | ||
namespace format { | ||
namespace endf { | ||
|
||
/** | ||
* @brief Create a TabulatedMultiplicity from a parsed ENDF multiplicity | ||
*/ | ||
TabulatedAverageEnergy | ||
createTabulatedAverageEnergy( const ENDFtk::section::Type< 26 >::EnergyTransfer& transfer ) { | ||
|
||
try { | ||
|
||
// the average outgoing electron energy is the incident electron energy minus the | ||
// transfer value | ||
|
||
auto energies = createVector( transfer.energies() ); | ||
auto values = createVector( transfer.energyTransferValues() ); | ||
std::transform( energies.begin(), energies.end(), values.begin(), | ||
values.begin(), std::minus{} ); | ||
auto boundaries = createBoundaries( transfer.boundaries() ); | ||
auto interpolants = createInterpolants( transfer.interpolants() ); | ||
return TabulatedAverageEnergy( | ||
std::move( energies ), std::move( values ), | ||
std::move( boundaries ), std::move( interpolants ) ); | ||
} | ||
catch ( ... ) { | ||
|
||
Log::info( "Error encountered while creating an average reaction product energy table" ); | ||
throw; | ||
} | ||
} | ||
|
||
} // endf namespace | ||
} // format namespace | ||
} // dryad namespace | ||
} // njoy namespace | ||
|
||
#endif |
61 changes: 61 additions & 0 deletions
61
src/dryad/format/endf/createTabulatedEnergyDistribution.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,61 @@ | ||
#ifndef NJOY_DRYAD_FORMAT_ENDF_CREATETABULATEDENERGYDISTRIBUTION | ||
#define NJOY_DRYAD_FORMAT_ENDF_CREATETABULATEDENERGYDISTRIBUTION | ||
|
||
// 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/TabulatedEnergyDistribution.hpp" | ||
#include "ENDFtk/section/26.hpp" | ||
|
||
namespace njoy { | ||
namespace dryad { | ||
namespace format { | ||
namespace endf { | ||
|
||
/** | ||
* @brief Create a TabulatedEnergyDistribution from a parsed ENDF MF26 LAW = 1 | ||
* LegendreCoefficients entry (with NA = 0) | ||
*/ | ||
TabulatedEnergyDistribution | ||
createTabulatedEnergyDistribution( | ||
const ENDFtk::section::Type< 26 >::ContinuumEnergyAngle::LegendreCoefficients& distribution ) { | ||
|
||
if ( distribution.numberAngularParameters() != 0 ) { | ||
|
||
Log::error( "MF26 LAW = 1 data must be fully isotropic, found NA = {}", | ||
distribution.numberAngularParameters() ); | ||
throw std::exception(); | ||
} | ||
|
||
//! @todo interpolants and boundaries on LegendreCoefficients for interpolation on | ||
//! outgoing energy? | ||
//! @todo what is the interpolation type over the outgoing energy axis? | ||
|
||
try { | ||
|
||
auto energies = createVector( distribution.energies() ); | ||
auto values = createVector( distribution.totalEmissionProbabilities() ); | ||
std::vector< std::size_t > boundaries = { energies.size() - 1 }; | ||
std::vector< InterpolationType > interpolants = { InterpolationType::LinearLinear }; | ||
return TabulatedEnergyDistribution( | ||
std::move( energies ), std::move( values ), | ||
std::move( boundaries ), std::move( interpolants ) ); | ||
} | ||
catch ( ... ) { | ||
|
||
Log::info( "Error encountered while creating an average reaction product energy table" ); | ||
throw; | ||
} | ||
} | ||
|
||
} // endf namespace | ||
} // format namespace | ||
} // dryad namespace | ||
} // njoy namespace | ||
|
||
#endif |
56 changes: 56 additions & 0 deletions
56
src/dryad/format/endf/createTabulatedEnergyDistributions.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_TABULATEDENERGYDISTRIBUTIONS | ||
#define NJOY_DRYAD_FORMAT_ENDF_TABULATEDENERGYDISTRIBUTIONS | ||
|
||
// system includes | ||
#include <vector> | ||
|
||
// other includes | ||
#include "tools/Log.hpp" | ||
#include "dryad/id/ParticleID.hpp" | ||
#include "dryad/format/createVector.hpp" | ||
#include "dryad/format/endf/createBoundaries.hpp" | ||
#include "dryad/format/endf/createInterpolants.hpp" | ||
#include "dryad/format/endf/createTabulatedEnergyDistribution.hpp" | ||
#include "dryad/TabulatedEnergyDistributions.hpp" | ||
#include "ENDFtk/section/26.hpp" | ||
|
||
namespace njoy { | ||
namespace dryad { | ||
namespace format { | ||
namespace endf { | ||
|
||
/** | ||
* @brief Create a TabulatedEnergyDistributions instance from a parsed | ||
* ENDF MF6 ContinuumEnergyAngle component | ||
*/ | ||
TabulatedEnergyDistributions | ||
createTabulatedEnergyDistributions( const ENDFtk::section::Type< 26 >::ContinuumEnergyAngle& distribution ) { | ||
|
||
try { | ||
|
||
auto energies = createVector( distribution.incidentEnergies() ); | ||
std::vector< TabulatedEnergyDistribution > distributions; | ||
distributions.reserve( energies.size() ); | ||
for ( auto&& table : distribution.distributions() ) { | ||
|
||
distributions.emplace_back( createTabulatedEnergyDistribution( table ) ); | ||
} | ||
auto boundaries = createBoundaries( distribution.boundaries() ); | ||
auto interpolants = createInterpolants( distribution.interpolants() ); | ||
return TabulatedEnergyDistributions( | ||
std::move( energies ), std::move( distributions ), | ||
std::move( boundaries ), std::move( interpolants ) ); | ||
} | ||
catch ( ... ) { | ||
|
||
Log::info( "Error encountered while creating an average reaction product energy table" ); | ||
throw; | ||
} | ||
} | ||
|
||
} // endf namespace | ||
} // format namespace | ||
} // dryad namespace | ||
} // njoy namespace | ||
|
||
#endif |