Line | |
---|
1 | #include "average.hpp" |
---|
2 | #include "array_new.hpp" |
---|
3 | |
---|
4 | namespace xios |
---|
5 | { |
---|
6 | namespace func |
---|
7 | { |
---|
8 | /// ////////////////////// Définitions ////////////////////// /// |
---|
9 | |
---|
10 | CAverage::CAverage(CArray<double,1>& doutput) |
---|
11 | : SuperClass(StdString("average"), doutput) |
---|
12 | { /* Ne rien faire de plus */ } |
---|
13 | |
---|
14 | CAverage::~CAverage(void) |
---|
15 | { /* Ne rien faire de plus */ } |
---|
16 | |
---|
17 | //--------------------------------------------------------------- |
---|
18 | |
---|
19 | void CAverage::apply(const CArray<double,1>& _dinput, |
---|
20 | CArray<double,1>& _doutput) |
---|
21 | { |
---|
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 | if (this->nbcall == 1) _doutput=_dinput ; |
---|
31 | else _doutput+=_dinput ; |
---|
32 | |
---|
33 | } |
---|
34 | |
---|
35 | void CAverage::final(void) |
---|
36 | { |
---|
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 | this->nbcall = 0; |
---|
44 | } |
---|
45 | } // namespace func |
---|
46 | } // namespace xmlioserver |
---|
Note: See
TracBrowser
for help on using the repository browser.