escript  Revision_
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 #ifndef __ESCRIPT_DATAEMPTY_H__
18 #define __ESCRIPT_DATAEMPTY_H__
19 
20 #include "system_dep.h"
21 #include "DataReady.h"
22 
23 namespace escript {
24 
33 class DataEmpty : public DataReady {
34 typedef DataReady parent;
35  public:
36 
46  DataEmpty();
47 
53  virtual
54  ~DataEmpty();
55 
61  virtual
62  std::string
63  toString() const;
64 
69  virtual
71  deepCopy() const;
72 
73 
83  virtual
85  getPointOffset(int sampleNo,
86  int dataPointNo) const;
87 
89  virtual
91  getPointOffset(int sampleNo,
92  int dataPointNo);
93 
100  virtual
102  getLength() const;
103 
112  virtual
113  DataAbstract*
114  getSlice(const DataTypes::RegionType& region) const;
115 
126  virtual
127  void
128  setSlice(const DataAbstract* value,
129  const DataTypes::RegionType& region);
130 
137  int
138  matrixInverse(DataAbstract* out) const;
139 
140  void
141  dump(const std::string fileName) const;
142 
144  bool
145  hasNaN() const
146  {
147  return false;
148  }
149 
151  void
153  {
154 
155  }
156 
158  void
160  {
161 
162  }
163 
164  protected:
165 
171  getVectorRW();
172 
173 
175  virtual const DataTypes::RealVectorType&
176  getVectorRO() const;
177 
180  getVectorRWC();
181 
182 
184  virtual const DataTypes::CplxVectorType&
185  getVectorROC() const;
186 
189 
190  virtual const DataTypes::RealVectorType&
191  getTypedVectorRO(DataTypes::real_t dummy) const;
192 
195 
196  virtual const DataTypes::CplxVectorType&
197  getTypedVectorRO(DataTypes::cplx_t dummy) const;
198 
199 
200  private:
201 
202 // /**
203 /* \brief
204  Throw a standard exception. This function is called if an attempt
205  is made to use functions of DataEmpty that are not valid.*/
206 // */
207 // void
208 // throwStandardException(const std::string& functionName) const;
209 
210 };
211 
212 } // end of namespace
213 
214 #endif // __ESCRIPT_DATAEMPTY_H__
215 
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:89
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:82
Definition: DataReady.h:35
DataTypes::vec_size_type size_type
Definition: DataVectorAlt.h:49
std::vector< std::pair< int, int > > RegionType
Definition: DataTypes.h:43
Definition: AbstractContinuousDomain.cpp:22
virtual const DataTypes::RealVectorType & getVectorRO() const
Definition: DataEmpty.cpp:111
virtual const DataTypes::RealVectorType & getTypedVectorRO(DataTypes::real_t dummy) const
Definition: DataEmpty.cpp:141
Implements the DataAbstract interface for an empty Data object.
Definition: DataEmpty.h:33
virtual DataTypes::RealVectorType & getVectorRW()
Provide access to underlying storage. Internal use only!
Definition: DataEmpty.cpp:104
virtual std::string toString() const
Return a textual representation of the Data object.
Definition: DataEmpty.cpp:47
void replaceNaN(DataTypes::real_t value)
replaces all NaN values with value
Definition: DataEmpty.h:152
bool hasNaN() const
return true if data contains NaN.
Definition: DataEmpty.h:145
virtual ~DataEmpty()
Destructor for DataEmpty.
Definition: DataEmpty.cpp:42
void replaceNaN(DataTypes::cplx_t value)
replaces all NaN values with value
Definition: DataEmpty.h:159
virtual DataTypes::CplxVectorType & getVectorRWC()
Definition: DataEmpty.cpp:119
int matrixInverse(DataAbstract *out) const
invert square matricies
Definition: DataEmpty.cpp:96
virtual DataTypes::RealVectorType::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:60
std::complex< real_t > cplx_t
complex data type
Definition: DataTypes.h:53
virtual DataTypes::RealVectorType::size_type getLength() const
Return the number of doubles stored for the Data object. As this is an empty Data object...
Definition: DataEmpty.cpp:76
#define ESCRIPT_DLL_API
Definition: escriptcore/src/system_dep.h:29
Definition: DataAbstract.h:61
void dump(const std::string fileName) const
dumps the object into a netCDF file
Definition: DataEmpty.cpp:165
DataReady parent
Definition: DataEmpty.h:34
virtual DataTypes::RealVectorType & getTypedVectorRW(DataTypes::real_t dummy)
These versions use the type system rather than method name to determine return type.
Definition: DataEmpty.cpp:134
virtual DataAbstract * deepCopy() const
Return a deep copy of the current object.
Definition: DataEmpty.cpp:54
virtual const DataTypes::CplxVectorType & getVectorROC() const
Definition: DataEmpty.cpp:126
double real_t
type of all real-valued scalars in escript
Definition: DataTypes.h:50
DataEmpty()
Default constructor for DataEmpty.
Definition: DataEmpty.cpp:36