[772] | 1 | // This may look like C code, but it is really -*- C++ -*-
|
---|
| 2 | // template array class for numerical types
|
---|
| 3 | // R. Ansari, C.Magneville 03/2000
|
---|
| 4 |
|
---|
| 5 | #ifndef TArray_SEEN
|
---|
| 6 | #define TArray_SEEN
|
---|
| 7 |
|
---|
| 8 | #include "machdefs.h"
|
---|
| 9 | #include <math.h>
|
---|
| 10 | #include <iostream.h>
|
---|
[787] | 11 | #include "basarr.h"
|
---|
[772] | 12 | #include "ndatablock.h"
|
---|
| 13 | #include <complex>
|
---|
[785] | 14 | #include "utilarr.h"
|
---|
[772] | 15 |
|
---|
| 16 |
|
---|
| 17 | namespace SOPHYA {
|
---|
| 18 |
|
---|
| 19 | // Forward declaration
|
---|
| 20 | template <class T> class FIO_TArray;
|
---|
| 21 |
|
---|
[787] | 22 | // --------------------------- classe template Array -----------------------
|
---|
| 23 | // ( See BaseArray class for data organisation in memory and related methods )
|
---|
| 24 |
|
---|
[894] | 25 | //! Class for template arrays
|
---|
[772] | 26 | template <class T>
|
---|
[787] | 27 | class TArray : public BaseArray {
|
---|
[772] | 28 | public:
|
---|
| 29 | // Creation / destruction
|
---|
| 30 | TArray();
|
---|
[804] | 31 | TArray(uint_4 ndim, const uint_4 * siz, uint_4 step =1);
|
---|
| 32 | TArray(uint_4 nx, uint_4 ny=0, uint_4 nz=0, uint_4 nt=0, uint_4 nu=0);
|
---|
| 33 | TArray(uint_4 ndim, const uint_4 * siz, NDataBlock<T> & db, bool share=false, uint_4 step=1, uint_8 offset=0);
|
---|
| 34 | TArray(uint_4 ndim, const uint_4 * siz, T* values, uint_4 step=1, uint_8 offset=0, Bridge* br=NULL);
|
---|
[772] | 35 | TArray(const TArray<T>& a);
|
---|
| 36 | TArray(const TArray<T>& a, bool share);
|
---|
| 37 |
|
---|
| 38 | virtual ~TArray();
|
---|
| 39 |
|
---|
[967] | 40 | // A = B
|
---|
[894] | 41 | //! = operator between TArray
|
---|
[967] | 42 | /*! \sa Set \sa NDataBlock::operator=(const NDataBlock<T>&) */
|
---|
[804] | 43 | inline TArray<T>& operator = (const TArray<T>& a) { return Set(a); }
|
---|
| 44 | virtual TArray<T>& Set(const TArray<T>& a);
|
---|
[772] | 45 |
|
---|
| 46 | // Gestion taille/Remplissage
|
---|
| 47 | virtual void Clone(const TArray<T>& a);
|
---|
[970] | 48 | // partage les donnees si "a" temporaire, clone sinon.
|
---|
| 49 | void CloneOrShare(const TArray<T>& a);
|
---|
| 50 | // Share: partage les donnees de "a"
|
---|
| 51 |
|
---|
| 52 | void Share(const TArray<T>& a);
|
---|
[804] | 53 | void ReSize(uint_4 ndim, uint_4 * siz, uint_4 step=1);
|
---|
| 54 | void Realloc(uint_4 ndim, uint_4 * siz, uint_4 step=1, bool force=false);
|
---|
[787] | 55 |
|
---|
[785] | 56 | // Compacts size=1 array dimensions
|
---|
[787] | 57 | virtual TArray<T>& CompactAllDimensions();
|
---|
| 58 | virtual TArray<T>& CompactTrailingDimensions();
|
---|
[785] | 59 |
|
---|
[804] | 60 | // Packing array elements in memory
|
---|
| 61 | virtual TArray<T> PackElements(bool force=false) const ;
|
---|
[772] | 62 |
|
---|
[804] | 63 | // SubArrays - $CHECK$ Reza 03/2000 je ne sais pas s'il faut declarer ca const ??
|
---|
[894] | 64 | TArray<T> SubArray(Range rx, Range ry, Range rz, Range rt, Range ru) const ;
|
---|
[963] | 65 | #if !defined(__GNUG__)
|
---|
[894] | 66 | //! () operator for Sub arrays extraction
|
---|
| 67 | /*! \sa SubArray */
|
---|
[804] | 68 | inline TArray<T> operator () (Range rx, Range ry, Range rz, Range rt=0, Range ru=0) const
|
---|
| 69 | { return SubArray(rx, ry, rz, rt, ru); }
|
---|
[963] | 70 | #else
|
---|
| 71 | // g++ (2.95) se melange les pinceaux avec les arguments par defaut !
|
---|
| 72 | //! () operator for Sub arrays extraction
|
---|
| 73 | /*! \sa SubArray */
|
---|
| 74 | inline TArray<T> operator () (Range rx, Range ry, Range rz) const
|
---|
| 75 | { return SubArray(rx, ry, rz, Range(0), Range(0)); }
|
---|
| 76 | inline TArray<T> operator () (Range rx, Range ry, Range rz, Range rt) const
|
---|
| 77 | { return SubArray(rx, ry, rz, rt, Range(0)); }
|
---|
| 78 | inline TArray<T> operator () (Range rx, Range ry, Range rz, Range rt, Range ru) const
|
---|
| 79 | { return SubArray(rx, ry, rz, rt, ru); }
|
---|
| 80 | #endif
|
---|
[772] | 81 |
|
---|
[787] | 82 | // ---- Access to data
|
---|
| 83 | // Definition of virtual element acces method inherited from BaseArray class
|
---|
| 84 | virtual double ValueAtPosition(uint_8 ip) const;
|
---|
[785] | 85 |
|
---|
[787] | 86 | // Data Access: operator overloaded inline acces methods
|
---|
[772] | 87 | inline T const& operator()(uint_4 ix, uint_4 iy, uint_4 iz) const ;
|
---|
| 88 | inline T& operator()(uint_4 ix, uint_4 iy, uint_4 iz);
|
---|
| 89 | inline T const& operator()(uint_4 ix, uint_4 iy, uint_4 iz, uint_4 it, uint_4 iu=0) const ;
|
---|
| 90 | inline T& operator()(uint_4 ix, uint_4 iy, uint_4 iz, uint_4 it, uint_4 iu=0);
|
---|
[785] | 91 | inline T const& operator[](uint_8 ip) const ;
|
---|
| 92 | inline T& operator[](uint_8 ip);
|
---|
[772] | 93 |
|
---|
| 94 | inline T const& Elem(uint_4 ix, uint_4 iy, uint_4 iz, uint_4 it=0, uint_4 iu=0) const ;
|
---|
| 95 | inline T& Elem(uint_4 ix, uint_4 iy, uint_4 iz, uint_4 it=0, uint_4 iu=0);
|
---|
| 96 | inline T const& ElemCheckBound(uint_4 ix, uint_4 iy, uint_4 iz, uint_4 it=0, uint_4 iu=0) const ;
|
---|
| 97 | inline T& ElemCheckBound(uint_4 ix, uint_4 iy, uint_4 iz, uint_4 it=0, uint_4 iu=0);
|
---|
| 98 |
|
---|
[894] | 99 | //! Return pointer to first element adress
|
---|
[772] | 100 | inline T* Data() {return mNDBlock.Begin()+offset_;}
|
---|
[894] | 101 | //! Return pointer to first element adress
|
---|
[772] | 102 | inline const T* Data() const {return mNDBlock.Begin()+offset_;}
|
---|
[894] | 103 | //! Return reference to datablock NDataBlock
|
---|
[772] | 104 | inline NDataBlock<T>& DataBlock() {return mNDBlock;}
|
---|
[894] | 105 | //! Return reference to datablock NDataBlock
|
---|
[772] | 106 | inline const NDataBlock<T>& DataBlock() const {return mNDBlock;}
|
---|
| 107 |
|
---|
[787] | 108 | // Temporaire?
|
---|
[894] | 109 | //! Are the array temporay ?
|
---|
[787] | 110 | inline bool IsTemp(void) const {return mNDBlock.IsTemp();}
|
---|
[894] | 111 | //! Set the array as temporay
|
---|
[787] | 112 | inline void SetTemp(bool temp=false) const {mNDBlock.SetTemp(temp);}
|
---|
| 113 |
|
---|
[772] | 114 | // Operations diverses = , +=, ...
|
---|
| 115 | // Conversion en type T, if Size() == 1
|
---|
[787] | 116 | inline T toScalar();
|
---|
[772] | 117 | // Met les elements a une suite de valeurs
|
---|
[813] | 118 | virtual TArray<T>& SetSeq(Sequence seq);
|
---|
[894] | 119 | //! Fill TArray with Sequence \b seq
|
---|
[813] | 120 | inline TArray<T>& operator = (Sequence seq) { return SetSeq(seq); }
|
---|
[772] | 121 | // A = x (tous les elements a x)
|
---|
[813] | 122 | virtual TArray<T>& SetT(T x);
|
---|
[894] | 123 | //! Fill TArray with all elements equal to \b x
|
---|
[813] | 124 | inline TArray<T>& operator = (T x) { return SetT(x); }
|
---|
[772] | 125 | // A += -= *= /= x (ajoute, soustrait, ... x a tous les elements)
|
---|
[804] | 126 | virtual TArray<T>& Add(T x);
|
---|
[894] | 127 | //! Add \b x to all elements
|
---|
[804] | 128 | inline TArray<T>& operator += (T x) { return Add(x); }
|
---|
[970] | 129 | virtual TArray<T>& Sub(T x, bool fginv=false);
|
---|
[894] | 130 | //! Substract \b x to all elements
|
---|
[804] | 131 | inline TArray<T>& operator -= (T x) { return Sub(x); }
|
---|
| 132 | virtual TArray<T>& Mul(T x);
|
---|
[894] | 133 | //! Multiply all elements by \b x
|
---|
[804] | 134 | inline TArray<T>& operator *= (T x) { return Mul(x); }
|
---|
[970] | 135 | virtual TArray<T>& Div(T x, bool fginv=false);
|
---|
[894] | 136 | //! Divide all elements by \b x
|
---|
[804] | 137 | inline TArray<T>& operator /= (T x) { return Div(x); }
|
---|
| 138 |
|
---|
[772] | 139 | // A += -= (ajoute, soustrait element par element les deux tableaux )
|
---|
[804] | 140 | virtual TArray<T>& AddElt(const TArray<T>& a);
|
---|
[894] | 141 | //! Operator TArray += TArray
|
---|
[804] | 142 | inline TArray<T>& operator += (const TArray<T>& a) { return AddElt(a); }
|
---|
[970] | 143 | virtual TArray<T>& SubElt(const TArray<T>& a, bool fginv=false);
|
---|
[894] | 144 | //! Operator TArray -= TArray
|
---|
[804] | 145 | inline TArray<T>& operator -= (const TArray<T>& a) { return SubElt(a); }
|
---|
[787] | 146 | // Multiplication, division element par element les deux tableaux
|
---|
[804] | 147 | virtual TArray<T>& MulElt(const TArray<T>& a);
|
---|
[970] | 148 | virtual TArray<T>& DivElt(const TArray<T>& a, bool fginv=false);
|
---|
[804] | 149 | // Recopie des valeurs, element par element
|
---|
| 150 | virtual TArray<T>& CopyElt(const TArray<T>& a);
|
---|
[772] | 151 |
|
---|
[804] | 152 | // Somme et produit des elements
|
---|
| 153 | virtual T Sum() const ;
|
---|
| 154 | virtual T Product() const ;
|
---|
| 155 |
|
---|
[772] | 156 | // Impression, I/O, ...
|
---|
[813] | 157 | virtual string InfoString() const;
|
---|
| 158 | virtual void Print(ostream& os, int_4 maxprt=-1, bool si=false) const ;
|
---|
[772] | 159 |
|
---|
| 160 | // Pour la gestion de persistance
|
---|
| 161 | friend class FIO_TArray<T>;
|
---|
| 162 |
|
---|
| 163 | protected:
|
---|
| 164 |
|
---|
[894] | 165 | NDataBlock<T> mNDBlock; //!< Block for datas
|
---|
[772] | 166 | };
|
---|
| 167 |
|
---|
| 168 | ////////////////////////////////////////////////////////////////
|
---|
| 169 | // Surcharge d'operateur <<
|
---|
[894] | 170 | //! Print TArray \b a on stream \b os
|
---|
[772] | 171 | template <class T>
|
---|
| 172 | inline ostream& operator << (ostream& os, const TArray<T>& a)
|
---|
| 173 | { a.Print(os); return(os); }
|
---|
| 174 |
|
---|
| 175 | ////////////////////////////////////////////////////////////////
|
---|
| 176 | // Surcharge d'operateurs A (+,-,*,/) (T) x
|
---|
| 177 |
|
---|
[958] | 178 | /*! \ingroup TArray \fn operator+(const TArray<T>&,T)
|
---|
| 179 | \brief Operator TArray = TArray + constant */
|
---|
[772] | 180 | template <class T> inline TArray<T> operator + (const TArray<T>& a, T b)
|
---|
[970] | 181 | {TArray<T> result; result.CloneOrShare(a); result.SetTemp(true);
|
---|
| 182 | result.Add(b); return result;}
|
---|
[772] | 183 |
|
---|
[958] | 184 | /*! \ingroup TArray \fn operator+(T,const TArray<T>&)
|
---|
| 185 | \brief Operator TArray = constant + TArray */
|
---|
[772] | 186 | template <class T> inline TArray<T> operator + (T b,const TArray<T>& a)
|
---|
[970] | 187 | {TArray<T> result; result.CloneOrShare(a); result.SetTemp(true);
|
---|
| 188 | result.Add(b); return result;}
|
---|
[772] | 189 |
|
---|
[958] | 190 | /*! \ingroup TArray \fn operator-(const TArray<T>&,T)
|
---|
| 191 | \brief Operator TArray = TArray - constant */
|
---|
[772] | 192 | template <class T> inline TArray<T> operator - (const TArray<T>& a, T b)
|
---|
[970] | 193 | {TArray<T> result; result.CloneOrShare(a); result.SetTemp(true);
|
---|
| 194 | result.Sub(b); return result;}
|
---|
[772] | 195 |
|
---|
[958] | 196 | /*! \ingroup TArray \fn operator-(T,const TArray<T>&)
|
---|
| 197 | \brief Operator TArray = constant - TArray */
|
---|
[772] | 198 | template <class T> inline TArray<T> operator - (T b,const TArray<T>& a)
|
---|
[970] | 199 | {TArray<T> result; result.CloneOrShare(a); result.SetTemp(true);
|
---|
| 200 | result.Sub(b,true); return result;}
|
---|
[772] | 201 |
|
---|
[958] | 202 | /*! \ingroup TArray \fn operator*(const TArray<T>&,T)
|
---|
| 203 | \brief Operator TArray = TArray * constant */
|
---|
[772] | 204 | template <class T> inline TArray<T> operator * (const TArray<T>& a, T b)
|
---|
[970] | 205 | {TArray<T> result; result.CloneOrShare(a); result.SetTemp(true);
|
---|
| 206 | result.Mul(b); return result;}
|
---|
[772] | 207 |
|
---|
[958] | 208 | /*! \ingroup TArray \fn operator*(T,const TArray<T>&)
|
---|
| 209 | \brief Operator TArray = constant * TArray */
|
---|
[772] | 210 | template <class T> inline TArray<T> operator * (T b,const TArray<T>& a)
|
---|
[970] | 211 | {TArray<T> result; result.CloneOrShare(a); result.SetTemp(true);
|
---|
| 212 | result.Mul(b); return result;}
|
---|
[772] | 213 |
|
---|
[958] | 214 | /*! \ingroup TArray \fn operator/(const TArray<T>&,T)
|
---|
| 215 | \brief Operator TArray = TArray / constant */
|
---|
[772] | 216 | template <class T> inline TArray<T> operator / (const TArray<T>& a, T b)
|
---|
[970] | 217 | {TArray<T> result; result.CloneOrShare(a); result.SetTemp(true);
|
---|
| 218 | result.Div(b); return result;}
|
---|
[772] | 219 |
|
---|
[970] | 220 | /*! \ingroup TArray \fn operator/(T,const TArray<T>&)
|
---|
| 221 | \brief Operator TArray = constant / TArray */
|
---|
| 222 | template <class T> inline TArray<T> operator / (T b, const TArray<T>& a)
|
---|
| 223 | {TArray<T> result; result.CloneOrShare(a); result.SetTemp(true);
|
---|
| 224 | result.Div(b, true); return result;}
|
---|
| 225 |
|
---|
[772] | 226 | ////////////////////////////////////////////////////////////////
|
---|
| 227 | // Surcharge d'operateurs C = A (+,-) B
|
---|
| 228 |
|
---|
[958] | 229 | /*! \ingroup TArray \fn operator+(const TArray<T>&,const TArray<T>&)
|
---|
| 230 | \brief Operator TArray = TArray + TArray */
|
---|
[772] | 231 | template <class T>
|
---|
| 232 | inline TArray<T> operator + (const TArray<T>& a,const TArray<T>& b)
|
---|
[970] | 233 | { TArray<T> result; result.SetTemp(true);
|
---|
| 234 | if (b.IsTemp()) { result.Share(b); result.AddElt(a); }
|
---|
| 235 | else { result.CloneOrShare(a); result.AddElt(b); }
|
---|
| 236 | return result; }
|
---|
[772] | 237 |
|
---|
[958] | 238 | /*! \ingroup TArray \fn operator-(const TArray<T>&,const TArray<T>&)
|
---|
| 239 | \brief Operator TArray = TArray - TArray */
|
---|
[772] | 240 | template <class T>
|
---|
| 241 | inline TArray<T> operator - (const TArray<T>& a,const TArray<T>& b)
|
---|
[970] | 242 | { TArray<T> result; result.SetTemp(true);
|
---|
| 243 | if (b.IsTemp()) { result.Share(b); result.SubElt(a, true); }
|
---|
| 244 | else { result.CloneOrShare(a); result.SubElt(b); }
|
---|
| 245 | return result; }
|
---|
[772] | 246 |
|
---|
| 247 |
|
---|
| 248 | // --------------------------------------------------
|
---|
| 249 | // inline element acces methods
|
---|
| 250 | // --------------------------------------------------
|
---|
[894] | 251 |
|
---|
| 252 | //! Return element (ix,iy,iz,it,iu) value
|
---|
[772] | 253 | template <class T>
|
---|
| 254 | inline T const& TArray<T>::Elem(uint_4 ix, uint_4 iy, uint_4 iz, uint_4 it, uint_4 iu) const
|
---|
| 255 | {
|
---|
| 256 | return ( *( mNDBlock.Begin()+ offset_+
|
---|
| 257 | ix*step_[0] + iy*step_[1] + iz*step_[2] +
|
---|
| 258 | it*step_[3] + iu*step_[4]) );
|
---|
| 259 | }
|
---|
| 260 |
|
---|
[894] | 261 | //! Return element (ix,iy,iz,it,iu) value
|
---|
[772] | 262 | template <class T>
|
---|
| 263 | inline T & TArray<T>::Elem(uint_4 ix, uint_4 iy, uint_4 iz, uint_4 it, uint_4 iu)
|
---|
| 264 | {
|
---|
| 265 | return ( *( mNDBlock.Begin()+ offset_+
|
---|
| 266 | ix*step_[0] + iy*step_[1] + iz*step_[2] +
|
---|
| 267 | it*step_[3] + iu*step_[4]) );
|
---|
| 268 | }
|
---|
| 269 |
|
---|
[894] | 270 | //! Return element (ix,iy,iz,it,iu) value with Check of indexes bound first
|
---|
[772] | 271 | template <class T>
|
---|
| 272 | inline T const& TArray<T>::ElemCheckBound(uint_4 ix, uint_4 iy, uint_4 iz, uint_4 it, uint_4 iu) const
|
---|
| 273 | {
|
---|
| 274 | CheckBound(ix, iy, iz, it, iu, 4);
|
---|
[804] | 275 | return(Elem(ix, iy, iz, it, iu));
|
---|
[772] | 276 | }
|
---|
| 277 |
|
---|
[894] | 278 | //! Return element (ix,iy,iz,it,iu) value with Check of indexes bound first
|
---|
[772] | 279 | template <class T>
|
---|
| 280 | inline T & TArray<T>::ElemCheckBound(uint_4 ix, uint_4 iy, uint_4 iz, uint_4 it, uint_4 iu)
|
---|
| 281 | {
|
---|
| 282 | CheckBound(ix, iy, iz, it, iu, 4);
|
---|
[804] | 283 | return(Elem(ix, iy, iz, it, iu));
|
---|
[772] | 284 | }
|
---|
| 285 |
|
---|
[894] | 286 | //! Return element (ix,iy,iz) value
|
---|
[772] | 287 | template <class T>
|
---|
| 288 | inline T const& TArray<T>::operator()(uint_4 ix, uint_4 iy, uint_4 iz) const
|
---|
| 289 | {
|
---|
| 290 | #ifdef SO_BOUNDCHECKING
|
---|
| 291 | CheckBound(ix, iy, iz, 0, 0, 4);
|
---|
| 292 | #endif
|
---|
| 293 | return ( *( mNDBlock.Begin()+ offset_+
|
---|
| 294 | ix*step_[0] + iy*step_[1] + iz*step_[2]) );
|
---|
| 295 | }
|
---|
| 296 |
|
---|
[894] | 297 | //! Return element (ix,iy,iz) value
|
---|
[772] | 298 | template <class T>
|
---|
| 299 | inline T & TArray<T>::operator()(uint_4 ix, uint_4 iy, uint_4 iz)
|
---|
| 300 | {
|
---|
| 301 | #ifdef SO_BOUNDCHECKING
|
---|
| 302 | CheckBound(ix, iy, iz, 0, 0, 4);
|
---|
| 303 | #endif
|
---|
| 304 | return ( *( mNDBlock.Begin()+ offset_+
|
---|
| 305 | ix*step_[0] + iy*step_[1] + iz*step_[2]) );
|
---|
| 306 | }
|
---|
| 307 |
|
---|
[894] | 308 | //! Operator () : return element (ix,iy,iz,it,iu) value
|
---|
[772] | 309 | template <class T>
|
---|
| 310 | inline T const& TArray<T>::operator()(uint_4 ix, uint_4 iy, uint_4 iz, uint_4 it, uint_4 iu) const
|
---|
| 311 | {
|
---|
| 312 | #ifdef SO_BOUNDCHECKING
|
---|
| 313 | CheckBound(ix, iy, iz, it, iu, 4);
|
---|
| 314 | #endif
|
---|
| 315 | return ( *( mNDBlock.Begin()+ offset_+
|
---|
| 316 | ix*step_[0] + iy*step_[1] + iz*step_[2] +
|
---|
| 317 | it*step_[3] + iu*step_[4]) );
|
---|
| 318 | }
|
---|
| 319 |
|
---|
[894] | 320 | //! Operator () : return element (ix,iy,iz,it,iu) value
|
---|
[772] | 321 | template <class T>
|
---|
| 322 | inline T & TArray<T>::operator()(uint_4 ix, uint_4 iy, uint_4 iz, uint_4 it, uint_4 iu)
|
---|
| 323 | {
|
---|
| 324 | #ifdef SO_BOUNDCHECKING
|
---|
| 325 | CheckBound(ix, iy, iz, it, iu, 4);
|
---|
| 326 | #endif
|
---|
| 327 | return ( *( mNDBlock.Begin()+ offset_+
|
---|
| 328 | ix*step_[0] + iy*step_[1] + iz*step_[2] +
|
---|
| 329 | it*step_[3] + iu*step_[4]) );
|
---|
| 330 | }
|
---|
| 331 |
|
---|
[785] | 332 |
|
---|
[894] | 333 | //! Operator [] : return element at positon ip
|
---|
[772] | 334 | template <class T>
|
---|
[785] | 335 | inline T const& TArray<T>::operator[](uint_8 ip) const
|
---|
[772] | 336 | {
|
---|
| 337 | #ifdef SO_BOUNDCHECKING
|
---|
| 338 | if (ip >= totsize_) throw( ParmError("TArray<T>::operator[] Out-of-bound Error") );
|
---|
| 339 | #endif
|
---|
[785] | 340 | return *(mNDBlock.Begin()+Offset(ip));
|
---|
[772] | 341 | }
|
---|
| 342 |
|
---|
[894] | 343 | //! Operator [] : return element at positon ip
|
---|
[772] | 344 | template <class T>
|
---|
[785] | 345 | inline T & TArray<T>::operator[](uint_8 ip)
|
---|
[772] | 346 | {
|
---|
| 347 | #ifdef SO_BOUNDCHECKING
|
---|
| 348 | if (ip >= totsize_) throw( ParmError("TArray<T>::operator[] Out-of-bound Error") );
|
---|
| 349 | #endif
|
---|
[785] | 350 | return *(mNDBlock.Begin()+Offset(ip));
|
---|
[772] | 351 | }
|
---|
| 352 |
|
---|
[785] | 353 |
|
---|
[894] | 354 | //! Return the value of first element
|
---|
[772] | 355 | template <class T>
|
---|
[787] | 356 | inline T TArray<T>::toScalar()
|
---|
[772] | 357 | {
|
---|
| 358 | if (Size() != 1) throw(SzMismatchError("TArray<T>::operator T() Size() != 1")) ;
|
---|
| 359 | return ( (*this)[0] );
|
---|
| 360 | }
|
---|
| 361 |
|
---|
[804] | 362 | // Typedef pour simplifier
|
---|
[956] | 363 | /*! \ingroup TArray
|
---|
| 364 | \typedef Array
|
---|
| 365 | \brief To simplified TArray<r_8> writing
|
---|
| 366 | */
|
---|
[804] | 367 | typedef TArray<r_8> Array;
|
---|
| 368 |
|
---|
[772] | 369 | } // Fin du namespace
|
---|
| 370 |
|
---|
| 371 | #endif
|
---|