/[escript]/trunk/escript/src/DataReady.h
ViewVC logotype

Contents of /trunk/escript/src/DataReady.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2005 - (show annotations)
Mon Nov 10 01:21:39 2008 UTC (10 years, 10 months ago) by jfenwick
File MIME type: text/plain
File size: 2398 byte(s)
Bringing all changes across from schroedinger.
(Note this does not mean development is done, just that it will happen
on the trunk for now).
If anyone notices any problems please contact me.


1
2 /*******************************************************
3 *
4 * Copyright (c) 2003-2008 by University of Queensland
5 * Earth Systems Science Computational Center (ESSCC)
6 * http://www.uq.edu.au/esscc
7 *
8 * Primary Business: Queensland, Australia
9 * Licensed under the Open Software License version 3.0
10 * http://www.opensource.org/licenses/osl-3.0.php
11 *
12 *******************************************************/
13
14
15 #if !defined escript_DataReady_20081008_H
16 #define escript_DataReady_20081008_H
17 #include "system_dep.h"
18
19 #include "DataAbstract.h"
20
21 namespace escript {
22
23 // Anything which requires getVector should be moved down here
24
25
26
27 /**
28 \class DataReady ...Purpose...
29 */
30 class DataReady : public DataAbstract
31 {
32 typedef DataAbstract parent;
33 public:
34 DataReady(const FunctionSpace& what, const ShapeType& shape, bool isDataEmpty=false);
35 ~DataReady(){};
36
37
38
39 /**
40 \brief
41 Return the sample data for the given sample number.
42 */
43 ESCRIPT_DLL_API
44 double*
45 getSampleData(ValueType::size_type sampleNo);
46
47
48 /**
49 \brief Provide access to underlying storage. Internal use only!
50 */
51 ESCRIPT_DLL_API
52 virtual DataTypes::ValueType&
53 getVector()=0;
54
55 ESCRIPT_DLL_API
56 virtual const DataTypes::ValueType&
57 getVector() const=0;
58
59 /**
60 \brief
61 Copy the specified region from the given object.
62
63 \param value - Input - Data to copy from
64 \param region - Input - Region to copy.
65 */
66 ESCRIPT_DLL_API
67 virtual
68 void
69 setSlice(const DataAbstract* value,
70 const DataTypes::RegionType& region) = 0;
71
72
73 /**
74 \brief get a reference to the beginning of a data point
75 */
76 ESCRIPT_DLL_API
77 DataTypes::ValueType::const_reference
78 getDataAtOffset(DataTypes::ValueType::size_type i) const;
79
80
81 ESCRIPT_DLL_API
82 DataTypes::ValueType::reference
83 getDataAtOffset(DataTypes::ValueType::size_type i);
84
85 ESCRIPT_DLL_API
86 DataReady_ptr
87 resolve();
88
89 };
90
91
92 inline
93 DataAbstract::ValueType::value_type*
94 DataReady::getSampleData(ValueType::size_type sampleNo)
95 {
96 // return &(m_pointDataView->getData(getPointOffset(sampleNo,0)));
97 return &(getVector()[getPointOffset(sampleNo,0)]);
98 }
99
100
101 inline
102 DataTypes::ValueType::const_reference
103 DataReady::getDataAtOffset(DataTypes::ValueType::size_type i) const
104 {
105 return getVector()[i];
106 }
107
108 inline
109 DataTypes::ValueType::reference
110 DataReady::getDataAtOffset(DataTypes::ValueType::size_type i)
111 {
112 return getVector()[i];
113 }
114
115
116
117 }
118
119 #endif

  ViewVC Help
Powered by ViewVC 1.1.26