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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 110 - (hide annotations)
Mon Feb 14 04:14:42 2005 UTC (14 years, 9 months ago) by jgs
Original Path: trunk/esys2/escript/src/Data/DataAbstract.cpp
File size: 3498 byte(s)
*** empty log message ***

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