Changeset 470 for XIOS/trunk/src/functor/accumulate.cpp
- Timestamp:
- 01/30/14 15:55:42 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
XIOS/trunk/src/functor/accumulate.cpp
r443 r470 9 9 10 10 CAccumulate::CAccumulate(CArray<double,1>& doutput) 11 : SuperClass(StdString("average"), 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) 12 16 { /* Ne rien faire de plus */ } 13 17 … … 20 24 CArray<double,1>& _doutput) 21 25 { 22 /*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;29 */30 26 if (this->nbcall == 1) _doutput=_dinput ; 31 else _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 } 32 44 33 }34 45 35 46 void CAccumulate::final(void) 36 47 { 37 /* double * it1 = this->getDataOutput()->data(),38 * end1 = this->getDataOutput()->data() + this->getDataOutput()->num_elements();39 for (; it1 != end1; it1++) *it1 /= this->nbcall;40 this->nbcall = 0;41 */42 // doutput/=this->nbcall;43 48 this->nbcall = 0; 44 49 }
Note: See TracChangeset
for help on using the changeset viewer.