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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 767 - (show annotations)
Fri Jun 30 07:29:08 2006 UTC (13 years, 3 months ago) by gross
File MIME type: text/plain
File size: 4483 byte(s)
new FunctionSpace method setTags added
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 */
150 int
151 getReferenceNoFromSampleNo(int sampleNo) const;
152
153 /**
154 \brief
155 Return the spatial locations of the data points.
156 */
157 escript::Data
158 getX() const;
159
160 /**
161 \brief
162 Return the surface normal field.
163 */
164 escript::Data
165 getNormal() const;
166
167 /**
168 \brief
169 Return the sample size (e.g. the diameter of elements, radius of particles).
170 */
171 escript::Data
172 getSize() const;
173
174 /**
175 \brief
176 Return the number of samples.
177 */
178 inline
179 int
180 getNumSamples() const {
181 return getDataShape().second;
182 }
183
184 /**
185 \brief
186 Return the number of data points per sample.
187 */
188 inline
189 int
190 getNumDPPSample() const {
191 return getNumDataPointsPerSample();
192 }
193
194 inline
195 int
196 getNumDataPointsPerSample() const {
197 return getDataShape().first;
198 }
199
200 /**
201 \brief
202 Return the spatial dimension of the underlying domain.
203 */
204 inline
205 int
206 getDim() const {
207 return getDomain().getDim();
208 }
209
210 protected:
211
212 private:
213
214 //
215 // static null domain value
216 static NullDomain m_nullDomainValue;
217
218 //
219 // function space domain
220 const AbstractDomain* m_domain;
221
222 //
223 // function space type code.
224 int m_functionSpaceType;
225
226 };
227
228 } // end of namespace
229
230 #endif

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.26