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

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

Parent Directory Parent Directory | Revision Log Revision Log


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

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.26