File indexing completed on 2025-01-31 09:21:50
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035
0036
0037
0038
0039
0040
0041
0042
0043
0044 #ifndef CEXMC_SIMPLE_RANGE_WITH_VALUE_HH
0045 #define CEXMC_SIMPLE_RANGE_WITH_VALUE_HH
0046
0047 #include <vector>
0048 #include <iosfwd>
0049 #include <G4Types.hh>
0050
0051
0052 enum CexmcValueCategory
0053 {
0054 CexmcPlainValueCategory,
0055 CexmcEnergyValueCategory
0056 };
0057
0058
0059 template < CexmcValueCategory RangeCategory = CexmcPlainValueCategory,
0060 CexmcValueCategory ValueCategory = CexmcPlainValueCategory >
0061 struct CexmcSimpleRangeWithValue
0062 {
0063 CexmcSimpleRangeWithValue()
0064 {}
0065
0066 CexmcSimpleRangeWithValue( G4double bottom_, G4double top_,
0067 G4double value_ ) :
0068 bottom( bottom_ ), top( top_ ), value( value_ )
0069 {}
0070
0071 G4double bottom;
0072
0073 G4double top;
0074
0075 G4double value;
0076
0077 template < typename Archive >
0078 void serialize( Archive & archive, const unsigned int version );
0079 };
0080
0081
0082 template < CexmcValueCategory RangeCategory,
0083 CexmcValueCategory ValueCategory >
0084 template < typename Archive >
0085 inline void
0086 CexmcSimpleRangeWithValue< RangeCategory, ValueCategory >::serialize(
0087 Archive & archive, const unsigned int )
0088 {
0089 archive & bottom;
0090 archive & top;
0091 archive & value;
0092 }
0093
0094
0095 template < CexmcValueCategory RangeCategory,
0096 CexmcValueCategory ValueCategory >
0097 inline G4bool operator<(
0098 const CexmcSimpleRangeWithValue< RangeCategory, ValueCategory > & left,
0099 const CexmcSimpleRangeWithValue< RangeCategory, ValueCategory > & right )
0100 {
0101 if ( left.bottom != right.bottom )
0102 return left.bottom < right.bottom;
0103 if ( left.top != right.top )
0104 return left.top > right.top;
0105
0106 return false;
0107 }
0108
0109
0110 typedef CexmcSimpleRangeWithValue< CexmcEnergyValueCategory >
0111 CexmcEnergyRangeWithDoubleValue;
0112
0113 typedef std::vector< CexmcEnergyRangeWithDoubleValue >
0114 CexmcEnergyRangeWithDoubleValueList;
0115
0116
0117 std::ostream & operator<<( std::ostream & out,
0118 const CexmcEnergyRangeWithDoubleValue & range );
0119
0120
0121 std::ostream & operator<<( std::ostream & out,
0122 const CexmcEnergyRangeWithDoubleValueList & range );
0123
0124
0125 #endif
0126