Go to the documentation of this file.
5 #include <ext/hash_map>
6 #define stdext __gnu_cxx
11 template<
class CellT,
unsigned int DimT >
38 template<
class CellT >
47 operator const CellT& ()
const
62 template<
class CellT,
unsigned int DimT >
83 unsigned int* m_extent;
88 template<
class CellT >
110 template<
class CellT,
unsigned int DimT >
119 unsigned int i)
const
128 template<
class CellT >
136 operator const CellT& ()
const
145 template<
class CellT,
unsigned int DimT >
152 for (
unsigned int i = 0; i < DimT; ++i)
177 for (
unsigned int i = 0; i < DimT; ++i)
179 m_extent[i] = extent[i];
189 unsigned int i)
const
195 unsigned int m_extent[DimT];
199 template<
class CellT,
unsigned int DimT >
204 stdext::hash_map< size_t, CellT >& hash)
213 m_hashKey + (*m_factors) * i, m_hash);
217 const size_t* m_factors;
219 stdext::hash_map< size_t, CellT >& m_hash;
222 template<
class CellT >
227 stdext::hash_map< size_t, CellT >& hash)
234 return m_hash[m_hashKey] =
c;
239 return m_hash[m_hashKey];
244 return m_hash[m_hashKey];
249 return &m_hash[m_hashKey];
254 stdext::hash_map< size_t, CellT >& m_hash;
257 template<
class CellT,
unsigned int DimT >
262 const stdext::hash_map< size_t, CellT >& hash)
271 m_hashKey + (*m_factors) * i, m_hash);
275 const size_t* m_factors;
277 const stdext::hash_map< size_t, CellT >& m_hash;
280 template<
class CellT >
285 const stdext::hash_map< size_t, CellT >& hash)
290 operator const CellT* ()
292 typename stdext::hash_map< size_t, CellT >::const_iterator i =
293 m_hash.find(m_hashKey);
294 if (i != m_hash.end())
303 const stdext::hash_map< size_t, CellT >& m_hash;
306 template<
class CellT,
unsigned int DimT >
310 typedef typename stdext::hash_map< size_t, CellT >::iterator
iterator;
311 typedef typename stdext::hash_map< size_t, CellT >::const_iterator
316 for (
unsigned int i = 0; i < DimT; ++i)
327 template<
class ExtentT >
330 m_factors[DimT - 1] = 1;
331 for (
unsigned int i = DimT - 1; i != 0; --i)
333 m_factors[i - 1] = m_factors[i] * extent[i];
347 template<
class IndexT >
350 return m_hash[HashKey(
index)];
353 CellT&
at(
size_t hashKey)
355 return m_hash[hashKey];
358 const CellT&
at(
size_t hashKey)
const
360 return m_hash[hashKey];
363 template<
class IndexT >
367 if (i != m_hash.end())
374 template<
class IndexT >
378 if (i != m_hash.end())
387 return m_hash.begin();
395 return m_hash.begin();
403 return m_hash.size();
407 template<
class IndexT >
408 size_t HashKey(
const IndexT&
index)
const
410 size_t hashKey = m_factors[0] *
index[0];
411 for (
unsigned int i = 1; i < DimT; ++i)
413 hashKey += m_factors[i] *
index[i];
419 size_t m_factors[DimT];
420 stdext::hash_map< size_t, CellT > m_hash;
CellT & operator=(const CellT &c)
ArrayGridAccessor< CellT, DimT - 1 > operator[](unsigned int i)
CellT & at(size_t hashKey)
ConstHashGridAccessor< CellT, DimT - 1 > operator[](size_t i) const
ArrayGridKernel(ArrayGridKernel< CellT, DimT - 1 > *array)
ConstHashGridAccessor< CellT, DimT - 1 > operator[](size_t i)
const ConstArrayGridAccessor< CellT, DimT - 1 > operator[](unsigned int i) const
stdext::hash_map< size_t, CellT >::iterator iterator
HashGridAccessor(const size_t *factors, size_t hashKey, stdext::hash_map< size_t, CellT > &hash)
ArrayGridKernel< CellT, DimT - 1 > * m_array
const_iterator begin() const
stdext::hash_map< size_t, CellT >::const_iterator const_iterator
HashGridAccessor< CellT, DimT - 1 > operator[](size_t i)
const CellT * find(const IndexT &index) const
const ConstArrayGridAccessor< CellT, DimT - 1 > operator[](unsigned int i) const
ArrayGridAccessor(unsigned int *extent, ArrayGridKernel< CellT, DimT - 1 > *&array)
CellT & operator[](const IndexT *index)
ConstArrayGridAccessor(const ArrayGridKernel< CellT, DimT - 1 > *array)
ConstHashGridAccessor(const size_t *, size_t hashKey, const stdext::hash_map< size_t, CellT > &hash)
const_iterator end() const
ArrayGrid(const unsigned int *extent)
CellT & operator=(const CellT &c)
HashGridAccessor(const size_t *, size_t hashKey, stdext::hash_map< size_t, CellT > &hash)
ArrayGridAccessor< CellT, DimT - 1 > operator[](unsigned int i)
ArrayGrid(const MiscLib::Vector< unsigned int > &extent)
const CellT & at(size_t hashKey) const
ConstHashGridAccessor(const size_t *factors, size_t hashKey, const stdext::hash_map< size_t, CellT > &hash)
void Extent(const unsigned int *extent)
ArrayGridAccessor(unsigned int *, CellT &cell)
ConstArrayGridAccessor(unsigned int *, const CellT &cell)
HashGridAccessor< CellT, DimT - 1 > operator[](size_t i)
ArrayGridKernel< CellT, DimT - 1 > *& Data()
CellT * find(const IndexT &index)
void Extent(const ExtentT &extent)