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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 123 - (hide annotations)
Fri Jul 8 04:08:13 2005 UTC (14 years ago) by jgs
Original Path: trunk/esys2/escript/src/Data/DataAbstract.cpp
File size: 3822 byte(s)
Merge of development branch back to main trunk on 2005-07-08

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 jgs 123 #include <fstream>
21 jgs 82
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 jgs 119 DataAbstract::resetPointDataView()
45     {
46     m_pointDataView.reset(new DataArrayView());
47     }
48    
49     void
50 jgs 82 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 jgs 110 throw DataException("Error - DataAbstract::getSampleDataByTag: Data type does not have tag values.");
85 jgs 82 }
86    
87     void
88     DataAbstract::setTaggedValue(int tagKey,
89     const DataArrayView& value)
90     {
91 jgs 110 throw DataException("Error - DataAbstract::setTaggedValue: Data type does not have tag values.");
92 jgs 82 }
93    
94 jgs 110 void
95     DataAbstract::setRefValue(int ref,
96     const DataArray& value)
97     {
98     throw DataException("Error - DataAbstract::setRefValue: Data type cannot be accessed by reference values.");
99     }
100    
101     void
102     DataAbstract::getRefValue(int ref,
103     DataArray& value)
104     {
105     throw DataException("Error - DataAbstract::getRefValue: Data type cannot be accessed by reference values.");
106     }
107    
108 jgs 123 int
109     DataAbstract::archiveData(ofstream& archiveFile,
110     const ValueType::size_type noValues) const
111     {
112     return 0;
113     }
114    
115     int
116     DataAbstract::extractData(ifstream& archiveFile,
117     const ValueType::size_type noValues)
118     {
119     return 0;
120     }
121    
122 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