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

Contents of /trunk/escript/src/DataCached.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 615 - (show annotations)
Wed Mar 22 02:12:00 2006 UTC (13 years, 6 months ago) by elspeth
File MIME type: text/plain
File size: 3531 byte(s)
More copyright information.

1 /* $Id$ */
2
3 /*
4 ************************************************************
5 * Copyright 2006 by ACcESS MNRF *
6 * *
7 * http://www.access.edu.au *
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_DataCached_20050414_H
16 #define escript_DataCached_20050414_H
17
18 #include "DataAbstract.h"
19
20 namespace escript {
21
22 /**
23 \brief
24 Implements the DataAbstract interface for a cached Data object.
25
26 Description:
27 Implements the DataAbstract interface for a cached Data object.
28 */
29
30 class DataCached : public DataAbstract {
31
32 public:
33
34 /**
35 \brief
36 Default constructor for DataCached.
37
38 Description:
39 Default constructor for DataCached.
40
41 */
42 DataCached();
43
44 /**
45 \brief
46 Destructor for DataCached.
47 */
48 virtual
49 ~DataCached();
50
51 /**
52 \brief
53 Return a textual representation of the Data object.
54 */
55 virtual
56 std::string
57 toString() const;
58
59 /**
60 \brief
61 Return the offset into the data array for the data point specified.
62 \param sampleNo - Input - Sample number.
63 \param dataPointNo - Input - data-point number.
64 */
65 virtual
66 DataArrayView::ValueType::size_type
67 getPointOffset(int sampleNo,
68 int dataPointNo) const;
69
70 /**
71 \brief
72 Return a view into the data array for the data point specified.
73 \param sampleNo - Input - Sample number.
74 \param dataPointNo - Input - data-point number.
75 */
76 virtual
77 DataArrayView
78 getDataPoint(int sampleNo,
79 int dataPointNo);
80
81 /**
82 \brief
83 Return the number of doubles stored for this object.
84 */
85 virtual
86 ValueType::size_type
87 getLength() const;
88
89 /**
90 \brief
91 Factory method that returns a newly created DataCached sliced from the
92 current Data object according to the specified region.
93 The caller is reponsible for managing the object created.
94 */
95 virtual
96 DataAbstract*
97 getSlice(const DataArrayView::RegionType& region) const;
98
99 /**
100 \brief
101 Set the current Data object according to the specified slice from the
102 given input value.
103 \param value Input - Data to copy from
104 \param region Input - Region to copy.
105 */
106 virtual
107 void
108 setSlice(const DataAbstract* value,
109 const DataArrayView::RegionType& region);
110
111 /**
112 \brief
113 Reshape the data point if the data point is currently rank 0.
114 The original data point value is used for all values of the new
115 data point.
116 */
117 virtual
118 void
119 reshapeDataPoint(const DataArrayView::ShapeType& shape);
120
121 protected:
122
123 private:
124
125 /**
126 \brief
127 Throw a standard exception. This function is called if an attempt
128 is made to use functions of DataCached that are not valid.
129 */
130 void
131 throwStandardException(const std::string& functionName) const;
132
133 // data members will need to include:
134
135 // 0. flag to turn caching on, or pass everything through to act like normal Data object (?)
136
137 // 1. a stack of the operations applied
138
139 // 2. a coresponding stack of the Data/DataVector objects which are the operands to the operations
140
141 // 3. a DataVector representing the initial values of this object
142
143 };
144
145 } // end of namespace
146
147 #endif

Properties

Name Value
svn:eol-style native
svn:keywords Author Date Id Revision

  ViewVC Help
Powered by ViewVC 1.1.26