Index: trunk/SophyaLib/TArray/basarr.cc
===================================================================
--- trunk/SophyaLib/TArray/basarr.cc	(revision 787)
+++ trunk/SophyaLib/TArray/basarr.cc	(revision 787)
@@ -0,0 +1,305 @@
+//      Base class for numerical arrays 
+//                     R. Ansari, C.Magneville   03/2000
+
+#include "machdefs.h"
+#include <stdio.h>
+#include <stdlib.h>
+#include "pexceptions.h"
+#include "basarr.h"
+
+
+
+// Variables statiques globales
+char * BaseArray::ck_op_msg_[6] = {"???", "Size(int )", "IsPacked(int )", 
+				 "Stride(int )", "ElemCheckBound()", "operator()" };
+uint_4 BaseArray::max_nprt_ = 50;
+
+// Methodes statiques globales
+void BaseArray::SetMaxPrint(uint_4 nprt)
+{
+  max_nprt_ = nprt;
+}
+
+
+uint_8 BaseArray::ComputeTotalSize(uint_4 ndim, uint_4 * siz, uint_4 step, uint_8 offset)
+{
+  uint_8 rs = step;
+  for(int k=0; k<ndim; k++) rs *= siz[k];
+  return(rs+offset);
+}
+
+// -------------------------------------------------------
+//                Methodes de la classe
+// -------------------------------------------------------
+
+// Les constructeurs 
+BaseArray::BaseArray()
+  : mInfo(NULL)
+// Default constructor
+{
+  ndim_ = 0;
+  for(int k=0; k<BASEARRAY_MAXNDIMS; k++) step_[k] = size_[k] = 0;
+  totsize_ = 0;
+  minstep_ = 0;
+  moystep_ = 0;
+  offset_ = 0;
+  // Default for matrices : Lines = Y , Columns = X
+  macoli_ = 0;
+  marowi_ = 1;
+}
+
+// Destructeur 
+BaseArray::~BaseArray()
+{
+}
+
+
+bool BaseArray::CompareSizes(const BaseArray& a)
+{
+  if (ndim_ != a.ndim_)  return(false);
+  for(int k=0; k<ndim_; k++) 
+    if (size_[k] != a.size_[k])  return(false);
+  if ( (macoli_ != a.macoli_) || (marowi_ != a.marowi_) )  return(false);
+  return(true);
+}
+
+void BaseArray::CompactAllDim()
+{
+  if (ndim_ < 2)  return;
+  uint_4 ndim = 0;
+  uint_4 size[BASEARRAY_MAXNDIMS];
+  uint_4 step[BASEARRAY_MAXNDIMS];
+  for(int k=0; k<ndim_; k++) {
+    if (size_[k] < 2)  continue;
+    size[ndim] = size_[k];
+    step[ndim] = step_[k];
+    ndim++;
+  }
+  if (ndim == 0)  {
+    size[0] = size_[0];
+    step[0] = step_[0];
+    ndim = 1;
+  }
+  string exmsg = "BaseArray::CompactAllDim() ";
+  if (!UpdateSizes(ndim, size, step, offset_, exmsg))  throw( ParmError(exmsg) );
+  return;
+}
+
+void BaseArray::CompactTrailingDim()
+{
+  if (ndim_ < 2)  return;
+  uint_4 ndim = 0;
+  uint_4 size[BASEARRAY_MAXNDIMS];
+  uint_4 step[BASEARRAY_MAXNDIMS];
+  for(int k=0; k<ndim_; k++) {
+    size[ndim] = size_[k];
+    step[ndim] = step_[k];
+    if (size_[k] > 1)  ndim=k;
+  }
+  if (ndim == 0)  ndim = 1;
+  string exmsg = "BaseArray::CompactTrailingDim() ";
+  if (!UpdateSizes(ndim, size, step, offset_, exmsg))  throw( ParmError(exmsg) );
+  return;
+}
+
+
+uint_4 BaseArray::MinStepKA() const
+{
+  for(int ka=0; ka<ndim_; ka++)
+    if (step_[ka] == minstep_) return(ka);
+  return(0);
+}
+
+uint_4 BaseArray::MaxSizeKA() const
+{
+  uint_4 ka = 0;
+  uint_4 mx = size_[0];
+  for(int k=0; k<ndim_; k++)  
+    if (size_[k] > mx) {  ka = k;  mx = size_[k];  }
+  return(ka);
+}
+
+
+//  Acces lineaire aux elements ....  Calcul d'offset
+
+uint_8 BaseArray::Offset(uint_8 ip) const
+{
+if (ip == 0)  return(offset_);
+uint_4 idx[BASEARRAY_MAXNDIMS];
+int k;
+uint_8 rest = ip;
+for(k=0; k<ndim_; k++)   { idx[k] = rest%size_[k];   rest /= size_[k];  }   
+uint_8 off = offset_;
+for(k=0; k<ndim_; k++)  off += idx[k]*step_[k];
+return (off);
+}
+
+
+// ----------------------------------------------------
+//       Impression, etc ...
+// ----------------------------------------------------
+
+void BaseArray::Show(ostream& os, bool si) const
+{
+  os << " TArray< " << DataType() << " >  NDim= " << ndim_
+     << "(" << typeid(*this).name() << " )" << endl;
+  os << "TotSize=" << totsize_ << " Size(X*Y*...)= " ;
+  for(int k=0; k<ndim_; k++) { 
+    os << size_[k];
+    if (k<ndim_-1)  os << " x ";
+  }
+  os << endl;
+  os <<  " Step(X Y ...)= " ;
+  for(int k=0; k<ndim_; k++)     os << step_[k] << "  " ;
+  os << " Offset= " << offset_  << "\n " << endl;
+  if (si && (mInfo != NULL)) os << (*mInfo) << endl;
+ 
+}
+
+
+DVList& BaseArray::Info()
+{
+if (mInfo == NULL)  mInfo = new DVList;
+return(*mInfo);
+}
+
+
+bool BaseArray::UpdateSizes(uint_4 ndim, const uint_4 * siz, uint_4 step, uint_8 offset, string & exmsg)
+{
+  if (ndim >= BASEARRAY_MAXNDIMS) {
+    exmsg += " NDim Error";  return false;
+  }
+  if (step < 1) {
+    exmsg += " Step(=0) Error";  return false;
+  }
+
+  minstep_ = moystep_ = step;
+
+  // Flagging bad updates ...
+  ndim_ = 0;
+
+  totsize_ = 1;
+  int k;
+  for(k=0; k<BASEARRAY_MAXNDIMS; k++) {
+    size_[k] = 1;
+    step_[k] = 0;
+  }
+  for(k=0; k<ndim; k++) {
+    size_[k] = siz[k] ;
+    step_[k] = totsize_*step;
+    totsize_ *= size_[k];
+  }
+  if (totsize_ < 1) {
+    exmsg += " Size Error";  return false;
+  }
+  offset_ = offset;
+  // Default for matrices : Lines = Y , Columns = X
+  macoli_ = 0;
+  marowi_ = 1;
+  // Update OK 
+  ndim_ = ndim;
+  return true;
+}
+
+bool BaseArray::UpdateSizes(uint_4 ndim, const uint_4 * siz, const uint_4 * step, uint_8 offset, string & exmsg)
+{
+  if (ndim >= BASEARRAY_MAXNDIMS) {
+    exmsg += " NDim Error";  return false;
+  }
+
+  // Flagging bad updates ...
+  ndim_ = 0;
+
+  totsize_ = 1;
+  int k;
+  for(k=0; k<BASEARRAY_MAXNDIMS; k++) {
+    size_[k] = 1;
+    step_[k] = 0;
+  }
+  uint_4 minstep = step[0];
+  for(k=0; k<ndim; k++) {
+    size_[k] = siz[k] ;
+    step_[k] = step[k];
+    totsize_ *= size_[k];
+    if (step_[k] < minstep)  minstep = step_[k];
+  }
+  if (minstep < 1) {
+    exmsg += " Step(=0) Error";  return false;
+  }
+  if (totsize_ < 1) {
+    exmsg += " Size Error";  return false;
+  }
+  uint_8 plast = 0;
+  for(k=0; k<ndim; k++)   plast += (siz[k]-1)*step[k];
+  if (plast == minstep*totsize_ )  moystep_ = minstep;
+  else moystep_ = 0;
+  minstep_ = minstep;
+  offset_ = offset;
+  // Default for matrices : Lines = Y , Columns = X
+  macoli_ = 0;
+  marowi_ = 1;
+  // Update OK 
+  ndim_ = ndim;
+  return true;
+}
+
+bool BaseArray::UpdateSizes(const BaseArray& a, string & exmsg)
+{
+  if (a.ndim_ >= BASEARRAY_MAXNDIMS) {
+    exmsg += " NDim Error";  return false;
+  }
+
+  // Flagging bad updates ...
+  ndim_ = 0;
+
+  totsize_ = 1;
+  int k;
+  for(k=0; k<BASEARRAY_MAXNDIMS; k++) {
+    size_[k] = 1;
+    step_[k] = 0;
+  }
+  uint_4 minstep = a.step_[0];
+  for(k=0; k<a.ndim_; k++) {
+    size_[k] = a.size_[k] ;
+    step_[k] = a.step_[k];
+    totsize_ *= size_[k];
+    if (step_[k] < minstep)  minstep = step_[k];
+  }
+  if (minstep < 1) {
+    exmsg += " Step(=0) Error";  return false;
+  }
+  if (totsize_ < 1) {
+    exmsg += " Size Error";  return false;
+  }
+
+  minstep_ = a.minstep_;
+  moystep_ = a.moystep_;
+  offset_ = a.offset_;
+  macoli_ = a.macoli_;
+  marowi_ = a.marowi_;
+  // Update OK 
+  ndim_ = a.ndim_;
+  return true;
+}
+
+
+void BaseArray::SubArray(BaseArray & ra, uint_4 ndim, uint_4 * siz, uint_4 * pos, uint_4 * step)
+{
+  if ( (ndim > ndim_) || (ndim < 1) ) throw(SzMismatchError("BaseArray::SubArray( ... ) NDim Error") );
+  int k;
+  for(k=0; k<ndim; k++) 
+    if ( (siz[k]*step[k]+pos[k]) > size_[k] )  
+      throw(SzMismatchError("BaseArray::SubArray( ... ) Size/Pos Error") );
+  uint_8 offset = offset_;
+  for(k=0; k<ndim_; k++) { 
+    offset += pos[k]*step_[k]; 
+    step[k] *= step_[k];
+  }
+  string exm = "BaseArray::SubArray() ";
+  if (!ra.UpdateSizes(ndim, siz, step, offset,  exm))
+     throw( ParmError(exm) );
+  //  (ra.mNDBlock).Share(mNDBlock);
+  return;
+}
+
+
Index: trunk/SophyaLib/TArray/basarr.h
===================================================================
--- trunk/SophyaLib/TArray/basarr.h	(revision 787)
+++ trunk/SophyaLib/TArray/basarr.h	(revision 787)
@@ -0,0 +1,142 @@
+// This may look like C code, but it is really -*- C++ -*-
+//      Base array class - Memory organisation management
+//                     R. Ansari, C.Magneville   03/2000
+
+#ifndef BaseArray_SEEN
+#define BaseArray_SEEN
+
+#include "machdefs.h"
+#include <math.h>
+#include <iostream.h>
+#include "anydataobj.h"
+#include "dvlist.h"
+
+
+//  Maximum number of dimensions for array
+#define BASEARRAY_MAXNDIMS  5
+
+namespace SOPHYA {  
+
+//   ------------ classe template Array ----------- 
+class BaseArray : public AnyDataObj {
+public:
+  // Creation / destruction 
+  BaseArray();
+  virtual ~BaseArray();
+
+  // Returns true if ndim and sizes are equal
+  virtual bool CompareSizes(const BaseArray& a);
+
+  // Compacts size=1 array dimensions
+  virtual void CompactAllDim();         // suppresses all size==1 dimensions 
+  virtual void CompactTrailingDim();    // suppresses size==1 dimensions after the last size>1 dimension
+
+  // Array dimensions
+  inline uint_4 NbDimensions() const { return( ndim_ ); }
+
+  inline uint_8 Size() const { return(totsize_); }
+  inline uint_4 SizeX() const { return(size_[0]); }
+  inline uint_4 SizeY() const { return(size_[1]); }
+  inline uint_4 SizeZ() const { return(size_[2]); }
+  inline uint_4 Size(int ka) const { return(size_[CheckDI(ka,1)]); }
+
+  uint_4 MaxSizeKA() const ;
+
+  // memory organisation - packing information
+  inline bool   IsPacked() const { return(moystep_ == 1); }
+  inline bool   IsPackedX() const { return(step_[0] == 1); }
+  inline bool   IsPackedY() const { return(step_[1] == 1); }
+  inline bool   IsPackedZ() const { return(step_[2] == 1); }
+  inline bool   IsPacked(int ka) const { return(step_[CheckDI(ka,2)] == 1); }
+
+  inline uint_4 MinStep() const  { return(minstep_); }
+  inline uint_4 AvgStep() const  { return(moystep_); }
+  inline uint_4 StepX() const { return(step_[0]); }
+  inline uint_4 StepY() const { return(step_[1]); }
+  inline uint_4 StepZ() const { return(step_[2]); }
+  inline uint_4 Step(int ka) const { return(step_[CheckDI(ka,3)]); }
+
+  uint_4 MinStepKA() const ;
+
+  uint_8 Offset(uint_8 ip=0) const ;
+  inline uint_8  Offset(uint_4 ix, uint_4 iy, uint_4 iz, uint_4 it=0, uint_4 iu=0) const;  
+
+//  a abstract element acces methode
+  virtual double ValueAtPosition(uint_8 ip) const = 0;
+
+// Impression, I/O, ...
+  static void   SetMaxPrint(uint_4 nprt=50);   
+  void          Show(ostream& os, bool si=false) const;
+  inline void   Show() const { Show(cout); }
+  virtual string DataType() const = 0;
+
+//  Objet DVList info 
+  DVList&       Info();
+
+protected:
+  // Verifie la compatibilite de l'index de dimension
+  inline int CheckDI(int ka, int msg) const ;
+  // Verifie la compatibilite des bornes d'index
+  inline void CheckBound(int ix, uint_4 iy, uint_4 iz, uint_4 it, uint_4 iu, int msg) const ;
+  // Changing Sizes/NDim ... return true if OK
+  bool UpdateSizes(uint_4 ndim, const uint_4 * siz, uint_4 step, uint_8 offset, string & exmsg);
+  bool UpdateSizes(uint_4 ndim, const uint_4 * siz, const uint_4 * step, uint_8 offset, string & exmsg);
+  bool UpdateSizes(const BaseArray& a, string & exmsg);
+  static uint_8 ComputeTotalSize(uint_4 ndim, uint_4 * siz, uint_4 step, uint_8 offset) ;
+  // Pour Extraction de sous-tableau
+  virtual void SubArray(BaseArray & ra, uint_4 ndim, uint_4 * siz, uint_4 * pos, uint_4 * step);
+
+  uint_4 ndim_;                   // nb of dimensions
+  uint_4 size_[BASEARRAY_MAXNDIMS];     // array size in each dimension
+  uint_8 totsize_;                   // Total number of elements
+  uint_4 step_[BASEARRAY_MAXNDIMS];     // two consecutive elements distance in a given dimension 
+  uint_4 minstep_;                   // minimal step (in any axes)
+  uint_4 moystep_;                   // mean step 0 non regular steps
+  uint_8 offset_;              // global offset -> position of elem[0] in DataBlock
+  uint_4 marowi_, macoli_;     // For matrices, Row index and column index in dimensions
+
+  DVList* mInfo;               // Infos (variables) attachees au tableau
+
+  static char * ck_op_msg_[6];  // Operation messages for CheckDI() CheckBound()
+  static uint_4 max_nprt_;      // Nb maxi d'elements imprimes
+};
+
+// --------------------------------------------------
+//        Methodes inline de verification
+// --------------------------------------------------
+inline int BaseArray::CheckDI(int ka, int msg)  const
+{
+  if ( (ka < 0) || (ka >= ndim_) ) {
+    string txt = "BaseArray::CheckDimensionIndex/Error ";   txt += ck_op_msg_[msg];
+    throw(ParmError(txt));
+  }
+  return(ka);
+}
+
+inline void BaseArray::CheckBound(int ix, uint_4 iy, uint_4 iz, uint_4 it, uint_4 iu, int msg)  const
+{
+  if ( (ix >= size_[0]) || (iy >= size_[1]) || (iz > size_[2]) ||
+       (it >= size_[3]) || (iu >= size_[4]) ) {
+    string txt = "BaseArray::CheckArrayBound/Error ";   txt += ck_op_msg_[msg];
+    throw(ParmError(txt));
+  }
+  return;
+}
+
+
+// --------------------------------------------------
+//        Position d'un element
+// --------------------------------------------------
+inline uint_8 BaseArray::Offset(uint_4 ix, uint_4 iy, uint_4 iz, uint_4 it, uint_4 iu) const
+{
+#ifdef SO_BOUNDCHECKING
+  CheckBound(ix, iy, iz, it, iu, 4);
+#endif
+  return ( offset_+  ix*step_[0] + iy*step_[1] + iz*step_[2] +
+	      it*step_[3] + iu*step_[4] );
+}
+
+
+} // Fin du namespace
+
+#endif
Index: trunk/SophyaLib/TArray/fioarr.cc
===================================================================
--- trunk/SophyaLib/TArray/fioarr.cc	(revision 786)
+++ trunk/SophyaLib/TArray/fioarr.cc	(revision 787)
@@ -70,7 +70,7 @@
 // On lit les tailles, etc ...
   is.Get(dobj->ndim_);
-  is.Get(dobj->size_, TARRAY_MAXNDIMS);
+  is.Get(dobj->size_, BASEARRAY_MAXNDIMS);
   is.Get(dobj->totsize_);
-  is.Get(dobj->step_, TARRAY_MAXNDIMS);
+  is.Get(dobj->step_, BASEARRAY_MAXNDIMS);
   is.Get(dobj->minstep_);
   is.Get(dobj->moystep_);
@@ -98,7 +98,7 @@
 // On ecrit les tailles, etc ...
   os.Put(dobj->ndim_);
-  os.Put(dobj->size_, TARRAY_MAXNDIMS);
+  os.Put(dobj->size_, BASEARRAY_MAXNDIMS);
   os.Put(dobj->totsize_);
-  os.Put(dobj->step_, TARRAY_MAXNDIMS);
+  os.Put(dobj->step_, BASEARRAY_MAXNDIMS);
   os.Put(dobj->minstep_);
   os.Put(dobj->moystep_);
Index: trunk/SophyaLib/TArray/matharr.cc
===================================================================
--- trunk/SophyaLib/TArray/matharr.cc	(revision 787)
+++ trunk/SophyaLib/TArray/matharr.cc	(revision 787)
@@ -0,0 +1,86 @@
+//  Usuall mathematical functions and operations on arrays
+//                     R. Ansari, C.Magneville   03/2000
+
+#include "machdefs.h"
+#include <stdlib.h>
+#include "matharr.h"
+
+// ----------------------------------------------------
+//          Application d'une fonction
+// ----------------------------------------------------
+
+template <class T>
+TArray<T>& MathArray<T>::ApplyFunctionInPlace(TArray<T> & a, Arr_DoubleFunctionOfX f)
+{
+  T * pe;
+  uint_8 j,k;
+  if (a.AvgStep() > 0)   {  // regularly spaced elements
+    uint_8 step = a.AvgStep(); 
+    uint_8 maxx = a.Size()*step;
+    pe = a.Data();
+    for(k=0; k<maxx; k+=step )  pe[k] = (T)(f((double)pe[k])); 
+  }
+  else {    // Non regular data spacing ...
+    uint_4 ka = a.MaxSizeKA();
+    uint_8 step = a.Step(ka);
+    uint_8 gpas = a.Size(ka)*step;
+    for(j=0; j<a.Size(); j += a.Size(ka))  {
+      pe = a.DataBlock().Begin()+a.Offset(j);
+      for(k=0; k<gpas; k+=step)  pe[k] = (T)(f((double)pe[k]));
+    }
+  }
+  return(a);
+}
+
+template <class T>
+TArray<T>& MathArray<T>::ApplyFunctionInPlace(TArray<T> & a, Arr_FloatFunctionOfX f)
+{
+  T * pe;
+  uint_8 j,k;
+  if (a.AvgStep() > 0)   {  // regularly spaced elements
+    uint_8 step = a.AvgStep(); 
+    uint_8 maxx = a.Size()*step;
+    pe = a.Data();
+    for(k=0; k<maxx; k+=step )  pe[k] = (T)(f((float)pe[k])); 
+  }
+  else {    // Non regular data spacing ...
+    uint_4 ka = a.MaxSizeKA();
+    uint_8 step = a.Step(ka);
+    uint_8 gpas = a.Size(ka)*step;
+    for(j=0; j<a.Size(); j += a.Size(ka))  {
+      pe = a.DataBlock().Begin()+a.Offset(j);
+      for(k=0; k<gpas; k+=step)  pe[k] = (T)(f((float)pe[k]));
+    }
+  }
+  return(a);
+}
+
+
+template <class T>
+TArray<T> MathArray<T>::ApplyFunction(TArray<T> const & a, Arr_DoubleFunctionOfX f)
+{
+  TArray<T> ra;
+  ra = a;
+  ApplyFunctionInPlace(ra, f);
+  return(ra);
+}
+
+template <class T>
+TArray<T> MathArray<T>::ApplyFunction(TArray<T> const & a, Arr_FloatFunctionOfX f)
+{
+  TArray<T> ra;
+  ra = a;
+  ApplyFunctionInPlace(ra, f);
+  return(ra);
+}
+
+///////////////////////////////////////////////////////////////
+#ifdef __CXX_PRAGMA_TEMPLATES__
+#pragma define_template MathArray<r_4>
+#pragma define_template MathArray<r_8>
+#endif
+
+#if defined(ANSI_TEMPLATES) || defined(GNU_TEMPLATES)
+template class MathArray<r_4>;
+template class MathArray<r_8>;
+#endif
Index: trunk/SophyaLib/TArray/matharr.h
===================================================================
--- trunk/SophyaLib/TArray/matharr.h	(revision 787)
+++ trunk/SophyaLib/TArray/matharr.h	(revision 787)
@@ -0,0 +1,45 @@
+// This may look like C code, but it is really -*- C++ -*-
+//  Usuall mathematical functions and operations on arrays
+//                     R. Ansari, C.Magneville   03/2000
+
+#ifndef MathArray_SEEN
+#define MathArray_SEEN
+
+#include "machdefs.h"
+#include "tarray.h"
+#include <math.h>
+
+namespace SOPHYA {
+
+//       Class for simple mathematical operation on arrays 
+//   Instanciated only for real and double (r_4, r_8) type arrays 
+//                                                Reza 03/2000
+template <class T>
+class MathArray {
+public:
+// Applying a function 
+  // Replaces the input array content with the result f(x)
+  virtual TArray<T>&  ApplyFunctionInPlace(TArray<T> & a, Arr_DoubleFunctionOfX f);
+  virtual TArray<T>&  ApplyFunctionInPlace(TArray<T> & a, Arr_FloatFunctionOfX f);
+  // Creates a new array and fills it with f(x)
+  virtual TArray<T>  ApplyFunction(TArray<T> const & a, Arr_DoubleFunctionOfX f);
+  virtual TArray<T>  ApplyFunction(TArray<T> const & a, Arr_FloatFunctionOfX f);
+};
+
+////////////////////////////////////////////////
+//  Calcul de fonctions usuelles 
+template <class T>
+inline TArray<T> sin(const TArray<T>& a)
+  { MathArray<T> ma;   return( ma.ApplyFunction(a, sin) ); }
+
+template <class T>
+inline TArray<T> cos(const TArray<T>& a)
+  { MathArray<T> ma;   return( ma.ApplyFunction(a, cos) ); }
+
+template <class T>
+inline TArray<T> tan(const TArray<T>& a)
+  { MathArray<T> ma;   return( ma.ApplyFunction(a, tan) ); }
+
+} // Fin du namespace
+
+#endif
Index: trunk/SophyaLib/TArray/tarray.cc
===================================================================
--- trunk/SophyaLib/TArray/tarray.cc	(revision 786)
+++ trunk/SophyaLib/TArray/tarray.cc	(revision 787)
@@ -10,26 +10,4 @@
 
 
-// Variables statiques globales
-template <class T>
-char * TArray<T>::ck_op_msg_[6] = {"???", "Size(int )", "IsPacked(int )", 
-				 "Stride(int )", "ElemCheckBound()", "operator()" };
-template <class T>
-uint_4 TArray<T>::max_nprt_ = 50;
-
-// Methodes statiques globales
-template <class T>
-void TArray<T>::SetMaxPrint(uint_4 nprt)
-{
-  max_nprt_ = nprt;
-}
-
-
-template <class T>
-uint_8 TArray<T>::ComputeTotalSize(uint_4 ndim, uint_4 * siz, uint_4 step, uint_8 offset)
-{
-  uint_8 rs = step;
-  for(int k=0; k<ndim; k++) rs *= siz[k];
-  return(rs+offset);
-}
 
 // -------------------------------------------------------
@@ -40,21 +18,12 @@
 template <class T>
 TArray<T>::TArray()
-  : mNDBlock() , mInfo(NULL)
+  : mNDBlock() , BaseArray()
 // Default constructor
 {
-  ndim_ = 0;
-  for(int k=0; k<TARRAY_MAXNDIMS; k++) step_[k] = size_[k] = 0;
-  totsize_ = 0;
-  minstep_ = 0;
-  moystep_ = 0;
-  offset_ = 0;
-  // Default for matrices : Lines = Y , Columns = X
-  macoli_ = 0;
-  marowi_ = 1;
 }
 
 template <class T>
 TArray<T>::TArray(uint_4 ndim, uint_4 * siz, uint_4 step)
-  : mNDBlock(ComputeTotalSize(ndim, siz, step, 1)) , mInfo(NULL)
+  : mNDBlock(ComputeTotalSize(ndim, siz, step, 1)) , BaseArray()
 {
   string exmsg = "TArray<T>::TArray(uint_4, uint_4 *, uint_4)";
@@ -64,7 +33,7 @@
 template <class T>
 TArray<T>::TArray(uint_4 nx, uint_4 ny=1, uint_4 nz=1)
-  : mNDBlock(nx*((ny>0)?ny:1)*((nz>0)?nz:1)) , mInfo(NULL)
-{
-  uint_4 size[TARRAY_MAXNDIMS];
+  : mNDBlock(nx*((ny>0)?ny:1)*((nz>0)?nz:1)) , BaseArray()
+{
+  uint_4 size[BASEARRAY_MAXNDIMS];
   size[0] = nx;   size[1] = ny;   size[2] = nz;
   int ndim = 1;
@@ -78,5 +47,5 @@
 template <class T>
 TArray<T>::TArray(uint_4 ndim, uint_4 * siz, NDataBlock<T> & db, bool share, uint_4 step, uint_8 offset)
-  : mNDBlock(db, share) , mInfo(NULL)
+  : mNDBlock(db, share) , BaseArray()
 {
   string exmsg = "TArray<T>::TArray(uint_4, uint_4 *,  NDataBlock<T> & ... )";
@@ -87,5 +56,5 @@
 template <class T>
 TArray<T>::TArray(uint_4 ndim, uint_4 * siz, T* values, uint_4 step, uint_8 offset, Bridge* br)
-  : mNDBlock(ComputeTotalSize(ndim, siz, step, 1), values, br) , mInfo(NULL)
+  : mNDBlock(ComputeTotalSize(ndim, siz, step, 1), values, br) , BaseArray()
 {
   string exmsg = "TArray<T>::TArray(uint_4, uint_4 *, T* ... )";
@@ -95,5 +64,5 @@
 template <class T>
 TArray<T>::TArray(const TArray<T>& a)
-  : mNDBlock(a.mNDBlock) , mInfo(NULL)
+  : mNDBlock(a.mNDBlock) , BaseArray()
 {
   string exmsg = "TArray<T>::TArray(const TArray<T>&)";
@@ -104,5 +73,5 @@
 template <class T>
 TArray<T>::TArray(const TArray<T>& a, bool share)
-  : mNDBlock(a.mNDBlock, share) , mInfo(NULL)
+  : mNDBlock(a.mNDBlock, share) , BaseArray()
 {
   string exmsg = "TArray<T>::TArray(const TArray<T>&, bool)";
@@ -154,80 +123,60 @@
 }
 
-template <class T>
-bool TArray<T>::CompareSizes(const TArray<T>& a)
-{
-  if (ndim_ != a.ndim_)  return(false);
-  for(int k=0; k<ndim_; k++) 
-    if (size_[k] != a.size_[k])  return(false);
-  if ( (macoli_ != a.macoli_) || (marowi_ != a.marowi_) )  return(false);
-  return(true);
-}
-
-template <class T>
-TArray<T>& TArray<T>::CompactDim()
-{
-  if (ndim_ < 2)  return(*this);
+
+template <class T>
+TArray<T>& TArray<T>::CompactAllDimensions()
+{
+  CompactAllDim();
+  return(*this);
+}
+
+template <class T>
+TArray<T>& TArray<T>::CompactTrailingDimensions()
+{
+  CompactTrailingDim();
+  return(*this);
+}
+
+template <class T>
+double TArray<T>::ValueAtPosition(uint_8 ip) const
+{
+#ifdef SO_BOUNDCHECKING
+  if (ip >= totsize_)  throw( ParmError("TArray<T>::ValueAtPosition(uint_8 ip) Out-of-bound Error") );
+#endif
+  return( (double)(*(mNDBlock.Begin()+Offset(ip))) );
+}
+
+// For complex values, we return the module of the complex number
+double TArray< complex<r_4> >::ValueAtPosition(uint_8 ip) const
+{
+#ifdef SO_BOUNDCHECKING
+  if (ip >= totsize_)  throw( ParmError("TArray<T>::ValueAtPosition(uint_8 ip) Out-of-bound Error") );
+#endif
+  complex<r_4> c = *(mNDBlock.Begin()+Offset(ip));
+  double cr = (double)(c.real());
+  double ci = (double)(c.imag());
+  return( sqrt(cr*cr+ci*ci) );
+}
+
+double TArray< complex<r_8> >::ValueAtPosition(uint_8 ip) const
+{
+#ifdef SO_BOUNDCHECKING
+  if (ip >= totsize_)  throw( ParmError("TArray<T>::ValueAtPosition(uint_8 ip) Out-of-bound Error") );
+#endif
+  complex<r_8> c = *(mNDBlock.Begin()+Offset(ip));
+  double cr = (double)(c.real());
+  double ci = (double)(c.imag());
+  return( sqrt(cr*cr+ci*ci) );
+}
+
+
+// SubArrays 
+template <class T>
+TArray<T> TArray<T>::operator () (Range rx, Range ry, Range rz, Range rt, Range ru)
+{
   uint_4 ndim = 0;
-  uint_4 size[TARRAY_MAXNDIMS];
-  uint_4 step[TARRAY_MAXNDIMS];
-  for(int k=0; k<ndim_; k++) {
-    if (size_[k] < 2)  continue;
-    size[ndim] = size_[k];
-    step[ndim] = step_[k];
-    ndim++;
-  }
-  if (ndim == 0)  {
-    size[0] = size_[0];
-    step[0] = step_[0];
-    ndim = 1;
-  }
-  string exmsg = "TArray<T>::CompactDim() ";
-  if (!UpdateSizes(ndim, size, step, offset_, exmsg))  throw( ParmError(exmsg) );
-  return(*this);
-}
-
-
-template <class T>
-uint_4 TArray<T>::MinStepKA() const
-{
-  for(int ka=0; ka<ndim_; ka++)
-    if (step_[ka] == minstep_) return(ka);
-  return(0);
-}
-
-template <class T>
-uint_4 TArray<T>::MaxSizeKA() const
-{
-  uint_4 ka = 0;
-  uint_4 mx = size_[0];
-  for(int k=0; k<ndim_; k++)  
-    if (size_[k] > mx) {  ka = k;  mx = size_[k];  }
-  return(ka);
-}
-
-
-//  Acces lineaire aux elements ....  Calcul d'offset
-
-template <class T>
-uint_8 TArray<T>::Offset(uint_8 ip) const
-{
-if (ip == 0)  return(offset_);
-uint_4 idx[TARRAY_MAXNDIMS];
-int k;
-uint_8 rest = ip;
-for(k=0; k<ndim_; k++)   { idx[k] = rest%size_[k];   rest /= size_[k];  }   
-uint_8 off = offset_;
-for(k=0; k<ndim_; k++)  off += idx[k]*step_[k];
-return (off);
-}
-
-// SubArrays 
-template <class T>
-TArray<T> TArray<T>::operator () (Range rx, Range ry, Range rz, Range rt, Range ru)
-{
-  uint_4 ndim = 0;
-  uint_4 size[TARRAY_MAXNDIMS];
-  uint_4 step[TARRAY_MAXNDIMS];
-  uint_4 pos[TARRAY_MAXNDIMS];
+  uint_4 size[BASEARRAY_MAXNDIMS];
+  uint_4 step[BASEARRAY_MAXNDIMS];
+  uint_4 pos[BASEARRAY_MAXNDIMS];
   size[0] = rx.Size();
   size[1] = ry.Size();
@@ -251,4 +200,5 @@
   TArray<T> ra;
   SubArray(ra, ndim, size, pos, step); 
+  ra.DataBlock().Share(this->DataBlock());
   ra.SetTemp(true);
   return(ra);
@@ -523,92 +473,12 @@
 
 // ----------------------------------------------------
-//          Application d'une fonction
-// ----------------------------------------------------
-template <class T>
-TArray<T>& TArray<T>::ApplyFunction(Arr_DoubleFunctionOfX f)
-{
-  T * pe;
-  uint_8 j,k;
-  if (AvgStep() > 0)   {  // regularly spaced elements
-    uint_8 step = AvgStep();
-    uint_8 maxx = totsize_*step;
-    pe = Data();
-    for(k=0; k<maxx; k+=step )  pe[k] = (T)(f((double)pe[k]));
-  }
-  else {    // Non regular data spacing ...
-    uint_4 ka = MaxSizeKA();
-    uint_8 step = Step(ka);
-    uint_8 gpas = Size(ka)*step;
-    for(j=0; j<totsize_; j += Size(ka))  {
-      pe = mNDBlock.Begin()+Offset(j);
-      for(k=0; k<gpas; k+=step)  pe[k] = (T)(f((double)pe[k]));
-    }
-  }
-  return(*this);
-}
-
-template <class T>
-TArray<T>& TArray<T>::ApplyFunction(Arr_FloatFunctionOfX f)
-{
-  T * pe;
-  uint_8 j,k;
-  if (AvgStep() > 0)   {  // regularly spaced elements
-    uint_8 step = AvgStep();
-    uint_8 maxx = totsize_*step;
-    pe = Data();
-    for(k=0; k<maxx; k+=step )  pe[k] = (T)(f((float)pe[k]));
-  }
-  else {    // Non regular data spacing ...
-    uint_4 ka = MaxSizeKA();
-    uint_8 step = Step(ka);
-    uint_8 gpas = Size(ka)*step;
-    for(j=0; j<totsize_; j += Size(ka))  {
-      pe = mNDBlock.Begin()+Offset(j);
-      for(k=0; k<gpas; k+=step)  pe[k] = (T)(f((float)pe[k]));
-    }
-  }
-  return(*this);
-}
-
-TArray< complex<r_4> >& TArray< complex<r_4> >::ApplyFunction(Arr_DoubleFunctionOfX f)
-{
-  throw( NotAvailableOperation("TArray< complex<r_4> >::ApplyFunction() - Unsupported operation ") );
-}
-
-TArray< complex<r_4> >& TArray< complex<r_4> >::ApplyFunction(Arr_FloatFunctionOfX f)
-{
-  throw(NotAvailableOperation( "TArray< complex<r_4> >::ApplyFunction() - Unsupported operation ") );
-}
-
-TArray< complex<r_8> >& TArray< complex<r_8> >::ApplyFunction(Arr_DoubleFunctionOfX f)
-{
-  throw(NotAvailableOperation("TArray< complex<r_8> >::ApplyFunction() - Unsupported operation ") );
-}
-
-TArray< complex<r_8> >& TArray< complex<r_8> >::ApplyFunction(Arr_FloatFunctionOfX f)
-{
-  throw(NotAvailableOperation("TArray< complex<r_8> >::ApplyFunction() - Unsupported operation ") );
-}
-
-// ----------------------------------------------------
 //       Impression, etc ...
 // ----------------------------------------------------
 
 template <class T>
-void TArray<T>::Show(ostream& os, bool si) const
-{
-  os << " TArray< " << typeid(T).name() << " NDim= " << ndim_
-     << "(" << typeid(*this).name() << " )" << endl;
-  os << "TotSize=" << totsize_ << " Size(X*Y*...)= " ;
-  for(int k=0; k<ndim_; k++) { 
-    os << size_[k];
-    if (k<ndim_-1)  os << " x ";
-  }
-  os << endl;
-  os <<  " Step(X Y ...)= " ;
-  for(int k=0; k<ndim_; k++)     os << step_[k] << "  " ;
-  os << " Offset= " << offset_  << "\n " << endl;
-  if (si && (mInfo != NULL)) os << (*mInfo) << endl;
- 
+string TArray<T>::DataType() const
+{
+  string rs = typeid(T).name();
+  return(rs);
 }
 
@@ -643,132 +513,4 @@
 }
 
-template <class T>
-DVList& TArray<T>::Info()
-{
-if (mInfo == NULL)  mInfo = new DVList;
-return(*mInfo);
-}
-
-
-template <class T>
-bool TArray<T>::UpdateSizes(uint_4 ndim, const uint_4 * siz, uint_4 step, uint_8 offset, string & exmsg)
-{
-  if (ndim >= TARRAY_MAXNDIMS) {
-    exmsg += " NDim Error";  return false;
-  }
-  if (step < 1) {
-    exmsg += " Step(=0) Error";  return false;
-  }
-
-  minstep_ = moystep_ = step;
-
-  // Flagging bad updates ...
-  ndim_ = 0;
-
-  totsize_ = 1;
-  int k;
-  for(k=0; k<TARRAY_MAXNDIMS; k++) {
-    size_[k] = 1;
-    step_[k] = 0;
-  }
-  for(k=0; k<ndim; k++) {
-    size_[k] = siz[k] ;
-    step_[k] = totsize_*step;
-    totsize_ *= size_[k];
-  }
-  if (totsize_ < 1) {
-    exmsg += " Size Error";  return false;
-  }
-  offset_ = offset;
-  // Default for matrices : Lines = Y , Columns = X
-  macoli_ = 0;
-  marowi_ = 1;
-  // Update OK 
-  ndim_ = ndim;
-  return true;
-}
-
-template <class T>
-bool TArray<T>::UpdateSizes(uint_4 ndim, const uint_4 * siz, const uint_4 * step, uint_8 offset, string & exmsg)
-{
-  if (ndim >= TARRAY_MAXNDIMS) {
-    exmsg += " NDim Error";  return false;
-  }
-
-  // Flagging bad updates ...
-  ndim_ = 0;
-
-  totsize_ = 1;
-  int k;
-  for(k=0; k<TARRAY_MAXNDIMS; k++) {
-    size_[k] = 1;
-    step_[k] = 0;
-  }
-  uint_4 minstep = step[0];
-  for(k=0; k<ndim; k++) {
-    size_[k] = siz[k] ;
-    step_[k] = step[k];
-    totsize_ *= size_[k];
-    if (step_[k] < minstep)  minstep = step_[k];
-  }
-  if (minstep < 1) {
-    exmsg += " Step(=0) Error";  return false;
-  }
-  if (totsize_ < 1) {
-    exmsg += " Size Error";  return false;
-  }
-  uint_8 plast = 0;
-  for(k=0; k<ndim; k++)   plast += (siz[k]-1)*step[k];
-  if (plast == minstep*totsize_ )  moystep_ = minstep;
-  else moystep_ = 0;
-  minstep_ = minstep;
-  offset_ = offset;
-  // Default for matrices : Lines = Y , Columns = X
-  macoli_ = 0;
-  marowi_ = 1;
-  // Update OK 
-  ndim_ = ndim;
-  return true;
-}
-
-template <class T>
-bool TArray<T>::UpdateSizes(const TArray<T>& a, string & exmsg)
-{
-  if (a.ndim_ >= TARRAY_MAXNDIMS) {
-    exmsg += " NDim Error";  return false;
-  }
-
-  // Flagging bad updates ...
-  ndim_ = 0;
-
-  totsize_ = 1;
-  int k;
-  for(k=0; k<TARRAY_MAXNDIMS; k++) {
-    size_[k] = 1;
-    step_[k] = 0;
-  }
-  uint_4 minstep = a.step_[0];
-  for(k=0; k<a.ndim_; k++) {
-    size_[k] = a.size_[k] ;
-    step_[k] = a.step_[k];
-    totsize_ *= size_[k];
-    if (step_[k] < minstep)  minstep = step_[k];
-  }
-  if (minstep < 1) {
-    exmsg += " Step(=0) Error";  return false;
-  }
-  if (totsize_ < 1) {
-    exmsg += " Size Error";  return false;
-  }
-
-  minstep_ = a.minstep_;
-  moystep_ = a.moystep_;
-  offset_ = a.offset_;
-  macoli_ = a.macoli_;
-  marowi_ = a.marowi_;
-  // Update OK 
-  ndim_ = a.ndim_;
-  return true;
-}
 
 template <class T>
@@ -789,24 +531,4 @@
 
 
-template <class T>
-void TArray<T>::SubArray(TArray<T> & ra, uint_4 ndim, uint_4 * siz, uint_4 * pos, uint_4 * step)
-{
-  if ( (ndim > ndim_) || (ndim < 1) ) throw(SzMismatchError("TArray<T>::SubArray( ... ) NDim Error") );
-  int k;
-  for(k=0; k<ndim; k++) 
-    if ( (siz[k]*step[k]+pos[k]) > size_[k] )  
-      throw(SzMismatchError("TArray<T>::SubArray( ... ) Size/Pos Error") );
-  (ra.mNDBlock).Share(mNDBlock);
-  uint_8 offset = offset_;
-  for(k=0; k<ndim_; k++) { 
-    offset += pos[k]*step_[k]; 
-    step[k] *= step_[k];
-  }
-  string exm = "TArray<T>::SubArray() ";
-  if (!ra.UpdateSizes(ndim, siz, step, offset,  exm))
-     throw( ParmError(exm) );
-  (ra.mNDBlock).Share(mNDBlock);
-  return;
-}
 
 ///////////////////////////////////////////////////////////////
Index: trunk/SophyaLib/TArray/tarray.h
===================================================================
--- trunk/SophyaLib/TArray/tarray.h	(revision 786)
+++ trunk/SophyaLib/TArray/tarray.h	(revision 787)
@@ -9,14 +9,9 @@
 #include <math.h>
 #include <iostream.h>
+#include "basarr.h"
 #include "ndatablock.h"
 #include <complex>
-#include "anydataobj.h"
-#include "ndatablock.h"
-#include "dvlist.h"
 #include "utilarr.h"
 
-
-//  Maximum number of dimensions for array
-#define TARRAY_MAXNDIMS  5
 
 namespace SOPHYA {
@@ -25,7 +20,9 @@
 template <class T> class FIO_TArray;
 
-//   ------------ classe template Array ----------- 
-template <class T>
-class TArray : public AnyDataObj {
+//   --------------------------- classe template Array -----------------------
+//  ( See BaseArray class for data organisation in  memory and related methods )
+
+template <class T>
+class TArray : public BaseArray {
 public:
   // Creation / destruction 
@@ -43,52 +40,22 @@
   virtual TArray<T>& operator = (const TArray<T>& a);
 
-
   // Gestion taille/Remplissage
   virtual void Clone(const TArray<T>& a); 
   virtual void ReSize(uint_4 ndim, uint_4 * siz, uint_4 step=1);
   virtual void Realloc(uint_4 ndim, uint_4 * siz, uint_4 step=1, bool force=false);
-  // Returns true if ndim and sizes are equal
-  virtual bool CompareSizes(const TArray<T>& a);
+
   // Compacts size=1 array dimensions
-  virtual TArray<T>& CompactDim();
-
-  // Array dimensions
-  inline uint_4 NbDimensions() const { return( ndim_ ); }
-
-  inline uint_8 Size() const { return(totsize_); }
-  inline uint_4 SizeX() const { return(size_[0]); }
-  inline uint_4 SizeY() const { return(size_[1]); }
-  inline uint_4 SizeZ() const { return(size_[2]); }
-  inline uint_4 Size(int ka) const { return(size_[CheckDI(ka,1)]); }
-
-  uint_4 MaxSizeKA() const ;
-
-  // memory organisation - packing information
-  inline bool   IsPacked() const { return(moystep_ == 1); }
-  inline bool   IsPackedX() const { return(step_[0] == 1); }
-  inline bool   IsPackedY() const { return(step_[1] == 1); }
-  inline bool   IsPackedZ() const { return(step_[2] == 1); }
-  inline bool   IsPacked(int ka) const { return(step_[CheckDI(ka,2)] == 1); }
-
-  inline uint_4 MinStep() const  { return(minstep_); }
-  inline uint_4 AvgStep() const  { return(moystep_); }
-  inline uint_4 StepX() const { return(step_[0]); }
-  inline uint_4 StepZ() const { return(step_[1]); }
-  inline uint_4 StepY() const { return(step_[2]); }
-  inline uint_4 Step(int ka) const { return(step_[CheckDI(ka,3)]); }
-
-  uint_4 MinStepKA() const ;
-
-  uint_8 Offset(uint_8 ip=0) const ;
-
-
-  // Temporaire?
-  inline bool   IsTemp(void) const {return mNDBlock.IsTemp();}
-  inline void   SetTemp(bool temp=false) const {mNDBlock.SetTemp(temp);}
+  virtual TArray<T>& CompactAllDimensions();
+  virtual TArray<T>& CompactTrailingDimensions();
 
   // SubArrays
   virtual TArray<T> operator () (Range rx, Range ry, Range rz=0, Range rt=0, Range ru=0); 
 
-  // Acces to data
+
+  // ---- Access to data
+  // Definition of virtual element acces method inherited from BaseArray class 
+  virtual double ValueAtPosition(uint_8 ip) const;
+
+  // Data Access: operator overloaded inline acces methods 
   inline T const& operator()(uint_4 ix, uint_4 iy, uint_4 iz) const ;
   inline T&       operator()(uint_4 ix, uint_4 iy, uint_4 iz);
@@ -108,7 +75,11 @@
   inline const  NDataBlock<T>& DataBlock() const {return mNDBlock;}
 
+  // Temporaire?
+  inline bool   IsTemp(void) const {return mNDBlock.IsTemp();}
+  inline void   SetTemp(bool temp=false) const {mNDBlock.SetTemp(temp);}
+
 // Operations diverses  = , +=, ...
 // Conversion en type T, if Size() == 1
-  inline operator T();
+  inline T toScalar();
 // Met les elements a une suite de valeurs
   virtual TArray<T>&  operator = (Sequence seq);
@@ -123,20 +94,11 @@
   virtual TArray<T>&  operator += (const TArray<T>& a);
   virtual TArray<T>&  operator -= (const TArray<T>& a);
-// Multilication, division element par element les deux tableaux 
+// Multiplication, division element par element les deux tableaux 
   virtual TArray<T>&  MultElt(const TArray<T>& a);
   virtual TArray<T>&  DivElt(const TArray<T>& a);
 
-// Application d'une fonction
-  virtual TArray<T>&  ApplyFunction(Arr_DoubleFunctionOfX f);
-  virtual TArray<T>&  ApplyFunction(Arr_FloatFunctionOfX f);
-
 // Impression, I/O, ...
-  static void   SetMaxPrint(uint_4 nprt=50);   
-  void          Show(ostream& os, bool si=false) const;
-  inline void   Show() const { Show(cout); }
-  void          Print(ostream& os, int_4 maxprt=-1, bool si=false) const ;
-
-//  Objet DVList info 
-  DVList&       Info();
+  virtual string DataType() const;   // definition of abstract method inherited from BaseArray
+  virtual void  Print(ostream& os, int_4 maxprt=-1, bool si=false) const ;
 
 //  Pour la gestion de persistance
@@ -144,34 +106,10 @@
 
 protected:
-  // Verifie la compatibilite de l'index de dimension
-  inline int CheckDI(int ka, int msg) const ;
-  // Verifie la compatibilite des bornes d'index
-  inline void CheckBound(int ix, uint_4 iy, uint_4 iz, uint_4 it, uint_4 iu, int msg) const ;
-  // Changing Sizes/NDim ... return true if OK
-  bool UpdateSizes(uint_4 ndim, const uint_4 * siz, uint_4 step, uint_8 offset, string & exmsg);
-  bool UpdateSizes(uint_4 ndim, const uint_4 * siz, const uint_4 * step, uint_8 offset, string & exmsg);
-  bool UpdateSizes(const TArray<T>& a, string & exmsg);
-  static uint_8 ComputeTotalSize(uint_4 ndim, uint_4 * siz, uint_4 step, uint_8 offset) ;
   // partage les donnees si "a" temporaire, clone sinon.
   void CloneOrShare(const TArray<T>& a);
   // Share: partage les donnees de "a"
   void Share(const TArray<T>& a);
-  // Extraction de sous-tableau
-  virtual void SubArray(TArray<T> & ra, uint_4 ndim, uint_4 * siz, uint_4 * pos, uint_4 * step);
-
-  uint_4 ndim_;                   // nb of dimensions
-  uint_4 size_[TARRAY_MAXNDIMS];     // array size in each dimension
-  uint_8 totsize_;                   // Total number of elements
-  uint_4 step_[TARRAY_MAXNDIMS];     // two consecutive elements distance in a given dimension 
-  uint_4 minstep_;                   // minimal step (in any axes)
-  uint_4 moystep_;                   // mean step 0 non regular steps
-  uint_8 offset_;              // global offset -> position of elem[0] in DataBlock
+
   NDataBlock<T> mNDBlock;      // Le bloc des donnees
-  uint_4 marowi_, macoli_;     // For matrices, Row index and column index in dimensions
-
-  DVList* mInfo;               // Infos (variables) attachees au tableau
-
-  static char * ck_op_msg_[6];  // Operation messages for CheckDI() CheckBound()
-  static uint_4 max_nprt_;      // Nb maxi d'elements imprimes
 };
 
@@ -218,38 +156,4 @@
     {TArray<T> result(a); result.SetTemp(true); result += b; return result;}
 
-////////////////////////////////////////////////
-//  Calcul de fonction 
-template <class T>
-inline TArray<T> sin(const TArray<T>& a)
-    {TArray<T> result(a); result.SetTemp(true); result.ApplyFunction(sin); return result;}
-
-template <class T>
-inline TArray<T> cos(const TArray<T>& a)
-    {TArray<T> result(a); result.SetTemp(true); result.ApplyFunction(cos); return result;}
-
-// --------------------------------------------------
-//        Methodes inline de verification
-// --------------------------------------------------
-template <class T>
-inline int TArray<T>::CheckDI(int ka, int msg)  const
-{
-  if ( (ka < 0) || (ka >= ndim_) ) {
-    string txt = "TArray<T>::CheckDimensionIndex/Error ";   txt += ck_op_msg_[msg];
-    throw(ParmError(txt));
-  }
-  return(ka);
-}
-
-template <class T>
-inline void TArray<T>::CheckBound(int ix, uint_4 iy, uint_4 iz, uint_4 it, uint_4 iu, int msg)  const
-{
-  if ( (ix >= size_[0]) || (iy >= size_[1]) || (iz > size_[2]) ||
-       (it >= size_[3]) || (iu >= size_[4]) ) {
-    string txt = "TArray<T>::CheckArrayBound/Error ";   txt += ck_op_msg_[msg];
-    throw(ParmError(txt));
-  }
-  return;
-}
-
 
 // --------------------------------------------------
@@ -349,5 +253,5 @@
 
 template <class T>
-inline TArray<T>::operator T()
+inline T TArray<T>::toScalar()
 { 
   if (Size() != 1) throw(SzMismatchError("TArray<T>::operator T() Size() != 1")) ;
