/[escript]/trunk/escript/src/DataLazy.h
ViewVC logotype

Diff of /trunk/escript/src/DataLazy.h

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1865 by jfenwick, Thu Oct 9 03:53:57 2008 UTC revision 1889 by jfenwick, Thu Oct 16 05:57:09 2008 UTC
# Line 21  Line 21 
21  //#include "FunctionSpace.h"  //#include "FunctionSpace.h"
22    
23  #include <string>  #include <string>
24    #include <functional>
25    
26    #include "LocalOps.h"       // for tensor_binary_op
27    
28  namespace escript {  namespace escript {
29    
30  enum ES_optype  enum ES_optype
31  {  {
32      UNKNOWNOP=0,      UNKNOWNOP=0,
33      IDENTITY=1      IDENTITY=1,
34        ADD=2,
35        SUB=3,
36        MUL=4,
37        DIV=5,
38        SIN=6,
39        COS=7,
40        TAN=8,
41        ASIN=9,
42        ACOS=10,
43        ATAN=11,
44        SINH=12,
45        COSH=13,
46        TANH=14,
47        ERF=15,
48        ASINH=16,
49        ACOSH=17,
50        ATANH=18,
51        LOG10=19,
52        LOG=20,
53        SIGN=21,
54        ABS=22,
55        NEG=23,
56        POS=24,
57        EXP=25,
58        SQRT=26,
59        RECIP=27,
60        GZ=28,
61        LZ=29,
62        GEZ=30,
63        LEZ=31
64  };  };
65    
66  const std::string&  const std::string&
# Line 37  opToString(ES_optype op); Line 70  opToString(ES_optype op);
70  \class escript::DataLazy  \class escript::DataLazy
71  \brief Wraps an expression tree of other DataObjects.  \brief Wraps an expression tree of other DataObjects.
72  The values of DataPoints are computed when requested rather than all at once.  The values of DataPoints are computed when requested rather than all at once.
73    
74    NOTE: This class assumes that the Data being pointed at are immutable.
75  */  */
76    
77    class DataLazy;
78    
79    typedef POINTER_WRAPPER_CLASS(DataLazy) DataLazy_ptr;
80    typedef POINTER_WRAPPER_CLASS(const DataLazy) const_DataLazy_ptr;
81    
82  class DataLazy : public DataAbstract  class DataLazy : public DataAbstract
83  {  {
84    
# Line 51  public: Line 91  public:
91    DataLazy(DataAbstract_ptr p);    DataLazy(DataAbstract_ptr p);
92    
93    ESCRIPT_DLL_API    ESCRIPT_DLL_API
94      DataLazy(DataAbstract_ptr left, ES_optype op);
95    
96    
97    /*
98      ESCRIPT_DLL_API
99      DataLazy(DataLazy_ptr left, DataLazy_ptr right, ES_optype op);*/
100    
101      ESCRIPT_DLL_API
102    DataLazy(DataAbstract_ptr left, DataAbstract_ptr right, ES_optype op);    DataLazy(DataAbstract_ptr left, DataAbstract_ptr right, ES_optype op);
103    
104    ESCRIPT_DLL_API    ESCRIPT_DLL_API
# Line 62  public: Line 110  public:
110    \brief Compute all data points in the expression tree    \brief Compute all data points in the expression tree
111    */    */
112    ESCRIPT_DLL_API    ESCRIPT_DLL_API
113    DataReady_ptr resolve();    DataReady_ptr
114      resolve();
115    
116    ESCRIPT_DLL_API    ESCRIPT_DLL_API
117    std::string    std::string
# Line 91  public: Line 140  public:
140    getPointOffset(int sampleNo,    getPointOffset(int sampleNo,
141                   int dataPointNo) const;                   int dataPointNo) const;
142    
143    
144      ESCRIPT_DLL_API
145      int
146      getBuffsRequired() const;
147    
148    
149    
150  private:  private:
151    DataAbstract_ptr m_left, m_right;    DataReady_ptr m_id;
152      DataLazy_ptr m_left, m_right;
153    ES_optype m_op;    ES_optype m_op;
154    size_t length;    // number of values represented by the operation    size_t m_length;  // number of values represented by the operation
155    
156      int m_buffsRequired;  // how many buffers are required to evaluate this expression
157      size_t m_samplesize;  // number of values required to store a sample
158    
159      const double*
160      resolveSample(ValueType& v,int sampleNo,  size_t offset );
161    
162      const double*
163      resolveSample2(ValueType& v,int sampleNo,  size_t offset );
164    
165    
166      void
167      intoString(std::ostringstream& oss) const;
168    
169      char m_readytype;
170    
171      void
172      collapse();       // converts the node into an IDENTITY node
173    
174      DataReady_ptr
175      collapseToReady();
176    
177      const double*
178      resolveUnary(ValueType& v,int sampleNo,  size_t offset) const;
179    
180      const double*
181      resolveBinary(ValueType& v,int sampleNo,  size_t offset) const;
182    
183    
184  };  };
185    
186  }  }

Legend:
Removed from v.1865  
changed lines
  Added in v.1889

  ViewVC Help
Powered by ViewVC 1.1.26