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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 854 - (show annotations)
Thu Sep 21 05:29:42 2006 UTC (13 years ago) by gross
File MIME type: text/plain
File size: 3715 byte(s)
Some modifications to the binary operations +,-,*/, pow. 
The code is a bit simpler now and more efficient has there is
no reseising required now. the resizing method has been removed as
it is very, very inefficient. Even serial code should be faster now.
It is now forbidden to do an inplace update of scalar data object with an object 
of rank >0 as this is very slow (and does not make much sense). 


1 //$Id$
2 /*
3 ************************************************************
4 * Copyright 2006 by ACcESS MNRF *
5 * *
6 * http://www.access.edu.au *
7 * Primary Business: Queensland, Australia *
8 * Licensed under the Open Software License version 3.0 *
9 * http://www.opensource.org/licenses/osl-3.0.php *
10 * *
11 ************************************************************
12 */
13
14 #if !defined escript_DataEmpty_20040726_H
15 #define escript_DataEmpty_20040726_H
16 #include "system_dep.h"
17
18 #include "DataAbstract.h"
19
20 namespace escript {
21
22 /**
23 \brief
24 Implements the DataAbstract interface for an empty Data object.
25
26 Description:
27 Implements the DataAbstract interface for an empty Data object.
28 */
29
30 class DataEmpty : public DataAbstract {
31
32 public:
33
34 /**
35 \brief
36 Default constructor for DataEmpty.
37
38 Description:
39 Default constructor for DataEmpty.
40
41 */
42 ESCRIPT_DLL_API
43 DataEmpty();
44
45 /**
46 \brief
47 Destructor for DataEmpty.
48 */
49 ESCRIPT_DLL_API
50 virtual
51 ~DataEmpty();
52
53 /**
54 \brief
55 Return a textual representation of the Data object.
56 */
57 ESCRIPT_DLL_API
58 virtual
59 std::string
60 toString() const;
61
62 /**
63 \brief
64 Return the offset for the given sample.
65 NB: This will throw an exception as obviously an empty Data object contains no
66 samples. An implementation is required by parent DataAbstract class.
67 \param sampleNo - Input - Sample number.
68 \param dataPointNo - Input - data-point number.
69 */
70 ESCRIPT_DLL_API
71 virtual
72 DataArrayView::ValueType::size_type
73 getPointOffset(int sampleNo,
74 int dataPointNo) const;
75
76 /**
77 \brief
78 Return a view into the data for the data point specified.
79 NB: This will throw an exception as obviously an empty Data object contains no
80 data points. An implementation is required by parent DataAbstract class.
81 \param sampleNo - Input - Sample number.
82 \param dataPointNo - Input - data-point number.
83 */
84 ESCRIPT_DLL_API
85 virtual
86 DataArrayView
87 getDataPoint(int sampleNo,
88 int dataPointNo);
89
90 /**
91 \brief
92 Return the number of doubles stored for the Data object.
93 As this is an empty Data object, this method will always return 0.
94 */
95 ESCRIPT_DLL_API
96 virtual
97 ValueType::size_type
98 getLength() const;
99
100 /**
101 \brief
102 Factory method that returns a newly created DataEmpty sliced from the
103 current Data object according to the specified region.
104 NB: This will throw an exception as obviously an empty Data object contains no
105 data to slice from. An implementation is required by parent DataAbstract class.
106 */
107 ESCRIPT_DLL_API
108 virtual
109 DataAbstract*
110 getSlice(const DataArrayView::RegionType& region) const;
111
112 /**
113 \brief
114 Set the current Data object according to the specified slice from the
115 given input value.
116 NB: This will throw an exception as obviously an empty Data object contains no
117 data to slice to. An implementation is required by parent DataAbstract class.
118 \param value Input - Data to copy from
119 \param region Input - Region to copy.
120 */
121 ESCRIPT_DLL_API
122 virtual
123 void
124 setSlice(const DataAbstract* value,
125 const DataArrayView::RegionType& region);
126
127 protected:
128
129 private:
130
131 /**
132 \brief
133 Throw a standard exception. This function is called if an attempt
134 is made to use functions of DataEmpty that are not valid.
135 */
136 void
137 throwStandardException(const std::string& functionName) const;
138
139 };
140
141 } // end of namespace
142
143 #endif

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.26