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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1872 - (show annotations)
Mon Oct 13 00:18:55 2008 UTC (11 years, 7 months ago) by jfenwick
File MIME type: text/plain
File size: 6387 byte(s)
Closing the moreshared branch

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_FunctionSpace_20040323_H
16 #define escript_FunctionSpace_20040323_H
17 #include "system_dep.h"
18
19 #include "AbstractDomain.h"
20 #include "NullDomain.h"
21
22 #include <string>
23 #include <list>
24
25 namespace escript {
26
27 //
28 // Forward declaration for class Data.
29 class Data;
30
31 /**
32 \brief
33 Give a short description of what FunctionSpace does.
34
35 Description:
36 Give a detailed description of FunctionSpace.
37
38 Template Parameters:
39 For templates describe any conditions that the parameters used in the
40 template must satisfy.
41 */
42
43 class FunctionSpace
44 {
45 public:
46 /**
47 \brief
48 Default constructor for FunctionSpace.
49
50 Description:
51 Default constructor for FunctionSpace
52 Generates a function space with a null domain.
53
54 Preconditions:
55 Describe any preconditions.
56
57 Throws:
58 Describe any exceptions thrown.
59 */
60 ESCRIPT_DLL_API
61 FunctionSpace();
62
63 /**
64 \brief
65 Constructor for FunctionSpace.
66
67 Description:
68 Constructor for FunctionSpace.
69 */
70 ESCRIPT_DLL_API
71 FunctionSpace(const_Domain_ptr domain,
72 int functionSpaceType);
73
74
75 ESCRIPT_DLL_API
76 FunctionSpace(const FunctionSpace& other);
77
78 /**
79 \brief
80 Return the function space type code.
81
82 Note: The meaning of the code depends on the domain object the FunctionSpace is built on.
83 */
84 ESCRIPT_DLL_API
85 int
86 getTypeCode() const;
87
88 /**
89 \brief
90 Return the function space domain.
91 */
92 ESCRIPT_DLL_API
93 // const
94 // AbstractDomain&
95 const_Domain_ptr
96 getDomain() const;
97
98 /**
99 \brief
100 Return the function space domain.
101 TODO: Internal use only! This is temporary and should be removed.
102 */
103 ESCRIPT_DLL_API
104 // const
105 // AbstractDomain&
106 Domain_ptr
107 getDomainPython() const;
108
109
110
111 /**
112 \brief Checks if this functionspace support tags
113 */
114 ESCRIPT_DLL_API
115 bool
116 canTag() const;
117
118
119 /**
120 \brief assigns new tag newTag to all samples with a positive
121 value of mask for any its sample point.
122
123 */
124 ESCRIPT_DLL_API
125 void setTags(const int newTag, const escript::Data& mask) const;
126
127
128 /**
129 \brief
130 Return the shape of the data needed to represent the function space.
131 */
132 ESCRIPT_DLL_API
133 std::pair<int,int>
134 getDataShape() const;
135
136 /**
137 \brief
138 Comparison operator.
139 Return true if function spaces are equal.
140 ie: Same domain and same function space type.
141 */
142 ESCRIPT_DLL_API
143 bool
144 operator==(const FunctionSpace& other) const;
145
146 ESCRIPT_DLL_API
147 bool
148 operator!=(const FunctionSpace& other) const;
149
150 /**
151 \brief
152 Return a text description of the function space.
153 */
154 ESCRIPT_DLL_API
155 std::string
156 toString() const;
157
158 //#define DEBUG_PY_STRINGS
159
160 #ifdef DEBUG_PY_STRINGS
161 /**
162 \brief
163 Return a text description of the function space
164 as a python string.
165 NOTE: This code was used to debug a conversion of
166 std::string to python string problem on windows.
167 An alternative approach was sought.
168 */
169 ESCRIPT_DLL_API
170 PyObject *
171 toPyString() const;
172 #endif
173
174 /**
175 \brief
176 Return the tag associated with the given sample number.
177 */
178 ESCRIPT_DLL_API
179 int
180 getTagFromSampleNo(int sampleNo) const;
181
182 /**
183 \brief
184 Return the tag associated with the given data-point number.
185 */
186 ESCRIPT_DLL_API
187 int
188 getTagFromDataPointNo(int dataPointNo) const;
189
190 /**
191 \brief
192 Return the reference number associated with the given data-point number.
193 */
194 ESCRIPT_DLL_API
195 int getReferenceIDFromDataPointNo(int dataPointNo) const;
196
197 /**
198 \brief
199 Return the reference number associated with the given sample number.
200 This function is not efficient. It is better to first call
201 borrowSampleReferenceIDs and then when iterating over sampleNo to use sampleNo as an offset.
202 */
203 ESCRIPT_DLL_API
204 inline
205 int
206 getReferenceIDOfSample(int sampleNo) const
207 {
208 return borrowSampleReferenceIDs()[sampleNo];
209 }
210 /**
211 \brief
212 Return a borrowed reference to the list of sample reference IDs
213 */
214 ESCRIPT_DLL_API
215 int*
216 borrowSampleReferenceIDs() const;
217
218 /**
219 \brief
220 Return the spatial locations of the data points.
221 */
222 ESCRIPT_DLL_API
223 escript::Data
224 getX() const;
225
226 /**
227 \brief
228 Return the surface normal field.
229 */
230 ESCRIPT_DLL_API
231 escript::Data
232 getNormal() const;
233
234 /**
235 \brief
236 Return the sample size (e.g. the diameter of elements, radius of particles).
237 */
238 ESCRIPT_DLL_API
239 escript::Data
240 getSize() const;
241
242 /**
243 \brief
244 Return the number of samples.
245 */
246 ESCRIPT_DLL_API
247 inline
248 int
249 getNumSamples() const {
250 return getDataShape().second;
251 }
252
253 /**
254 \brief
255 Return the number of data points per sample.
256 */
257 ESCRIPT_DLL_API
258 inline
259 int
260 getNumDPPSample() const {
261 return getNumDataPointsPerSample();
262 }
263
264 ESCRIPT_DLL_API
265 inline
266 int
267 getNumDataPointsPerSample() const {
268 return getDataShape().first;
269 }
270
271 /**
272 \brief
273 Return the spatial dimension of the underlying domain.
274 */
275 ESCRIPT_DLL_API
276 inline
277 int
278 getDim() const {
279 return getDomain()->getDim();
280 }
281 /**
282 \brief
283 Returns a list of the tags used in this function space
284 */
285 ESCRIPT_DLL_API
286 boost::python::list
287 getListOfTags() const;
288 /**
289 \brief
290 Returns an stl::list of the tags used in this function space
291 */
292 ESCRIPT_DLL_API
293 std::list<int>
294 getListOfTagsSTL() const;
295
296 /**
297 \brief
298 return the number of tags in use and a pointer to an array with the number of tags in use
299 */
300 ESCRIPT_DLL_API
301 virtual int getNumberOfTagsInUse() const;
302
303 ESCRIPT_DLL_API
304 virtual int* borrowListOfTagsInUse() const;
305
306
307
308 protected:
309
310 private:
311 /**
312 \brief
313 Assignment operator.
314 This method is only defined (private) to prevent people from using it.
315 */
316 ESCRIPT_DLL_API
317 FunctionSpace&
318 operator=(const FunctionSpace& other);
319
320 //
321 // function space domain
322
323 // const AbstractDomain* m_domain;
324 const_Domain_ptr m_domain;
325
326
327 //
328 // function space type code.
329 int m_functionSpaceType;
330
331 };
332
333 } // end of namespace
334
335 #endif

Properties

Name Value
svn:eol-style native
svn:keywords Author Date Id Revision

  ViewVC Help
Powered by ViewVC 1.1.26