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

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

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 804 by gross, Thu Aug 10 01:12:16 2006 UTC revision 1811 by ksteube, Thu Sep 25 23:11:13 2008 UTC
# Line 1  Line 1 
1  // $Id$  
2  /*  /*******************************************************
3   ************************************************************  *
4   *          Copyright 2006 by ACcESS MNRF                   *  * Copyright (c) 2003-2008 by University of Queensland
5   *                                                          *  * Earth Systems Science Computational Center (ESSCC)
6   *              http://www.access.edu.au                    *  * http://www.uq.edu.au/esscc
7   *       Primary Business: Queensland, Australia            *  *
8   *  Licensed under the Open Software License version 3.0    *  * Primary Business: Queensland, Australia
9   *     http://www.opensource.org/licenses/osl-3.0.php       *  * Licensed under the Open Software License version 3.0
10   *                                                          *  * http://www.opensource.org/licenses/osl-3.0.php
11   ************************************************************  *
12  */  *******************************************************/
13    
14    
15  #include "DataAbstract.h"  #include "DataAbstract.h"
16  #include "DataException.h"  #include "DataException.h"
# Line 18  using namespace std; Line 19  using namespace std;
19    
20  namespace escript {  namespace escript {
21    
22  DataAbstract::DataAbstract(const FunctionSpace& what):  DataAbstract::DataAbstract(const FunctionSpace& what, const ShapeType& shape, bool isDataEmpty):
23      m_noDataPointsPerSample(what.getNumDPPSample()),      m_noDataPointsPerSample(what.getNumDPPSample()),
24      m_noSamples(what.getNumSamples()),      m_noSamples(what.getNumSamples()),
25      m_functionSpace(what)      m_functionSpace(what),
26        m_shape(shape),
27        m_rank(DataTypes::getRank(shape)),
28        m_novalues(DataTypes::noValues(shape))
29  {  {
30        m_isempty=isDataEmpty;
31  }  }
32    
33  DataAbstract::~DataAbstract()  DataAbstract::~DataAbstract()
34  {  {
35  }  }
36    
 void  
 DataAbstract::setPointDataView(const DataArrayView& input)  
 {  
     m_pointDataView.reset(new DataArrayView(input.getData(),input.getShape(),input.getOffset()));  
 }  
   
 void  
 DataAbstract::resetPointDataView()  
 {  
     m_pointDataView.reset(new DataArrayView());  
 }  
37    
38  void  void
39  DataAbstract::operandCheck(const DataAbstract& right) const  DataAbstract::operandCheck(const DataAbstract& right) const
# Line 61  DataAbstract::operandCheck(const DataAbs Line 55  DataAbstract::operandCheck(const DataAbs
55    
56      //      //
57      // Check the shape of the point data, a rank of 0(scalar) is okay      // Check the shape of the point data, a rank of 0(scalar) is okay
58      if (!((right.getPointDataView().getRank()==0) ||      if (!((right.getRank()==0) ||
59        (right.getPointDataView().getShape()==getPointDataView().getShape())))        (right.getShape()==getShape())))
60        {        {
61          stringstream temp;          stringstream temp;
62      temp << "Error - Right hand argument point data shape: "      temp << "Error - Right hand argument point data shape: "
63           << DataArrayView::shapeToString(right.getPointDataView().getShape())           << DataTypes::shapeToString(right.getShape())
64           << " doesn't match left: "           << " doesn't match left: "
65           << DataArrayView::shapeToString(getPointDataView().getShape());           << DataTypes::shapeToString(getShape());
66      throw DataException(temp.str());      throw DataException(temp.str());
67        }        }
68  }  }
69    
70    void
71    DataAbstract::dump(const std::string fileName) const
72    {
73        throw DataException("Error - DataAbstract::dump: not implemented.");
74    }
75    
76    
77    
78  DataAbstract::ValueType::value_type*  DataAbstract::ValueType::value_type*
79  DataAbstract::getSampleDataByTag(int tag)  DataAbstract::getSampleDataByTag(int tag)
80  {  {
81      throw DataException("Error - DataAbstract::getSampleDataByTag: Data type does not have tag values.");      throw DataException("Error - DataAbstract::getSampleDataByTag: Data type does not have tag values.");
82  }  }
83    
84  void  
85    void  
86  DataAbstract::setTaggedValue(int tagKey,  DataAbstract::setTaggedValue(int tagKey,
87                               const DataArrayView& value)             const DataTypes::ShapeType& pointshape,
88                   const DataTypes::ValueType& value,
89               int dataOffset)
90  {  {
91      throw DataException("Error - DataAbstract::setTaggedValue: Data type does not have tag values.");      throw DataException("Error - DataAbstract::setTaggedValue: Data type does not have tag values.");
92  }  }
93    
94    
95  int  int
96  DataAbstract::getTagNumber(int dpno)  DataAbstract::getTagNumber(int dpno)
97  {  {
# Line 93  DataAbstract::getTagNumber(int dpno) Line 99  DataAbstract::getTagNumber(int dpno)
99      return (0);      return (0);
100  }  }
101    
 void  
 DataAbstract::setRefValue(int ref,  
                           const DataArray& value)  
 {  
     throw DataException("Error - DataAbstract::setRefValue: Data type cannot be accessed by reference values.");  
 }  
102    
 void  
 DataAbstract::getRefValue(int ref,  
                           DataArray& value)  
 {  
     throw DataException("Error - DataAbstract::getRefValue: Data type cannot be accessed by reference values.");  
 }  
103    
104  int  void
105  DataAbstract::archiveData(ofstream& archiveFile,  DataAbstract::copyAll(const boost::python::numeric::array& value)
                           const ValueType::size_type noValues) const  
106  {  {
107    return 0;      throw DataException("Error - DataAbstract::copying data from numarray objects is not supported.");
108  }  }
109    void
110  int  DataAbstract::copyToDataPoint(const int sampleNo, const int dataPointNo, const double value)
 DataAbstract::extractData(ifstream& archiveFile,  
                           const ValueType::size_type noValues)  
111  {  {
112    return 0;      throw DataException("Error - DataAbstract::copying data from double value to a single data point is not supported.");
113  }  }
   
114  void  void
115  DataAbstract::copyAll(const boost::python::numeric::array& value)  DataAbstract::copyToDataPoint(const int sampleNo, const int dataPointNo, const boost::python::numeric::array& value)
116  {  {
117      throw DataException("Error - DataAbstract::copying data from numarray objects is not supported.");      throw DataException("Error - DataAbstract::copying data from numarray objects to a single data point is not supported.");
118  }  }
119    
120  void  void
# Line 160  void Line 150  void
150  DataAbstract::eigenvalues(DataAbstract* ev)  DataAbstract::eigenvalues(DataAbstract* ev)
151  {  {
152      throw DataException("Error - DataAbstract::eigenvalues is not supported.");      throw DataException("Error - DataAbstract::eigenvalues is not supported.");
   
153  }  }
154  void  void
155  DataAbstract::eigenvalues_and_eigenvectors(DataAbstract* ev,DataAbstract* V,const double tol)  DataAbstract::eigenvalues_and_eigenvectors(DataAbstract* ev,DataAbstract* V,const double tol)
# Line 168  DataAbstract::eigenvalues_and_eigenvecto Line 157  DataAbstract::eigenvalues_and_eigenvecto
157      throw DataException("Error - DataAbstract::eigenvalues_and_eigenvectors is not supported.");      throw DataException("Error - DataAbstract::eigenvalues_and_eigenvectors is not supported.");
158    
159  }  }
160    void
161    DataAbstract::setToZero()
162    {
163        throw DataException("Error - DataAbstract:: cannot set values to zero.");
164    }
165    
166    void
167    DataAbstract::reorderByReferenceIDs(int *reference_ids)
168    {
169        throw DataException("Error - DataAbstract:: cannot reorder by reference ids.");
170    }
171    
172    
173    DataTypes::ValueType&
174    DataAbstract::getVector()
175    {
176       throw DataException("Error - DataAbstract:: does not have a DataVector.");
177    }
178    
179    const DataTypes::ValueType&
180    DataAbstract::getVector() const
181    {
182       throw DataException("Error - DataAbstract:: does not have a DataVector.");
183    }
184    
185    
186    
187    

Legend:
Removed from v.804  
changed lines
  Added in v.1811

  ViewVC Help
Powered by ViewVC 1.1.26