escript  Revision_Unversioneddirectory
DataEmpty.h
Go to the documentation of this file.
1 
2 /*****************************************************************************
3 *
4 * Copyright (c) 2003-2016 by The University of Queensland
5 * http://www.uq.edu.au
6 *
7 * Primary Business: Queensland, Australia
8 * Licensed under the Apache License, version 2.0
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Development until 2012 by Earth Systems Science Computational Center (ESSCC)
12 * Development 2012-2013 by School of Earth Sciences
13 * Development from 2014 by Centre for Geoscience Computing (GeoComp)
14 *
15 *****************************************************************************/
16 
17 
18 #if !defined escript_DataEmpty_20040726_H
19 #define escript_DataEmpty_20040726_H
20 #include "system_dep.h"
21 
22 #include "DataReady.h"
23 
24 namespace escript {
25 
34 class DataEmpty : public DataReady {
35 typedef DataReady parent;
36  public:
37 
47  DataEmpty();
48 
54  virtual
55  ~DataEmpty();
56 
62  virtual
63  std::string
64  toString() const;
65 
70  virtual
72  deepCopy();
73 
74 
84  virtual
86  getPointOffset(int sampleNo,
87  int dataPointNo) const;
88 
90  virtual
92  getPointOffset(int sampleNo,
93  int dataPointNo);
94 
101  virtual
103  getLength() const;
104 
113  virtual
114  DataAbstract*
115  getSlice(const DataTypes::RegionType& region) const;
116 
127  virtual
128  void
129  setSlice(const DataAbstract* value,
130  const DataTypes::RegionType& region);
131 
138  int
139  matrixInverse(DataAbstract* out) const;
140 
141  void
142  dump(const std::string fileName) const;
143 
145  bool
146  hasNaN() const
147  {
148  return false;
149  }
150 
152  void
153  replaceNaN(double value)
154  {
155 
156  }
157 
158  protected:
159 
164  virtual DataTypes::ValueType&
165  getVectorRW();
166 
167 
169  virtual const DataTypes::ValueType&
170  getVectorRO() const;
171 
172 
173  private:
174 
175 // /**
176 /* \brief
177  Throw a standard exception. This function is called if an attempt
178  is made to use functions of DataEmpty that are not valid.*/
179 // */
180 // void
181 // throwStandardException(const std::string& functionName) const;
182 
183 };
184 
185 } // end of namespace
186 
187 #endif
DataVector implements an arbitrarily long vector of data values. DataVector is the underlying data co...
Definition: DataVector.h:44
virtual void setSlice(const DataAbstract *value, const DataTypes::RegionType &region)
Set the current Data object according to the specified slice from the given input value...
Definition: DataEmpty.cpp:94
virtual DataAbstract * getSlice(const DataTypes::RegionType &region) const
Factory method that returns a newly created DataEmpty sliced from the current Data object according t...
Definition: DataEmpty.cpp:87
Definition: DataReady.h:35
std::vector< std::pair< int, int > > RegionType
Definition: DataTypes.h:39
Definition: AbstractContinuousDomain.cpp:24
void replaceNaN(double value)
replaces all NaN values with value
Definition: DataEmpty.h:153
virtual std::string toString() const
Return a textual representation of the Data object.
Definition: DataEmpty.cpp:52
Implements the DataAbstract interface for an empty Data object.
Definition: DataEmpty.h:34
virtual DataAbstract * deepCopy()
Return a deep copy of the current object.
Definition: DataEmpty.cpp:59
virtual const DataTypes::ValueType & getVectorRO() const
Definition: DataEmpty.cpp:116
int matrixInverse(DataAbstract *out) const
invert square matricies
Definition: DataEmpty.cpp:101
virtual ~DataEmpty()
Destructor for DataEmpty.
Definition: DataEmpty.cpp:47
virtual ValueType::size_type getLength() const
Return the number of doubles stored for the Data object. As this is an empty Data object...
Definition: DataEmpty.cpp:81
bool hasNaN() const
return true if data contains NaN.
Definition: DataEmpty.h:146
virtual DataTypes::ValueType & getVectorRW()
Provide access to underlying storage. Internal use only!
Definition: DataEmpty.cpp:109
#define ESCRIPT_DLL_API
Definition: escriptcore/src/system_dep.h:54
virtual DataTypes::ValueType::size_type getPointOffset(int sampleNo, int dataPointNo) const
Return the offset for the given sample. NB: This will throw an exception as obviously an empty Data o...
Definition: DataEmpty.cpp:65
Definition: DataAbstract.h:61
DataReady parent
Definition: DataEmpty.h:35
long size_type
Definition: DataVector.h:60
void dump(const std::string fileName) const
dumps the object into a netCDF file
Definition: DataEmpty.cpp:124
DataEmpty()
Default constructor for DataEmpty.
Definition: DataEmpty.cpp:41