a Code for the Combination of Indirect and Direct Constraints on High Energy Physics Models Logo
SparseQuadruplyIndexedBlock.hpp
Go to the documentation of this file.
1/*
2 * SparseQuadruplyIndexedBlock.hpp
3 *
4 * Created on: Apr 1, 2012 (really!)
5 * Author: Ben O'Leary (benjamin.oleary@gmail.com)
6 * Copyright 2012 Ben O'Leary
7 *
8 * This file is part of LesHouchesParserClasses, released under the
9 * GNU General Public License. Please see the accompanying
10 * README.LHPC_CPP.txt file for a full list of files, brief documentation
11 * on how to use these classes, and further details on the license.
12 */
13
14#ifndef SPARSEQUADRUPLYINDEXEDBLOCK_HPP_
15#define SPARSEQUADRUPLYINDEXEDBLOCK_HPP_
16
19
20namespace LHPC
21{
22 namespace SLHA
23 {
24 /* this template class interprets all the blocks with the same name, though
25 * differing scale values, which are interpreted as having a pair of int
26 * indices which does not have to have entries for each value (nor even
27 * necessarily positive index values).
28 */
29 template< class ValueClass >
31 ValueClass,
32 InterpreterClass::SparseQuadruplyIndexed< ValueClass > >
33 {
34 public:
35 SparseQuadruplyIndexedBlock( std::string const& blockName,
36 ValueClass const& defaultUnsetValue,
37 bool const isVerbose = false,
38 int const firstIndexDigits = 9,
39 int const secondIndexDigits = 9,
40 int const thirdIndexDigits = 2,
41 int const fourthIndexDigits = 2 );
42 virtual
44
45 ValueClass&
46 operator()( std::pair< std::pair< int, int >,
47 std::pair< int, int > > const& indexQuadruple );
48 // this returns operator() of the lowest-scale interpreter.
49 ValueClass const&
50 operator()( std::pair< std::pair< int, int >,
51 std::pair< int, int > > const& indexQuadruple ) const;
52 // const version of above.
53 ValueClass&
54 operator()( int const firstIndex,
55 int const secondIndex,
56 int const thirdIndex,
57 int const fourthIndex )
58 { return (*this)( std::make_pair( std::make_pair( firstIndex,
59 secondIndex ),
60 std::make_pair( thirdIndex,
61 fourthIndex ) ) ); }
62 ValueClass const&
63 operator()( int const firstIndex,
64 int const secondIndex,
65 int const thirdIndex,
66 int const fourthIndex ) const
67 { return (*this)( std::make_pair( std::make_pair( firstIndex,
68 secondIndex ),
69 std::make_pair( thirdIndex,
70 fourthIndex ) ) ); }
71 bool
72 hasEntry( std::pair< std::pair< int, int >,
73 std::pair< int, int > > const& indexQuadruple ) const;
74 // this returns hasEntry( indexPair ) of the lowest-scale interpreter.
75 bool
76 hasEntry( int const firstIndex,
77 int const secondIndex,
78 int const thirdIndex,
79 int const fourthIndex ) const
80 { return hasEntry( std::make_pair( std::make_pair( firstIndex,
81 secondIndex ),
82 std::make_pair( thirdIndex,
83 fourthIndex ) ) ); }
84 };
85
86
87
88
89
90 template< class ValueClass >
91 inline
93 std::string const& blockName,
94 ValueClass const& defaultUnsetValue,
95 bool const isVerbose,
96 int const firstIndexDigits,
97 int const secondIndexDigits,
98 int const thirdIndexDigits,
99 int const fourthIndexDigits ) :
100 IndexedBlockTemplate< ValueClass,
101 InterpreterClass::SparseQuadruplyIndexed< ValueClass > >(
102 blockName,
103 defaultUnsetValue,
104 isVerbose,
105 BOL::Vi( firstIndexDigits )(
106 secondIndexDigits )(
107 thirdIndexDigits ).e(
108 fourthIndexDigits ) )
109 {
110 // just an initialization list.
111 }
112
113 template< class ValueClass >
114 inline
116 {
117 // does nothing.
118 }
119
120
121 template< class ValueClass >
122 inline ValueClass&
124 std::pair< std::pair< int, int >,
125 std::pair< int, int > > const& indexQuadruple )
126 // this returns operator() of the lowest-scale interpreter.
127 {
128 return this->dataBlocks[ this->lowestScaleIndex ]( indexQuadruple );
129 }
130
131 template< class ValueClass >
132 inline ValueClass const&
134 std::pair< std::pair< int, int >,
135 std::pair< int, int > > const& indexQuadruple ) const
136 // const version of above.
137 {
138 return this->dataBlocks[ this->lowestScaleIndex ]( indexQuadruple );
139 }
140
141 template< class ValueClass >
142 inline bool
144 std::pair< std::pair< int, int >,
145 std::pair< int, int > > const& indexQuadruple ) const
146 // derived classes over-ride this to interpret their data as a
147 // std::string.
148 {
149 return
150 this->dataBlocks[ this->lowestScaleIndex ].hasEntry( indexQuadruple );
151 }
152
153 } // end of SLHA namespace
154
155} // end of LHPC namespace
156
157
158#endif /* SPARSEQUADRUPLYINDEXEDBLOCK_HPP_ */
ValueClass const defaultUnsetValue
Definition: SlhaBlock.hpp:139
ValueClass const & operator()(int const firstIndex, int const secondIndex, int const thirdIndex, int const fourthIndex) const
ValueClass & operator()(std::pair< std::pair< int, int >, std::pair< int, int > > const &indexQuadruple)
SparseQuadruplyIndexedBlock(std::string const &blockName, ValueClass const &defaultUnsetValue, bool const isVerbose=false, int const firstIndexDigits=9, int const secondIndexDigits=9, int const thirdIndexDigits=2, int const fourthIndexDigits=2)
bool hasEntry(std::pair< std::pair< int, int >, std::pair< int, int > > const &indexQuadruple) const
bool hasEntry(int const firstIndex, int const secondIndex, int const thirdIndex, int const fourthIndex) const
ValueClass & operator()(int const firstIndex, int const secondIndex, int const thirdIndex, int const fourthIndex)
StdVectorFiller< int > Vi