1 | #include "functor.hpp" |
---|
2 | #include "array_new.hpp" |
---|
3 | |
---|
4 | namespace xios |
---|
5 | { |
---|
6 | namespace func |
---|
7 | { |
---|
8 | /// ////////////////////// Définitions ////////////////////// /// |
---|
9 | |
---|
10 | CFunctor::CFunctor(const StdString & id, CArray<double, 1>& doutput) |
---|
11 | : SuperClass(id), doutput(doutput), nbcall(0),hasMissingValue(false) |
---|
12 | { /* Ne rien faire de plus */ } |
---|
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 | } |
---|
19 | |
---|
20 | CFunctor::~CFunctor(void) |
---|
21 | { /* Ne rien faire de plus */ } |
---|
22 | |
---|
23 | //--------------------------------------------------------------- |
---|
24 | |
---|
25 | CArray<double,1> CFunctor::getDataOutput(void) const |
---|
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 | |
---|
46 | CArray<double,1> CFunctor::operator ()(const CArray<double,1>& dinput) |
---|
47 | { |
---|
48 | this->nbcall++; |
---|
49 | if (dinput.numElements() != this->doutput.numElements()) |
---|
50 | ERROR("CFunctor::operator ()(dinput)", |
---|
51 | << "[ input size = " << dinput.numElements() |
---|
52 | << ", output size = " << this->doutput.numElements() << " ]" |
---|
53 | << " size of input array != size of output array !"); |
---|
54 | this->apply(dinput, this->doutput); |
---|
55 | return (this->doutput); |
---|
56 | } |
---|
57 | |
---|
58 | void CFunctor::final(void) |
---|
59 | { |
---|
60 | this->nbcall = 0; |
---|
61 | } |
---|
62 | |
---|
63 | //--------------------------------------------------------------- |
---|
64 | |
---|
65 | } // namespace func |
---|
66 | } // namespace xios |
---|