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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1137 - (hide annotations)
Thu May 10 08:11:31 2007 UTC (12 years, 6 months ago) by gross
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 jgs 82 /*
2 elspeth 615 ************************************************************
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 jgs 82 */
12 jgs 115
13     #if !defined escript_FunctionSpace_20040323_H
14 jgs 82 #define escript_FunctionSpace_20040323_H
15 woo409 757 #include "system_dep.h"
16 jgs 82
17 jgs 474 #include "AbstractDomain.h"
18     #include "NullDomain.h"
19 gross 1137 #include <boost/python/str.hpp>
20 jgs 82
21     #include <string>
22    
23     namespace escript {
24    
25 jgs 117 //
26     // Forward declaration for class Data.
27     class Data;
28 jgs 82
29     /**
30     \brief
31     Give a short description of what FunctionSpace does.
32    
33     Description:
34 jgs 117 Give a detailed description of FunctionSpace.
35 jgs 82
36     Template Parameters:
37     For templates describe any conditions that the parameters used in the
38 jgs 117 template must satisfy.
39 jgs 82 */
40    
41 woo409 757 class ESCRIPT_DLL_API FunctionSpace {
42 jgs 82
43     public:
44     /**
45     \brief
46 jgs 117 Default constructor for FunctionSpace.
47 jgs 82
48     Description:
49     Default constructor for FunctionSpace
50     Generates a function space with a null domain.
51    
52     Preconditions:
53 jgs 117 Describe any preconditions.
54 jgs 82
55     Throws:
56 jgs 117 Describe any exceptions thrown.
57 jgs 82 */
58     FunctionSpace();
59    
60     /**
61     \brief
62 jgs 117 Constructor for FunctionSpace.
63 jgs 82
64     Description:
65     Constructor for FunctionSpace.
66 jgs 115
67 jgs 82 NOTE: The FunctionSpace class relies on the domain existing
68 jgs 115 for the lifetime of the FunctionSpace object. ie: domain must
69     be an externally managed object (!).
70 jgs 82 */
71 jgs 117 FunctionSpace(const AbstractDomain& domain,
72     int functionSpaceType);
73 jgs 82
74     /**
75     \brief
76     Return the function space type code.
77     */
78 jgs 117 int
79     getTypeCode() const;
80 jgs 82
81     /**
82     \brief
83     Return the function space domain.
84     */
85 jgs 117 const
86     AbstractDomain&
87     getDomain() const;
88 jgs 82
89     /**
90     \brief
91     Assignment operator.
92 jgs 149 NOTE: Assignment copies the domain object pointer
93 jgs 82 as this object is managed externally to this class.
94     */
95 jgs 117 FunctionSpace&
96     operator=(const FunctionSpace& other);
97 jgs 82
98 gross 767
99 jgs 82 /**
100 gross 767 \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 jgs 82 \brief
109     Return the shape of the data needed to represent the function space.
110     */
111 jgs 117 std::pair<int,int>
112     getDataShape() const;
113 jgs 82
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 jgs 117 bool
121     operator==(const FunctionSpace& other) const;
122 jgs 82
123 jgs 117 bool
124     operator!=(const FunctionSpace& other) const;
125    
126 jgs 82 /**
127     \brief
128 gross 1137 Return a text description of the function space for python.
129     */
130     const boost::python::str
131     str() const;
132    
133     /**
134     \brief
135 jgs 115 Return a text description of the function space.
136 jgs 82 */
137 jgs 117 std::string
138     toString() const;
139 jgs 82 /**
140     \brief
141     Return the tag associated with the given sample number.
142     */
143 jgs 117 int
144     getTagFromSampleNo(int sampleNo) const;
145 jgs 115
146 jgs 110 /**
147     \brief
148 jgs 149 Return the tag associated with the given data-point number.
149 jgs 110 */
150 jgs 117 int
151 jgs 149 getTagFromDataPointNo(int dataPointNo) const;
152    
153     /**
154     \brief
155     Return the reference number associated with the given sample number.
156 gross 964 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 jgs 149 */
159 gross 964 inline
160 jgs 149 int
161 gross 964 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 jgs 82
172     /**
173     \brief
174 jgs 149 Return the spatial locations of the data points.
175 jgs 82 */
176 jgs 117 escript::Data
177     getX() const;
178 jgs 149
179 jgs 82 /**
180     \brief
181     Return the surface normal field.
182     */
183 jgs 117 escript::Data
184     getNormal() const;
185 jgs 82
186     /**
187     \brief
188     Return the sample size (e.g. the diameter of elements, radius of particles).
189     */
190 jgs 117 escript::Data
191     getSize() const;
192 jgs 82
193     /**
194     \brief
195 jgs 115 Return the number of samples.
196 jgs 82 */
197 jgs 117 inline
198     int
199     getNumSamples() const {
200 jgs 82 return getDataShape().second;
201     }
202    
203     /**
204     \brief
205     Return the number of data points per sample.
206     */
207 jgs 117 inline
208     int
209     getNumDPPSample() const {
210 jgs 82 return getNumDataPointsPerSample();
211     }
212 jgs 149
213 jgs 117 inline
214     int
215     getNumDataPointsPerSample() const {
216 jgs 82 return getDataShape().first;
217     }
218    
219     /**
220     \brief
221     Return the spatial dimension of the underlying domain.
222     */
223 jgs 117 inline
224     int
225     getDim() const {
226 jgs 82 return getDomain().getDim();
227     }
228 jgs 115
229 jgs 82 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 jgs 149
241 jgs 82 //
242     // function space type code.
243     int m_functionSpaceType;
244    
245     };
246    
247     } // end of namespace
248 jgs 117
249 jgs 82 #endif

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.26