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

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

Parent Directory Parent Directory | Revision Log Revision Log


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