-
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.
Adding create function for coherent an incoherent scattering function
- Loading branch information
Showing
2 changed files
with
73 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
#include "dryad/format/endf/createTabulatedScatteringFunction.hpp" |
72 changes: 72 additions & 0 deletions
72
src/dryad/format/ace/createTabulatedScatteringFunction.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,72 @@ | ||
#ifndef NJOY_DRYAD_FORMAT_ACE_CREATETABULATEDSCATTERINGFUNCTION | ||
#define NJOY_DRYAD_FORMAT_ACE_CREATETABULATEDSCATTERINGFUNCTION | ||
|
||
// system includes | ||
#include <vector> | ||
|
||
// other includes | ||
#include "tools/Log.hpp" | ||
#include "dryad/format/createVector.hpp" | ||
#include "dryad/TabulatedScatteringFunction.hpp" | ||
#include "ACEtk/photoatomic/CoherentFormFactorBlock.hpp" | ||
#include "ACEtk/photoatomic/IncoherentScatteringFunctionBlock.hpp" | ||
|
||
namespace njoy { | ||
namespace dryad { | ||
namespace format { | ||
namespace ace { | ||
|
||
/** | ||
* @brief Create a TabulatedScatteringFunction from a CoherentFormFactorBlock | ||
*/ | ||
TabulatedScatteringFunction | ||
createTabulatedScatteringFunction( const njoy::ACEtk::photoatomic::CoherentFormFactorBlock& block ) { | ||
|
||
try { | ||
|
||
Log::info( "Reading scattering function data" ); | ||
auto x = createVector( block.momentum() ); | ||
auto values = createVector( block.formFactors() ); | ||
std::vector< std::size_t > boundaries = { x.size() - 1 }; | ||
std::vector< InterpolationType > interpolants = { InterpolationType::LinearLinear }; | ||
return TabulatedScatteringFunction( | ||
std::move( x ), std::move( values ), | ||
std::move( boundaries ), std::move( interpolants ) ); | ||
} | ||
catch ( ... ) { | ||
|
||
Log::info( "Error encountered while creating a tabulated scattering function" ); | ||
throw; | ||
} | ||
} | ||
|
||
/** | ||
* @brief Create a TabulatedScatteringFunction from a CoherentFormFactorBlock | ||
*/ | ||
TabulatedScatteringFunction | ||
createTabulatedScatteringFunction( const njoy::ACEtk::photoatomic::IncoherentScatteringFunctionBlock& block ) { | ||
|
||
try { | ||
|
||
Log::info( "Reading scattering function data" ); | ||
auto x = createVector( block.momentum() ); | ||
auto values = createVector( block.values() ); | ||
std::vector< std::size_t > boundaries = { x.size() - 1 }; | ||
std::vector< InterpolationType > interpolants = { InterpolationType::LinearLinear }; | ||
return TabulatedScatteringFunction( | ||
std::move( x ), std::move( values ), | ||
std::move( boundaries ), std::move( interpolants ) ); | ||
} | ||
catch ( ... ) { | ||
|
||
Log::info( "Error encountered while creating a tabulated scattering function" ); | ||
throw; | ||
} | ||
} | ||
|
||
} // ace namespace | ||
} // format namespace | ||
} // dryad namespace | ||
} // njoy namespace | ||
|
||
#endif |