18 #ifndef VFSYMETRICMATRIX_H 19 #define VFSYMETRICMATRIX_H 21 #if defined(__clang__) 22 #include <unordered_map> 23 #elif defined(__GNUC__) 25 #include <ext/hash_map> 27 #include <tr1/unordered_map> 30 #include <unordered_map> 33 #include <meteoio/MeteoIO.h> 47 void resize(
const int nx,
const int ny);
53 U
getElement(
const unsigned int x,
const unsigned int y);
55 const U
operator()(
const unsigned int& x,
const unsigned int& y)
const;
57 void setElement(
const unsigned int x,
const unsigned int y, U val);
64 #if defined(__clang__) 65 typedef std::unordered_map< int, T > my_map;
66 #elif defined(__GNUC__) 68 typedef __gnu_cxx::hash_map< int, T > my_map;
70 typedef std::tr1::unordered_map< int, T > my_map;
73 typedef std::tr1::unordered_map< int, T > my_map;
85 return (
int) mapData.size();
91 if ((x >= nx) || (y >= ny))
92 throw mio::IndexOutOfBoundsException(std::string(), AT);
98 typename my_map::iterator j = mapData.find(idx);
99 if ( j == mapData.end() ) {
100 return static_cast<U
>(0.);
102 return static_cast<U
>((*j).second);
109 if ((x >= nx) || (y >= ny))
110 throw mio::IndexOutOfBoundsException(std::string(), AT);
116 typename my_map::const_iterator j = mapData.find(idx);
117 if ( j == mapData.end() ) {
118 return static_cast<U
>(0.);
120 return static_cast<U
>((*j).second);
127 if ((x >= nx) || (y >= ny))
128 throw mio::IndexOutOfBoundsException(std::string(), AT);
130 T tval =
static_cast<T
>(val);
159 if ((anx > 0) && (any > 0)){
163 throw mio::IndexOutOfBoundsException(std::string(), AT);
184 mapData = val.mapData;
Definition: VFSymetricMatrix.h:40
VFSymetricMatrix()
Definition: VFSymetricMatrix.h:140
void GetSize(int &nx, int &ny)
Definition: VFSymetricMatrix.h:167
const U operator()(const unsigned int &x, const unsigned int &y) const
Definition: VFSymetricMatrix.h:106
void setElement(const unsigned int x, const unsigned int y, U val)
Definition: VFSymetricMatrix.h:124
U getElement(const unsigned int x, const unsigned int y)
Definition: VFSymetricMatrix.h:88
void Destroy()
Definition: VFSymetricMatrix.h:173
int size()
Definition: VFSymetricMatrix.h:83
void resize(const int nx, const int ny)
Definition: VFSymetricMatrix.h:156
~VFSymetricMatrix()
Definition: VFSymetricMatrix.h:151
VFSymetricMatrix< T, U > & operator=(VFSymetricMatrix< T, U > &val)
Definition: VFSymetricMatrix.h:179