/[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 1487 by gross, Thu Apr 10 05:28:01 2008 UTC revision 1811 by ksteube, Thu Sep 25 23:11:13 2008 UTC
# Line 1  Line 1 
1    
 /* $Id$ */  
   
2  /*******************************************************  /*******************************************************
3   *  *
4   *           Copyright 2003-2007 by ACceSS MNRF  * Copyright (c) 2003-2008 by University of Queensland
5   *       Copyright 2007 by University of Queensland  * Earth Systems Science Computational Center (ESSCC)
6   *  * http://www.uq.edu.au/esscc
7   *                http://esscc.uq.edu.au  *
8   *        Primary Business: Queensland, Australia  * Primary Business: Queensland, Australia
9   *  Licensed under the Open Software License version 3.0  * Licensed under the Open Software License version 3.0
10   *     http://www.opensource.org/licenses/osl-3.0.php  * 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 20  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 63  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  }  }
# Line 78  DataAbstract::operandCheck(const DataAbs Line 70  DataAbstract::operandCheck(const DataAbs
70  void  void
71  DataAbstract::dump(const std::string fileName) const  DataAbstract::dump(const std::string fileName) const
72  {  {
73      throw DataException("Error - DataAbstract:: dump: not implemented.");      throw DataException("Error - DataAbstract::dump: not implemented.");
74  }  }
75    
76    
# Line 89  DataAbstract::getSampleDataByTag(int tag Line 81  DataAbstract::getSampleDataByTag(int tag
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 103  DataAbstract::getTagNumber(int dpno) Line 99  DataAbstract::getTagNumber(int dpno)
99      return (0);      return (0);
100  }  }
101    
 int  
 DataAbstract::archiveData(ofstream& archiveFile,  
                           const ValueType::size_type noValues) const  
 {  
   return 0;  
 }  
102    
 int  
 DataAbstract::extractData(ifstream& archiveFile,  
                           const ValueType::size_type noValues)  
 {  
   return 0;  
 }  
103    
104  void  void
105  DataAbstract::copyAll(const boost::python::numeric::array& value)  DataAbstract::copyAll(const boost::python::numeric::array& value)
# Line 182  DataAbstract::setToZero() Line 166  DataAbstract::setToZero()
166  void  void
167  DataAbstract::reorderByReferenceIDs(int *reference_ids)  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    

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

  ViewVC Help
Powered by ViewVC 1.1.26