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

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

Parent Directory Parent Directory | Revision Log Revision Log


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

1 jgs 115
2 ksteube 1312 /*******************************************************
3 ksteube 1811 *
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 ksteube 1312
14 ksteube 1811
15 jgs 115 #if !defined escript_FunctionSpace_20040323_H
16 jgs 82 #define escript_FunctionSpace_20040323_H
17 woo409 757 #include "system_dep.h"
18 jgs 82
19 jgs 474 #include "AbstractDomain.h"
20     #include "NullDomain.h"
21 jgs 82
22     #include <string>
23 jfenwick 1802 #include <list>
24 jgs 82
25     namespace escript {
26    
27 jgs 117 //
28     // Forward declaration for class Data.
29     class Data;
30 jgs 82
31     /**
32     \brief
33     Give a short description of what FunctionSpace does.
34    
35     Description:
36 jgs 117 Give a detailed description of FunctionSpace.
37 jgs 82
38     Template Parameters:
39     For templates describe any conditions that the parameters used in the
40 jgs 117 template must satisfy.
41 jgs 82 */
42    
43 jfenwick 1872 class FunctionSpace
44     {
45     public:
46 jgs 82 /**
47     \brief
48 jgs 117 Default constructor for FunctionSpace.
49 jgs 82
50     Description:
51     Default constructor for FunctionSpace
52     Generates a function space with a null domain.
53    
54     Preconditions:
55 jgs 117 Describe any preconditions.
56 jgs 82
57     Throws:
58 jgs 117 Describe any exceptions thrown.
59 jgs 82 */
60 trankine 1426 ESCRIPT_DLL_API
61 jgs 82 FunctionSpace();
62    
63     /**
64     \brief
65 jgs 117 Constructor for FunctionSpace.
66 jgs 82
67     Description:
68     Constructor for FunctionSpace.
69     */
70 trankine 1426 ESCRIPT_DLL_API
71 jfenwick 1872 FunctionSpace(const_Domain_ptr domain,
72 jgs 117 int functionSpaceType);
73 jgs 82
74 jfenwick 1872
75     ESCRIPT_DLL_API
76     FunctionSpace(const FunctionSpace& other);
77    
78 jgs 82 /**
79     \brief
80     Return the function space type code.
81 jfenwick 1802
82     Note: The meaning of the code depends on the domain object the FunctionSpace is built on.
83 jgs 82 */
84 trankine 1426 ESCRIPT_DLL_API
85 jgs 117 int
86     getTypeCode() const;
87 jgs 82
88     /**
89     \brief
90     Return the function space domain.
91     */
92 trankine 1426 ESCRIPT_DLL_API
93 jfenwick 1872 // const
94     // AbstractDomain&
95     const_Domain_ptr
96 jgs 117 getDomain() const;
97 jgs 82
98 jfenwick 1872 /**
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 jfenwick 1802 /**
112     \brief Checks if this functionspace support tags
113     */
114     ESCRIPT_DLL_API
115     bool
116     canTag() const;
117 jgs 82
118 gross 767
119 jgs 82 /**
120 gross 767 \brief assigns new tag newTag to all samples with a positive
121     value of mask for any its sample point.
122    
123     */
124 trankine 1426 ESCRIPT_DLL_API
125 gross 767 void setTags(const int newTag, const escript::Data& mask) const;
126    
127    
128     /**
129 jgs 82 \brief
130     Return the shape of the data needed to represent the function space.
131     */
132 trankine 1426 ESCRIPT_DLL_API
133 jgs 117 std::pair<int,int>
134     getDataShape() const;
135 jgs 82
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 trankine 1426 ESCRIPT_DLL_API
143 jgs 117 bool
144     operator==(const FunctionSpace& other) const;
145 jgs 82
146 trankine 1426 ESCRIPT_DLL_API
147 jgs 117 bool
148     operator!=(const FunctionSpace& other) const;
149    
150 jgs 82 /**
151     \brief
152 jgs 115 Return a text description of the function space.
153 jgs 82 */
154 trankine 1426 ESCRIPT_DLL_API
155 phornby 1628 std::string
156 jgs 117 toString() const;
157 ksteube 1312
158 trankine 1426 //#define DEBUG_PY_STRINGS
159    
160     #ifdef DEBUG_PY_STRINGS
161 jgs 82 /**
162     \brief
163 trankine 1426 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 jgs 82 Return the tag associated with the given sample number.
177     */
178 trankine 1426 ESCRIPT_DLL_API
179 jgs 117 int
180     getTagFromSampleNo(int sampleNo) const;
181 jgs 115
182 jgs 110 /**
183     \brief
184 jgs 149 Return the tag associated with the given data-point number.
185 jgs 110 */
186 trankine 1426 ESCRIPT_DLL_API
187 jgs 117 int
188 jgs 149 getTagFromDataPointNo(int dataPointNo) const;
189    
190     /**
191     \brief
192 gross 1718 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 jgs 149 Return the reference number associated with the given sample number.
200 gross 964 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 jgs 149 */
203 trankine 1426 ESCRIPT_DLL_API
204 gross 964 inline
205 jgs 149 int
206 gross 964 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 trankine 1426 ESCRIPT_DLL_API
215 gross 964 int*
216     borrowSampleReferenceIDs() const;
217 jgs 82
218     /**
219     \brief
220 jgs 149 Return the spatial locations of the data points.
221 jgs 82 */
222 trankine 1426 ESCRIPT_DLL_API
223 jgs 117 escript::Data
224     getX() const;
225 jgs 149
226 jgs 82 /**
227     \brief
228     Return the surface normal field.
229     */
230 trankine 1426 ESCRIPT_DLL_API
231 jgs 117 escript::Data
232     getNormal() const;
233 jgs 82
234     /**
235     \brief
236     Return the sample size (e.g. the diameter of elements, radius of particles).
237     */
238 trankine 1426 ESCRIPT_DLL_API
239 jgs 117 escript::Data
240     getSize() const;
241 jgs 82
242     /**
243     \brief
244 jgs 115 Return the number of samples.
245 jgs 82 */
246 trankine 1426 ESCRIPT_DLL_API
247 jgs 117 inline
248     int
249     getNumSamples() const {
250 jgs 82 return getDataShape().second;
251     }
252    
253     /**
254     \brief
255     Return the number of data points per sample.
256     */
257 trankine 1426 ESCRIPT_DLL_API
258 jgs 117 inline
259     int
260     getNumDPPSample() const {
261 jgs 82 return getNumDataPointsPerSample();
262     }
263 jgs 149
264 trankine 1426 ESCRIPT_DLL_API
265 jgs 117 inline
266     int
267     getNumDataPointsPerSample() const {
268 jgs 82 return getDataShape().first;
269     }
270    
271     /**
272     \brief
273     Return the spatial dimension of the underlying domain.
274     */
275 trankine 1426 ESCRIPT_DLL_API
276 jgs 117 inline
277     int
278     getDim() const {
279 jfenwick 1872 return getDomain()->getDim();
280 jgs 82 }
281 gross 1716 /**
282     \brief
283 jfenwick 1802 Returns a list of the tags used in this function space
284 gross 1716 */
285     ESCRIPT_DLL_API
286     boost::python::list
287     getListOfTags() const;
288 jfenwick 1802 /**
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 jgs 115
296 gross 1716 /**
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 jgs 82 protected:
309    
310     private:
311 trankine 1426 /**
312     \brief
313     Assignment operator.
314 jfenwick 1872 This method is only defined (private) to prevent people from using it.
315 trankine 1426 */
316     ESCRIPT_DLL_API
317     FunctionSpace&
318     operator=(const FunctionSpace& other);
319 jgs 82
320     //
321     // function space domain
322 jfenwick 1872
323     // const AbstractDomain* m_domain;
324     const_Domain_ptr m_domain;
325 jgs 149
326 jfenwick 1872
327 jgs 82 //
328     // function space type code.
329     int m_functionSpaceType;
330    
331     };
332    
333     } // end of namespace
334 jgs 117
335 jgs 82 #endif

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.26