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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2766 - (hide annotations)
Mon Nov 23 05:10:53 2009 UTC (9 years, 11 months ago) by jfenwick
File MIME type: text/plain
File size: 3866 byte(s)
inf, sup and Lsup now correctly handle +-infinity.
They also will return NaN if any part of their input is NaN.

This will break unit tests since it exposes the hidden bug (#447 in mantis)

This code relies on the ability to test for NaNs.
To do this it makes use of macros and functions from C99.
If you do not have a C99 compiler, then you will probably get the old behaviour.
That is, you won't know when you have NaNs.


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

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.26