/[escript]/branches/schroedinger/escript/src/DataLazy.h
ViewVC logotype

Annotation of /branches/schroedinger/escript/src/DataLazy.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1868 - (hide annotations)
Thu Oct 9 06:30:49 2008 UTC (11 years, 7 months ago) by jfenwick
File MIME type: text/plain
File size: 2019 byte(s)
Branch commit.
Bulk resolve for + - * /

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 jfenwick 1868 #include <functional>
25 jfenwick 1865
26     namespace escript {
27    
28     enum ES_optype
29     {
30     UNKNOWNOP=0,
31 jfenwick 1868 IDENTITY=1,
32     ADD=2,
33     SUB=3,
34     MUL=4,
35     DIV=5
36 jfenwick 1865 };
37    
38     const std::string&
39     opToString(ES_optype op);
40    
41     /**
42     \class escript::DataLazy
43     \brief Wraps an expression tree of other DataObjects.
44     The values of DataPoints are computed when requested rather than all at once.
45     */
46    
47     class DataLazy : public DataAbstract
48     {
49    
50     typedef DataAbstract parent;
51     typedef DataTypes::ValueType ValueType;
52     typedef DataTypes::ShapeType ShapeType;
53    
54     public:
55     ESCRIPT_DLL_API
56     DataLazy(DataAbstract_ptr p);
57    
58     ESCRIPT_DLL_API
59     DataLazy(DataAbstract_ptr left, DataAbstract_ptr right, ES_optype op);
60    
61     ESCRIPT_DLL_API
62     ~DataLazy();
63    
64    
65    
66     /**
67     \brief Compute all data points in the expression tree
68     */
69     ESCRIPT_DLL_API
70     DataReady_ptr resolve();
71    
72     ESCRIPT_DLL_API
73     std::string
74     toString() const;
75    
76     ESCRIPT_DLL_API
77     DataAbstract*
78     deepCopy();
79    
80    
81     /**
82     \brief
83     Return the number of doubles that would be stored for this Data object if it were resolved.
84     */
85     ESCRIPT_DLL_API
86     ValueType::size_type
87     getLength() const;
88    
89    
90     ESCRIPT_DLL_API
91     DataAbstract*
92     getSlice(const DataTypes::RegionType& region) const;
93    
94    
95     DataTypes::ValueType::size_type
96     getPointOffset(int sampleNo,
97     int dataPointNo) const;
98    
99     private:
100     DataAbstract_ptr m_left, m_right;
101     ES_optype m_op;
102     size_t length; // number of values represented by the operation
103     };
104    
105     }
106     #endif

  ViewVC Help
Powered by ViewVC 1.1.26