-
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.
finishing adding coherent and incoherent for gnds
- Loading branch information
Showing
14 changed files
with
232 additions
and
104 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
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,68 @@ | ||
#ifndef NJOY_DRYAD_FORMAT_GNDS_CREATECOHERENTDISTRIBUTIONDATA | ||
#define NJOY_DRYAD_FORMAT_GNDS_CREATECOHERENTDISTRIBUTIONDATA | ||
|
||
// system includes | ||
#include <vector> | ||
|
||
// other includes | ||
#include "pugixml.hpp" | ||
#include "tools/Log.hpp" | ||
#include "dryad/format/gnds/createReferenceFrame.hpp" | ||
#include "dryad/format/gnds/createTabulatedFormFactorFromNodes.hpp" | ||
#include "dryad/format/gnds/createTabulatedScatteringFunctionFromNodes.hpp" | ||
#include "dryad/CoherentDistributionData.hpp" | ||
|
||
namespace njoy { | ||
namespace dryad { | ||
namespace format { | ||
namespace gnds { | ||
|
||
/** | ||
* @brief Create a CoherentDistributionData from a GNDS coherentPhotonScattering node | ||
*/ | ||
static CoherentDistributionData | ||
createCoherentDistributionData( const pugi::xml_node& coherent ) { | ||
|
||
// check that this is a valid coherentPhotonScattering node | ||
throwExceptionOnWrongNode( coherent, "coherentPhotonScattering" ); | ||
|
||
// get the reference frame | ||
auto frame = createReferenceFrame( coherent.attribute( "productFrame" ).as_string() ); | ||
|
||
auto node = coherent.child( "formFactor" ).first_child(); | ||
auto function = createTabulatedScatteringFunctionFromNodes( node ); | ||
std::optional< TabulatedFormFactor > real = std::nullopt; | ||
std::optional< TabulatedFormFactor > imaginary = std::nullopt; | ||
|
||
node = coherent.child( "realAnomalousFactor" ).first_child(); | ||
if ( node ) { | ||
|
||
real = createTabulatedFormFactorFromNodes( node ); | ||
} | ||
|
||
node = coherent.child( "imaginaryAnomalousFactor" ).first_child(); | ||
if ( node ) { | ||
|
||
imaginary = createTabulatedFormFactorFromNodes( node ); | ||
} | ||
|
||
if ( real.has_value() || imaginary.has_value() ) { | ||
|
||
return CoherentDistributionData( std::move( frame ), | ||
std::move( function ), | ||
std::move( real.value() ), | ||
std::move( imaginary.value() ) ); | ||
} | ||
else { | ||
|
||
return CoherentDistributionData( std::move( frame ), | ||
std::move( function ) ); | ||
} | ||
} | ||
|
||
} // gnds namespace | ||
} // format namespace | ||
} // dryad namespace | ||
} // njoy namespace | ||
|
||
#endif |
43 changes: 43 additions & 0 deletions
43
src/dryad/format/gnds/createIncoherentDistributionData.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,43 @@ | ||
#ifndef NJOY_DRYAD_FORMAT_GNDS_CREATEINIncoherentDistributionData | ||
#define NJOY_DRYAD_FORMAT_GNDS_CREATEINIncoherentDistributionData | ||
|
||
// system includes | ||
#include <vector> | ||
|
||
// other includes | ||
#include "pugixml.hpp" | ||
#include "tools/Log.hpp" | ||
#include "dryad/format/gnds/createReferenceFrame.hpp" | ||
#include "dryad/format/gnds/createTabulatedScatteringFunctionFromNodes.hpp" | ||
#include "dryad/IncoherentDistributionData.hpp" | ||
|
||
namespace njoy { | ||
namespace dryad { | ||
namespace format { | ||
namespace gnds { | ||
|
||
/** | ||
* @brief Create a IncoherentDistributionData from a GNDS coherentPhotonScattering node | ||
*/ | ||
static IncoherentDistributionData | ||
createIncoherentDistributionData( const pugi::xml_node& incoherent ) { | ||
|
||
// check that this is a valid coherentPhotonScattering node | ||
throwExceptionOnWrongNode( incoherent, "incoherentPhotonScattering" ); | ||
|
||
// get the reference frame | ||
auto frame = createReferenceFrame( incoherent.attribute( "productFrame" ).as_string() ); | ||
|
||
auto node = incoherent.child( "scatteringFactor" ).first_child(); | ||
auto function = createTabulatedScatteringFunctionFromNodes( node ); | ||
|
||
return IncoherentDistributionData( std::move( frame ), | ||
std::move( function ) ); | ||
} | ||
|
||
} // gnds 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,6 @@ | |
|
||
// system includes | ||
#include <vector> | ||
#include <iostream> | ||
|
||
// other includes | ||
#include "pugixml.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
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
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.