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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 964 - (show annotations)
Tue Feb 13 05:10:26 2007 UTC (12 years, 9 months ago) by gross
File MIME type: text/plain
File size: 4836 byte(s)
The set/getRefVal functions of Data objects have been removed (mainly to avoid later problems with MPI).
Moreover, a faster access to the reference id of samples has been introduced. I don't think that anybody will
profit form this at this stage but it will allow a faster dump of data objects.


1 /*
2 ************************************************************
3 * Copyright 2006 by ACcESS MNRF *
4 * *
5 * http://www.access.edu.au *
6 * Primary Business: Queensland, Australia *
7 * Licensed under the Open Software License version 3.0 *
8 * http://www.opensource.org/licenses/osl-3.0.php *
9 * *
10 ************************************************************
11 */
12
13 #if !defined escript_FunctionSpace_20040323_H
14 #define escript_FunctionSpace_20040323_H
15 #include "system_dep.h"
16
17 #include "AbstractDomain.h"
18 #include "NullDomain.h"
19
20 #include <string>
21
22 namespace escript {
23
24 //
25 // Forward declaration for class Data.
26 class Data;
27
28 /**
29 \brief
30 Give a short description of what FunctionSpace does.
31
32 Description:
33 Give a detailed description of FunctionSpace.
34
35 Template Parameters:
36 For templates describe any conditions that the parameters used in the
37 template must satisfy.
38 */
39
40 class ESCRIPT_DLL_API FunctionSpace {
41
42 public:
43 /**
44 \brief
45 Default constructor for FunctionSpace.
46
47 Description:
48 Default constructor for FunctionSpace
49 Generates a function space with a null domain.
50
51 Preconditions:
52 Describe any preconditions.
53
54 Throws:
55 Describe any exceptions thrown.
56 */
57 FunctionSpace();
58
59 /**
60 \brief
61 Constructor for FunctionSpace.
62
63 Description:
64 Constructor for FunctionSpace.
65
66 NOTE: The FunctionSpace class relies on the domain existing
67 for the lifetime of the FunctionSpace object. ie: domain must
68 be an externally managed object (!).
69 */
70 FunctionSpace(const AbstractDomain& domain,
71 int functionSpaceType);
72
73 /**
74 \brief
75 Return the function space type code.
76 */
77 int
78 getTypeCode() const;
79
80 /**
81 \brief
82 Return the function space domain.
83 */
84 const
85 AbstractDomain&
86 getDomain() const;
87
88 /**
89 \brief
90 Assignment operator.
91 NOTE: Assignment copies the domain object pointer
92 as this object is managed externally to this class.
93 */
94 FunctionSpace&
95 operator=(const FunctionSpace& other);
96
97
98 /**
99 \brief assigns new tag newTag to all samples with a positive
100 value of mask for any its sample point.
101
102 */
103 void setTags(const int newTag, const escript::Data& mask) const;
104
105
106 /**
107 \brief
108 Return the shape of the data needed to represent the function space.
109 */
110 std::pair<int,int>
111 getDataShape() const;
112
113 /**
114 \brief
115 Comparison operator.
116 Return true if function spaces are equal.
117 ie: Same domain and same function space type.
118 */
119 bool
120 operator==(const FunctionSpace& other) const;
121
122 bool
123 operator!=(const FunctionSpace& other) const;
124
125 /**
126 \brief
127 Return a text description of the function space.
128 */
129 std::string
130 toString() const;
131
132 /**
133 \brief
134 Return the tag associated with the given sample number.
135 */
136 int
137 getTagFromSampleNo(int sampleNo) const;
138
139 /**
140 \brief
141 Return the tag associated with the given data-point number.
142 */
143 int
144 getTagFromDataPointNo(int dataPointNo) const;
145
146 /**
147 \brief
148 Return the reference number associated with the given sample number.
149 This function is not efficient. It is better to first call
150 borrowSampleReferenceIDs and then when iterating over sampleNo to use sampleNo as an offset.
151 */
152 inline
153 int
154 getReferenceIDOfSample(int sampleNo) const
155 {
156 return borrowSampleReferenceIDs()[sampleNo];
157 }
158 /**
159 \brief
160 Return a borrowed reference to the list of sample reference IDs
161 */
162 int*
163 borrowSampleReferenceIDs() const;
164
165 /**
166 \brief
167 Return the spatial locations of the data points.
168 */
169 escript::Data
170 getX() const;
171
172 /**
173 \brief
174 Return the surface normal field.
175 */
176 escript::Data
177 getNormal() const;
178
179 /**
180 \brief
181 Return the sample size (e.g. the diameter of elements, radius of particles).
182 */
183 escript::Data
184 getSize() const;
185
186 /**
187 \brief
188 Return the number of samples.
189 */
190 inline
191 int
192 getNumSamples() const {
193 return getDataShape().second;
194 }
195
196 /**
197 \brief
198 Return the number of data points per sample.
199 */
200 inline
201 int
202 getNumDPPSample() const {
203 return getNumDataPointsPerSample();
204 }
205
206 inline
207 int
208 getNumDataPointsPerSample() const {
209 return getDataShape().first;
210 }
211
212 /**
213 \brief
214 Return the spatial dimension of the underlying domain.
215 */
216 inline
217 int
218 getDim() const {
219 return getDomain().getDim();
220 }
221
222 protected:
223
224 private:
225
226 //
227 // static null domain value
228 static NullDomain m_nullDomainValue;
229
230 //
231 // function space domain
232 const AbstractDomain* m_domain;
233
234 //
235 // function space type code.
236 int m_functionSpaceType;
237
238 };
239
240 } // end of namespace
241
242 #endif

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.26