/[escript]/branches/subworld2/escriptcore/src/DataEmpty.h
ViewVC logotype

Contents of /branches/subworld2/escriptcore/src/DataEmpty.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 5504 - (show annotations)
Wed Mar 4 22:58:13 2015 UTC (4 years, 1 month ago) by jfenwick
File MIME type: text/plain
File size: 4161 byte(s)
Again with a more up to date copy


1
2 /*****************************************************************************
3 *
4 * Copyright (c) 2003-2015 by University of Queensland
5 * http://www.uq.edu.au
6 *
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 * Development until 2012 by Earth Systems Science Computational Center (ESSCC)
12 * Development 2012-2013 by School of Earth Sciences
13 * Development from 2014 by Centre for Geoscience Computing (GeoComp)
14 *
15 *****************************************************************************/
16
17
18 #if !defined escript_DataEmpty_20040726_H
19 #define escript_DataEmpty_20040726_H
20 #include "system_dep.h"
21
22 #include "DataReady.h"
23
24 namespace escript {
25
26 /**
27 \brief
28 Implements the DataAbstract interface for an empty Data object.
29
30 Description:
31 Implements the DataAbstract interface for an empty Data object.
32 */
33
34 class DataEmpty : public DataReady {
35 typedef DataReady parent;
36 public:
37
38 /**
39 \brief
40 Default constructor for DataEmpty.
41
42 Description:
43 Default constructor for DataEmpty.
44
45 */
46 ESCRIPT_DLL_API
47 DataEmpty();
48
49 /**
50 \brief
51 Destructor for DataEmpty.
52 */
53 ESCRIPT_DLL_API
54 virtual
55 ~DataEmpty();
56
57 /**
58 \brief
59 Return a textual representation of the Data object.
60 */
61 ESCRIPT_DLL_API
62 virtual
63 std::string
64 toString() const;
65
66 /**
67 \brief Return a deep copy of the current object.
68 */
69 ESCRIPT_DLL_API
70 virtual
71 DataAbstract*
72 deepCopy();
73
74
75 /**
76 \brief
77 Return the offset for the given sample.
78 NB: This will throw an exception as obviously an empty Data object contains no
79 samples. An implementation is required by parent DataAbstract class.
80 \param sampleNo - Input - Sample number.
81 \param dataPointNo - Input - data-point number.
82 */
83 ESCRIPT_DLL_API
84 virtual
85 DataTypes::ValueType::size_type
86 getPointOffset(int sampleNo,
87 int dataPointNo) const;
88
89 ESCRIPT_DLL_API
90 virtual
91 DataTypes::ValueType::size_type
92 getPointOffset(int sampleNo,
93 int dataPointNo);
94
95 /**
96 \brief
97 Return the number of doubles stored for the Data object.
98 As this is an empty Data object, this method will always return 0.
99 */
100 ESCRIPT_DLL_API
101 virtual
102 ValueType::size_type
103 getLength() const;
104
105 /**
106 \brief
107 Factory method that returns a newly created DataEmpty sliced from the
108 current Data object according to the specified region.
109 NB: This will throw an exception as obviously an empty Data object contains no
110 data to slice from. An implementation is required by parent DataAbstract class.
111 */
112 ESCRIPT_DLL_API
113 virtual
114 DataAbstract*
115 getSlice(const DataTypes::RegionType& region) const;
116
117 /**
118 \brief
119 Set the current Data object according to the specified slice from the
120 given input value.
121 NB: This will throw an exception as obviously an empty Data object contains no
122 data to slice to. An implementation is required by parent DataAbstract class.
123 \param value Input - Data to copy from
124 \param region Input - Region to copy.
125 */
126 ESCRIPT_DLL_API
127 virtual
128 void
129 setSlice(const DataAbstract* value,
130 const DataTypes::RegionType& region);
131
132 /**
133 \brief invert square matricies
134 \param out - Where to store the results
135 \return errorcode (0 indicates success)
136 */
137 ESCRIPT_DLL_API
138 int
139 matrixInverse(DataAbstract* out) const;
140
141 void
142 dump(const std::string fileName) const;
143
144 ESCRIPT_DLL_API
145 bool
146 hasNaN() const
147 {
148 return false;
149 }
150
151 ESCRIPT_DLL_API
152 void
153 replaceNaN(double value)
154 {
155
156 }
157
158 protected:
159
160 /**
161 \brief Provide access to underlying storage. Internal use only!
162 */
163 ESCRIPT_DLL_API
164 virtual DataTypes::ValueType&
165 getVectorRW();
166
167
168 ESCRIPT_DLL_API
169 virtual const DataTypes::ValueType&
170 getVectorRO() const;
171
172
173 private:
174
175 // /**
176 /* \brief
177 Throw a standard exception. This function is called if an attempt
178 is made to use functions of DataEmpty that are not valid.*/
179 // */
180 // void
181 // throwStandardException(const std::string& functionName) const;
182
183 };
184
185 } // end of namespace
186
187 #endif

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.26