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

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

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

revision 1795 by trankine, Fri Jan 11 07:45:58 2008 UTC revision 1796 by jfenwick, Wed Sep 17 01:45:46 2008 UTC
# Line 16  Line 16 
16  #include "DataEmpty.h"  #include "DataEmpty.h"
17  #include "DataException.h"  #include "DataException.h"
18    
19    
20    namespace {
21    
22    
23    // This function is inlined to prevent the compiler complaining about missing return statements
24    // in methods where it is called.
25    // inline
26    void
27    throwStandardException(const std::string& functionName)
28    {
29      throw escript::DataException("Error - "+functionName+" function call invalid for DataEmpty.");
30    }
31    
32    
33    escript::DataTypes::ValueType dummy;    
34    
35    }
36    
37  namespace escript {  namespace escript {
38    
39  DataEmpty::DataEmpty() :  DataEmpty::DataEmpty() :
40    DataAbstract(FunctionSpace())    DataAbstract(FunctionSpace(),DataTypes::scalarShape)
41  {  {
42    resetPointDataView();  //  resetPointDataView();
43  }  }
44    
45  DataEmpty::~DataEmpty()  DataEmpty::~DataEmpty()
# Line 34  DataEmpty::toString() const Line 52  DataEmpty::toString() const
52    return "(Empty Data)";    return "(Empty Data)";
53  }  }
54    
55  DataArrayView::ValueType::size_type  DataTypes::ValueType::size_type
56  DataEmpty::getPointOffset(int sampleNo,  DataEmpty::getPointOffset(int sampleNo,
57                            int dataPointNo) const                            int dataPointNo) const
58  {  {
# Line 42  DataEmpty::getPointOffset(int sampleNo, Line 60  DataEmpty::getPointOffset(int sampleNo,
60    return 0;    return 0;
61  }  }
62    
63  DataArrayView  // DataArrayView
64  DataEmpty::getDataPoint(int sampleNo,  // DataEmpty::getDataPoint(int sampleNo,
65                          int dataPointNo)  //                         int dataPointNo)
66  {  // {
67    throwStandardException("getDataPoint");  //   throwStandardException("getDataPoint");
68    return getPointDataView();  //   return getPointDataView();
69  }  // }
70    
71  DataArrayView::ValueType::size_type  DataTypes::ValueType::size_type
72  DataEmpty::getLength() const  DataEmpty::getLength() const
73  {  {
74    return 0;    return 0;
75  }  }
76    
77  DataAbstract*  DataAbstract*
78  DataEmpty::getSlice(const DataArrayView::RegionType& region) const  DataEmpty::getSlice(const DataTypes::RegionType& region) const
79  {  {
80    throwStandardException("getSlice");    throwStandardException("getSlice");
81    return 0;    return 0;
# Line 65  DataEmpty::getSlice(const DataArrayView: Line 83  DataEmpty::getSlice(const DataArrayView:
83    
84  void  void
85  DataEmpty::setSlice(const DataAbstract* value,  DataEmpty::setSlice(const DataAbstract* value,
86                      const DataArrayView::RegionType& region)                      const DataTypes::RegionType& region)
87  {  {
88    throwStandardException("setSlice");    throwStandardException("setSlice");
89  }  }
90    
91  void  
92  DataEmpty::throwStandardException(const std::string& functionName) const  
93    DataTypes::ValueType&
94    DataEmpty::getVector()
95  {  {
96    throw DataException("Error - "+functionName+" function call invalid for DataEmpty.");    throwStandardException("getVector");  // always throws but the compiler doesn't know that.
97      return dummy;         // dead code to stop the compiler complaining
98  }  }
99    
100    const DataTypes::ValueType&
101    DataEmpty::getVector() const
102    {
103      throwStandardException("getVector");  // always throws but the compiler doesn't know that.
104      return dummy;         // dead code to stop the compiler complaining
105    }
106    
107    
108    
109  }  // end of namespace  }  // end of namespace

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

  ViewVC Help
Powered by ViewVC 1.1.26