[219] | 1 | #include "functor.hpp" |
---|
[369] | 2 | #include "array_new.hpp" |
---|
[219] | 3 | |
---|
[335] | 4 | namespace xios |
---|
[219] | 5 | { |
---|
| 6 | namespace func |
---|
| 7 | { |
---|
| 8 | /// ////////////////////// Définitions ////////////////////// /// |
---|
| 9 | |
---|
[369] | 10 | CFunctor::CFunctor(const StdString & id, CArray<double, 1>& doutput) |
---|
[471] | 11 | : SuperClass(id), doutput(doutput), nbcall(0),hasMissingValue(false) |
---|
[219] | 12 | { /* Ne rien faire de plus */ } |
---|
[471] | 13 | |
---|
| 14 | CFunctor::CFunctor(const StdString & id, CArray<double, 1>& doutput, double missingValue) |
---|
| 15 | : SuperClass(id), doutput(doutput), nbcall(0),hasMissingValue(true),missingValue(missingValue) |
---|
| 16 | { |
---|
| 17 | /* Ne rien faire de plus */ |
---|
| 18 | } |
---|
[219] | 19 | |
---|
| 20 | CFunctor::~CFunctor(void) |
---|
| 21 | { /* Ne rien faire de plus */ } |
---|
| 22 | |
---|
| 23 | //--------------------------------------------------------------- |
---|
| 24 | |
---|
[369] | 25 | CArray<double,1> CFunctor::getDataOutput(void) const |
---|
[219] | 26 | { |
---|
| 27 | return (this->doutput); |
---|
| 28 | } |
---|
| 29 | |
---|
| 30 | //--------------------------------------------------------------- |
---|
| 31 | |
---|
| 32 | StdString CFunctor::toString(void) const |
---|
| 33 | { |
---|
| 34 | ERROR("CFunctor::toString()", << "Not implemented yet !"); |
---|
| 35 | return (SuperClass::getId()); |
---|
| 36 | } |
---|
| 37 | |
---|
| 38 | void CFunctor::fromString(const StdString & str) |
---|
| 39 | { |
---|
| 40 | ERROR("CFunctor::fromString(str)", |
---|
| 41 | << "[ str = " << str << "] Not implemented yet !"); |
---|
| 42 | } |
---|
| 43 | |
---|
| 44 | //--------------------------------------------------------------- |
---|
| 45 | |
---|
[369] | 46 | CArray<double,1> CFunctor::operator ()(const CArray<double,1>& dinput) |
---|
[219] | 47 | { |
---|
[266] | 48 | this->nbcall++; |
---|
[369] | 49 | if (dinput.numElements() != this->doutput.numElements()) |
---|
[219] | 50 | ERROR("CFunctor::operator ()(dinput)", |
---|
[369] | 51 | << "[ input size = " << dinput.numElements() |
---|
| 52 | << ", output size = " << this->doutput.numElements() << " ]" |
---|
[219] | 53 | << " size of input array != size of output array !"); |
---|
| 54 | this->apply(dinput, this->doutput); |
---|
| 55 | return (this->doutput); |
---|
| 56 | } |
---|
| 57 | |
---|
[266] | 58 | void CFunctor::final(void) |
---|
| 59 | { |
---|
[471] | 60 | this->nbcall = 0; |
---|
[266] | 61 | } |
---|
| 62 | |
---|
[219] | 63 | //--------------------------------------------------------------- |
---|
| 64 | |
---|
| 65 | } // namespace func |
---|
[335] | 66 | } // namespace xios |
---|