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

Annotation of /branches/arrayview_from_1695_trunk/escript/src/DataAbstract.cpp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1721 - (hide annotations)
Fri Aug 22 00:39:32 2008 UTC (11 years, 3 months ago) by jfenwick
File size: 5772 byte(s)
Branch commit.

Fixed problems with copyFromNumArray
Removed version of setTaggedValueFromCPP() which required DataArrayView.
Updated tests.


1 jgs 82
2 ksteube 1312 /* $Id$ */
3    
4     /*******************************************************
5     *
6     * Copyright 2003-2007 by ACceSS MNRF
7     * Copyright 2007 by University of Queensland
8     *
9     * http://esscc.uq.edu.au
10     * Primary Business: Queensland, Australia
11     * Licensed under the Open Software License version 3.0
12     * http://www.opensource.org/licenses/osl-3.0.php
13     *
14     *******************************************************/
15    
16 jgs 474 #include "DataAbstract.h"
17     #include "DataException.h"
18 jgs 82
19     using namespace std;
20    
21     namespace escript {
22    
23     DataAbstract::DataAbstract(const FunctionSpace& what):
24     m_noDataPointsPerSample(what.getNumDPPSample()),
25     m_noSamples(what.getNumSamples()),
26 jfenwick 1704 m_functionSpace(what),
27     m_rank(0)
28 jgs 82 {
29 jfenwick 1704 setShape(DataTypes::ShapeType());
30 jgs 82 }
31    
32     DataAbstract::~DataAbstract()
33     {
34     }
35    
36     void
37     DataAbstract::setPointDataView(const DataArrayView& input)
38     {
39     m_pointDataView.reset(new DataArrayView(input.getData(),input.getShape(),input.getOffset()));
40 jfenwick 1704
41     // until we get rid of m_pointDataView, we need to keep m_shape in sync
42     setShape(input.getShape());
43 jgs 82 }
44    
45 jfenwick 1712 // perhaps this should be a constructor parameter
46 jgs 82 void
47 jfenwick 1704 DataAbstract::setShape(const DataTypes::ShapeType& s)
48     {
49     m_shape=s;
50     m_rank=DataTypes::getRank(s);
51     m_novalues=DataTypes::noValues(s);
52     }
53    
54    
55     void
56 jgs 119 DataAbstract::resetPointDataView()
57     {
58     m_pointDataView.reset(new DataArrayView());
59 jfenwick 1704 m_shape.clear();
60     m_rank=0;
61     m_novalues=1;
62 jgs 119 }
63    
64     void
65 jgs 82 DataAbstract::operandCheck(const DataAbstract& right) const
66     {
67     if ((right.getNumDPPSample()!=getNumDPPSample()) ||
68     (right.getNumSamples()!=getNumSamples()) ||
69     (right.getFunctionSpace()!=getFunctionSpace())) {
70     stringstream temp;
71     temp << "Error - Right hand argument sample shape or function space "
72     << "incompatible with left." << endl
73     << "LHS: (" << getNumSamples() << ","
74     << getNumDPPSample() << ") " << getFunctionSpace().toString()
75     << endl
76     << "RHS: (" << right.getNumSamples() << ","
77     << right.getNumDPPSample() << ") "
78     << right.getFunctionSpace().toString();
79     throw DataException(temp.str());
80     }
81    
82     //
83     // Check the shape of the point data, a rank of 0(scalar) is okay
84     if (!((right.getPointDataView().getRank()==0) ||
85     (right.getPointDataView().getShape()==getPointDataView().getShape())))
86     {
87     stringstream temp;
88     temp << "Error - Right hand argument point data shape: "
89 jfenwick 1698 << DataTypes::shapeToString(right.getPointDataView().getShape())
90 jgs 82 << " doesn't match left: "
91 jfenwick 1698 << DataTypes::shapeToString(getPointDataView().getShape());
92 jgs 82 throw DataException(temp.str());
93     }
94     }
95    
96 gross 950 void
97     DataAbstract::dump(const std::string fileName) const
98     {
99     throw DataException("Error - DataAbstract:: dump: not implemented.");
100     }
101    
102    
103    
104 jgs 82 DataAbstract::ValueType::value_type*
105     DataAbstract::getSampleDataByTag(int tag)
106     {
107 jgs 110 throw DataException("Error - DataAbstract::getSampleDataByTag: Data type does not have tag values.");
108 jgs 82 }
109    
110     void
111     DataAbstract::setTaggedValue(int tagKey,
112     const DataArrayView& value)
113     {
114 jgs 110 throw DataException("Error - DataAbstract::setTaggedValue: Data type does not have tag values.");
115 jgs 82 }
116    
117 jfenwick 1715 void
118     DataAbstract::setTaggedValue(int tagKey,
119     const DataTypes::ShapeType& pointshape,
120 jfenwick 1721 const DataTypes::ValueType& value,
121     int dataOffset)
122 jfenwick 1715 {
123     throw DataException("Error - DataAbstract::setTaggedValue: Data type does not have tag values.");
124     }
125    
126    
127 jgs 149 int
128     DataAbstract::getTagNumber(int dpno)
129     {
130     throw DataException("Error - DataAbstract::getTagNumber: Data type cannot be accessed by tag values.");
131     return (0);
132     }
133    
134 jgs 123 int
135     DataAbstract::archiveData(ofstream& archiveFile,
136     const ValueType::size_type noValues) const
137     {
138     return 0;
139     }
140    
141     int
142     DataAbstract::extractData(ifstream& archiveFile,
143     const ValueType::size_type noValues)
144     {
145     return 0;
146     }
147    
148 jgs 126 void
149     DataAbstract::copyAll(const boost::python::numeric::array& value)
150     {
151     throw DataException("Error - DataAbstract::copying data from numarray objects is not supported.");
152     }
153 gross 921 void
154 gross 922 DataAbstract::copyToDataPoint(const int sampleNo, const int dataPointNo, const double value)
155     {
156     throw DataException("Error - DataAbstract::copying data from double value to a single data point is not supported.");
157     }
158     void
159 gross 921 DataAbstract::copyToDataPoint(const int sampleNo, const int dataPointNo, const boost::python::numeric::array& value)
160     {
161     throw DataException("Error - DataAbstract::copying data from numarray objects to a single data point is not supported.");
162     }
163 jgs 126
164 gross 576 void
165 ksteube 775 DataAbstract::symmetric(DataAbstract* ev)
166     {
167     throw DataException("Error - DataAbstract::symmetric is not supported.");
168     }
169    
170     void
171     DataAbstract::nonsymmetric(DataAbstract* ev)
172     {
173     throw DataException("Error - DataAbstract::nonsymmetric is not supported.");
174     }
175    
176     void
177 gross 800 DataAbstract::trace(DataAbstract* ev, int axis_offset)
178 ksteube 775 {
179 gross 800 throw DataException("Error - DataAbstract::trace is not supported.");
180 ksteube 775 }
181    
182     void
183 gross 804 DataAbstract::swapaxes(DataAbstract* ev, int axis0, int axis1)
184 gross 800 {
185 gross 804 throw DataException("Error - DataAbstract::component swapaxes is not supported.");
186 gross 800 }
187     void
188 ksteube 775 DataAbstract::transpose(DataAbstract* ev, int axis_offset)
189     {
190     throw DataException("Error - DataAbstract::transpose is not supported.");
191     }
192    
193     void
194 gross 576 DataAbstract::eigenvalues(DataAbstract* ev)
195     {
196     throw DataException("Error - DataAbstract::eigenvalues is not supported.");
197     }
198     void
199     DataAbstract::eigenvalues_and_eigenvectors(DataAbstract* ev,DataAbstract* V,const double tol)
200     {
201     throw DataException("Error - DataAbstract::eigenvalues_and_eigenvectors is not supported.");
202    
203     }
204 gross 1118 void
205     DataAbstract::setToZero()
206     {
207     throw DataException("Error - DataAbstract:: cannot set values to zero.");
208     }
209 gross 576
210 gross 1487 void
211     DataAbstract::reorderByReferenceIDs(int *reference_ids)
212     {
213     }
214 gross 576
215    
216 gross 1487
217    
218 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