source: XIOS/trunk/src/functor.cpp @ 470

Last change on this file since 470 was 369, checked in by ymipsl, 12 years ago

Major Update

  • redesign Type and attribute manipulation
  • add enumerate type and attribute
  • use blitz class array instead of boost class array

YM

File size: 1.8 KB
Line 
1#include "functor.hpp"
2#include "array_new.hpp"
3
4namespace 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)
12      { /* Ne rien faire de plus */  }
13
14      CFunctor::~CFunctor(void)
15      { /* Ne rien faire de plus */ }
16
17      //---------------------------------------------------------------
18
19      CArray<double,1> CFunctor::getDataOutput(void) const
20      { 
21         return (this->doutput);
22      }
23
24      //---------------------------------------------------------------
25
26      StdString CFunctor::toString(void) const
27      {
28         ERROR("CFunctor::toString()", << "Not implemented yet !");
29         return (SuperClass::getId());
30      }
31
32      void CFunctor::fromString(const StdString & str)
33      {
34         ERROR("CFunctor::fromString(str)",
35                << "[ str = " << str << "] Not implemented yet !");
36      }
37
38      //---------------------------------------------------------------
39
40      CArray<double,1> CFunctor::operator ()(const CArray<double,1>& dinput)
41      {
42         this->nbcall++;
43         if (dinput.numElements() != this->doutput.numElements())
44            ERROR("CFunctor::operator ()(dinput)",
45                   << "[ input size = "  << dinput.numElements()
46                   << ", output size = " << this->doutput.numElements() << " ]"
47                   << " size of input array !=  size of output array !");
48         this->apply(dinput, this->doutput);
49         return (this->doutput);
50      }
51
52      void CFunctor::final(void) 
53      {
54         this->nbcall = 0;
55      } 
56
57      //---------------------------------------------------------------
58
59   } // namespace func
60} // namespace xios
Note: See TracBrowser for help on using the repository browser.