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

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

Parent Directory Parent Directory | Revision Log Revision Log


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

  ViewVC Help
Powered by ViewVC 1.1.26