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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1946 - (hide annotations)
Wed Oct 29 05:48:53 2008 UTC (11 years, 3 months ago) by jfenwick
File size: 5535 byte(s)
A cleanup of some of the problems I found doing a Wall compile.

Removed some commented out lines.
Swapped some member initialisers.
Removed virtual qualifiers from some methods in FunctionSpace.
Fixed some unused or (possibly) uninitialised variables.


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