Index: trunk/SophyaPI/PIext/nomtarradapter.cc
===================================================================
--- trunk/SophyaPI/PIext/nomtarradapter.cc	(revision 3712)
+++ trunk/SophyaPI/PIext/nomtarradapter.cc	(revision 3713)
@@ -224,5 +224,5 @@
   TVector<T>* v = new TVector<T>(arr, true);  // on partage les donnees
   dopt = "thinline," + dopt;
-  return( new PIYfXDrawer( new POTVectorAdapter<T>(v, true), NULL, true) );
+  return( new PIYfXDrawer( new POTVectorAdapter<T>(v, true, StringToCmplxDispOption(dopt)), NULL, true) );
 }
 else { 
@@ -234,5 +234,5 @@
 /* --Methode-- */
 template <class T> 
-P2DArrayAdapter* NOMAdapter_TArray<T>::Get2DArray(string &)
+P2DArrayAdapter* NOMAdapter_TArray<T>::Get2DArray(string & dopt)
 {
 TArray<T> arr(*mArr, true);    // on partage les donnees 
@@ -241,5 +241,5 @@
   // On peut en faire un tableau 2-D ...
   TMatrix<T>* m = new TMatrix<T>(arr, true);  // on partage les donnees
-  return ( new POTMatrixAdapter<T>(m, true) );
+  return ( new POTMatrixAdapter<T>(m, true, StringToCmplxDispOption(dopt)) );
 }
 else { 
Index: trunk/SophyaPI/PIext/nomtmatvecadapter.cc
===================================================================
--- trunk/SophyaPI/PIext/nomtmatvecadapter.cc	(revision 3712)
+++ trunk/SophyaPI/PIext/nomtmatvecadapter.cc	(revision 3713)
@@ -234,27 +234,28 @@
 else {
   dopt = "thinline " + dopt;
-  return( new PIYfXDrawer( new POTVectorAdapter<T>(v, false), NULL, true) );
-  }
-}
-
-/* --Methode-- */
-template <class T> 
-P2DArrayAdapter* NOMAdapter_TMatrix<T>::Get2DArray(string &)
+  return( new PIYfXDrawer( new POTVectorAdapter<T>(v, false, StringToCmplxDispOption(dopt)), NULL, true) );
+  }
+}
+
+/* --Methode-- */
+template <class T> 
+P2DArrayAdapter* NOMAdapter_TMatrix<T>::Get2DArray(string & dopt)
 {
 Image<T>* img = dynamic_cast<Image<T> *>(mMtx);
 if (img != NULL) return ( new ImageAdapter<T>(img, false) );
-else return ( new POTMatrixAdapter<T>(mMtx, false) );
-}
+ else return ( new POTMatrixAdapter<T>(mMtx, false, StringToCmplxDispOption(dopt)) );
+}
+
 
 // ---- Specialisation pour complexes -----
 DECL_TEMP_SPEC  /* equivalent a template <> , pour SGI-CC en particulier */
-P2DArrayAdapter* NOMAdapter_TMatrix< complex<r_4> >::Get2DArray(string &)
-{
-return ( new POTMatrixAdapter< complex<r_4> >(mMtx, false) );
-}
-DECL_TEMP_SPEC  /* equivalent a template <> , pour SGI-CC en particulier */
-P2DArrayAdapter* NOMAdapter_TMatrix< complex<r_8> >::Get2DArray(string &)
-{
-return ( new POTMatrixAdapter< complex<r_8> >(mMtx, false) );
+P2DArrayAdapter* NOMAdapter_TMatrix< complex<r_4> >::Get2DArray(string & dopt)
+{
+  return ( new POTMatrixAdapter< complex<r_4> >(mMtx, false, StringToCmplxDispOption(dopt) ) );
+}
+DECL_TEMP_SPEC  /* equivalent a template <> , pour SGI-CC en particulier */
+P2DArrayAdapter* NOMAdapter_TMatrix< complex<r_8> >::Get2DArray(string & dopt)
+{
+  return ( new POTMatrixAdapter< complex<r_8> >(mMtx, false, StringToCmplxDispOption(dopt) ) );
 }
 // -------------------------------------------------------------
Index: trunk/SophyaPI/PIext/pitvmaad.cc
===================================================================
--- trunk/SophyaPI/PIext/pitvmaad.cc	(revision 3712)
+++ trunk/SophyaPI/PIext/pitvmaad.cc	(revision 3713)
@@ -7,9 +7,45 @@
 #include <math.h>
 
-/* --Methode-- */
-template <class T> 
-POTVectorAdapter<T>::POTVectorAdapter(TVector<T>* v, bool ad)
+// -------------------------------------------------------
+// Decodage de la presence dans la chaine opt des options d'affichage pour tableaux complexes 
+//   cdreal , cdimag , cdphase , cdmod , cdmod2
+PICmplxDispOption StringToCmplxDispOption( string & opt )
+{
+PICmplxDispOption dopt=PICDO_Module;
+size_t olen = opt.length();
+if (opt.find("cdmod2")<olen) dopt=PICDO_Module2;
+else if (opt.find("cdmod")<olen) dopt=PICDO_Module;
+else if (opt.find("cdphas")<olen) dopt=PICDO_Phase;
+else if (opt.find("cdimag")<olen) dopt=PICDO_Imag;
+else if (opt.find("cdreal")<olen) dopt=PICDO_Real;
+else dopt=PICDO_Module;
+return dopt;  
+}
+
+/* --- Methodes de calcul inline pour valeurs de retour complexes ---- */
+static inline double  _z_mod_( complex< r_4 > z) 
+{
+  return ( sqrt((double)(z.real()*z.real()+z.imag()*z.imag() ) ) );
+}
+static inline double  _z_mod_( complex< r_8 > z) 
+{
+  return ( sqrt(z.real()*z.real()+z.imag()*z.imag() )  );
+}
+static inline double  _z_mod2_( complex< r_4 > z) 
+{
+  return ( (double)(z.real()*z.real()+z.imag()*z.imag() ) );
+}
+static inline double  _z_mod2_( complex< r_8 > z) 
+{
+  return ( z.real()*z.real()+z.imag()*z.imag() );
+}
+/* ----------------------------  */
+
+/* --Methode-- */
+template <class T> 
+POTVectorAdapter<T>::POTVectorAdapter(TVector<T>* v, bool ad, PICmplxDispOption dopt)
         : P1DArrayAdapter(v->NElts())
 {
+dOpt = dopt;
 aDel = ad; 
 mVec = v; 
@@ -26,5 +62,5 @@
 double POTVectorAdapter<T>::Value(int i)
 {
-return((*mVec)(i));
+  return((double)(*mVec)(i));
 }
 
@@ -33,8 +69,21 @@
 double POTVectorAdapter< complex<float> >::Value(int i)
 {
-double re,im;
-re = (*mVec)(i).real();
-im = (*mVec)(i).imag();
-return(sqrt(re*re+im*im));
+switch (dOpt) {
+ case PICDO_Module:
+   return _z_mod_( (*mVec)(i) );
+   break;
+ case PICDO_Real:
+   return (double)(((*mVec)(i)).real());
+   break;
+ case PICDO_Imag:
+   return (double)(((*mVec)(i)).imag());
+   break;
+ case PICDO_Phase:
+   return atan2( (double) ((*mVec)(i).real()), (double)((*mVec)(i).imag()) );
+   break;
+ case PICDO_Module2:
+   return _z_mod2_( (*mVec)(i) );
+   break;
+ }
 }
 
@@ -43,15 +92,29 @@
 double POTVectorAdapter< complex<double> >::Value(int i)
 {
-double re,im;
-re = (*mVec)(i).real();
-im = (*mVec)(i).imag();
-return(sqrt(re*re+im*im));
-}
-
-/* --Methode-- */
-template <class T> 
-POTMatrixAdapter<T>::POTMatrixAdapter(TMatrix<T>* mtx, bool ad)
+switch (dOpt) {
+ case PICDO_Module:
+   return _z_mod_( (*mVec)(i) );
+   break;
+ case PICDO_Real:
+   return (double)(((*mVec)(i)).real());
+   break;
+ case PICDO_Imag:
+   return (double)(((*mVec)(i)).imag());
+   break;
+ case PICDO_Phase:
+   return atan2( (double) ((*mVec)(i).real()), (double)((*mVec)(i).imag()) );
+   break;
+ case PICDO_Module2:
+   return _z_mod2_( (*mVec)(i) );
+   break;
+ }
+}
+
+/* --Methode-- */
+template <class T> 
+POTMatrixAdapter<T>::POTMatrixAdapter(TMatrix<T>* mtx, bool ad, PICmplxDispOption dopt)
         : P2DArrayAdapter(mtx->NCols(), mtx->NRows())
 {
+dOpt = dopt;
 aDel = ad; 
 mMtx = mtx;
@@ -89,8 +152,21 @@
 double POTMatrixAdapter< complex<float> >::Value(int ix, int iy)
 {
-double re,im;
-re = (*mMtx)(iy, ix).real();
-im = (*mMtx)(iy, ix).imag();
-return(sqrt(re*re+im*im));
+switch (dOpt) {
+ case PICDO_Module:
+   return _z_mod_( (*mMtx)(iy, ix) );
+   break;
+ case PICDO_Real:
+   return (double)(((*mMtx)(iy, ix)).real());
+   break;
+ case PICDO_Imag:
+   return (double)(((*mMtx)(iy, ix)).imag());
+   break;
+ case PICDO_Phase:
+   return atan2( (double) ((*mMtx)(iy, ix)).real(), (double) ((*mMtx)(iy, ix)).imag() );
+   break;
+ case PICDO_Module2:
+   return _z_mod2_( (*mMtx)(iy, ix) );
+   break;
+ }
 }
 
@@ -99,8 +175,21 @@
 double POTMatrixAdapter< complex<double> >::Value(int ix, int iy)
 {
-double re,im;
-re = (*mMtx)(iy, ix).real();
-im = (*mMtx)(iy, ix).imag();
-return(sqrt(re*re+im*im));
+switch (dOpt) {
+ case PICDO_Module:
+   return _z_mod_( (*mMtx)(iy, ix) );
+   break;
+ case PICDO_Real:
+   return (double)(((*mMtx)(iy, ix)).real());
+   break;
+ case PICDO_Imag:
+   return (double)(((*mMtx)(iy, ix)).imag());
+   break;
+ case PICDO_Phase:
+   return atan2( (double) ((*mMtx)(iy, ix)).real(), (double) ((*mMtx)(iy, ix)).imag() );
+   break;
+ case PICDO_Module2:
+   return _z_mod2_( (*mMtx)(iy, ix) );
+   break;
+ }
 }
 
@@ -112,9 +201,25 @@
 if (ix1>ix2) { ec=ix1; ix1=ix2; ix2=ec; }
 if (jy1>jy2) { ec=jy1; jy1=jy2; jy2=ec; }    
-complex<float> ss = 0.;
+complex<float> ssz = complex<float>(0.,0.);
 for(int j=jy1; j<=jy2; j++) 
-  for(int i=ix1; i<=ix2; i++)  ss += (*mMtx)(j, i);
-ss /= (double)((jy2-jy1+1)*(ix2-ix1+1));
-return sqrt(ss.real()*ss.real()+ss.imag()*ss.imag());  
+  for(int i=ix1; i<=ix2; i++)  ssz += (*mMtx)(j, i);
+switch (dOpt) {
+ case PICDO_Module:
+   return _z_mod_( ssz / complex<float>((float)((jy2-jy1+1)*(ix2-ix1+1)),(float)0.) );
+   break;
+ case PICDO_Real:
+   return ((double)(ssz.real())/(double)((jy2-jy1+1)*(ix2-ix1+1)) ) ;
+   break;
+ case PICDO_Imag:
+   return ((double)(ssz.imag())/(double)((jy2-jy1+1)*(ix2-ix1+1)) ) ;
+   break;
+ case PICDO_Phase:
+   return atan2( (double) ssz.real(), (double) ssz.imag() );
+   break;
+ case PICDO_Module2:
+   return _z_mod2_( ssz / complex<float>((float)((jy2-jy1+1)*(ix2-ix1+1)),(float)0.) );
+   break;
+ }
+return 0.;  
 }   
 
@@ -126,10 +231,30 @@
 if (ix1>ix2) { ec=ix1; ix1=ix2; ix2=ec; }
 if (jy1>jy2) { ec=jy1; jy1=jy2; jy2=ec; }    
-complex<double> ss = 0.;
+complex<double> ssz = complex<double>(0.,0.);
 for(int j=jy1; j<=jy2; j++) 
-  for(int i=ix1; i<=ix2; i++)  ss += (*mMtx)(j, i);
-ss /= (double)((jy2-jy1+1)*(ix2-ix1+1));
-return sqrt(ss.real()*ss.real()+ss.imag()*ss.imag());  
+  for(int i=ix1; i<=ix2; i++)  ssz += (*mMtx)(j, i);
+switch (dOpt) {
+ case PICDO_Module:
+   return _z_mod_( ssz / complex<double>((double)((jy2-jy1+1)*(ix2-ix1+1)),(double)0.) );
+   break;
+ case PICDO_Real:
+   return ((double)(ssz.real())/(double)((jy2-jy1+1)*(ix2-ix1+1)) ) ;
+   break;
+ case PICDO_Imag:
+   return ((double)(ssz.imag())/(double)((jy2-jy1+1)*(ix2-ix1+1)) ) ;
+   break;
+ case PICDO_Phase:
+   return atan2( (double) ssz.real(), (double) ssz.imag() );
+   break;
+ case PICDO_Module2:
+   return _z_mod2_( ssz / complex<double>((double)((jy2-jy1+1)*(ix2-ix1+1)),(double)0.) );
+   break;
+ }
+return 0.;  
 }   
+
+
+
+
 
 #ifdef __CXX_PRAGMA_TEMPLATES__
Index: trunk/SophyaPI/PIext/pitvmaad.h
===================================================================
--- trunk/SophyaPI/PIext/pitvmaad.h	(revision 3712)
+++ trunk/SophyaPI/PIext/pitvmaad.h	(revision 3713)
@@ -13,4 +13,8 @@
 #include "tvector.h"
 
+// Definition d'enum pour choix de la quantite affichee pour les tableaux de complexes.
+enum PICmplxDispOption { PICDO_Module, PICDO_Real, PICDO_Imag, PICDO_Phase, PICDO_Module2 };
+// Decode la presence d'une chaine opt contenant cdreal , cdimag , cdphase , cdmod , cdmod2
+PICmplxDispOption StringToCmplxDispOption( string & opt );
 
 // Adaptateur de vecteurs SOPHYA a P1DArrayAdapter
@@ -18,9 +22,10 @@
 class POTVectorAdapter : public P1DArrayAdapter {
 public :
-		  POTVectorAdapter(TVector<T>* v, bool ad=false); 
+  POTVectorAdapter(TVector<T>* v, bool ad=false, PICmplxDispOption dopt=PICDO_Module); 
   virtual         ~POTVectorAdapter();
   virtual double  Value(int i);
 
 protected:
+  PICmplxDispOption dOpt;
   bool aDel;
   TVector<T>* mVec;
@@ -35,5 +40,5 @@
 class POTMatrixAdapter :  public P2DArrayAdapter {
 public :
-                  POTMatrixAdapter(TMatrix<T>* mtx, bool ad=false);
+  POTMatrixAdapter(TMatrix<T>* mtx, bool ad=false, PICmplxDispOption dopt=PICDO_Module);
   virtual         ~POTMatrixAdapter();
   virtual double  Value(int ix, int iy);
@@ -41,4 +46,5 @@
 
 protected:
+  PICmplxDispOption dOpt;
   bool aDel;
   TMatrix<T>* mMtx;
