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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1865 - (hide annotations)
Thu Oct 9 03:53:57 2008 UTC (11 years, 5 months ago) by jfenwick
Original Path: branches/schroedinger/escript/src/DataLazy.h
File MIME type: text/plain
File size: 1965 byte(s)
Branch commit
Added some missing files.

In python can ask a data object if it-  isReady(), isConstant(), 
isLazy().



1 jfenwick 1865
2     /*******************************************************
3     *
4     * Copyright (c) 2003-2008 by University of Queensland
5     * Earth Systems Science Computational Center (ESSCC)
6     * http://www.uq.edu.au/esscc
7     *
8     * Primary Business: Queensland, Australia
9     * Licensed under the Open Software License version 3.0
10     * http://www.opensource.org/licenses/osl-3.0.php
11     *
12     *******************************************************/
13    
14    
15     #if !defined escript_DataLazy_20081008_H
16     #define escript_DataLazy_20081008_H
17     #include "system_dep.h"
18    
19     #include "DataAbstract.h"
20     //#include "DataTypes.h"
21     //#include "FunctionSpace.h"
22    
23     #include <string>
24    
25     namespace escript {
26    
27     enum ES_optype
28     {
29     UNKNOWNOP=0,
30     IDENTITY=1
31     };
32    
33     const std::string&
34     opToString(ES_optype op);
35    
36     /**
37     \class escript::DataLazy
38     \brief Wraps an expression tree of other DataObjects.
39     The values of DataPoints are computed when requested rather than all at once.
40     */
41    
42     class DataLazy : public DataAbstract
43     {
44    
45     typedef DataAbstract parent;
46     typedef DataTypes::ValueType ValueType;
47     typedef DataTypes::ShapeType ShapeType;
48    
49     public:
50     ESCRIPT_DLL_API
51     DataLazy(DataAbstract_ptr p);
52    
53     ESCRIPT_DLL_API
54     DataLazy(DataAbstract_ptr left, DataAbstract_ptr right, ES_optype op);
55    
56     ESCRIPT_DLL_API
57     ~DataLazy();
58    
59    
60    
61     /**
62     \brief Compute all data points in the expression tree
63     */
64     ESCRIPT_DLL_API
65     DataReady_ptr resolve();
66    
67     ESCRIPT_DLL_API
68     std::string
69     toString() const;
70    
71     ESCRIPT_DLL_API
72     DataAbstract*
73     deepCopy();
74    
75    
76     /**
77     \brief
78     Return the number of doubles that would be stored for this Data object if it were resolved.
79     */
80     ESCRIPT_DLL_API
81     ValueType::size_type
82     getLength() const;
83    
84    
85     ESCRIPT_DLL_API
86     DataAbstract*
87     getSlice(const DataTypes::RegionType& region) const;
88    
89    
90     DataTypes::ValueType::size_type
91     getPointOffset(int sampleNo,
92     int dataPointNo) const;
93    
94     private:
95     DataAbstract_ptr m_left, m_right;
96     ES_optype m_op;
97     size_t length; // number of values represented by the operation
98     };
99    
100     }
101     #endif

  ViewVC Help
Powered by ViewVC 1.1.26