-
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
13 changed files
with
254 additions
and
24 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
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
16 changes: 16 additions & 0 deletions
16
src/NDItk/MultigroupTable/src/generateOutgoingStructureMetadata.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 @@ | ||
static std::map< unsigned int, unsigned int > | ||
generateOutgoingStructureMetadata( const std::vector< multigroup::EnergyGroupStructure >& outgoing ) { | ||
|
||
std::map< unsigned int, unsigned int > metadata; | ||
for ( const auto& entry : outgoing ) { | ||
|
||
unsigned int particle = entry.particle().value(); | ||
if ( metadata.find( particle ) != metadata.end() ) { | ||
|
||
Log::error( "Found duplicate outgoing group structure for particle \'{}\'", particle ); | ||
throw std::exception(); | ||
} | ||
metadata[ particle ] = entry.numberGroups(); | ||
} | ||
return metadata; | ||
} |
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,32 @@ | ||
template< typename Iterator > | ||
void readOutgoingStructure( const std::string& key, Iterator& iter, const Iterator& end ) { | ||
|
||
base::Keyword secondary( key ); | ||
unsigned int particle = secondary.particle().value(); | ||
if ( this->metadata_.numberOutgoingGroups( particle ).has_value() ) { | ||
|
||
auto pos = std::lower_bound( this->outgoing_structure_.begin(), | ||
this->outgoing_structure_.end(), | ||
particle, | ||
[] ( auto&& left, auto&& right ) { | ||
|
||
return left.particle() < right; | ||
} ); | ||
if ( pos != this->outgoing_structure_.end() ) { | ||
|
||
if ( pos->particle() == particle ) { | ||
|
||
Log::error( "Duplicate keyword found: \'{}\'", secondary.keyword() ); | ||
throw std::exception(); | ||
} | ||
} | ||
pos = this->outgoing_structure_.insert( pos, multigroup::EnergyGroupStructure( particle ) ); | ||
readRecord( *pos, iter, end, this->metadata_.numberOutgoingGroups( particle ).value() + 1 ); | ||
} | ||
else { | ||
|
||
Log::error( "Metadata required for the \'\' record was not found", secondary.keyword() ); | ||
Log::info( "Required metadata is missing: number of groups in the outgoing group structure" ); | ||
throw std::exception(); | ||
} | ||
} |
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,15 @@ | ||
template< typename Iterator > | ||
void readPrimaryStructure( Iterator& iter, const Iterator& end ) { | ||
|
||
if ( this->metadata_.numberGroups().has_value() ) { | ||
|
||
readRecord( this->primary_structure_, iter, end, | ||
this->metadata_.numberGroups().value() + 1 ); | ||
} | ||
else { | ||
|
||
Log::error( "Metadata required for the \'\' record was not found", this->primary_structure_.keyword() ); | ||
Log::info( "Required metadata is missing: number of groups in the primary group structure" ); | ||
throw std::exception(); | ||
} | ||
} |
Oops, something went wrong.