1 |
jgs |
82 |
// $Id$ |
2 |
|
|
/* |
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 |
|
|
|
14 |
jgs |
474 |
#include "DataAbstract.h" |
15 |
|
|
#include "DataException.h" |
16 |
jgs |
82 |
|
17 |
|
|
using namespace std; |
18 |
|
|
|
19 |
|
|
namespace escript { |
20 |
|
|
|
21 |
|
|
DataAbstract::DataAbstract(const FunctionSpace& what): |
22 |
|
|
m_noDataPointsPerSample(what.getNumDPPSample()), |
23 |
|
|
m_noSamples(what.getNumSamples()), |
24 |
|
|
m_functionSpace(what) |
25 |
|
|
{ |
26 |
|
|
} |
27 |
|
|
|
28 |
|
|
DataAbstract::~DataAbstract() |
29 |
|
|
{ |
30 |
|
|
} |
31 |
|
|
|
32 |
|
|
void |
33 |
|
|
DataAbstract::setPointDataView(const DataArrayView& input) |
34 |
|
|
{ |
35 |
|
|
m_pointDataView.reset(new DataArrayView(input.getData(),input.getShape(),input.getOffset())); |
36 |
|
|
} |
37 |
|
|
|
38 |
|
|
void |
39 |
jgs |
119 |
DataAbstract::resetPointDataView() |
40 |
|
|
{ |
41 |
|
|
m_pointDataView.reset(new DataArrayView()); |
42 |
|
|
} |
43 |
|
|
|
44 |
|
|
void |
45 |
jgs |
82 |
DataAbstract::operandCheck(const DataAbstract& right) const |
46 |
|
|
{ |
47 |
|
|
if ((right.getNumDPPSample()!=getNumDPPSample()) || |
48 |
|
|
(right.getNumSamples()!=getNumSamples()) || |
49 |
|
|
(right.getFunctionSpace()!=getFunctionSpace())) { |
50 |
|
|
stringstream temp; |
51 |
|
|
temp << "Error - Right hand argument sample shape or function space " |
52 |
|
|
<< "incompatible with left." << endl |
53 |
|
|
<< "LHS: (" << getNumSamples() << "," |
54 |
|
|
<< getNumDPPSample() << ") " << getFunctionSpace().toString() |
55 |
|
|
<< endl |
56 |
|
|
<< "RHS: (" << right.getNumSamples() << "," |
57 |
|
|
<< right.getNumDPPSample() << ") " |
58 |
|
|
<< right.getFunctionSpace().toString(); |
59 |
|
|
throw DataException(temp.str()); |
60 |
|
|
} |
61 |
|
|
|
62 |
|
|
// |
63 |
|
|
// Check the shape of the point data, a rank of 0(scalar) is okay |
64 |
|
|
if (!((right.getPointDataView().getRank()==0) || |
65 |
|
|
(right.getPointDataView().getShape()==getPointDataView().getShape()))) |
66 |
|
|
{ |
67 |
|
|
stringstream temp; |
68 |
|
|
temp << "Error - Right hand argument point data shape: " |
69 |
|
|
<< DataArrayView::shapeToString(right.getPointDataView().getShape()) |
70 |
|
|
<< " doesn't match left: " |
71 |
|
|
<< DataArrayView::shapeToString(getPointDataView().getShape()); |
72 |
|
|
throw DataException(temp.str()); |
73 |
|
|
} |
74 |
|
|
} |
75 |
|
|
|
76 |
gross |
950 |
void |
77 |
|
|
DataAbstract::dump(const std::string fileName) const |
78 |
|
|
{ |
79 |
|
|
throw DataException("Error - DataAbstract:: dump: not implemented."); |
80 |
|
|
} |
81 |
|
|
|
82 |
|
|
|
83 |
|
|
|
84 |
jgs |
82 |
DataAbstract::ValueType::value_type* |
85 |
|
|
DataAbstract::getSampleDataByTag(int tag) |
86 |
|
|
{ |
87 |
jgs |
110 |
throw DataException("Error - DataAbstract::getSampleDataByTag: Data type does not have tag values."); |
88 |
jgs |
82 |
} |
89 |
|
|
|
90 |
|
|
void |
91 |
|
|
DataAbstract::setTaggedValue(int tagKey, |
92 |
|
|
const DataArrayView& value) |
93 |
|
|
{ |
94 |
jgs |
110 |
throw DataException("Error - DataAbstract::setTaggedValue: Data type does not have tag values."); |
95 |
jgs |
82 |
} |
96 |
|
|
|
97 |
jgs |
149 |
int |
98 |
|
|
DataAbstract::getTagNumber(int dpno) |
99 |
|
|
{ |
100 |
|
|
throw DataException("Error - DataAbstract::getTagNumber: Data type cannot be accessed by tag values."); |
101 |
|
|
return (0); |
102 |
|
|
} |
103 |
|
|
|
104 |
jgs |
123 |
int |
105 |
|
|
DataAbstract::archiveData(ofstream& archiveFile, |
106 |
|
|
const ValueType::size_type noValues) const |
107 |
|
|
{ |
108 |
|
|
return 0; |
109 |
|
|
} |
110 |
|
|
|
111 |
|
|
int |
112 |
|
|
DataAbstract::extractData(ifstream& archiveFile, |
113 |
|
|
const ValueType::size_type noValues) |
114 |
|
|
{ |
115 |
|
|
return 0; |
116 |
|
|
} |
117 |
|
|
|
118 |
jgs |
126 |
void |
119 |
|
|
DataAbstract::copyAll(const boost::python::numeric::array& value) |
120 |
|
|
{ |
121 |
|
|
throw DataException("Error - DataAbstract::copying data from numarray objects is not supported."); |
122 |
|
|
} |
123 |
gross |
921 |
void |
124 |
gross |
922 |
DataAbstract::copyToDataPoint(const int sampleNo, const int dataPointNo, const double value) |
125 |
|
|
{ |
126 |
|
|
throw DataException("Error - DataAbstract::copying data from double value to a single data point is not supported."); |
127 |
|
|
} |
128 |
|
|
void |
129 |
gross |
921 |
DataAbstract::copyToDataPoint(const int sampleNo, const int dataPointNo, const boost::python::numeric::array& value) |
130 |
|
|
{ |
131 |
|
|
throw DataException("Error - DataAbstract::copying data from numarray objects to a single data point is not supported."); |
132 |
|
|
} |
133 |
jgs |
126 |
|
134 |
gross |
576 |
void |
135 |
ksteube |
775 |
DataAbstract::symmetric(DataAbstract* ev) |
136 |
|
|
{ |
137 |
|
|
throw DataException("Error - DataAbstract::symmetric is not supported."); |
138 |
|
|
} |
139 |
|
|
|
140 |
|
|
void |
141 |
|
|
DataAbstract::nonsymmetric(DataAbstract* ev) |
142 |
|
|
{ |
143 |
|
|
throw DataException("Error - DataAbstract::nonsymmetric is not supported."); |
144 |
|
|
} |
145 |
|
|
|
146 |
|
|
void |
147 |
gross |
800 |
DataAbstract::trace(DataAbstract* ev, int axis_offset) |
148 |
ksteube |
775 |
{ |
149 |
gross |
800 |
throw DataException("Error - DataAbstract::trace is not supported."); |
150 |
ksteube |
775 |
} |
151 |
|
|
|
152 |
|
|
void |
153 |
gross |
804 |
DataAbstract::swapaxes(DataAbstract* ev, int axis0, int axis1) |
154 |
gross |
800 |
{ |
155 |
gross |
804 |
throw DataException("Error - DataAbstract::component swapaxes is not supported."); |
156 |
gross |
800 |
} |
157 |
|
|
void |
158 |
ksteube |
775 |
DataAbstract::transpose(DataAbstract* ev, int axis_offset) |
159 |
|
|
{ |
160 |
|
|
throw DataException("Error - DataAbstract::transpose is not supported."); |
161 |
|
|
} |
162 |
|
|
|
163 |
|
|
void |
164 |
gross |
576 |
DataAbstract::eigenvalues(DataAbstract* ev) |
165 |
|
|
{ |
166 |
|
|
throw DataException("Error - DataAbstract::eigenvalues is not supported."); |
167 |
|
|
} |
168 |
|
|
void |
169 |
|
|
DataAbstract::eigenvalues_and_eigenvectors(DataAbstract* ev,DataAbstract* V,const double tol) |
170 |
|
|
{ |
171 |
|
|
throw DataException("Error - DataAbstract::eigenvalues_and_eigenvectors is not supported."); |
172 |
|
|
|
173 |
|
|
} |
174 |
gross |
1118 |
void |
175 |
|
|
DataAbstract::setToZero() |
176 |
|
|
{ |
177 |
|
|
throw DataException("Error - DataAbstract:: cannot set values to zero."); |
178 |
|
|
} |
179 |
gross |
576 |
|
180 |
|
|
|
181 |
|
|
|
182 |
jgs |
82 |
} // end of namespace |