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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 117 - (show annotations)
Fri Apr 1 05:48:57 2005 UTC (14 years, 5 months ago) by jgs
Original Path: trunk/esys2/escript/src/Data/DataAbstract.cpp
File size: 3438 byte(s)
*** empty log message ***

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
21 using namespace std;
22
23 namespace escript {
24
25 DataAbstract::DataAbstract(const FunctionSpace& what):
26 m_noDataPointsPerSample(what.getNumDPPSample()),
27 m_noSamples(what.getNumSamples()),
28 m_functionSpace(what)
29 {
30 }
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 }
41
42 void
43 DataAbstract::operandCheck(const DataAbstract& right) const
44 {
45 if ((right.getNumDPPSample()!=getNumDPPSample()) ||
46 (right.getNumSamples()!=getNumSamples()) ||
47 (right.getFunctionSpace()!=getFunctionSpace())) {
48 stringstream temp;
49 temp << "Error - Right hand argument sample shape or function space "
50 << "incompatible with left." << endl
51 << "LHS: (" << getNumSamples() << ","
52 << getNumDPPSample() << ") " << getFunctionSpace().toString()
53 << endl
54 << "RHS: (" << right.getNumSamples() << ","
55 << right.getNumDPPSample() << ") "
56 << right.getFunctionSpace().toString();
57 throw DataException(temp.str());
58 }
59
60 //
61 // Check the shape of the point data, a rank of 0(scalar) is okay
62 if (!((right.getPointDataView().getRank()==0) ||
63 (right.getPointDataView().getShape()==getPointDataView().getShape())))
64 {
65 stringstream temp;
66 temp << "Error - Right hand argument point data shape: "
67 << DataArrayView::shapeToString(right.getPointDataView().getShape())
68 << " doesn't match left: "
69 << DataArrayView::shapeToString(getPointDataView().getShape());
70 throw DataException(temp.str());
71 }
72 }
73
74 DataAbstract::ValueType::value_type*
75 DataAbstract::getSampleDataByTag(int tag)
76 {
77 throw DataException("Error - DataAbstract::getSampleDataByTag: Data type does not have tag values.");
78 }
79
80 void
81 DataAbstract::setTaggedValue(int tagKey,
82 const DataArrayView& value)
83 {
84 throw DataException("Error - DataAbstract::setTaggedValue: Data type does not have tag values.");
85 }
86
87 void
88 DataAbstract::setRefValue(int ref,
89 const DataArray& value)
90 {
91 throw DataException("Error - DataAbstract::setRefValue: Data type cannot be accessed by reference values.");
92 }
93
94 void
95 DataAbstract::getRefValue(int ref,
96 DataArray& value)
97 {
98 throw DataException("Error - DataAbstract::getRefValue: Data type cannot be accessed by reference values.");
99 }
100
101 } // end of namespace

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.26