[3848] | 1 | #include "maximum.hpp" |
---|
| 2 | #include "array_new.hpp" |
---|
| 3 | |
---|
| 4 | |
---|
| 5 | |
---|
| 6 | namespace xios |
---|
| 7 | { |
---|
| 8 | namespace func |
---|
| 9 | { |
---|
| 10 | /// ////////////////////// Définitions ////////////////////// /// |
---|
| 11 | |
---|
| 12 | CMaximum::CMaximum(CArray<double,1>& doutput) |
---|
| 13 | : SuperClass(StdString("maximum"), doutput) |
---|
| 14 | { /* Ne rien faire de plus */ } |
---|
| 15 | |
---|
| 16 | CMaximum::CMaximum(CArray<double,1>& doutput, double missingValue) |
---|
| 17 | : SuperClass(StdString("maximum"), doutput, missingValue) |
---|
| 18 | { /* Ne rien faire de plus */ } |
---|
| 19 | |
---|
| 20 | CMaximum::~CMaximum(void) |
---|
| 21 | { /* Ne rien faire de plus */ } |
---|
| 22 | |
---|
| 23 | //--------------------------------------------------------------- |
---|
| 24 | |
---|
| 25 | void CMaximum::apply(const CArray<double,1>& _dinput, |
---|
| 26 | CArray<double,1>& _doutput) |
---|
| 27 | { |
---|
| 28 | const double * it1 = _dinput.dataFirst(), |
---|
| 29 | * end1 = _dinput.dataFirst() + _dinput.numElements(); |
---|
| 30 | double * it = _doutput.dataFirst(); |
---|
| 31 | if (this->nbcall == 1) for (; it1 != end1; it1++, it++) *it = *it1; |
---|
| 32 | else |
---|
| 33 | { |
---|
| 34 | if (hasMissingValue) |
---|
| 35 | { |
---|
| 36 | for (; it1 != end1; it1++, it++) |
---|
| 37 | if (*it1 != missingValue) |
---|
| 38 | { |
---|
| 39 | if ( *it != missingValue) *it = std::max(*it1, *it); |
---|
| 40 | else *it=*it1 ; |
---|
| 41 | } |
---|
| 42 | } |
---|
| 43 | else for (; it1 != end1; it1++, it++) *it = std::max(*it1, *it); |
---|
| 44 | } |
---|
| 45 | |
---|
| 46 | |
---|
| 47 | } |
---|
| 48 | |
---|
| 49 | //--------------------------------------------------------------- |
---|
| 50 | |
---|
| 51 | } // namespace func |
---|
| 52 | } // namespace xmlioserver |
---|