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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1796 - (show annotations)
Wed Sep 17 01:45:46 2008 UTC (10 years, 7 months ago) by jfenwick
File size: 6100 byte(s)
Merged noarrayview branch onto trunk.


1
2 /* $Id$ */
3
4 /*******************************************************
5 *
6 * Copyright 2003-2007 by ACceSS MNRF
7 * Copyright 2007 by University of Queensland
8 *
9 * http://esscc.uq.edu.au
10 * Primary Business: Queensland, Australia
11 * Licensed under the Open Software License version 3.0
12 * http://www.opensource.org/licenses/osl-3.0.php
13 *
14 *******************************************************/
15
16 #include "DataAbstract.h"
17 #include "DataException.h"
18
19 using namespace std;
20
21 namespace escript {
22
23 // DataAbstract::DataAbstract(const FunctionSpace& what):
24 // m_noDataPointsPerSample(what.getNumDPPSample()),
25 // m_noSamples(what.getNumSamples()),
26 // m_functionSpace(what),
27 // m_rank(0)
28 // {
29 // setShape(DataTypes::ShapeType());
30 // }
31
32
33 DataAbstract::DataAbstract(const FunctionSpace& what, const ShapeType& shape):
34 m_noDataPointsPerSample(what.getNumDPPSample()),
35 m_noSamples(what.getNumSamples()),
36 m_functionSpace(what),
37 m_shape(shape),
38 m_rank(DataTypes::getRank(shape)),
39 m_novalues(DataTypes::noValues(shape))
40
41 {
42 }
43
44 DataAbstract::~DataAbstract()
45 {
46 }
47
48 // void
49 // DataAbstract::setPointDataView(const DataArrayView& input)
50 // {
51 // m_pointDataView.reset(new DataArrayView(input.getData(),input.getShape(),input.getOffset()));
52 //
53 // // until we get rid of m_pointDataView, we need to keep m_shape in sync
54 // setShape(input.getShape());
55 // }
56
57 // perhaps this should be a constructor parameter
58 // void
59 // DataAbstract::setShape(const DataTypes::ShapeType& s)
60 // {
61 // m_shape=s;
62 // m_rank=DataTypes::getRank(s);
63 // m_novalues=DataTypes::noValues(s);
64 // }
65
66
67 // void
68 // DataAbstract::resetPointDataView()
69 // {
70 // m_pointDataView.reset(new DataArrayView());
71 // m_shape.clear();
72 // m_rank=0;
73 // m_novalues=1;
74 // }
75
76 void
77 DataAbstract::operandCheck(const DataAbstract& right) const
78 {
79 if ((right.getNumDPPSample()!=getNumDPPSample()) ||
80 (right.getNumSamples()!=getNumSamples()) ||
81 (right.getFunctionSpace()!=getFunctionSpace())) {
82 stringstream temp;
83 temp << "Error - Right hand argument sample shape or function space "
84 << "incompatible with left." << endl
85 << "LHS: (" << getNumSamples() << ","
86 << getNumDPPSample() << ") " << getFunctionSpace().toString()
87 << endl
88 << "RHS: (" << right.getNumSamples() << ","
89 << right.getNumDPPSample() << ") "
90 << right.getFunctionSpace().toString();
91 throw DataException(temp.str());
92 }
93
94 //
95 // Check the shape of the point data, a rank of 0(scalar) is okay
96 if (!((right.getRank()==0) ||
97 (right.getShape()==getShape())))
98 {
99 stringstream temp;
100 temp << "Error - Right hand argument point data shape: "
101 << DataTypes::shapeToString(right.getShape())
102 << " doesn't match left: "
103 << DataTypes::shapeToString(getShape());
104 throw DataException(temp.str());
105 }
106 }
107
108 void
109 DataAbstract::dump(const std::string fileName) const
110 {
111 throw DataException("Error - DataAbstract:: dump: not implemented.");
112 }
113
114
115
116 DataAbstract::ValueType::value_type*
117 DataAbstract::getSampleDataByTag(int tag)
118 {
119 throw DataException("Error - DataAbstract::getSampleDataByTag: Data type does not have tag values.");
120 }
121
122 // void
123 // DataAbstract::setTaggedValue(int tagKey,
124 // const DataArrayView& value)
125 // {
126 // throw DataException("Error - DataAbstract::setTaggedValue: Data type does not have tag values.");
127 // }
128
129 void
130 DataAbstract::setTaggedValue(int tagKey,
131 const DataTypes::ShapeType& pointshape,
132 const DataTypes::ValueType& value,
133 int dataOffset)
134 {
135 throw DataException("Error - DataAbstract::setTaggedValue: Data type does not have tag values.");
136 }
137
138
139 int
140 DataAbstract::getTagNumber(int dpno)
141 {
142 throw DataException("Error - DataAbstract::getTagNumber: Data type cannot be accessed by tag values.");
143 return (0);
144 }
145
146
147
148 void
149 DataAbstract::copyAll(const boost::python::numeric::array& value)
150 {
151 throw DataException("Error - DataAbstract::copying data from numarray objects is not supported.");
152 }
153 void
154 DataAbstract::copyToDataPoint(const int sampleNo, const int dataPointNo, const double value)
155 {
156 throw DataException("Error - DataAbstract::copying data from double value to a single data point is not supported.");
157 }
158 void
159 DataAbstract::copyToDataPoint(const int sampleNo, const int dataPointNo, const boost::python::numeric::array& value)
160 {
161 throw DataException("Error - DataAbstract::copying data from numarray objects to a single data point is not supported.");
162 }
163
164 void
165 DataAbstract::symmetric(DataAbstract* ev)
166 {
167 throw DataException("Error - DataAbstract::symmetric is not supported.");
168 }
169
170 void
171 DataAbstract::nonsymmetric(DataAbstract* ev)
172 {
173 throw DataException("Error - DataAbstract::nonsymmetric is not supported.");
174 }
175
176 void
177 DataAbstract::trace(DataAbstract* ev, int axis_offset)
178 {
179 throw DataException("Error - DataAbstract::trace is not supported.");
180 }
181
182 void
183 DataAbstract::swapaxes(DataAbstract* ev, int axis0, int axis1)
184 {
185 throw DataException("Error - DataAbstract::component swapaxes is not supported.");
186 }
187 void
188 DataAbstract::transpose(DataAbstract* ev, int axis_offset)
189 {
190 throw DataException("Error - DataAbstract::transpose is not supported.");
191 }
192
193 void
194 DataAbstract::eigenvalues(DataAbstract* ev)
195 {
196 throw DataException("Error - DataAbstract::eigenvalues is not supported.");
197 }
198 void
199 DataAbstract::eigenvalues_and_eigenvectors(DataAbstract* ev,DataAbstract* V,const double tol)
200 {
201 throw DataException("Error - DataAbstract::eigenvalues_and_eigenvectors is not supported.");
202
203 }
204 void
205 DataAbstract::setToZero()
206 {
207 throw DataException("Error - DataAbstract:: cannot set values to zero.");
208 }
209
210 void
211 DataAbstract::reorderByReferenceIDs(int *reference_ids)
212 {
213 }
214
215
216 DataTypes::ValueType&
217 DataAbstract::getVector()
218 {
219 throw DataException("Error - DataAbstract:: does not have a DataVector.");
220 }
221
222 const DataTypes::ValueType&
223 DataAbstract::getVector() const
224 {
225 throw DataException("Error - DataAbstract:: does not have a DataVector.");
226 }
227
228
229
230
231 } // end of namespace

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.26