/[escript]/branches/windows_from_1383_trunk/escript/src/FunctionSpace.h
ViewVC logotype

Contents of /branches/windows_from_1383_trunk/escript/src/FunctionSpace.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1137 - (show annotations)
Thu May 10 08:11:31 2007 UTC (12 years, 3 months ago) by gross
Original Path: trunk/escript/src/FunctionSpace.h
File MIME type: text/plain
File size: 4996 byte(s)
This version passes the tests on windows except for 

   * vtk
   * netCDF

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

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.26