/[escript]/branches/schroedinger/escript/src/DataAbstract.cpp
ViewVC logotype

Contents of /branches/schroedinger/escript/src/DataAbstract.cpp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1864 - (show annotations)
Thu Oct 9 03:09:30 2008 UTC (11 years, 5 months ago) by jfenwick
File size: 5678 byte(s)
Branch commit
It compiles but doesn't do much.


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

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.26