escript  Revision_
DataReady.h
Go to the documentation of this file.
1 
2 /*****************************************************************************
3 *
4 * Copyright (c) 2003-2020 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-2017 by Centre for Geoscience Computing (GeoComp)
14 * Development from 2019 by School of Earth and Environmental Sciences
15 **
16 *****************************************************************************/
17 
18 
19 #if !defined escript_DataReady_20081008_H
20 #define escript_DataReady_20081008_H
21 #include "system_dep.h"
22 
23 #include "DataAbstract.h"
24 
25 namespace escript {
26 
27 // Anything which requires getVector should be moved down here
28 
29 
30 
36 class DataReady : public DataAbstract
37 {
39 public:
40  DataReady(const FunctionSpace& what, const ShapeType& shape, bool isDataEmpty=false);
42 
43 
44 
52 
56 
58  const DataTypes::real_t*
60 
62  const DataTypes::cplx_t*
64 
65 
73 
74 
76  virtual const DataTypes::RealVectorType&
77  getVectorRO() const=0;
78 
82 
83 
85  virtual const DataTypes::CplxVectorType&
86  getVectorROC() const=0;
87 
94 
96  virtual const DataTypes::RealVectorType&
98 
102 
104  virtual const DataTypes::CplxVectorType&
106 
107 
108 
109 
110 
117  virtual bool
118  hasNaN() const=0;
119 
124  virtual void
126 
131  virtual void
133 
138  virtual bool
139  hasInf() const=0;
140 
145  virtual void
147 
152  virtual void
154 
155 
164  virtual
165  void
166  setSlice(const DataAbstract* value,
167  const DataTypes::RegionType& region) = 0;
168 
169 
176 
177 
181 
185 
186 
190 
191 
192 
193 
194 
197  resolve();
198 
199 };
200 
201 
202 inline
205 {
206  return &(getVectorRW()[getPointOffset(sampleNo,0)]); // exclusive write checks will be done in getVectorRW()
207 }
208 
209 inline
212 {
213  return &(getVectorRWC()[getPointOffset(sampleNo,0)]); // exclusive write checks will be done in getVectorRW()
214 }
215 
216 
217 inline const DataTypes::real_t*
219 {
220  return &(getVectorRO()[getPointOffset(sampleNo,0)]);
221 }
222 
223 inline const DataTypes::cplx_t*
225 {
226  return &(getVectorROC()[getPointOffset(sampleNo,0)]);
227 }
228 
229 
230 
231 inline
234 {
235  return getVectorRO()[i];
236 }
237 
238 inline
240 DataReady::getDataAtOffsetRW(DataTypes::RealVectorType::size_type i) // exclusive write checks will be done in getVectorRW()
241 {
242  return getVectorRW()[i];
243 }
244 
245 
246 inline
249 {
250  return getVectorROC()[i];
251 }
252 
253 inline
255 DataReady::getDataAtOffsetRWC(DataTypes::CplxVectorType::size_type i) // exclusive write checks will be done in getVectorRW()
256 {
257  return getVectorRWC()[i];
258 }
259 
260 
261 
262 }
263 
264 #endif
escript::DataReady::getTypedVectorRW
virtual DataTypes::CplxVectorType & getTypedVectorRW(DataTypes::cplx_t dummy)=0
escript::DataReady::getDataAtOffsetRO
DataTypes::RealVectorType::const_reference getDataAtOffsetRO(DataTypes::RealVectorType::size_type i) const
get a reference to the beginning of a data point
Definition: DataReady.h:233
ESCRIPT_DLL_API
#define ESCRIPT_DLL_API
Definition: escriptcore/src/system_dep.h:30
escript::DataReady::getVectorROC
virtual const DataTypes::CplxVectorType & getVectorROC() const =0
escript::DataTypes::real_t
double real_t
type of all real-valued scalars in escript
Definition: DataTypes.h:52
escript::DataTypes::DataVectorAlt< real_t >::const_reference
const ElementType & const_reference
Definition: DataVectorAlt.h:52
escript::DataReady::getSampleDataRO
const DataTypes::real_t * getSampleDataRO(DataTypes::RealVectorType::size_type sampleNo, DataTypes::real_t dummy=0) const
Definition: DataReady.h:218
escript::DataReady::getVectorRO
virtual const DataTypes::RealVectorType & getVectorRO() const =0
escript::DataReady::getVectorRWC
virtual DataTypes::CplxVectorType & getVectorRWC()=0
escript::DataAbstract::getPtr
DataAbstract_ptr getPtr()
Return shared pointer managing this object.
Definition: DataAbstract.cpp:39
escript::DataTypes::DataVectorAlt::size_type
DataTypes::vec_size_type size_type
Definition: DataVectorAlt.h:50
escript::DataTypes::DataVectorAlt
Definition: DataVectorAlt.h:37
escript::DataReady::replaceNaN
virtual void replaceNaN(DataTypes::cplx_t value)=0
replaces all NaN values with value
escript::DataReady::getDataAtOffsetRWC
DataTypes::CplxVectorType::reference getDataAtOffsetRWC(DataTypes::CplxVectorType::size_type i)
Definition: DataReady.h:255
escript::FunctionSpace
Definition: FunctionSpace.h:36
escript::DataReady::hasInf
virtual bool hasInf() const =0
Return true if data contains Inf or -Inf.
escript::DataReady
Definition: DataReady.h:37
escript::DataReady::replaceInf
virtual void replaceInf(DataTypes::real_t value)=0
replaces all (+/-)Inf values with value
escript::DataReady::getDataAtOffsetROC
DataTypes::CplxVectorType::const_reference getDataAtOffsetROC(DataTypes::CplxVectorType::size_type i) const
Definition: DataReady.h:248
escript::DataAbstract::getPointOffset
virtual DataTypes::RealVectorType::size_type getPointOffset(int sampleNo, int dataPointNo) const =0
Return the offset for the given sample. This returns the offset for the given point into the containe...
escript::DataReady::getSampleDataRW
DataTypes::real_t * getSampleDataRW(DataTypes::RealVectorType::size_type sampleNo, DataTypes::real_t dummy=0)
Return the sample data for the given sample number.
Definition: DataReady.h:204
escript::DataReady::resolve
DataReady_ptr resolve()
Return a data object with all points resolved.
Definition: DataReady.cpp:30
escript::DataTypes::RegionType
std::vector< std::pair< int, int > > RegionType
Definition: DataTypes.h:45
DataAbstract.h
escript::DataReady::parent
DataAbstract parent
Definition: DataReady.h:38
escript::DataReady::~DataReady
~DataReady()
Definition: DataReady.h:41
escript::DataReady::setSlice
virtual void setSlice(const DataAbstract *value, const DataTypes::RegionType &region)=0
Copy the specified region from the given object.
escript
Definition: AbstractContinuousDomain.cpp:23
escript::DataReady::getVectorRW
virtual DataTypes::RealVectorType & getVectorRW()=0
Provide access to underlying storage. Internal use only!
escript::DataAbstract
Definition: DataAbstract.h:63
escript::DataReady::getTypedVectorRW
virtual DataTypes::RealVectorType & getTypedVectorRW(DataTypes::real_t dummy)=0
These versions use the type system rather than method name to determine return type.
escript::DataReady::DataReady
DataReady(const FunctionSpace &what, const ShapeType &shape, bool isDataEmpty=false)
Definition: DataReady.cpp:23
escript::DataTypes::DataVectorAlt< real_t >::reference
ElementType & reference
Definition: DataVectorAlt.h:51
DataReady.h
escript::DataReady::replaceInf
virtual void replaceInf(DataTypes::cplx_t value)=0
replaces all (+/-)Inf values with value
system_dep.h
escript::DataTypes::cplx_t
std::complex< real_t > cplx_t
complex data type
Definition: DataTypes.h:55
escript::DataReady::getDataAtOffsetRW
DataTypes::RealVectorType::reference getDataAtOffsetRW(DataTypes::RealVectorType::size_type i)
Definition: DataReady.h:240
escript::DataReady_ptr
boost::shared_ptr< DataReady > DataReady_ptr
Definition: DataAbstract.h:57
escript::DataAbstract::ShapeType
DataTypes::ShapeType ShapeType
Definition: DataAbstract.h:67
escript::DataReady::getTypedVectorRO
virtual const DataTypes::CplxVectorType & getTypedVectorRO(DataTypes::cplx_t dummy) const =0
escript::DataReady::getTypedVectorRO
virtual const DataTypes::RealVectorType & getTypedVectorRO(DataTypes::real_t dummy) const =0
escript::DataReady::hasNaN
virtual bool hasNaN() const =0
return true if data contains NaN.
escript::DataReady::replaceNaN
virtual void replaceNaN(DataTypes::real_t value)=0
replaces all NaN values with value