source: XIOS/trunk/src/functor/average.cpp @ 380

Last change on this file since 380 was 380, checked in by ymipsl, 12 years ago

cleaning some output

YM

File size: 1.5 KB
RevLine 
[219]1#include "average.hpp"
[369]2#include "array_new.hpp"
[219]3
[335]4namespace xios
[219]5{
6   namespace func
7   {
8      /// ////////////////////// Définitions ////////////////////// ///
9
[369]10      CAverage::CAverage(CArray<double,1>& doutput)
[219]11         : SuperClass(StdString("average"), doutput)
[380]12      { /* Ne rien faire de plus */ }
[219]13
14      CAverage::~CAverage(void)
15      { /* Ne rien faire de plus */ }
16
17      //---------------------------------------------------------------
18
[369]19      void CAverage::apply(const CArray<double,1>& _dinput,
20                                 CArray<double,1>& _doutput)
[219]21      {
[369]22/*
[266]23         const double * it1  = _dinput->data(),
24                      * end1 = _dinput->data() + _dinput->num_elements();
25               double * it   = _doutput->data();
26         if (this->nbcall == 1)
27              for (; it1 != end1; it1++, it++) *it  = *it1;
28         else for (; it1 != end1; it1++, it++) *it += *it1;               
[369]29*/
30        if (this->nbcall == 1) _doutput=_dinput ;
31        else _doutput+=_dinput ;
32     
[219]33      }
[266]34     
35      void CAverage::final(void)
36      {
[369]37/*          double * it1  = this->getDataOutput()->data(),
[266]38                 * end1 = this->getDataOutput()->data() + this->getDataOutput()->num_elements();
39          for (; it1 != end1; it1++) *it1 /= this->nbcall;
40          this->nbcall = 0;                                                   
[369]41*/
42        doutput/=this->nbcall; 
43        this->nbcall = 0; 
[266]44      }
[219]45   } // namespace func
46} // namespace xmlioserver
Note: See TracBrowser for help on using the repository browser.