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

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

  ViewVC Help
Powered by ViewVC 1.1.26