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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 82 - (show annotations)
Tue Oct 26 06:53:54 2004 UTC (15 years, 1 month ago) by jgs
Original Path: trunk/esys2/escript/src/Data/DataAbstract.cpp
File size: 2984 byte(s)
Initial revision

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
18 #include <iostream>
19
20 using namespace std;
21
22 namespace escript {
23
24 DataAbstract::DataAbstract(const FunctionSpace& what):
25 m_noDataPointsPerSample(what.getNumDPPSample()),
26 m_noSamples(what.getNumSamples()),
27 m_functionSpace(what)
28 {
29 //cout << "Calling DataAbstract constructor." << endl;
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
63 if (!((right.getPointDataView().getRank()==0) ||
64 (right.getPointDataView().getShape()==getPointDataView().getShape())))
65 {
66 stringstream temp;
67 temp << "Error - Right hand argument point data shape: "
68 << DataArrayView::shapeToString(right.getPointDataView().getShape())
69 << " doesn't match left: "
70 << DataArrayView::shapeToString(getPointDataView().getShape());
71 throw DataException(temp.str());
72 }
73 }
74
75 DataAbstract::ValueType::value_type*
76 DataAbstract::getSampleDataByTag(int tag)
77 {
78 throw DataException("Error - Data type does not have tag values.");
79 }
80
81 void
82 DataAbstract::setTaggedValue(int tagKey,
83 const DataArrayView& value)
84 {
85 throw DataException("Error - Data type does not have tag values.");
86 }
87
88 } // end of namespace

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.26