Ignore:
Timestamp:
10/16/12 13:04:44 (12 years ago)
Author:
ymipsl
Message:

Major Update

  • redesign Type and attribute manipulation
  • add enumerate type and attribute
  • use blitz class array instead of boost class array

YM

File:
1 edited

Legend:

Unmodified
Added
Removed
  • XIOS/trunk/src/functor/average.cpp

    r335 r369  
    11#include "average.hpp" 
     2#include "array_new.hpp" 
    23 
    34namespace xios 
     
    78      /// ////////////////////// Définitions ////////////////////// /// 
    89 
    9       CAverage::CAverage(DoubleArray doutput) 
     10      CAverage::CAverage(CArray<double,1>& doutput) 
    1011         : SuperClass(StdString("average"), doutput) 
    11       { /* Ne rien faire de plus */ } 
     12      { doutput.dumpStructureInformation(cout) ;/* Ne rien faire de plus */ } 
    1213 
    1314      CAverage::~CAverage(void) 
     
    1617      //--------------------------------------------------------------- 
    1718 
    18       void CAverage::apply(const DoubleArray _dinput, 
    19                                  DoubleArray _doutput) 
     19      void CAverage::apply(const CArray<double,1>& _dinput, 
     20                                 CArray<double,1>& _doutput) 
    2021      { 
     22/* 
    2123         const double * it1  = _dinput->data(), 
    2224                      * end1 = _dinput->data() + _dinput->num_elements();  
     
    2527              for (; it1 != end1; it1++, it++) *it  = *it1; 
    2628         else for (; it1 != end1; it1++, it++) *it += *it1;                
     29*/ 
     30        if (this->nbcall == 1) _doutput=_dinput ; 
     31        else _doutput+=_dinput ; 
     32       
    2733      } 
    2834       
    2935      void CAverage::final(void) 
    3036      { 
    31           double * it1  = this->getDataOutput()->data(), 
     37/*          double * it1  = this->getDataOutput()->data(), 
    3238                 * end1 = this->getDataOutput()->data() + this->getDataOutput()->num_elements(); 
    3339          for (; it1 != end1; it1++) *it1 /= this->nbcall; 
    3440          this->nbcall = 0;                                                    
     41*/ 
     42        doutput/=this->nbcall;  
     43        this->nbcall = 0;  
    3544      } 
    3645   } // namespace func 
Note: See TracChangeset for help on using the changeset viewer.