-
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 fission neutron spectra vector and matrix records
- Loading branch information
Showing
12 changed files
with
362 additions
and
27 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,59 @@ | ||
#ifndef NJOY_NDITK_MULTIGROUP_FISSIONNEUTRONSPECTRUMMATRIX | ||
#define NJOY_NDITK_MULTIGROUP_FISSIONNEUTRONSPECTRUMMATRIX | ||
|
||
// system includes | ||
|
||
// other includes | ||
#include "tools/Log.hpp" | ||
#include "NDItk/base/RealListRecord.hpp" | ||
#include "NDItk/multigroup/FissionType.hpp" | ||
|
||
namespace njoy { | ||
namespace NDItk { | ||
namespace multigroup { | ||
|
||
/** | ||
* @brief A fission neutron spectrum matrix record for multigroup neutron and photon data | ||
*/ | ||
class FissionNeutronSpectrumMatrix : protected base::RealListRecord { | ||
|
||
/* fields */ | ||
|
||
/* auxiliary functions */ | ||
|
||
#include "NDItk/multigroup/FissionNeutronSpectrumMatrix/src/verify.hpp" | ||
|
||
public: | ||
|
||
/* constructor */ | ||
|
||
#include "NDItk/multigroup/FissionNeutronSpectrumMatrix/src/ctor.hpp" | ||
|
||
/* methods */ | ||
|
||
/** | ||
* @brief Return the fission type defined by this record | ||
*/ | ||
FissionType type() const { return this->key().fissionType().value(); } | ||
|
||
/** | ||
* @brief Return the number of groups defined by this record | ||
*/ | ||
unsigned int numberGroups() const { return std::sqrt( this->size() ); } | ||
|
||
using base::RealListRecord::keyword; | ||
using base::RealListRecord::values; | ||
using base::RealListRecord::size; | ||
using base::RealListRecord::empty; | ||
using base::RealListRecord::begin; | ||
using base::RealListRecord::end; | ||
using base::RealListRecord::print; | ||
|
||
#include "NDItk/multigroup/FissionNeutronSpectrumMatrix/src/read.hpp" | ||
}; | ||
|
||
} // multigroup namespace | ||
} // NDItk namespace | ||
} // njoy namespace | ||
|
||
#endif |
21 changes: 21 additions & 0 deletions
21
src/NDItk/multigroup/FissionNeutronSpectrumMatrix/src/ctor.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,21 @@ | ||
/** | ||
* @brief Default constructor | ||
*/ | ||
FissionNeutronSpectrumMatrix() : RealListRecord( base::Keyword( "chi_mat" ) ) {} | ||
|
||
/** | ||
* @brief Default constructor | ||
*/ | ||
FissionNeutronSpectrumMatrix( FissionType type ) : RealListRecord( base::Keyword( "chi_mat", type ) ) {} | ||
|
||
/** | ||
* @brief Constructor | ||
* | ||
* @param[in] values the fission neutron spectrum matrix values | ||
*/ | ||
FissionNeutronSpectrumMatrix( FissionType type, | ||
std::vector< double > values ) : | ||
RealListRecord( base::Keyword( "chi_mat", type ), std::move( values ) ) { | ||
|
||
verify( this->values() ); | ||
} |
16 changes: 16 additions & 0 deletions
16
src/NDItk/multigroup/FissionNeutronSpectrumMatrix/src/read.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,16 @@ | ||
/** | ||
* @brief Read the record data | ||
* | ||
* This function overrides the base record read() function to enable | ||
* verification of the read data. | ||
* | ||
* @param[in,out] iter an iterator to the current position in the input | ||
* @param[in,out] end an iterator to the end of the input | ||
* @param[in,out] number the number of groups | ||
*/ | ||
template< typename Iterator > | ||
void read( Iterator& iter, const Iterator& end, std::size_t number ) { | ||
|
||
base::RealListRecord::read( iter, end, number * number ); | ||
verify( this->values() ); | ||
}; |
18 changes: 18 additions & 0 deletions
18
src/NDItk/multigroup/FissionNeutronSpectrumMatrix/src/verify.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,18 @@ | ||
/** | ||
* @brief Verify the fission neutron spectrum vector values | ||
* | ||
* The following verification tests are performed: | ||
* - there is at least one value | ||
* | ||
* @param[in] values the production values to be verified | ||
*/ | ||
template < typename Range > | ||
static void verify( const Range& values ) { | ||
|
||
if ( values.size() < 1 ) { | ||
|
||
Log::error( "Expected at least one fission neutron spectrum matrix value, found {}", | ||
values.size() ); | ||
throw std::exception(); | ||
} | ||
} |
Oops, something went wrong.