/[escript]/trunk/escript/src/DataAbstract.cpp
ViewVC logotype

Contents of /trunk/escript/src/DataAbstract.cpp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1946 - (show annotations)
Wed Oct 29 05:48:53 2008 UTC (11 years, 2 months ago) by jfenwick
File size: 5535 byte(s)
A cleanup of some of the problems I found doing a Wall compile.

Removed some commented out lines.
Swapped some member initialisers.
Removed virtual qualifiers from some methods in FunctionSpace.
Fixed some unused or (possibly) uninitialised variables.


1
2 /*******************************************************
3 *
4 * Copyright (c) 2003-2008 by University of Queensland
5 * 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
14
15 #include "DataAbstract.h"
16 #include "DataException.h"
17
18 using namespace std;
19
20 namespace escript {
21
22 /**
23 \brief Returns smart pointer which is managing this object.
24 If one does not exist yet it creates one.
25
26 Note: This is _not_ equivalent to weak_ptr::lock.
27 */
28 DataAbstract_ptr DataAbstract::getPtr()
29 {
30 if (_internal_weak_this.expired())
31 {
32 return DataAbstract_ptr(this);
33 }
34 else
35 {
36 return shared_from_this();
37 }
38 }
39
40 const_DataAbstract_ptr DataAbstract::getPtr() const
41 {
42 if (_internal_weak_this.expired())
43 {
44 return const_DataAbstract_ptr(this);
45 }
46 else
47 {
48 return shared_from_this();
49 }
50 }
51
52
53
54 DataAbstract::DataAbstract(const FunctionSpace& what, const ShapeType& shape, bool isDataEmpty):
55 m_noSamples(what.getNumSamples()),
56 m_noDataPointsPerSample(what.getNumDPPSample()),
57 m_functionSpace(what),
58 m_shape(shape),
59 m_novalues(DataTypes::noValues(shape)),
60 m_rank(DataTypes::getRank(shape))
61
62 {
63 m_isempty=isDataEmpty;
64 }
65
66 DataAbstract::~DataAbstract()
67 {
68 }
69
70
71 void
72 DataAbstract::operandCheck(const DataAbstract& right) const
73 {
74 if ((right.getNumDPPSample()!=getNumDPPSample()) ||
75 (right.getNumSamples()!=getNumSamples()) ||
76 (right.getFunctionSpace()!=getFunctionSpace())) {
77 stringstream temp;
78 temp << "Error - Right hand argument sample shape or function space "
79 << "incompatible with left." << endl
80 << "LHS: (" << getNumSamples() << ","
81 << getNumDPPSample() << ") " << getFunctionSpace().toString()
82 << endl
83 << "RHS: (" << right.getNumSamples() << ","
84 << right.getNumDPPSample() << ") "
85 << right.getFunctionSpace().toString();
86 throw DataException(temp.str());
87 }
88
89 //
90 // Check the shape of the point data, a rank of 0(scalar) is okay
91 if (!((right.getRank()==0) ||
92 (right.getShape()==getShape())))
93 {
94 stringstream temp;
95 temp << "Error - Right hand argument point data shape: "
96 << DataTypes::shapeToString(right.getShape())
97 << " doesn't match left: "
98 << DataTypes::shapeToString(getShape());
99 throw DataException(temp.str());
100 }
101 }
102
103 void
104 DataAbstract::dump(const std::string fileName) const
105 {
106 throw DataException("Error - DataAbstract::dump: not implemented.");
107 }
108
109
110
111 DataAbstract::ValueType::value_type*
112 DataAbstract::getSampleDataByTag(int tag)
113 {
114 throw DataException("Error - DataAbstract::getSampleDataByTag: Data type does not have tag values.");
115 }
116
117
118 void
119 DataAbstract::setTaggedValue(int tagKey,
120 const DataTypes::ShapeType& pointshape,
121 const DataTypes::ValueType& value,
122 int dataOffset)
123 {
124 throw DataException("Error - DataAbstract::setTaggedValue: Data type does not have tag values.");
125 }
126
127
128 int
129 DataAbstract::getTagNumber(int dpno)
130 {
131 throw DataException("Error - DataAbstract::getTagNumber: Data type cannot be accessed by tag values.");
132 return (0);
133 }
134
135
136
137 void
138 DataAbstract::copyAll(const boost::python::numeric::array& value)
139 {
140 throw DataException("Error - DataAbstract::copying data from numarray objects is not supported.");
141 }
142 void
143 DataAbstract::copyToDataPoint(const int sampleNo, const int dataPointNo, const double value)
144 {
145 throw DataException("Error - DataAbstract::copying data from double value to a single data point is not supported.");
146 }
147 void
148 DataAbstract::copyToDataPoint(const int sampleNo, const int dataPointNo, const boost::python::numeric::array& value)
149 {
150 throw DataException("Error - DataAbstract::copying data from numarray objects to a single data point is not supported.");
151 }
152
153 void
154 DataAbstract::symmetric(DataAbstract* ev)
155 {
156 throw DataException("Error - DataAbstract::symmetric is not supported.");
157 }
158
159 void
160 DataAbstract::nonsymmetric(DataAbstract* ev)
161 {
162 throw DataException("Error - DataAbstract::nonsymmetric is not supported.");
163 }
164
165 void
166 DataAbstract::trace(DataAbstract* ev, int axis_offset)
167 {
168 throw DataException("Error - DataAbstract::trace is not supported.");
169 }
170
171 void
172 DataAbstract::swapaxes(DataAbstract* ev, int axis0, int axis1)
173 {
174 throw DataException("Error - DataAbstract::component swapaxes is not supported.");
175 }
176 void
177 DataAbstract::transpose(DataAbstract* ev, int axis_offset)
178 {
179 throw DataException("Error - DataAbstract::transpose is not supported.");
180 }
181
182 void
183 DataAbstract::eigenvalues(DataAbstract* ev)
184 {
185 throw DataException("Error - DataAbstract::eigenvalues is not supported.");
186 }
187 void
188 DataAbstract::eigenvalues_and_eigenvectors(DataAbstract* ev,DataAbstract* V,const double tol)
189 {
190 throw DataException("Error - DataAbstract::eigenvalues_and_eigenvectors is not supported.");
191
192 }
193 void
194 DataAbstract::setToZero()
195 {
196 throw DataException("Error - DataAbstract:: cannot set values to zero.");
197 }
198
199 void
200 DataAbstract::reorderByReferenceIDs(int *reference_ids)
201 {
202 throw DataException("Error - DataAbstract:: cannot reorder by reference ids.");
203 }
204
205
206 DataTypes::ValueType&
207 DataAbstract::getVector()
208 {
209 throw DataException("Error - DataAbstract:: does not have a DataVector.");
210 }
211
212 const DataTypes::ValueType&
213 DataAbstract::getVector() const
214 {
215 throw DataException("Error - DataAbstract:: does not have a DataVector.");
216 }
217
218
219
220
221 } // end of namespace

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.26