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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 854 - (hide 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 jgs 102 //$Id$
2 jgs 82 /*
3 elspeth 615 ************************************************************
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 jgs 82 */
13 jgs 121
14 jgs 102 #if !defined escript_DataEmpty_20040726_H
15 jgs 82 #define escript_DataEmpty_20040726_H
16 woo409 757 #include "system_dep.h"
17 jgs 82
18     #include "DataAbstract.h"
19    
20     namespace escript {
21    
22     /**
23     \brief
24 jgs 102 Implements the DataAbstract interface for an empty Data object.
25 jgs 82
26     Description:
27 jgs 102 Implements the DataAbstract interface for an empty Data object.
28 jgs 82 */
29 jgs 121
30 jgs 102 class DataEmpty : public DataAbstract {
31 jgs 82
32     public:
33    
34     /**
35     \brief
36 jgs 102 Default constructor for DataEmpty.
37 jgs 82
38     Description:
39 jgs 102 Default constructor for DataEmpty.
40 jgs 82
41     */
42 woo409 757 ESCRIPT_DLL_API
43 jgs 82 DataEmpty();
44 jgs 102
45 jgs 82 /**
46     \brief
47 jgs 102 Destructor for DataEmpty.
48 jgs 82 */
49 woo409 757 ESCRIPT_DLL_API
50 jgs 102 virtual
51     ~DataEmpty();
52    
53 jgs 82 /**
54     \brief
55 jgs 102 Return a textual representation of the Data object.
56 jgs 82 */
57 woo409 757 ESCRIPT_DLL_API
58 jgs 102 virtual
59     std::string
60     toString() const;
61    
62 jgs 82 /**
63     \brief
64 jgs 121 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 jgs 102 \param sampleNo - Input - Sample number.
68     \param dataPointNo - Input - data-point number.
69 jgs 82 */
70 woo409 757 ESCRIPT_DLL_API
71 jgs 102 virtual
72     DataArrayView::ValueType::size_type
73     getPointOffset(int sampleNo,
74     int dataPointNo) const;
75    
76 jgs 82 /**
77     \brief
78     Return a view into the data for the data point specified.
79 jgs 121 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 jgs 102 \param sampleNo - Input - Sample number.
82     \param dataPointNo - Input - data-point number.
83 jgs 82 */
84 woo409 757 ESCRIPT_DLL_API
85 jgs 102 virtual
86     DataArrayView
87     getDataPoint(int sampleNo,
88     int dataPointNo);
89    
90     /**
91 jgs 82 \brief
92 jgs 102 Return the number of doubles stored for the Data object.
93 jgs 121 As this is an empty Data object, this method will always return 0.
94 jgs 82 */
95 woo409 757 ESCRIPT_DLL_API
96 jgs 102 virtual
97     ValueType::size_type
98     getLength() const;
99    
100 jgs 82 /**
101     \brief
102 jgs 102 Factory method that returns a newly created DataEmpty sliced from the
103     current Data object according to the specified region.
104 jgs 121 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 jgs 82 */
107 woo409 757 ESCRIPT_DLL_API
108 jgs 102 virtual
109     DataAbstract*
110     getSlice(const DataArrayView::RegionType& region) const;
111    
112     /**
113 jgs 82 \brief
114 jgs 102 Set the current Data object according to the specified slice from the
115     given input value.
116 jgs 121 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 jgs 82 \param value Input - Data to copy from
119     \param region Input - Region to copy.
120     */
121 woo409 757 ESCRIPT_DLL_API
122 jgs 102 virtual
123     void
124     setSlice(const DataAbstract* value,
125     const DataArrayView::RegionType& region);
126    
127 jgs 82 protected:
128    
129     private:
130 jgs 102
131 jgs 121 /**
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 jgs 82 };
140    
141     } // end of namespace
142 jgs 121
143 jgs 82 #endif

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.26