Last change
on this file since 1060 was
1037,
checked in by yushan, 8 years ago
|
initialize the branch
|
-
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.4 KB
|
Line | |
---|
1 | #include "accumulate.hpp" |
---|
2 | #include "array_new.hpp" |
---|
3 | |
---|
4 | namespace xios |
---|
5 | { |
---|
6 | namespace func |
---|
7 | { |
---|
8 | /// ////////////////////// Définitions ////////////////////// /// |
---|
9 | |
---|
10 | CAccumulate::CAccumulate(CArray<double,1>& doutput) |
---|
11 | : SuperClass(StdString("accumulate"), doutput) |
---|
12 | { /* Ne rien faire de plus */ } |
---|
13 | |
---|
14 | CAccumulate::CAccumulate(CArray<double,1>& doutput, double missingValue) |
---|
15 | : SuperClass(StdString("accumulate"), doutput, missingValue) |
---|
16 | { /* Ne rien faire de plus */ } |
---|
17 | |
---|
18 | CAccumulate::~CAccumulate(void) |
---|
19 | { /* Ne rien faire de plus */ } |
---|
20 | |
---|
21 | //--------------------------------------------------------------- |
---|
22 | |
---|
23 | void CAccumulate::apply(const CArray<double,1>& _dinput, |
---|
24 | CArray<double,1>& _doutput) |
---|
25 | { |
---|
26 | if (this->nbcall == 1) _doutput=_dinput ; |
---|
27 | else |
---|
28 | { |
---|
29 | if (hasMissingValue) |
---|
30 | { |
---|
31 | int i, n =_dinput.numElements() ; |
---|
32 | const double * in=_dinput.dataFirst() ; |
---|
33 | double* out=_doutput.dataFirst(); |
---|
34 | for (i=0; i<n; ++i,++in,++out) |
---|
35 | if (*in!=missingValue) |
---|
36 | { |
---|
37 | if(*out!=missingValue) *out += *in; |
---|
38 | else *out=*in ; |
---|
39 | } |
---|
40 | } |
---|
41 | else _doutput+=_dinput ; |
---|
42 | } |
---|
43 | } |
---|
44 | |
---|
45 | |
---|
46 | void CAccumulate::final(void) |
---|
47 | { |
---|
48 | this->nbcall = 0; |
---|
49 | } |
---|
50 | } // namespace func |
---|
51 | } // namespace xios |
---|
Note: See
TracBrowser
for help on using the repository browser.