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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 480 - (hide annotations)
Wed Feb 1 05:15:12 2006 UTC (13 years, 10 months ago) by jgs
File size: 4106 byte(s)
rationalise #includes and forward declarations

1 jgs 82 // $Id$
2     /*
3     ******************************************************************************
4     * *
5     * COPYRIGHT ACcESS 2004 - All Rights Reserved *
6     * *
7     * This software is the property of ACcESS. No part of this code *
8     * may be copied in any form or by any means without the expressed written *
9     * consent of ACcESS. Copying, use or modification of this software *
10     * by any unauthorised person is illegal unless that person has a software *
11     * license agreement with ACcESS. *
12     * *
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     m_functionSpace(what)
27     {
28     }
29    
30     DataAbstract::~DataAbstract()
31     {
32     }
33    
34     void
35     DataAbstract::setPointDataView(const DataArrayView& input)
36     {
37     m_pointDataView.reset(new DataArrayView(input.getData(),input.getShape(),input.getOffset()));
38     }
39    
40     void
41 jgs 119 DataAbstract::resetPointDataView()
42     {
43     m_pointDataView.reset(new DataArrayView());
44     }
45    
46     void
47 jgs 82 DataAbstract::operandCheck(const DataAbstract& right) const
48     {
49     if ((right.getNumDPPSample()!=getNumDPPSample()) ||
50     (right.getNumSamples()!=getNumSamples()) ||
51     (right.getFunctionSpace()!=getFunctionSpace())) {
52     stringstream temp;
53     temp << "Error - Right hand argument sample shape or function space "
54     << "incompatible with left." << endl
55     << "LHS: (" << getNumSamples() << ","
56     << getNumDPPSample() << ") " << getFunctionSpace().toString()
57     << endl
58     << "RHS: (" << right.getNumSamples() << ","
59     << right.getNumDPPSample() << ") "
60     << right.getFunctionSpace().toString();
61     throw DataException(temp.str());
62     }
63    
64     //
65     // Check the shape of the point data, a rank of 0(scalar) is okay
66     if (!((right.getPointDataView().getRank()==0) ||
67     (right.getPointDataView().getShape()==getPointDataView().getShape())))
68     {
69     stringstream temp;
70     temp << "Error - Right hand argument point data shape: "
71     << DataArrayView::shapeToString(right.getPointDataView().getShape())
72     << " doesn't match left: "
73     << DataArrayView::shapeToString(getPointDataView().getShape());
74     throw DataException(temp.str());
75     }
76     }
77    
78     DataAbstract::ValueType::value_type*
79     DataAbstract::getSampleDataByTag(int tag)
80     {
81 jgs 110 throw DataException("Error - DataAbstract::getSampleDataByTag: Data type does not have tag values.");
82 jgs 82 }
83    
84     void
85     DataAbstract::setTaggedValue(int tagKey,
86     const DataArrayView& value)
87     {
88 jgs 110 throw DataException("Error - DataAbstract::setTaggedValue: Data type does not have tag values.");
89 jgs 82 }
90    
91 jgs 149 int
92     DataAbstract::getTagNumber(int dpno)
93     {
94     throw DataException("Error - DataAbstract::getTagNumber: Data type cannot be accessed by tag values.");
95     return (0);
96     }
97    
98 jgs 110 void
99     DataAbstract::setRefValue(int ref,
100     const DataArray& value)
101     {
102     throw DataException("Error - DataAbstract::setRefValue: Data type cannot be accessed by reference values.");
103     }
104    
105     void
106     DataAbstract::getRefValue(int ref,
107     DataArray& value)
108     {
109     throw DataException("Error - DataAbstract::getRefValue: Data type cannot be accessed by reference values.");
110     }
111    
112 jgs 123 int
113     DataAbstract::archiveData(ofstream& archiveFile,
114     const ValueType::size_type noValues) const
115     {
116     return 0;
117     }
118    
119     int
120     DataAbstract::extractData(ifstream& archiveFile,
121     const ValueType::size_type noValues)
122     {
123     return 0;
124     }
125    
126 jgs 126 void
127     DataAbstract::copyAll(const boost::python::numeric::array& value)
128     {
129     throw DataException("Error - DataAbstract::copying data from numarray objects is not supported.");
130     }
131    
132    
133 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