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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2005 - (hide annotations)
Mon Nov 10 01:21:39 2008 UTC (10 years, 10 months ago) by jfenwick
File size: 5679 byte(s)
Bringing all changes across from schroedinger.
(Note this does not mean development is done, just that it will happen
on the trunk for now).
If anyone notices any problems please contact me.


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

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.26