Index: /trunk/Cosmo/SimLSS/Makefile
===================================================================
--- /trunk/Cosmo/SimLSS/Makefile	(revision 3280)
+++ /trunk/Cosmo/SimLSS/Makefile	(revision 3281)
@@ -11,6 +11,6 @@
 
 MYEXTINC = ${EXTLIBDIR}/Include
-MYLIB = $(SOPHYAEXTSLBLIST) -L$(LIB) -lcmvsimbao -lfftw3 -lm
-#MYLIB = $(SOPHYAEXTSLBLIST) -L$(LIB) -lcmvsimbao -lfftw3_threads -lfftw3 -lm
+#MYLIB = $(SOPHYAEXTSLBLIST) -L$(LIB) -lcmvsimbao -lfftw3 -lm
+MYLIB = $(SOPHYAEXTSLBLIST) -L$(LIB) -lcmvsimbao -lfftw3_threads -lfftw3 -lm
 
 #---- Les programmes utilitaires de calcul de cartes
Index: /trunk/Cosmo/SimLSS/cmvobserv3d.cc
===================================================================
--- /trunk/Cosmo/SimLSS/cmvobserv3d.cc	(revision 3280)
+++ /trunk/Cosmo/SimLSS/cmvobserv3d.cc	(revision 3281)
@@ -39,5 +39,7 @@
      <<" -W : write cube in FITS format (complex cube is coded as real cube)"<<endl
      <<" -P : write cube in PPF format"<<endl
+     <<" -S : write cube slices in PPF format"<<endl
      <<" -V : compute variance from real space (for check, default: no)"<<endl
+     <<" -T nth : nombre de threads (si compil multi-thread, default: 0)"<<endl
      <<endl;
 }
@@ -91,5 +93,5 @@
  bool computefourier0=false;
  bool use_growth_factor = false;
- unsigned short nthread=4;
+ unsigned short nthread=0;
 
  // *** What to do
@@ -97,4 +99,5 @@
  bool wfits = false;
  bool wppf = false;
+ bool wslice = false;
  bool compvarreal = false;
 
@@ -106,5 +109,6 @@
 
  char c;
- while((c = getopt(narg,arg,"ha0PWV2Gx:y:z:s:Z:M:A:")) != -1) {
+ while((c = getopt(narg,arg,"ha0PWSV2Gx:y:z:s:Z:M:A:T:")) != -1) {
+  int nth = 0;
   switch (c) {
   case 'a' :
@@ -150,4 +154,11 @@
   case 'P' :
     wppf = true;
+    break;
+  case 'S' :
+    wslice = true;
+    break;
+  case 'T' :
+    sscanf(optarg,"%d",&nth);
+    nthread = (nth<1)? 0: nth;
     break;
   case 'h' :
@@ -410,4 +421,8 @@
    PrtTim(">>>> End WritePPF");
  }
+ if(wslice) {
+   fluct3d.WriteSlicePPF("cmvobserv3d_s_r0.ppf");
+   PrtTim(">>>> End WriteSlicePPF");
+ }
 
  int_8 nm;
@@ -448,4 +463,8 @@
    nm = fluct3d.MeanSigma2(rm,rs2,0.,1e200,true,0.);
  PrtTim(">>>> End Apply poisson on galaxy number");
+ if(wslice) {
+   fluct3d.WriteSlicePPF("cmvobserv3d_s_rn.ppf");
+   PrtTim(">>>> End WriteSlicePPF");
+ }
 
  cout<<"\n--- Convert Galaxy number to HI mass"<<endl;
@@ -479,4 +498,8 @@
    PrtTim(">>>> End WritePPF");
  }
+ if(wslice) {
+   fluct3d.WriteSlicePPF("cmvobserv3d_s_r.ppf");
+   PrtTim(">>>> End WriteSlicePPF");
+ }
 
  if(do_agn) {
@@ -502,4 +525,8 @@
    fluct3d.WritePPF("cmvobserv3d_rf.ppf",true);
    PrtTim(">>>> End WritePPF");
+ }
+ if(wslice) {
+   fluct3d.WriteSlicePPF("cmvobserv3d_s_rf.ppf");
+   PrtTim(">>>> End WriteSlicePPF");
  }
 
@@ -591,4 +618,10 @@
 
 ######################################################
+openppf cmvobserv3d_s_r0.ppf
+openppf cmvobserv3d_s_rn.ppf
+openppf cmvobserv3d_s_r.ppf
+openppf cmvobserv3d_s_rf.ppf
+
+######################################################
 openppf cmvobserv3d.ppf
 
Index: /trunk/Cosmo/SimLSS/genefluct3d.cc
===================================================================
--- /trunk/Cosmo/SimLSS/genefluct3d.cc	(revision 3280)
+++ /trunk/Cosmo/SimLSS/genefluct3d.cc	(revision 3281)
@@ -25,5 +25,5 @@
 #include "genefluct3d.h"
 
-//#define FFTW_THREAD
+#define FFTW_THREAD
 
 #define MODULE2(_x_) ((double)((_x_).real()*(_x_).real() + (_x_).imag()*(_x_).imag()))
@@ -437,4 +437,52 @@
    init_fftw();
    SetObservator(zref,kzref);
+ } catch (PThrowable & exc) {
+   cout<<"Exception : "<<(string)typeid(exc).name()
+       <<" - Msg= "<<exc.Msg()<<endl;
+   return;
+ } catch (...) {
+   cout<<" some other exception was caught !"<<endl;
+   return;
+ }
+}
+
+void GeneFluct3D::WriteSlicePPF(string cfname)
+// On ecrit 3 tranches du cube selon chaque axe
+{
+ cout<<"--- GeneFluct3D::WriteSlicePPF: Writing Cube Slices"<<cfname<<endl;
+ try {
+
+   POutPersist pos(cfname.c_str());
+   TMatrix<r_4> S;
+   char str[16];
+   long i,j,l;
+
+   // Tranches en Z
+   for(int s=0;s<3;s++) {
+     S.ReSize(Nx_,Ny_);
+     if(s==0) l=0; else if(s==1) l=(Nz_+1)/2; else  l=Nz_-1;
+     sprintf(str,"z%d",l);
+     for(i=0;i<Nx_;i++) for(j=0;j<Ny_;j++) S(i,j)=data_[IndexR(i,j,l)];
+     pos<<PPFNameTag(str)<<S; S.RenewObjId();
+   }
+
+   // Tranches en Y
+   for(int s=0;s<3;s++) {
+     S.ReSize(Nz_,Nx_);
+     if(s==0) j=0; else if(s==1) j=(Ny_+1)/2; else  j=Ny_-1;
+     sprintf(str,"y%d",j);
+     for(i=0;i<Nx_;i++) for(l=0;l<Nz_;l++) S(l,i)=data_[IndexR(i,j,l)];
+     pos<<PPFNameTag(str)<<S; S.RenewObjId();
+   }
+
+   // Tranches en X
+   for(int s=0;s<3;s++) {
+     S.ReSize(Nz_,Ny_);
+     if(s==0) i=0; else if(s==1) i=(Nx_+1)/2; else  i=Nx_-1;
+     sprintf(str,"x%d",i);
+     for(j=0;j<Ny_;j++) for(l=0;l<Nz_;l++) S(l,j)=data_[IndexR(i,j,l)];
+     pos<<PPFNameTag(str)<<S; S.RenewObjId();
+   }
+
  } catch (PThrowable & exc) {
    cout<<"Exception : "<<(string)typeid(exc).name()
Index: /trunk/Cosmo/SimLSS/genefluct3d.h
===================================================================
--- /trunk/Cosmo/SimLSS/genefluct3d.h	(revision 3280)
+++ /trunk/Cosmo/SimLSS/genefluct3d.h	(revision 3281)
@@ -100,4 +100,5 @@
   void WritePPF(string cfname,bool write_real=true);
   void ReadPPF(string cfname);
+  void WriteSlicePPF(string cfname);
 
   void SetPrtLevel(int lp=0) {lp_ = lp;}
