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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 155 - (show annotations)
Wed Nov 9 02:02:19 2005 UTC (13 years, 10 months ago) by jgs
Original Path: trunk/escript/src/Data/DataAbstract.cpp
File size: 4172 byte(s)
move all directories from trunk/esys2 into trunk and remove esys2

1 // $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 #include "escript/Data/DataAbstract.h"
17 #include "escript/Data/DataException.h"
18
19 #include <iostream>
20 #include <fstream>
21
22 using namespace std;
23
24 namespace escript {
25
26 DataAbstract::DataAbstract(const FunctionSpace& what):
27 m_noDataPointsPerSample(what.getNumDPPSample()),
28 m_noSamples(what.getNumSamples()),
29 m_functionSpace(what)
30 {
31 }
32
33 DataAbstract::~DataAbstract()
34 {
35 }
36
37 void
38 DataAbstract::setPointDataView(const DataArrayView& input)
39 {
40 m_pointDataView.reset(new DataArrayView(input.getData(),input.getShape(),input.getOffset()));
41 }
42
43 void
44 DataAbstract::resetPointDataView()
45 {
46 m_pointDataView.reset(new DataArrayView());
47 }
48
49 void
50 DataAbstract::operandCheck(const DataAbstract& right) const
51 {
52 if ((right.getNumDPPSample()!=getNumDPPSample()) ||
53 (right.getNumSamples()!=getNumSamples()) ||
54 (right.getFunctionSpace()!=getFunctionSpace())) {
55 stringstream temp;
56 temp << "Error - Right hand argument sample shape or function space "
57 << "incompatible with left." << endl
58 << "LHS: (" << getNumSamples() << ","
59 << getNumDPPSample() << ") " << getFunctionSpace().toString()
60 << endl
61 << "RHS: (" << right.getNumSamples() << ","
62 << right.getNumDPPSample() << ") "
63 << right.getFunctionSpace().toString();
64 throw DataException(temp.str());
65 }
66
67 //
68 // Check the shape of the point data, a rank of 0(scalar) is okay
69 if (!((right.getPointDataView().getRank()==0) ||
70 (right.getPointDataView().getShape()==getPointDataView().getShape())))
71 {
72 stringstream temp;
73 temp << "Error - Right hand argument point data shape: "
74 << DataArrayView::shapeToString(right.getPointDataView().getShape())
75 << " doesn't match left: "
76 << DataArrayView::shapeToString(getPointDataView().getShape());
77 throw DataException(temp.str());
78 }
79 }
80
81 DataAbstract::ValueType::value_type*
82 DataAbstract::getSampleDataByTag(int tag)
83 {
84 throw DataException("Error - DataAbstract::getSampleDataByTag: Data type does not have tag values.");
85 }
86
87 void
88 DataAbstract::setTaggedValue(int tagKey,
89 const DataArrayView& value)
90 {
91 throw DataException("Error - DataAbstract::setTaggedValue: Data type does not have tag values.");
92 }
93
94 int
95 DataAbstract::getTagNumber(int dpno)
96 {
97 throw DataException("Error - DataAbstract::getTagNumber: Data type cannot be accessed by tag values.");
98 return (0);
99 }
100
101 void
102 DataAbstract::setRefValue(int ref,
103 const DataArray& value)
104 {
105 throw DataException("Error - DataAbstract::setRefValue: Data type cannot be accessed by reference values.");
106 }
107
108 void
109 DataAbstract::getRefValue(int ref,
110 DataArray& value)
111 {
112 throw DataException("Error - DataAbstract::getRefValue: Data type cannot be accessed by reference values.");
113 }
114
115 int
116 DataAbstract::archiveData(ofstream& archiveFile,
117 const ValueType::size_type noValues) const
118 {
119 return 0;
120 }
121
122 int
123 DataAbstract::extractData(ifstream& archiveFile,
124 const ValueType::size_type noValues)
125 {
126 return 0;
127 }
128
129 void
130 DataAbstract::copyAll(const boost::python::numeric::array& value)
131 {
132 throw DataException("Error - DataAbstract::copying data from numarray objects is not supported.");
133 }
134
135
136 } // end of namespace

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.26