Index: trunk/SophyaLib/TArray/tarray.cc
===================================================================
--- trunk/SophyaLib/TArray/tarray.cc	(revision 850)
+++ trunk/SophyaLib/TArray/tarray.cc	(revision 894)
@@ -15,12 +15,20 @@
 // -------------------------------------------------------
 
-// Les constructeurs 
+////////////////////////// Les constructeurs / destructeurs
+
+//! Default constructor
 template <class T>
 TArray<T>::TArray()
   : BaseArray() , mNDBlock() 
-// Default constructor
-{
-}
-
+{
+}
+
+//! Constructor
+/*!
+  \param ndim : number of dimensions (less or equal to
+                \ref BASEARRAY_MAXNDIMS "BASEARRAY_MAXNDIMS")
+  \param siz[ndim] : size along each dimension
+  \param step : step (same for all dimensions)
+ */
 template <class T>
 TArray<T>::TArray(uint_4 ndim, const uint_4 * siz, uint_4 step)
@@ -31,4 +39,8 @@
 }
 
+//! Constructor
+/*!
+  \param nx,ny,nz,nt,nu : sizes along first, second, third, fourth and fifth dimension
+ */
 template <class T>
 TArray<T>::TArray(uint_4 nx, uint_4 ny, uint_4 nz, uint_4 nt, uint_4 nu)
@@ -48,4 +60,13 @@
 }
 
+//! Constructor
+/*!
+  \param ndim : number of dimensions
+  \param siz[ndim] : size along each dimension
+  \param db : datas are given by this NDataBlock
+  \param share : if true, data are shared, if false they are copied
+  \param step : step (same for all dimensions) in data block
+  \param offset : offset for first element in data block
+ */
 template <class T>
 TArray<T>::TArray(uint_4 ndim, const uint_4 * siz, NDataBlock<T> & db, bool share, uint_4 step, uint_8 offset)
@@ -57,4 +78,15 @@
 }
 
+//! Constructor
+/*!
+  \param ndim : number of dimensions
+  \param siz[ndim] : size along each dimension
+  \param values : datas are given by this pointer
+  \param share : if true, data are shared, if false they are copied
+  \param step : step (same for all dimensions) in data block
+  \param offset : offset for first element in data block
+  \param br : if not NULL, dats are bridge with other datas
+  \sa NDataBlock
+ */
 template <class T>
 TArray<T>::TArray(uint_4 ndim, const uint_4 * siz, T* values, uint_4 step, uint_8 offset, Bridge* br)
@@ -65,4 +97,5 @@
 }
 
+//! Constructor by copy
 template <class T>
 TArray<T>::TArray(const TArray<T>& a)
@@ -74,4 +107,8 @@
 }
 
+//! Constructor by copy
+/*!
+  \param share : if true, data are shared, if false they are copied
+ */
 template <class T>
 TArray<T>::TArray(const TArray<T>& a, bool share)
@@ -83,5 +120,5 @@
 }
 
-// Destructeur 
+//! Destructor 
 template <class T>
 TArray<T>::~TArray()
@@ -89,4 +126,7 @@
 }
 
+////////////////////////// Les methodes de copie/share
+
+//! Set array equal to \b a and return *this
 template <class T>
 TArray<T>& TArray<T>::Set(const TArray<T>& a)
@@ -94,5 +134,5 @@
   if (this != &a) { 
     CloneOrShare(a);
-    if (mInfo) delete mInfo;
+    if (mInfo) {delete mInfo; mInfo = NULL;}
     if (a.mInfo) mInfo = new DVList(*(a.mInfo));
   }
@@ -100,4 +140,5 @@
 }
 
+//! Clone array \b a
 template <class T>
 void TArray<T>::Clone(const TArray<T>& a)
@@ -106,8 +147,14 @@
   if (!UpdateSizes(a, exmsg))  throw( ParmError(exmsg) );
   mNDBlock.Clone(a.mNDBlock);
-  if (mInfo) delete mInfo;
+  if (mInfo) {delete mInfo; mInfo = NULL;}
   if (a.mInfo) mInfo = new DVList(*(a.mInfo));
 }
 
+//! Resize array
+/*!
+  \param ndim : number of dimensions
+  \param siz[ndim] : size along each dimension
+  \param step : step (same for all dimensions)
+ */
 template <class T>
 void TArray<T>::ReSize(uint_4 ndim, uint_4 * siz, uint_4 step)
@@ -118,4 +165,12 @@
 }
 
+//! Re-allocate space for array
+/*!
+  \param ndim : number of dimensions
+  \param siz[ndim] : size along each dimension
+  \param step : step (same for all dimensions)
+  \param force : if true re-allocation is forced, if not it occurs
+          only if the required space is greater than the old one.
+ */
 template <class T>
 void TArray<T>::Realloc(uint_4 ndim, uint_4 * siz, uint_4 step, bool force)
@@ -127,4 +182,5 @@
 
 
+//! Compact dimensions in one or more is equal to 1.
 template <class T>
 TArray<T>& TArray<T>::CompactAllDimensions()
@@ -134,4 +190,5 @@
 }
 
+//! Compact dimensions if the last one is equal to 1.
 template <class T>
 TArray<T>& TArray<T>::CompactTrailingDimensions()
@@ -141,4 +198,5 @@
 }
 
+//! Give value (in \b double) for element at position \b ip..
 template <class T>
 double TArray<T>::ValueAtPosition(uint_8 ip) const
@@ -150,5 +208,8 @@
 }
 
-// For complex values, we return the module of the complex number
+//! Give value (in \b double) for element at position \b ip..
+/*!
+  For complex values, we return the module of the complex number
+*/
 double TArray< complex<r_4> >::ValueAtPosition(uint_8 ip) const
 {
@@ -162,4 +223,8 @@
 }
 
+//! Give value (in \b double) for element at position \b ip..
+/*!
+  For complex values, we return the module of the complex number
+*/
 double TArray< complex<r_8> >::ValueAtPosition(uint_8 ip) const
 {
@@ -173,5 +238,11 @@
 }
 
-
+//! Return array with elements packed
+/*!
+  \param force : if true, pack elements in a new array.
+                 If false and array is already packed, return
+                 an array that share data with the current one.
+  \return packed array
+ */
 template <class T>
 TArray<T> TArray<T>::PackElements(bool force) const
@@ -194,4 +265,9 @@
 // SubArrays 
 // $CHECK$ Reza 03/2000  Doit-on declarer cette methode const ?
+//! Extract a sub-array
+/*!
+  \param rx,ry,rz,rt,ru : range of extraction along dimensions
+  \sa Range
+ */
 template <class T>
 TArray<T> TArray<T>::SubArray(Range rx, Range ry, Range rz, Range rt, Range ru) const
@@ -232,5 +308,11 @@
 //              ------- Attention --------
 //  Boucles normales prenant en compte les steps ....
-//  Possibilite de // , vectorisation 
+//  Possibilite de // , vectorisation
+
+//! Fill TArray with Sequence \b seq
+/*!
+  \param seq : sequence to fill the array
+  \sa Sequence
+ */
 template <class T>
 TArray<T>& TArray<T>::SetSeq(Sequence seq)
@@ -261,4 +343,5 @@
 //  >>>> Operations avec 2nd membre de type scalaire 
 
+//! Fill an array with a constant value \b x
 template <class T>
 TArray<T>& TArray<T>::SetT(T x)
@@ -287,4 +370,5 @@
 }
 
+//! Add a constant value \b x to an array
 template <class T>
 TArray<T>& TArray<T>::Add(T x)
@@ -313,4 +397,5 @@
 }
 
+//! Substract a constant value \b x to an array
 template <class T>
 TArray<T>& TArray<T>::Sub(T x)
@@ -339,4 +424,5 @@
 }
 
+//! Multiply an array by a constant value \b x
 template <class T>
 TArray<T>& TArray<T>::Mul(T x)
@@ -365,4 +451,5 @@
 }
 
+//! Divide an array by a constant value \b x
 template <class T>
 TArray<T>& TArray<T>::Div(T x)
@@ -370,4 +457,6 @@
   if (NbDimensions() < 1) 
     throw RangeCheckError("TArray<T>::Div(T )  - Not Allocated Array ! ");
+  if (x == (T) 0 ) 
+    throw MathExc("TArray<T>::Div(T )  - Divide by zero ! ");
   T * pe;
   uint_8 j,k;
@@ -392,4 +481,5 @@
 
 
+//! Inverse substract : A = \b x - A
 template <class T>
 TArray<T>& TArray<T>::SubInv(T x)
@@ -418,4 +508,5 @@
 }
 
+//! Inverse Divide : A(i,j,...) = x / A(i,j,...)
 template <class T>
 TArray<T>& TArray<T>::DivInv(T x)
@@ -446,4 +537,5 @@
 
 //  >>>> Operations avec 2nd membre de type tableau
+//! Add two TArrays
 template <class T>
 TArray<T>& TArray<T>::AddElt(const TArray<T>& a)
@@ -480,4 +572,5 @@
 }
 
+//! Substract two TArrays
 template <class T>
 TArray<T>& TArray<T>::SubElt(const TArray<T>& a)
@@ -514,5 +607,5 @@
 }
 
-
+//! Multiply two TArrays (elements by elements)
 template <class T>
 TArray<T>& TArray<T>::MulElt(const TArray<T>& a)
@@ -550,4 +643,5 @@
 
 
+//! Divide two TArrays (elements by elements)
 template <class T>
 TArray<T>& TArray<T>::DivElt(const TArray<T>& a)
@@ -584,4 +678,5 @@
 }
 
+//! Copy elements of \b a
 template <class T>
 TArray<T>& TArray<T>::CopyElt(const TArray<T>& a)
@@ -620,4 +715,5 @@
 
 // Somme et produit des elements
+//! Sum all elements
 template <class T>
 T TArray<T>::Sum() const
@@ -647,4 +743,5 @@
 }
 
+//! Multiply all elements
 template <class T>
 T TArray<T>::Product() const
@@ -680,4 +777,5 @@
 // ----------------------------------------------------
 
+//! Return a string that contain the type \b T of the array
 template <class T>
 string TArray<T>::InfoString() const
@@ -689,4 +787,11 @@
 }
 
+//! Print array
+/*!
+  \param os : output stream
+  \param maxprt : maximum numer of print
+  \param si : if true,  display attached DvList
+  \sa SetMaxPrint
+ */
 template <class T>
 void TArray<T>::Print(ostream& os, int_4 maxprt, bool si) const
@@ -720,5 +825,5 @@
 }
 
-
+//! Clone if \b a is not temporary, share if temporary
 template <class T>
 void TArray<T>::CloneOrShare(const TArray<T>& a)
@@ -729,4 +834,5 @@
 }
 
+//! Share data with a
 template <class T>
 void TArray<T>::Share(const TArray<T>& a)
