Ignore:
Timestamp:
Sep 11, 2008, 2:45:01 PM (17 years ago)
Author:
ansari
Message:

Ajout/codage methode P2DArrayAdapter::MeanVal() pour les classes adapter heritant de P2DArrayAdapter, Reza 11/09/2008

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/SophyaPI/PIext/nomskymapadapter.cc

    r3433 r3520  
    3333  virtual       ~LocalMapArrAdapter() { if (ad) delete map; }
    3434  virtual double  Value(int ix, int iy) { return((*map)(ix, iy)); }
     35  virtual double  MeanVal(int ix1, int ix2, int jy1, int jy2)
     36  {
     37  int ec;
     38  if (ix1>ix2) { ec=ix1; ix1=ix2; ix2=ec; }
     39  if (jy1>jy2) { ec=jy1; jy1=jy2; jy2=ec; }   
     40  double ss = 0.;
     41  for(int j=jy1; j<=jy2; j++)
     42    for(int i=ix1; i<=ix2; i++)  ss += (double)((*map)(i, j));
     43  ss /= (double)((jy2-jy1+1)*(ix2-ix1+1));
     44  return ss; 
     45  }   
    3546
    3647protected :
     
    5667im = (*map)(iy, ix).imag();
    5768return(sqrt(re*re+im*im));
     69}
     70
     71/* --Methode-- */
     72DECL_TEMP_SPEC  /* equivalent a template <> , pour SGI-CC en particulier */
     73double LocalMapArrAdapter< complex<float> >::MeanVal(int ix1, int ix2, int jy1, int jy2)
     74{
     75int ec;
     76if (ix1>ix2) { ec=ix1; ix1=ix2; ix2=ec; }
     77if (jy1>jy2) { ec=jy1; jy1=jy2; jy2=ec; }   
     78complex<float> ss = 0.;
     79for(int j=jy1; j<=jy2; j++)
     80  for(int i=ix1; i<=ix2; i++)  ss += (*map)(i, j);
     81ss /= (double)((jy2-jy1+1)*(ix2-ix1+1));
     82return sqrt(ss.real()*ss.real()+ss.imag()*ss.imag()); 
     83}
     84
     85/* --Methode-- */
     86DECL_TEMP_SPEC  /* equivalent a template <> , pour SGI-CC en particulier */
     87double LocalMapArrAdapter< complex<double> >::MeanVal(int ix1, int ix2, int jy1, int jy2)
     88{
     89int ec;
     90if (ix1>ix2) { ec=ix1; ix1=ix2; ix2=ec; }
     91if (jy1>jy2) { ec=jy1; jy1=jy2; jy2=ec; }   
     92complex<double> ss = 0.;
     93for(int j=jy1; j<=jy2; j++)
     94  for(int i=ix1; i<=ix2; i++)  ss += (*map)(i, j);
     95ss /= (double)((jy2-jy1+1)*(ix2-ix1+1));
     96return sqrt(ss.real()*ss.real()+ss.imag()*ss.imag()); 
    5897}
    5998
Note: See TracChangeset for help on using the changeset viewer.