14#ifndef DENSETRIPLYINDEXED_HPP_
15#define DENSETRIPLYINDEXED_HPP_
23 namespace InterpreterClass
29 template<
class ValueClass >
49 int thirdIndex )
const;
56 int const secondIndex,
57 int const thirdIndex )
const;
59 virtual std::string
const&
81 int const thirdIndex );
92 template<
class ValueClass >
97 firstRecordingIndex( 0 ),
98 secondRecordingIndex( 0 ),
99 thirdRecordingIndex( 0 ),
100 largestFirstIndex( 0 ),
101 largestSecondIndex( 0 ),
102 largestThirdIndex( 0 )
107 template<
class ValueClass >
115 template<
class ValueClass >
118 int const secondIndex,
119 int const thirdIndex )
126 return findOrMakeEntry( firstIndex,
131 template<
class ValueClass >
132 inline ValueClass
const&
135 int thirdIndex )
const
141 if( hasEntry( firstIndex,
145 return valueMatrixArray[ firstIndex - 1 ][ secondIndex
146 - 1 ][ thirdIndex - 1 ];
150 return this->defaultUnsetValue;
154 template<
class ValueClass >
158 int const thirdIndex )
const
160 if( ( 0 < firstIndex )
166 ( (--firstIndex) < valueMatrixArray.getSize() )
168 ( (--secondIndex) < valueMatrixArray[ firstIndex ].getSize() )
171 <= valueMatrixArray[ firstIndex ][ secondIndex ].size() ) )
181 template<
class ValueClass >
182 inline std::string
const&
186 this->stringInterpretation.clear();
187 for(
int firstIndex( 1 );
188 largestFirstIndex >= firstIndex;
191 for(
int secondIndex( 1 );
192 largestSecondIndex >= secondIndex;
195 for(
size_t thirdIndex( 1 );
196 largestThirdIndex >= thirdIndex;
199 this->indexPrintingVector[ 0 ] = firstIndex;
200 this->indexPrintingVector[ 1 ] = secondIndex;
201 this->indexPrintingVector[ 2 ] = thirdIndex;
202 this->stringInterpretation.append(
203 this->indicesToPrintingString() );
206 this->stringInterpretation.append( this->valueToPrintingString(
207 findOrMakeEntry( firstIndex,
210 this->stringInterpretation.append(
"\n" );
214 return this->stringInterpretation;
217 template<
class ValueClass >
223 valueMatrixArray.clearEntries();
226 template<
class ValueClass >
230 for(
int whichLine( this->currentStringBlock->getNumberOfBodyLines() );
235 (*(this->currentStringBlock))[ whichLine ].first,
236 &(this->lineRemainderA),
238 if( !(this->currentWord.empty()) )
243 this->lineRemainderA,
244 &(this->lineRemainderB),
249 this->lineRemainderB,
250 &(this->lineRemainderA),
255 this->lineRemainderA,
258 if( ( 0 < firstRecordingIndex )
260 ( 0 < secondRecordingIndex )
262 ( 0 < thirdRecordingIndex )
264 !(this->currentWord.empty()) )
266 findOrMakeEntry( firstRecordingIndex,
267 secondRecordingIndex,
268 thirdRecordingIndex )
269 = this->stringToValue( this->currentWord );
271 else if( this->isVerbose )
275 <<
"LHPC::SLHA::error! expected to find 3 positive indices then"
276 <<
" a value, instead found \""
277 << (*(this->currentStringBlock))[ whichLine ].first <<
"\"";
278 std::cout << std::endl;
284 template<
class ValueClass >
288 int const thirdIndex )
292 if( firstIndex > largestFirstIndex )
294 largestFirstIndex = firstIndex;
296 if( secondIndex > largestSecondIndex )
298 largestSecondIndex = secondIndex;
300 if( (
size_t)thirdIndex > largestThirdIndex )
302 largestThirdIndex = thirdIndex;
304 while( valueMatrixArray.getSize() < firstIndex )
306 valueMatrixArray.newEnd().clearEntries();
310 while( valueMatrixArray[ firstIndex ].getSize() < secondIndex )
312 valueMatrixArray[ firstIndex ].newEnd().clear();
315 if( valueMatrixArray[ firstIndex ][ (--secondIndex) ].size()
316 < (
size_t)thirdIndex )
320 valueMatrixArray[ firstIndex ][ secondIndex ].resize( thirdIndex,
321 this->defaultUnsetValue );
323 return valueMatrixArray[ firstIndex ][ secondIndex ][ thirdIndex - 1 ];
static std::string firstWordOf(std::string const &stringToParse, std::string *const remainderString=NULL, std::string const &separatorChars=whitespaceChars)
static std::string const whitespaceAndNewlineChars
static std::string trimFromFrontAndBack(std::string const &stringToTrim, std::string const &charsToTrim=whitespaceAndNewlineChars)
static int stringToInt(std::string const &stringToInterpret)
virtual void clearEntries()
virtual void interpretCurrentStringBlock()
virtual ~DenseTriplyIndexed()
virtual std::string const & getAsString()
size_t thirdRecordingIndex
ValueClass & findOrMakeEntry(int firstIndex, int secondIndex, int const thirdIndex)
class BOL::VectorlikeArray< std::vector< ValueClass > > ValueRankTwoMatrix
bool hasEntry(int const firstIndex, int const secondIndex, int const thirdIndex) const
ValueClass & operator()(int firstIndex, int secondIndex, int thirdIndex)
BOL::VectorlikeArray< ValueRankTwoMatrix > valueMatrixArray