/[escript]/branches/intelc_win32/bruce/src/Bruce.h
ViewVC logotype

Annotation of /branches/intelc_win32/bruce/src/Bruce.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 742 - (hide annotations)
Sat Jun 24 11:27:16 2006 UTC (13 years, 2 months ago) by woo409
File MIME type: text/plain
File size: 8497 byte(s)
+ Initial commit of win32 port using intel c++ compiler 9.1.x for Windows
+ This version is failing some file handling tests in python
1 jgs 149 // $Id$
2     /*
3 elspeth 627 ************************************************************
4     * Copyright 2006 by ACcESS MNRF *
5     * *
6     * http://www.access.edu.au *
7     * Primary Business: Queensland, Australia *
8     * Licensed under the Open Software License version 3.0 *
9     * http://www.opensource.org/licenses/osl-3.0.php *
10     * *
11     ************************************************************
12 jgs 149 */
13 jgs 151
14 jgs 149 #if !defined bruce_Bruce_20050829_H
15     #define bruce_Bruce_20050829_H
16 woo409 742 #include "system_dep.h"
17 robwdcock 682 #include "escript/AbstractDomain.h"
18     #include "escript/AbstractContinuousDomain.h"
19     #include "escript/FunctionSpace.h"
20     #include "escript/Data.h"
21 jgs 149
22 woo409 742
23 jgs 149 #include <string>
24 jgs 150 #include <vector>
25 jgs 149
26     namespace bruce {
27    
28     /**
29     \brief
30 jgs 151 Bruce implements a structured AbstractContinuousDomain.
31 jgs 149
32     Description:
33 jgs 151 Bruce implements a structured AbstractContinuousDomain.
34 jgs 149 */
35    
36     class Bruce : public escript::AbstractContinuousDomain {
37    
38     public:
39    
40     //
41     // Codes for function space types supported
42 woo409 742 BRUCE_DLL_API
43 jgs 154 static const int ContinuousFunction; // data is on the nodes
44 woo409 742 BRUCE_DLL_API
45 jgs 154 static const int Function; // data is on the cell centres
46 jgs 149
47 jgs 150 //
48     // Type of FunctionSpaceNamesMap
49     typedef std::map<int, std::string> FunctionSpaceNamesMapType;
50    
51     //
52     // Types for the dimension vectors
53     typedef std::vector<double> DimVec;
54    
55 jgs 149 /**
56     \brief
57 jgs 150 Default constructor for Bruce.
58    
59     Description:
60     Default constructor for Bruce.
61     Creates a null Bruce object.
62     */
63 woo409 742 BRUCE_DLL_API
64 jgs 150 Bruce();
65    
66     /**
67     \brief
68 jgs 149 Constructor for Bruce.
69    
70     Description:
71     Constructor for Bruce.
72 jgs 150
73     The point "origin" specifies the location of the origin
74     of the domain specified by this object. The dimensionality of this
75     point determines the dimensionality of the space the domain occupies.
76    
77     The vectors v0,v1,v2 specify the axis in
78     of the domain of this Bruce object. If v2 is an empty vector, this
79     object is a two dimensional domain. If v1 is also an empty vector,
80     this object is a one dimensional domain. If v0 is also an empty
81     vector, this is a point domain.
82    
83     The integers n0,n1,n2 specify the dumber of data-points along each
84     axis in the domain.
85 jgs 149 */
86 woo409 742 BRUCE_DLL_API
87 jgs 150 Bruce(DimVec v0, DimVec v1, DimVec v2,
88     int n0, int n1, int n2,
89     DimVec origin);
90 jgs 149
91     /**
92     \brief
93     Copy constructor.
94     */
95 woo409 742 BRUCE_DLL_API
96 jgs 149 Bruce(const Bruce& other);
97    
98     /**
99     \brief
100     Destructor for Bruce.
101     */
102 woo409 742 BRUCE_DLL_API
103 jgs 149 ~Bruce();
104    
105     /**
106     \brief
107     Return this as an AbstractContinuousDomain.
108     */
109 woo409 742 BRUCE_DLL_API
110 jgs 149 inline
111     const AbstractContinuousDomain&
112     asAbstractContinuousDomain() const
113     {
114 jgs 150 return *(static_cast<const AbstractContinuousDomain*>(this));
115 jgs 149 }
116    
117     /**
118     \brief
119     Return this as an AbstractDomain.
120     */
121 woo409 742 BRUCE_DLL_API
122 jgs 149 inline
123     const AbstractDomain&
124     asAbstractDomain() const
125     {
126 jgs 150 return *(static_cast<const AbstractDomain*>(this));
127 jgs 149 }
128    
129     /**
130     \brief
131 jgs 150 Return a description for this domain.
132     */
133 woo409 742 BRUCE_DLL_API
134 jgs 150 virtual
135 jgs 151 inline
136 jgs 150 std::string
137 jgs 151 getDescription() const
138     {
139     return "Bruce";
140     }
141 jgs 150
142     /**
143     \brief
144 jgs 149 Returns true if the given integer is a valid function space type
145     for this domain.
146     */
147 woo409 742 BRUCE_DLL_API
148 jgs 149 virtual
149     bool
150 jgs 150 isValidFunctionSpaceType(int functionSpaceCode) const;
151 jgs 149
152     /**
153     \brief
154 jgs 150 Return a description for the given function space type code.
155     */
156 woo409 742 BRUCE_DLL_API
157 jgs 150 virtual
158     std::string
159     functionSpaceTypeAsString(int functionSpaceCode) const;
160    
161     /**
162     \brief
163     Return a continuous FunctionSpace code.
164     */
165 woo409 742 BRUCE_DLL_API
166 jgs 150 virtual
167 jgs 151 inline
168 jgs 150 int
169 jgs 151 getContinuousFunctionCode() const
170     {
171     return ContinuousFunction;
172     }
173 jgs 150
174     /**
175     \brief
176     Return a function FunctionSpace code.
177     */
178 woo409 742 BRUCE_DLL_API
179 jgs 150 virtual
180 jgs 151 inline
181 jgs 150 int
182 jgs 151 getFunctionCode() const
183     {
184     return Function;
185     }
186 jgs 150
187     /**
188     \brief
189 jgs 149 Return the spatial dimension of the mesh.
190     */
191 woo409 742 BRUCE_DLL_API
192 jgs 149 virtual
193 jgs 151 inline
194 jgs 149 int
195 jgs 151 getDim() const
196     {
197     return m_origin.size();
198     }
199 jgs 149
200     /**
201     \brief
202     Return the number of data points per sample, and the number of samples
203     needed to represent data on parts of the mesh.
204     */
205 woo409 742 BRUCE_DLL_API
206 jgs 149 virtual
207     std::pair<int,int>
208     getDataShape(int functionSpaceCode) const;
209    
210     /**
211     \brief
212 jgs 154 Return the number of samples
213     needed to represent data on parts of the mesh.
214     */
215 woo409 742 BRUCE_DLL_API
216 jgs 154 int
217     getNumSamples(int functionSpaceCode) const;
218    
219     /**
220     \brief
221     Return the number of data-points per sample
222     needed to represent data on parts of the mesh.
223     */
224 woo409 742 BRUCE_DLL_API
225 jgs 154 inline
226     int
227     getNumDataPointsPerSample(int functionSpaceCode) const
228     {
229     return 1;
230     }
231    
232     /**
233     \brief
234 jgs 149 Returns the locations in the domain of the FEM nodes.
235     */
236 woo409 742 BRUCE_DLL_API
237 jgs 149 virtual
238     escript::Data
239     getX() const;
240    
241     /**
242     \brief
243 jgs 150 Copies the location of data points on the domain into out.
244     */
245 woo409 742 BRUCE_DLL_API
246 jgs 150 virtual
247     void
248     setToX(escript::Data& out) const;
249    
250     /**
251     \brief
252 jgs 149 Returns the element size.
253     */
254 woo409 742 BRUCE_DLL_API
255 jgs 149 virtual
256     escript::Data
257     getSize() const;
258    
259     /**
260     \brief
261 jgs 150 Copies the size of samples into out.
262     */
263 woo409 742 BRUCE_DLL_API
264 jgs 150 virtual
265     void
266     setToSize(escript::Data& out) const;
267    
268     /**
269     \brief
270 jgs 154 Copies the gradient of arg into grad. The actual function space to be considered
271     for the gradient is defined by grad. arg and grad have to be defined on this.
272     */
273 woo409 742 BRUCE_DLL_API
274 jgs 154 virtual
275     void
276     setToGradient(escript::Data& grad,
277     const escript::Data& arg) const;
278    
279     /**
280     \brief
281 jgs 149 Comparison operators.
282     */
283 woo409 742 BRUCE_DLL_API
284 jgs 149 virtual bool operator==(const AbstractDomain& other) const;
285 woo409 742 BRUCE_DLL_API
286 jgs 149 virtual bool operator!=(const AbstractDomain& other) const;
287    
288 jgs 153 /*
289     \brief
290     Return the tag key for the given sample number.
291 jgs 154 NB: tags are not implemented on Bruce, so this method always returns 0.
292 jgs 153 */
293 woo409 742 BRUCE_DLL_API
294 jgs 153 virtual
295 jgs 154 inline
296 jgs 153 int
297 jgs 154 getTagFromSampleNo(int functionSpaceCode,
298     int sampleNo) const
299     {
300     return 0;
301     }
302 jgs 153
303     /**
304     \brief
305     Return the reference number of the given sample number.
306     */
307 woo409 742 BRUCE_DLL_API
308 jgs 153 virtual
309     int
310 jgs 154 getReferenceNoFromSampleNo(int functionSpaceCode,
311     int sampleNo) const;
312 jgs 153
313 jgs 154 /**
314     \brief
315     Saves a dictionary of Data objects to a VTK XML input file.
316     The dictionary consists of pairs of Data objects plus a name
317     for each. Each Data object must be defined on this domain.
318     */
319 woo409 742 BRUCE_DLL_API
320 jgs 154 virtual
321     void
322     saveVTK(const std::string& filename,
323     const boost::python::dict& dataDict) const;
324 jgs 153
325 jgs 154 /**
326     \brief
327     Interpolates data given on source onto target where source and target
328     have to be given on the same domain.
329     */
330 woo409 742 BRUCE_DLL_API
331 jgs 154 virtual
332     void
333     interpolateOnDomain(escript::Data& target,
334     const escript::Data& source) const;
335    
336 woo409 742 BRUCE_DLL_API
337 jgs 154 virtual
338     bool
339     probeInterpolationOnDomain(int functionSpaceType_source,
340     int functionSpaceType_target) const;
341    
342     /**
343     \brief
344     Interpolates data given on source onto target where source and target
345     are given on different domains.
346     */
347 woo409 742 BRUCE_DLL_API
348 jgs 154 virtual
349     void
350     interpolateACross(escript::Data& target,
351     const escript::Data& source) const;
352    
353 woo409 742 BRUCE_DLL_API
354 jgs 154 virtual
355     bool
356     probeInterpolationACross(int functionSpaceType_source,
357     const AbstractDomain& targetDomain,
358     int functionSpaceType_target) const;
359    
360 jgs 149 protected:
361    
362 jgs 150 /**
363     \brief
364     Build the table of function space type names.
365     */
366 woo409 742 BRUCE_DLL_API
367 jgs 150 void
368     setFunctionSpaceTypeNames();
369    
370     /**
371     \brief
372     Ensure the parameters supplied to the constructor are valid.
373     */
374 woo409 742 BRUCE_DLL_API
375 jgs 150 bool
376     checkParameters();
377    
378     /**
379     \brief
380     Check if all components of vector are zero.
381     */
382 woo409 742 BRUCE_DLL_API
383 jgs 151 static
384 jgs 150 bool
385 jgs 151 isZero(DimVec vec);
386 jgs 150
387 jgs 149 private:
388    
389 jgs 150 //
390     // vectors describing axis of the domain
391     DimVec m_v0, m_v1, m_v2;
392    
393     //
394     // number of data points in each axial direction of the domain
395     int m_n0, m_n1, m_n2;
396    
397     //
398     // the coordinates of the origin of the domain
399     DimVec m_origin;
400    
401     //
402     // map from FunctionSpace codes to names
403     static FunctionSpaceNamesMapType m_functionSpaceTypeNames;
404    
405 jgs 149 };
406    
407     } // end of namespace
408    
409     #endif

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.26