source: XIOS/dev/dev_olga/src/functor/accumulate.cpp @ 1158

Last change on this file since 1158 was 1158, checked in by oabramkina, 7 years ago

Two server levels: merging with trunk r1137.
There are bugs.

  • Property copyright set to
    Software name : XIOS (Xml I/O Server)
    http://forge.ipsl.jussieu.fr/ioserver
    Creation date : January 2009
    Licence : CeCCIL version2
    see license file in root directory : Licence_CeCILL_V2-en.txt
    or http://www.cecill.info/licences/Licence_CeCILL_V2-en.html
    Holder : CEA/LSCE (Laboratoire des Sciences du CLimat et de l'Environnement)
    CNRS/IPSL (Institut Pierre Simon Laplace)
    Project Manager : Yann Meurdesoif
    yann.meurdesoif@cea.fr
  • Property svn:eol-style set to native
File size: 1.5 KB
Line 
1#include "accumulate.hpp"
2#include "array_new.hpp"
3#include "utils.hpp"
4
5namespace xios
6{
7   namespace func
8   {
9      /// ////////////////////// Définitions ////////////////////// ///
10
11      CAccumulate::CAccumulate(CArray<double,1>& doutput)
12         : SuperClass(StdString("accumulate"), doutput)
13      { /* Ne rien faire de plus */ }
14
15      CAccumulate::CAccumulate(CArray<double,1>& doutput, double missingValue)
16         : SuperClass(StdString("accumulate"), doutput, missingValue)
17      { /* Ne rien faire de plus */ }
18
19      CAccumulate::~CAccumulate(void)
20      { /* Ne rien faire de plus */ }
21
22      //---------------------------------------------------------------
23
24      void CAccumulate::apply(const CArray<double,1>& _dinput,
25                                 CArray<double,1>& _doutput)
26      {
27        if (this->nbcall == 1) _doutput=_dinput ;
28        else 
29        {
30          if (hasMissingValue)
31          {
32            int i, n =_dinput.numElements() ;
33            const double * in=_dinput.dataFirst() ;
34            double* out=_doutput.dataFirst();
35            for (i=0; i<n; ++i,++in,++out) 
36              if (!NumTraits<double>::isnan(*in))
37              {
38                if(!NumTraits<double>::isnan(*out)) *out  += *in;
39                else *out=*in ;
40              }
41          }
42          else _doutput+=_dinput ;
43        }
44      }
45     
46     
47      void CAccumulate::final(void)
48      {
49        this->nbcall = 0; 
50      }
51   } // namespace func
52} // namespace xios
Note: See TracBrowser for help on using the repository browser.