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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2635 - (show annotations)
Thu Aug 27 04:54:41 2009 UTC (10 years, 6 months ago) by jfenwick
File MIME type: text/plain
File size: 6140 byte(s)
A bunch of changes related to saveDataCSV.
[Not completed or unit tested yet]

Added saveDataCSV to util.py
AbstractDomain (and MeshAdapter) have a commonFunctionSpace method to 
take a group of FunctionSpaces and return something they can all be interpolated to.

Added pointToStream() in DataTypes to help print points.

added actsConstant() to data - required because DataConstant doesn't store samples the same way other Data do.
1
2 /*******************************************************
3 *
4 * Copyright (c) 2003-2009 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_TestDomain_20090618_H
16 #define escript_TestDomain_20090618_H
17 #include "system_dep.h"
18
19 #include "AbstractDomain.h"
20 #include "FunctionSpace.h"
21
22 #include <string>
23
24 namespace escript {
25
26 /**
27 \brief
28 (Testing use only) Provides a domain to wrap a collection of values.
29
30 This domain provides more functionality than NullDomain in that it can
31 store varying numbers of samples and points per sample.
32
33 It currently supports a single function space which does not support tagging.
34 No effort has been made to make this work with MPI
35
36 \warning This class exists to support testing and should not be used
37 as a general domain without ensuring that it works the way you expect.
38
39 */
40
41 class TestDomain : public AbstractDomain {
42
43 public:
44
45 /**
46 \brief
47 Default constructor for TestDomain.
48
49 Description:
50 Default constructor for TestDomain.
51
52 */
53 ESCRIPT_DLL_API
54 TestDomain(int pointspersample, int numsamples);
55
56 ESCRIPT_DLL_API
57 ~TestDomain();
58
59 /**
60 \brief
61 Returns true if the given integer is a valid function space type
62 for this domain.
63 */
64 ESCRIPT_DLL_API
65 virtual bool isValidFunctionSpaceType(int functionSpaceType) const;
66
67 /**
68 \brief
69 Return a description for this domain.
70 */
71 ESCRIPT_DLL_API
72 virtual std::string getDescription() const;
73
74 /**
75 \brief
76 Return a description for the given function space type code.
77 */
78 ESCRIPT_DLL_API
79 virtual std::string functionSpaceTypeAsString(int functionSpaceType) const;
80
81 /**
82 \brief
83 Interpolates data given on source onto target where source and target have to be given on the same domain.
84 TestDomain only has one FunctionSpace so this makes target a shallow copy of source.
85 */
86 ESCRIPT_DLL_API
87 virtual void interpolateOnDomain(escript::Data& target,const escript::Data& source) const;
88 ESCRIPT_DLL_API
89 virtual bool probeInterpolationOnDomain(int functionSpaceType_source,int functionSpaceType_target) const;
90
91 ESCRIPT_DLL_API
92 bool
93 commonFunctionSpace(const std::vector<int>& fs, int& resultcode) const;
94
95 /**
96 \brief
97 Interpolates data given on source onto target where source and target are given on different domains.
98 We do not permit interpolation into the TestDomain so this method always throws.
99 */
100 ESCRIPT_DLL_API
101 virtual void interpolateACross(escript::Data& target, const escript::Data& source) const;
102 ESCRIPT_DLL_API
103 virtual bool probeInterpolationACross(int functionSpaceType_source,const AbstractDomain& targetDomain, int functionSpaceType_target) const;
104
105
106 /**
107 \brief
108 Return a continuous FunctionSpace.
109 */
110 ESCRIPT_DLL_API
111 virtual int getDefaultCode() const;
112
113
114 /**
115 \brief
116 Return a continuous FunctionSpace.
117 */
118 ESCRIPT_DLL_API
119 virtual int getContinuousFunctionCode() const;
120
121 /**
122 \brief
123 Return a function FunctionSpace.
124 */
125 ESCRIPT_DLL_API
126 virtual int getFunctionCode() const;
127
128 /**
129 \brief
130 Return a function on boundary FunctionSpace.
131 */
132 ESCRIPT_DLL_API
133 virtual int getFunctionOnBoundaryCode() const;
134
135 /**
136 \brief
137 Return a FunctionSpace.
138 */
139 ESCRIPT_DLL_API
140 virtual int getFunctionOnContactZeroCode() const;
141
142 /**
143 \brief
144 Return a FunctionSpace.
145 */
146 ESCRIPT_DLL_API
147 virtual int getFunctionOnContactOneCode() const;
148
149 /**
150 \brief
151 Return a FunctionSpace.
152 */
153 ESCRIPT_DLL_API
154 virtual int getSolutionCode() const;
155
156 /**
157 \brief
158 Return a FunctionSpace.
159 */
160 ESCRIPT_DLL_API
161 virtual int getReducedSolutionCode() const;
162
163 /**
164 \brief
165 Return a FunctionSpace.
166 */
167 ESCRIPT_DLL_API
168 virtual int getDiracDeltaFunctionCode() const;
169
170 /**
171 \brief
172 Return the number of data points per sample, and the number of samples as a pair.
173 \param functionSpaceCode Input - Code for the function space type.
174 \return pair, first - number of data points per sample, second - number of samples
175 */
176 ESCRIPT_DLL_API
177 virtual std::pair<int,int> getDataShape(int functionSpaceCode) const;
178
179 /**
180 \brief
181 Return the tag key for the given sample number.
182 \param functionSpaceType Input - The function space type.
183 \param sampleNo Input - The sample number.
184 */
185 ESCRIPT_DLL_API
186 virtual int getTagFromSampleNo(int functionSpaceType, int sampleNo) const;
187
188 /**
189 \brief
190 Return a borrowed pointer to the sample reference number id list
191 \param functionSpaceType Input - The function space type.
192 */
193 ESCRIPT_DLL_API
194 virtual const int* borrowSampleReferenceIDs(int functionSpaceType) const;
195
196 /**
197 \brief
198 */
199 ESCRIPT_DLL_API
200 virtual int getDim() const;
201
202 /**
203 \brief
204 Return true if given domains are equal.
205 */
206 ESCRIPT_DLL_API
207 virtual bool operator==(const AbstractDomain& other) const;
208 ESCRIPT_DLL_API
209 virtual bool operator!=(const AbstractDomain& other) const;
210
211 /**
212 \brief Checks if this domain allows tags for the specified functionSpaceCode.
213 */
214 ESCRIPT_DLL_API
215 virtual
216 bool canTag(int functionSpaceCode) const;
217
218 /**
219 \brief
220 return the number of tags in use.
221 For this class the answer is always 1(the default tag).
222 */
223 ESCRIPT_DLL_API
224 virtual int getNumberOfTagsInUse(int functionSpaceCode) const;
225
226 /**
227 \brief returns a pointer to an array with the tags used.
228 For this class the answer will always be {0}
229 */
230 ESCRIPT_DLL_API
231 virtual const int* borrowListOfTagsInUse(int functionSpaceCode) const;
232
233 protected:
234
235 private:
236 int m_samples; // number of samples
237 int m_dpps; // data points per sample
238 int* m_samplerefids; // sample reference ids
239 };
240
241 ESCRIPT_DLL_API
242 FunctionSpace
243 getTestDomainFunctionSpace(int dpps, int samples);
244
245 } // end of namespace
246
247 #endif

  ViewVC Help
Powered by ViewVC 1.1.26