ESScript  Revision_4488
DataReady.h
Go to the documentation of this file.
1 
2 /*****************************************************************************
3 *
4 * Copyright (c) 2003-2013 by University of Queensland
5 * http://www.uq.edu.au
6 *
7 * Primary Business: Queensland, Australia
8 * Licensed under the Open Software License version 3.0
9 * http://www.opensource.org/licenses/osl-3.0.php
10 *
11 * Development until 2012 by Earth Systems Science Computational Center (ESSCC)
12 * Development since 2012 by School of Earth Sciences
13 *
14 *****************************************************************************/
15 
16 
17 #if !defined escript_DataReady_20081008_H
18 #define escript_DataReady_20081008_H
19 #include "system_dep.h"
20 
21 #include "DataAbstract.h"
22 
23 namespace escript {
24 
25 // Anything which requires getVector should be moved down here
26 
27 
28 
34 class DataReady : public DataAbstract
35 {
37 public:
38  DataReady(const FunctionSpace& what, const ShapeType& shape, bool isDataEmpty=false);
40 
41 
42 
48  double*
50 
52  const double*
53  getSampleDataRO(ValueType::size_type sampleNo) const;
54 
60  virtual DataTypes::ValueType&
61  getVectorRW()=0;
62 
63 
65  virtual const DataTypes::ValueType&
66  getVectorRO() const=0;
67 
74  virtual bool
75  hasNaN() const=0;
76 
85  virtual
86  void
87  setSlice(const DataAbstract* value,
88  const DataTypes::RegionType& region) = 0;
89 
90 
97 
98 
102 
105  resolve();
106 
107 };
108 
109 
110 inline
113 {
114  return &(getVectorRW()[getPointOffset(sampleNo,0)]); // exclusive write checks will be done in getVectorRW()
115 }
116 
117 inline const double*
119 {
120  return &(getVectorRO()[getPointOffset(sampleNo,0)]);
121 }
122 
123 
124 inline
127 {
128  return getVectorRO()[i];
129 }
130 
131 inline
133 DataReady::getDataAtOffsetRW(DataTypes::ValueType::size_type i) // exclusive write checks will be done in getVectorRW()
134 {
135  return getVectorRW()[i];
136 }
137 
138 
139 
140 }
141 
142 #endif