1 |
// $Id$ |
2 |
/* |
3 |
************************************************************ |
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 |
*/ |
13 |
|
14 |
#include "DataAbstract.h" |
15 |
#include "DataException.h" |
16 |
|
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 |
DataAbstract::resetPointDataView() |
40 |
{ |
41 |
m_pointDataView.reset(new DataArrayView()); |
42 |
} |
43 |
|
44 |
void |
45 |
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 |
DataAbstract::ValueType::value_type* |
77 |
DataAbstract::getSampleDataByTag(int tag) |
78 |
{ |
79 |
throw DataException("Error - DataAbstract::getSampleDataByTag: Data type does not have tag values."); |
80 |
} |
81 |
|
82 |
void |
83 |
DataAbstract::setTaggedValue(int tagKey, |
84 |
const DataArrayView& value) |
85 |
{ |
86 |
throw DataException("Error - DataAbstract::setTaggedValue: Data type does not have tag values."); |
87 |
} |
88 |
|
89 |
int |
90 |
DataAbstract::getTagNumber(int dpno) |
91 |
{ |
92 |
throw DataException("Error - DataAbstract::getTagNumber: Data type cannot be accessed by tag values."); |
93 |
return (0); |
94 |
} |
95 |
|
96 |
void |
97 |
DataAbstract::setRefValue(int ref, |
98 |
const DataArray& value) |
99 |
{ |
100 |
throw DataException("Error - DataAbstract::setRefValue: Data type cannot be accessed by reference values."); |
101 |
} |
102 |
|
103 |
void |
104 |
DataAbstract::getRefValue(int ref, |
105 |
DataArray& value) |
106 |
{ |
107 |
throw DataException("Error - DataAbstract::getRefValue: Data type cannot be accessed by reference values."); |
108 |
} |
109 |
|
110 |
int |
111 |
DataAbstract::archiveData(ofstream& archiveFile, |
112 |
const ValueType::size_type noValues) const |
113 |
{ |
114 |
return 0; |
115 |
} |
116 |
|
117 |
int |
118 |
DataAbstract::extractData(ifstream& archiveFile, |
119 |
const ValueType::size_type noValues) |
120 |
{ |
121 |
return 0; |
122 |
} |
123 |
|
124 |
void |
125 |
DataAbstract::copyAll(const boost::python::numeric::array& value) |
126 |
{ |
127 |
throw DataException("Error - DataAbstract::copying data from numarray objects is not supported."); |
128 |
} |
129 |
|
130 |
void |
131 |
DataAbstract::symmetric(DataAbstract* ev) |
132 |
{ |
133 |
throw DataException("Error - DataAbstract::symmetric is not supported."); |
134 |
} |
135 |
|
136 |
void |
137 |
DataAbstract::nonsymmetric(DataAbstract* ev) |
138 |
{ |
139 |
throw DataException("Error - DataAbstract::nonsymmetric is not supported."); |
140 |
} |
141 |
|
142 |
void |
143 |
DataAbstract::trace(DataAbstract* ev, int axis_offset) |
144 |
{ |
145 |
throw DataException("Error - DataAbstract::trace is not supported."); |
146 |
} |
147 |
|
148 |
void |
149 |
DataAbstract::swapaxes(DataAbstract* ev, int axis0, int axis1) |
150 |
{ |
151 |
throw DataException("Error - DataAbstract::component swapaxes is not supported."); |
152 |
} |
153 |
void |
154 |
DataAbstract::transpose(DataAbstract* ev, int axis_offset) |
155 |
{ |
156 |
throw DataException("Error - DataAbstract::transpose is not supported."); |
157 |
} |
158 |
|
159 |
void |
160 |
DataAbstract::eigenvalues(DataAbstract* ev) |
161 |
{ |
162 |
throw DataException("Error - DataAbstract::eigenvalues is not supported."); |
163 |
|
164 |
} |
165 |
void |
166 |
DataAbstract::eigenvalues_and_eigenvectors(DataAbstract* ev,DataAbstract* V,const double tol) |
167 |
{ |
168 |
throw DataException("Error - DataAbstract::eigenvalues_and_eigenvectors is not supported."); |
169 |
|
170 |
} |
171 |
|
172 |
|
173 |
|
174 |
} // end of namespace |