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