Changeset 3524 in Sophya for trunk/Cosmo/SimLSS/genefluct3d.cc


Ignore:
Timestamp:
Sep 22, 2008, 4:07:02 PM (17 years ago)
Author:
cmv
Message:

intro du remplissage du NTuple de debug cmv 22/09/2008

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Cosmo/SimLSS/genefluct3d.cc

    r3521 r3524  
    1515#include "fabtwriter.h"
    1616#include "fioarr.h"
     17#include "ntuple.h"
    1718
    1819#include "arrctcast.h"
     
    8384 nthread_ = 0;
    8485 lp_ = 0;
    85  array_allocated_ = false;
     86 array_allocated_ = false; array_type = 0;
    8687 cosmo_ = NULL;
    8788 growth_ = NULL;
     
    153154 try {
    154155   T_.ReSize(3,SzK_);
    155    array_allocated_ = true;
     156   array_allocated_ = true; array_type=0;
    156157   if(lp_>1) cout<<"  allocating: "<<T_.Size()*sizeof(complex<GEN3D_TYPE>)/1.e6<<" Mo"<<endl;
    157158 } catch (...) {
     
    552553
    553554//-------------------------------------------------------
     555void GeneFluct3D::NTupleCheck(POutPersist &pos,string ntname,unsigned long nent)
     556// Remplit le NTuple "ntname" avec "nent" valeurs du cube (reel ou complex) et l'ecrit dans "pos"
     557{
     558  if(ntname.size()<=0 || nent==0) return;
     559  int nvar = 0;
     560  if(array_type==1) nvar = 3;
     561  else if(array_type==2) nvar = 4;
     562  else return;
     563  char *vname[4] = {"t","z","re","im"};
     564  float xnt[4];
     565  NTuple nt(nvar,vname);
     566
     567  if(array_type==1) {
     568    unsigned long nmod = Nx_*Ny_*Nz_/nent; if(nmod==0) nmod=1;
     569    unsigned long n=0;
     570    for(long i=0;i<Nx_;i++) for(long j=0;j<Ny_;j++) for(long l=0;l<Nz_;l++) {
     571      if(n==nmod) {
     572        int_8 ip = IndexR(i,j,l);
     573        xnt[0]=sqrt(i*i+j*j); xnt[1]=l; xnt[2]=data_[ip];
     574        nt.Fill(xnt);
     575        n=0;
     576      }
     577      n++;
     578    }
     579  } else {
     580    unsigned long nmod = Nx_*Ny_*NCz_/nent; if(nmod==0) nmod=1;
     581    unsigned long n=0;
     582    for(long i=0;i<Nx_;i++) for(long j=0;j<Ny_;j++) for(long l=0;l<NCz_;l++) {
     583      if(n==nmod) {
     584        xnt[0]=sqrt(i*i+j*j); xnt[1]=l; xnt[2]=T_(l,j,i).real(); xnt[3]=T_(l,j,i).imag();
     585        nt.Fill(xnt);
     586        n=0;
     587      }
     588      n++;
     589    }
     590  }
     591
     592  pos.PutObject(nt,ntname);
     593}
     594
     595//-------------------------------------------------------
    554596void GeneFluct3D::Print(void)
    555597{
     
    611653 }
    612654
     655 array_type = 2;
     656
    613657 if(lp_>0) cout<<"...computing power"<<endl;
    614658 double p = compute_power_carte();
     
    654698 }
    655699
     700 array_type = 2;
    656701 manage_coefficients();   // gros effet pour les spectres que l'on utilise !
    657702
     
    851896 // On fait la FFT
    852897 GEN3D_FFTW_EXECUTE(pb_);
     898 array_type = 1;
    853899}
    854900
     
    861907 // On fait la FFT
    862908 GEN3D_FFTW_EXECUTE(pf_);
     909 array_type = 2;
     910
    863911 // On corrige du pb de la normalisation de FFTW3
    864912 double v = (double)NRtot_;
Note: See TracChangeset for help on using the changeset viewer.