Skip to content

Commit

Permalink
Changing following review #46
Browse files Browse the repository at this point in the history
  • Loading branch information
whaeck committed Mar 13, 2023
1 parent 73454e2 commit 6a3e9cf
Show file tree
Hide file tree
Showing 37 changed files with 200 additions and 198 deletions.
1 change: 0 additions & 1 deletion python/test/block/Test_ACEtk_AngularDistributionBlock.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
from ACEtk import FullyIsotropicDistribution
from ACEtk import AngularDistributionData
from ACEtk import IsotropicAngularDistribution
from ACEtk import EquiprobableAngularBins
from ACEtk import TabulatedAngularDistribution
from ACEtk import AngularDistributionType

Expand Down
16 changes: 8 additions & 8 deletions src/ACEtk/block/AngleEnergyDistributionData/src/generateXSS.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ generateXSS( const std::string& name,
std::size_t locb ) {

// add the distribution data to the xss array
std::size_t nr = boundaries.size();
std::size_t ne = distributions.size();
const auto nr = boundaries.size();
const auto ne = distributions.size();
std::vector< double > xss( 1 + 2 * ne );
xss[0] = ne;
std::size_t index = 1;
std::size_t offset = 1 + 2 * nr + locb;
const auto offset = 1 + 2 * nr + locb;
for ( const auto& distribution : distributions ) {

// set the associated value
Expand All @@ -21,11 +21,11 @@ generateXSS( const std::string& name,
xss[index + ne] = xss.size() + offset;

// remake the internal xss array with the proper locators
TabulatedAngleEnergyDistribution temp(
distribution.value(),
distribution.interpolation(),
std::move( distribution.distributions() ),
xss[index + ne] );
const TabulatedAngleEnergyDistribution temp(
distribution.value(),
distribution.interpolation(),
std::move( distribution.distributions() ),
xss[index + ne] );
xss.insert( xss.end(), temp.begin(), temp.end() );

// on to the next distribution
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
static std::vector< double >
generateXSS( std::vector< Distribution >&& distributions, std::size_t locb ) {

std::size_t ne = distributions.size();
const auto ne = distributions.size();
std::vector< double > xss( 1 + 2 * ne );

auto incidentEnergy = [] ( const auto& value )
Expand Down
10 changes: 5 additions & 5 deletions src/ACEtk/block/DelayedNeutronPrecursorData/src/generateXSS.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ generateXSS( double lambda,
std::vector< double >&& y ) {

std::vector< double > xss = { lambda };
details::BaseTabulatedData data( "DelayedNeutronPrecursorData",
std::move( boundaries ),
std::move( interpolants ),
std::move( x ),
std::move( y ) );
const details::BaseTabulatedData data( "DelayedNeutronPrecursorData",
std::move( boundaries ),
std::move( interpolants ),
std::move( x ),
std::move( y ) );
xss.insert( xss.end(), data.begin(), data.end() );
return xss;
}
26 changes: 13 additions & 13 deletions src/ACEtk/block/EnergyAngleDistributionData/src/generateXSS.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,36 +6,36 @@ generateXSS( const std::string& name,
std::size_t locb ) {

// add the distribution data to the xss array
std::size_t nr = boundaries.size();
std::size_t ne = distributions.size();
std::vector< double > xss( 1 + 2 * ne );
const auto nr = boundaries.size();
const auto ne = distributions.size();
std::vector< double > xss( static_cast< double >( 1 + 2 * ne ) );
xss[0] = ne;
std::size_t index = 1;
std::size_t offset = 1 + 2 * nr + locb;
const auto offset = 1 + 2 * nr + locb;
for ( const auto& distribution : distributions ) {

// set the associated value
xss[index] = distribution.value();

// set the locator
xss[index + ne] = xss.size() + offset;
xss[index + ne] = static_cast< double >( xss.size() + offset );

// remake the internal xss array with the proper locators
TabulatedEnergyAngleDistribution temp(
distribution.value(),
distribution.interpolation(),
std::move( distribution.distributions() ),
xss[index + ne] );
const TabulatedEnergyAngleDistribution temp(
distribution.value(),
distribution.interpolation(),
std::move( distribution.distributions() ),
xss[index + ne] );
xss.insert( xss.end(), temp.begin(), temp.end() );

// on to the next distribution
++index;
}

// insert the interpolation data in the front
InterpolationData interpolation( std::string( name ),
std::move( boundaries ),
std::move( interpolants ) );
const InterpolationData interpolation( std::string( name ),
std::move( boundaries ),
std::move( interpolants ) );
xss.insert( xss.begin(), interpolation.begin(), interpolation.end() );

return xss;
Expand Down
66 changes: 33 additions & 33 deletions src/ACEtk/block/EnergyDistributionBlock/src/generateXSS.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ generateXSS( std::vector< EnergyDistributionData >&& distributions,
throw std::exception();
}

std::size_t size = distributions.size();
std::vector< double > xss( size );
const auto size = distributions.size();
std::vector< double > xss( static_cast< double >( size ) );
std::vector< unsigned int > tyr;
std::size_t index = 0;
for ( auto&& distribution : distributions ) {
Expand All @@ -26,13 +26,13 @@ generateXSS( std::vector< EnergyDistributionData >&& distributions,

[ &xss, &tyr, &locator, size ] ( const TabulatedMultiplicity& value ) {

tyr.insert( tyr.end(), 100 + locator );
tyr.insert( tyr.end(), static_cast< double >( 100 + locator ) );
xss.insert( xss.end(), value.begin(), value.end() );
locator = xss.size() - size + 1;
},
[ &tyr ] ( const unsigned int& value ) {

tyr.insert( tyr.end(), value );
tyr.insert( tyr.end(), static_cast< double >( value ) );
}
},
multiplicities[index]
Expand All @@ -51,10 +51,10 @@ generateXSS( std::vector< EnergyDistributionData >&& distributions,
[ &xss, locator ] ( const MultiDistributionData& value ) {

// remake the internal xss array with the proper locators
MultiDistributionData temp(
std::move( value.probabilities() ),
std::move( value.distributions() ),
locator );
const MultiDistributionData temp(
std::move( value.probabilities() ),
std::move( value.distributions() ),
locator );
xss.insert( xss.end(), temp.begin(), temp.end() );
},
[] ( const auto& ) { /* nothing to do here */ }
Expand All @@ -74,11 +74,11 @@ generateXSS( std::vector< EnergyDistributionData >&& distributions,
[ &xss, &idat, locator ] ( const auto& value ) {

idat = locator + 3 + 1 + 5;
xss.push_back( 0 ); // LNW
xss.push_back( static_cast< short >( value.LAW() ) ); // LAW
xss.push_back( idat ); // IDAT
xss.push_back( 0 ); // NR
xss.push_back( 2 ); // NE
xss.push_back( 0. ); // LNW
xss.push_back( static_cast< double >( value.LAW() ) ); // LAW
xss.push_back( static_cast< double >( idat ) ); // IDAT
xss.push_back( 0. ); // NR
xss.push_back( 2. ); // NE
xss.push_back( value.minimumIncidentEnergy() ); // E[0]
xss.push_back( value.maximumIncidentEnergy() ); // E[1]
xss.push_back( 1. ); // P[0]
Expand All @@ -96,47 +96,47 @@ generateXSS( std::vector< EnergyDistributionData >&& distributions,
// remake the internal xss array with the proper locators
decltype(auto) boundaries = value.boundaries();
decltype(auto) interpolants = value.interpolants();
OutgoingEnergyDistributionData temp(
{ boundaries.begin(), boundaries.end() },
{ interpolants.begin(), interpolants.end() },
std::move( value.distributions() ),
idat );
const OutgoingEnergyDistributionData temp(
{ boundaries.begin(), boundaries.end() },
{ interpolants.begin(), interpolants.end() },
std::move( value.distributions() ),
idat );
xss.insert( xss.end(), temp.begin(), temp.end() );
},
[ &xss, idat ] ( const KalbachMannDistributionData& value ) {

// remake the internal xss array with the proper locators
decltype(auto) boundaries = value.boundaries();
decltype(auto) interpolants = value.interpolants();
KalbachMannDistributionData temp(
{ boundaries.begin(), boundaries.end() },
{ interpolants.begin(), interpolants.end() },
std::move( value.distributions() ),
idat );
const KalbachMannDistributionData temp(
{ boundaries.begin(), boundaries.end() },
{ interpolants.begin(), interpolants.end() },
std::move( value.distributions() ),
idat );
xss.insert( xss.end(), temp.begin(), temp.end() );
},
[ &xss, idat ] ( const EnergyAngleDistributionData& value ) {

// remake the internal xss array with the proper locators
decltype(auto) boundaries = value.boundaries();
decltype(auto) interpolants = value.interpolants();
EnergyAngleDistributionData temp(
{ boundaries.begin(), boundaries.end() },
{ interpolants.begin(), interpolants.end() },
std::move( value.distributions() ),
idat );
const EnergyAngleDistributionData temp(
{ boundaries.begin(), boundaries.end() },
{ interpolants.begin(), interpolants.end() },
std::move( value.distributions() ),
idat );
xss.insert( xss.end(), temp.begin(), temp.end() );
},
[ &xss, idat ] ( const AngleEnergyDistributionData& value ) {

// remake the internal xss array with the proper locators
decltype(auto) boundaries = value.boundaries();
decltype(auto) interpolants = value.interpolants();
AngleEnergyDistributionData temp(
{ boundaries.begin(), boundaries.end() },
{ interpolants.begin(), interpolants.end() },
std::move( value.distributions() ),
idat );
const AngleEnergyDistributionData temp(
{ boundaries.begin(), boundaries.end() },
{ interpolants.begin(), interpolants.end() },
std::move( value.distributions() ),
idat );
xss.insert( xss.end(), temp.begin(), temp.end() );
},
[ &xss ] ( const auto& value ) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,24 @@ generateXSS(
std::vector< EquiprobableOutgoingEnergyBins >&& distributions ) {

// reserve size in the vector
std::size_t nr = boundaries.size();
std::size_t ne = distributions.size();
std::vector< double > xss( 2 + ne ); // NE, list of energies, NET
const auto nr = boundaries.size();
const auto ne = distributions.size();
std::vector< double > xss( static_cast< double >( 2 + ne ) ); // NE, list of energies, NET

// sort distributions
std::sort( distributions.begin(), distributions.end(),
[=] ( const auto& left, const auto& right )
{ return left.incidentEnergy() < right.incidentEnergy(); } );

// insert the interpolation data
InterpolationData interpolation( "EquiprobableOutgoingEnergyBinData",
std::move( boundaries ),
std::move( interpolants ) );
const InterpolationData interpolation( "EquiprobableOutgoingEnergyBinData",
std::move( boundaries ),
std::move( interpolants ) );
xss.insert( xss.begin(), interpolation.begin(), interpolation.end() );

// insert the bin data
xss[ 1 + 2 * nr ] = ne;
xss[ 2 + 2 * nr + ne ] = distributions.front().numberBins() + 1;
xss[ 1 + 2 * nr ] = static_cast< double >( ne );
xss[ 2 + 2 * nr + ne ] = static_cast< double >( distributions.front().numberBins() + 1 );
std::size_t index = 2 + 2 * nr;
for ( const auto& distribution : distributions ) {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ generateXSS( std::vector< ReferenceFrame >&& frames,
std::vector< unsigned int >&& multiplicities ) {

std::vector< double > xss;
auto ntr = multiplicities.size();
const auto ntr = multiplicities.size();
xss.reserve( ntr );

if ( frames.size() != ntr ) {
Expand Down
10 changes: 5 additions & 5 deletions src/ACEtk/block/GeneralEvaporationSpectrum/src/generateXSS.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ generateXSS(

// insert the tabulated data
std::vector< double > xss;
details::BaseTabulatedData table( "GeneralEvaporationSpectrum",
std::move( boundaries ),
std::move( interpolants ),
std::move( energies ),
std::move( temperatures ) );
const details::BaseTabulatedData table( "GeneralEvaporationSpectrum",
std::move( boundaries ),
std::move( interpolants ),
std::move( energies ),
std::move( temperatures ) );
xss.insert( xss.end(), table.begin(), table.end() );

// insert the bin data
Expand Down
28 changes: 14 additions & 14 deletions src/ACEtk/block/MultiDistributionData/src/generateXSS.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ generateXSS( std::vector< DistributionProbability >&& probabilities,
std::size_t locb ) {

std::vector< double > xss;
std::size_t size = probabilities.size();
const auto size = probabilities.size();
if ( distributions.size() != size ) {

Log::error( "The number of distributions and probabilities is not the same" );
Expand All @@ -17,15 +17,15 @@ generateXSS( std::vector< DistributionProbability >&& probabilities,
// set lnw and idat appropriately
for ( unsigned int i = 0; i < size; ++i ) {

std::size_t offset = xss.size();
const auto offset = xss.size();
xss.push_back( 0 ); // lnw
std::visit(
[ &xss ] ( const auto& value )
{ xss.push_back( static_cast< double >( value.LAW() ) ); },
distributions[i] );
xss.push_back( 1 ); // idat
xss.push_back( 1. ); // idat
xss.insert( xss.end(), probabilities[i].begin(), probabilities[i].end() );
xss[ offset + 2 ] = xss.size() + locb; // idat
xss[ offset + 2 ] = static_cast< double >( xss.size() + locb ); // idat
std::visit(

utility::overload{
Expand All @@ -35,23 +35,23 @@ generateXSS( std::vector< DistributionProbability >&& probabilities,
// remake the internal xss array with the proper locators
decltype(auto) boundaries = value.boundaries();
decltype(auto) interpolants = value.interpolants();
OutgoingEnergyDistributionData temp(
{ boundaries.begin(), boundaries.end() },
{ interpolants.begin(), interpolants.end() },
std::move( value.distributions() ),
xss[ offset + 2 ] );
const OutgoingEnergyDistributionData temp(
{ boundaries.begin(), boundaries.end() },
{ interpolants.begin(), interpolants.end() },
std::move( value.distributions() ),
xss[ offset + 2 ] );
xss.insert( xss.end(), temp.begin(), temp.end() );
},
[ &xss, offset ] ( const KalbachMannDistributionData& value ) {

// remake the internal xss array with the proper locators
decltype(auto) boundaries = value.boundaries();
decltype(auto) interpolants = value.interpolants();
KalbachMannDistributionData temp(
{ boundaries.begin(), boundaries.end() },
{ interpolants.begin(), interpolants.end() },
std::move( value.distributions() ),
xss[ offset + 2 ] );
const KalbachMannDistributionData temp(
{ boundaries.begin(), boundaries.end() },
{ interpolants.begin(), interpolants.end() },
std::move( value.distributions() ),
xss[ offset + 2 ] );
xss.insert( xss.end(), temp.begin(), temp.end() );
},
[ &xss ] ( const auto& value ) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
static std::vector< double > generateXSS( std::vector< unsigned int >&& mts ) {

auto nyp = mts.size();
const auto nyp = mts.size();
std::vector< double > xss{ static_cast< double >( nyp ) };
xss.reserve( nyp + 1 );
xss.insert( xss.end(), mts.begin(), mts.end() );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ static std::vector< double > generateXSS( unsigned int npsx, double ap,
ap,
static_cast< double >( interpolation ) };
xss.reserve( 5 + 3 * values.size() );
details::ColumnData columns( "NBodyPhaseSpaceDistribution",
std::move( values ),
std::move( pdf ),
std::move( cdf ) );
const details::ColumnData columns( "NBodyPhaseSpaceDistribution",
std::move( values ),
std::move( pdf ),
std::move( cdf ) );
xss.insert( xss.end(), columns.begin(), columns.end() );

return xss;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
static std::vector< double > generateXSS( std::vector< PhotonProductionData >&& xs ) {

std::size_t ntr = xs.size();
const auto ntr = xs.size();
std::vector< double > xss( ntr );
std::size_t index = 0;
for ( const auto& data : xs ) {
Expand Down
Loading

0 comments on commit 6a3e9cf

Please sign in to comment.