/[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 1796 by jfenwick, Wed Sep 17 01:45:46 2008 UTC
# Line 20  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):
24    //     m_noDataPointsPerSample(what.getNumDPPSample()),
25    //     m_noSamples(what.getNumSamples()),
26    //     m_functionSpace(what),
27    //     m_rank(0)
28    // {
29    //  setShape(DataTypes::ShapeType());
30    // }
31    
32    
33    DataAbstract::DataAbstract(const FunctionSpace& what, const ShapeType& shape):
34      m_noDataPointsPerSample(what.getNumDPPSample()),      m_noDataPointsPerSample(what.getNumDPPSample()),
35      m_noSamples(what.getNumSamples()),      m_noSamples(what.getNumSamples()),
36      m_functionSpace(what)      m_functionSpace(what),
37        m_shape(shape),
38        m_rank(DataTypes::getRank(shape)),
39        m_novalues(DataTypes::noValues(shape))
40    
41  {  {
42  }  }
43    
# Line 31  DataAbstract::~DataAbstract() Line 45  DataAbstract::~DataAbstract()
45  {  {
46  }  }
47    
48  void  // void
49  DataAbstract::setPointDataView(const DataArrayView& input)  // DataAbstract::setPointDataView(const DataArrayView& input)
50  {  // {
51      m_pointDataView.reset(new DataArrayView(input.getData(),input.getShape(),input.getOffset()));  //     m_pointDataView.reset(new DataArrayView(input.getData(),input.getShape(),input.getOffset()));
52  }  //
53    //     // until we get rid of m_pointDataView, we need to keep m_shape in sync
54  void  //     setShape(input.getShape());
55  DataAbstract::resetPointDataView()  // }
56  {  
57      m_pointDataView.reset(new DataArrayView());  // perhaps this should be a constructor parameter
58  }  // void
59    // DataAbstract::setShape(const DataTypes::ShapeType& s)
60    // {
61    //    m_shape=s;
62    //    m_rank=DataTypes::getRank(s);
63    //    m_novalues=DataTypes::noValues(s);
64    // }
65    
66    
67    // void
68    // DataAbstract::resetPointDataView()
69    // {
70    //     m_pointDataView.reset(new DataArrayView());
71    //     m_shape.clear();
72    //     m_rank=0;
73    //     m_novalues=1;
74    // }
75    
76  void  void
77  DataAbstract::operandCheck(const DataAbstract& right) const  DataAbstract::operandCheck(const DataAbstract& right) const
# Line 63  DataAbstract::operandCheck(const DataAbs Line 93  DataAbstract::operandCheck(const DataAbs
93    
94      //      //
95      // 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
96      if (!((right.getPointDataView().getRank()==0) ||      if (!((right.getRank()==0) ||
97        (right.getPointDataView().getShape()==getPointDataView().getShape())))        (right.getShape()==getShape())))
98        {        {
99          stringstream temp;          stringstream temp;
100      temp << "Error - Right hand argument point data shape: "      temp << "Error - Right hand argument point data shape: "
101           << DataArrayView::shapeToString(right.getPointDataView().getShape())           << DataTypes::shapeToString(right.getShape())
102           << " doesn't match left: "           << " doesn't match left: "
103           << DataArrayView::shapeToString(getPointDataView().getShape());           << DataTypes::shapeToString(getShape());
104      throw DataException(temp.str());      throw DataException(temp.str());
105        }        }
106  }  }
# Line 89  DataAbstract::getSampleDataByTag(int tag Line 119  DataAbstract::getSampleDataByTag(int tag
119      throw DataException("Error - DataAbstract::getSampleDataByTag: Data type does not have tag values.");      throw DataException("Error - DataAbstract::getSampleDataByTag: Data type does not have tag values.");
120  }  }
121    
122  void  // void
123    // DataAbstract::setTaggedValue(int tagKey,
124    //                              const DataArrayView& value)
125    // {
126    //     throw DataException("Error - DataAbstract::setTaggedValue: Data type does not have tag values.");
127    // }
128    
129    void  
130  DataAbstract::setTaggedValue(int tagKey,  DataAbstract::setTaggedValue(int tagKey,
131                               const DataArrayView& value)             const DataTypes::ShapeType& pointshape,
132                   const DataTypes::ValueType& value,
133               int dataOffset)
134  {  {
135      throw DataException("Error - DataAbstract::setTaggedValue: Data type does not have tag values.");      throw DataException("Error - DataAbstract::setTaggedValue: Data type does not have tag values.");
136  }  }
137    
138    
139  int  int
140  DataAbstract::getTagNumber(int dpno)  DataAbstract::getTagNumber(int dpno)
141  {  {
# Line 103  DataAbstract::getTagNumber(int dpno) Line 143  DataAbstract::getTagNumber(int dpno)
143      return (0);      return (0);
144  }  }
145    
 int  
 DataAbstract::archiveData(ofstream& archiveFile,  
                           const ValueType::size_type noValues) const  
 {  
   return 0;  
 }  
146    
 int  
 DataAbstract::extractData(ifstream& archiveFile,  
                           const ValueType::size_type noValues)  
 {  
   return 0;  
 }  
147    
148  void  void
149  DataAbstract::copyAll(const boost::python::numeric::array& value)  DataAbstract::copyAll(const boost::python::numeric::array& value)
# Line 185  DataAbstract::reorderByReferenceIDs(int Line 213  DataAbstract::reorderByReferenceIDs(int
213  }  }
214    
215    
216    DataTypes::ValueType&
217    DataAbstract::getVector()
218    {
219       throw DataException("Error - DataAbstract:: does not have a DataVector.");
220    }
221    
222    const DataTypes::ValueType&
223    DataAbstract::getVector() const
224    {
225       throw DataException("Error - DataAbstract:: does not have a DataVector.");
226    }
227    
228    
229    
230    
231  }  // end of namespace  }  // end of namespace

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

  ViewVC Help
Powered by ViewVC 1.1.26