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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1137 - (hide annotations)
Thu May 10 08:11:31 2007 UTC (12 years, 4 months ago) by gross
File MIME type: text/plain
File size: 10245 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 102 // $Id$
2 jgs 82 /*
3 elspeth 615 ************************************************************
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    
13 jgs 82 */
14 jgs 115
15     #if !defined escript_AbstractDomain_20040609_H
16 jgs 82 #define escript_AbstractDomain_20040609_H
17 jgs 115
18 woo409 757 #include "system_dep.h"
19    
20 jgs 82 #include <string>
21 gross 797 #include <map>
22 jgs 153 #include <boost/python/dict.hpp>
23 gross 1137 #include <boost/python/str.hpp>
24 jgs 82
25     namespace escript {
26 gross 797 // class forward declarations
27 jgs 117 class Data;
28 jgs 82 /**
29     \brief
30     Base class for all escript domains.
31    
32     Description:
33     Base class for all escript domains.
34     */
35 jgs 115
36 jgs 82 class AbstractDomain {
37    
38     public:
39    
40 gross 1137
41 gross 797 // structure holding values for X, size and normal
42     typedef int StatusType;
43 gross 1137 // struct ValueBuffer
44     // {
45     // StatusType m_status;
46     // boost::shared_ptr<Data> m_data;
47     //};
48     // typedef struct ValueBuffer ValueBuffer;
49 gross 797
50     //
51     // map from function space type code to value buffer
52 gross 1137 // typedef std::map<int, ValueBuffer> BufferMapType;
53 gross 797
54    
55 jgs 82 /**
56     \brief
57 jgs 117 Default constructor for AbstractDomain.
58 jgs 82
59     Description:
60     Default constructor for AbstractDomain. As the name suggests
61     this is intended to be an abstract base class but by making it
62 jgs 117 constructable we avoid a boost.python wrapper class. A call to
63 jgs 82 almost any of the base class functions will throw an exception
64 jgs 115 as they are not intended to be used directly, but are overridden
65 jgs 117 by the underlying solver package which escript is linked to.
66 jgs 82
67 jgs 115 By default, this class is overridden by the class NullDomain.
68    
69 jgs 82 Preconditions:
70 jgs 117 Describe any preconditions.
71 jgs 82
72     Throws:
73 jgs 117 Describe any exceptions thrown.
74 jgs 82 */
75 woo409 757 ESCRIPT_DLL_API
76 jgs 82 AbstractDomain();
77 jgs 115
78 jgs 82 /**
79     \brief
80 jgs 117 Destructor for AbstractDomain.
81 jgs 82
82     Description:
83 jgs 117 Destructor for AbstractDomain.
84 jgs 82 */
85 woo409 757 ESCRIPT_DLL_API
86 jgs 82 virtual ~AbstractDomain();
87 jgs 115
88 jgs 82 /**
89     \brief
90     Returns true if the given integer is a valid function space type
91     for this domain.
92     */
93 woo409 757 ESCRIPT_DLL_API
94 jgs 82 virtual bool isValidFunctionSpaceType(int functionSpaceType) const;
95 jgs 115
96 jgs 82 /**
97     \brief
98 jgs 117 Return a description for this domain.
99 jgs 82 */
100 woo409 757 ESCRIPT_DLL_API
101 jgs 82 virtual std::string getDescription() const;
102 jgs 115
103 jgs 82 /**
104     \brief
105 gross 1137 Return a description for this domain for python.
106     */
107     ESCRIPT_DLL_API
108     const boost::python::str str() const;
109    
110     /**
111     \brief
112 jgs 117 Return a description for the given function space type code.
113 jgs 82 */
114 woo409 757 ESCRIPT_DLL_API
115 jgs 82 virtual std::string functionSpaceTypeAsString(int functionSpaceType) const;
116 jgs 115
117 jgs 82 /**
118     \brief
119 jgs 117 Returns the spatial dimension of the domain.
120 jgs 115
121 jgs 117 This has to be implemented by the actual Domain adapter.
122 jgs 82 */
123 woo409 757 ESCRIPT_DLL_API
124 jgs 82 virtual int getDim() const;
125    
126     /**
127 jgs 117 \brief
128     Return true if given domains are equal.
129 jgs 82 */
130 woo409 757 ESCRIPT_DLL_API
131 jgs 121 virtual bool operator==(const AbstractDomain& other) const;
132 woo409 757 ESCRIPT_DLL_API
133 jgs 121 virtual bool operator!=(const AbstractDomain& other) const;
134 jgs 115
135 jgs 82 /**
136     \brief
137 jgs 117 Writes the domain to an external file filename.
138    
139 jgs 115 This has to be implemented by the actual Domain adapter.
140 jgs 82 */
141 woo409 757 ESCRIPT_DLL_API
142 jgs 82 virtual void write(const std::string& filename) const;
143    
144     /**
145     \brief
146     Return the number of data points per sample, and the number of samples as a pair.
147 jgs 117
148     This has to be implemented by the actual Domain adapter.
149    
150 jgs 82 \param functionSpaceCode Input - Code for the function space type.
151     \return pair, first - number of data points per sample, second - number of samples
152     */
153 woo409 757 ESCRIPT_DLL_API
154 jgs 82 virtual std::pair<int,int> getDataShape(int functionSpaceCode) const;
155    
156     /**
157     \brief
158     Return the tag key for the given sample number.
159     \param functionSpaceType Input - The function space type.
160     \param sampleNo Input - The sample number.
161     */
162 woo409 757 ESCRIPT_DLL_API
163 jgs 82 virtual int getTagFromSampleNo(int functionSpaceType, int sampleNo) const;
164 jgs 115
165 jgs 82 /**
166     \brief
167 gross 1044 sets a map from a clear tag name to a tag key
168     \param name Input - tag name.
169     \param tag Input - tag key.
170     */
171     ESCRIPT_DLL_API
172     virtual void setTagMap(const std::string& name, int tag);
173    
174     /**
175     \brief
176     Return the tag key for tag name.
177     \param name Input - tag name
178     */
179     ESCRIPT_DLL_API
180     virtual int getTag(const std::string& name) const;
181    
182     /**
183     \brief
184     Returns True if name is a defined tag name
185     \param name Input - tag name
186     */
187     ESCRIPT_DLL_API
188     virtual bool isValidTagName(const std::string& name) const;
189    
190     /**
191     \brief
192     Returns all tag names in a single string sperated by commas
193     */
194     ESCRIPT_DLL_API
195     virtual std::string showTagNames() const;
196    
197     /**
198     \brief
199 gross 964 Return a borrowed pointer to the sample reference number id list
200 jgs 110 \param functionSpaceType Input - The function space type.
201     */
202 woo409 757 ESCRIPT_DLL_API
203 gross 964 virtual int* borrowSampleReferenceIDs(int functionSpaceType) const;
204 jgs 115
205 jgs 110 /**
206     \brief
207 jgs 117 Assigns new location to the domain.
208    
209     This has to be implemented by the actual Domain adapter.
210 jgs 82 */
211 woo409 757 ESCRIPT_DLL_API
212 jgs 82 virtual void setNewX(const escript::Data& arg);
213    
214     /**
215     \brief
216 jgs 115 Interpolates data given on source onto target where source and target have to be given on the same domain.
217 jgs 117
218     This has to be implemented by the actual Domain adapter.
219 jgs 82 */
220 woo409 757 ESCRIPT_DLL_API
221 jgs 82 virtual void interpolateOnDomain(escript::Data& target,const escript::Data& source) const;
222 woo409 757 ESCRIPT_DLL_API
223 jgs 82 virtual bool probeInterpolationOnDomain(int functionSpaceType_source,int functionSpaceType_target) const;
224 jgs 115
225 jgs 82 /**
226     \brief
227 jgs 115 Interpolates data given on source onto target where source and target are given on different domains.
228 jgs 117
229     This has to be implemented by the actual Domain adapter.
230 jgs 82 */
231 woo409 757 ESCRIPT_DLL_API
232 jgs 82 virtual void interpolateACross(escript::Data& target, const escript::Data& source) const;
233 woo409 757 ESCRIPT_DLL_API
234 jgs 82 virtual bool probeInterpolationACross(int functionSpaceType_source,const AbstractDomain& targetDomain, int functionSpaceType_target) const;
235    
236     /**
237 jgs 117 \brief
238     Returns locations in the domain. The function space is chosen appropriately.
239 jgs 102 */
240 woo409 757 ESCRIPT_DLL_API
241 jgs 102 virtual escript::Data getX() const;
242 jgs 115
243 jgs 102 /**
244 jgs 117 \brief
245     Return boundary normals. The function space is chosen appropriately.
246 jgs 102 */
247 woo409 757 ESCRIPT_DLL_API
248 jgs 102 virtual escript::Data getNormal() const;
249 jgs 115
250 jgs 102 /**
251 jgs 117 \brief
252     Returns the local size of samples. The function space is chosen appropriately.
253 jgs 102 */
254 woo409 757 ESCRIPT_DLL_API
255 jgs 102 virtual escript::Data getSize() const;
256    
257     /**
258 jgs 82 \brief
259 jgs 115 Copies the location of data points on the domain into out.
260     The actual function space to be considered
261 jgs 82 is defined by out. out has to be defined on this.
262 jgs 117
263     This has to be implemented by the actual Domain adapter.
264 jgs 82 */
265 woo409 757 ESCRIPT_DLL_API
266 jgs 82 virtual void setToX(escript::Data& out) const;
267 jgs 115
268 jgs 82 /**
269     \brief
270 jgs 115 Copies the surface normals at data points into out.
271     The actual function space to be considered
272 jgs 82 is defined by out. out has to be defined on this.
273 jgs 117
274     This has to be implemented by the actual Domain adapter.
275 jgs 82 */
276 woo409 757 ESCRIPT_DLL_API
277 jgs 82 virtual void setToNormal(escript::Data& out) const;
278 jgs 115
279 jgs 82 /**
280     \brief
281 jgs 115 Copies the size of samples into out. The actual
282     function space to be considered
283 jgs 82 is defined by out. out has to be defined on this.
284 jgs 117
285     This has to be implemented by the actual Domain adapter.
286 jgs 82 */
287 woo409 757 ESCRIPT_DLL_API
288 jgs 82 virtual void setToSize(escript::Data& out) const;
289    
290     /**
291     \brief
292 jgs 115 Copies the gradient of arg into grad. The actual function space to be considered
293 jgs 82 for the gradient is defined by grad. arg and grad have to be defined on this.
294 jgs 117
295     This has to be implemented by the actual Domain adapter.
296 jgs 82 */
297 woo409 757 ESCRIPT_DLL_API
298 jgs 82 virtual void setToGradient(escript::Data& grad, const escript::Data& arg) const;
299     /**
300     \brief
301 jgs 153 Saves a dictonary of Data objects to an OpenDX input file. The keywords are used as identifier
302 jgs 117
303     This has to be implemented by the actual Domain adapter.
304 jgs 82 */
305 woo409 757 ESCRIPT_DLL_API
306 jgs 153 virtual void saveDX(const std::string& filename,const boost::python::dict& arg) const;
307 jgs 110
308 jgs 82 /**
309     \brief
310 jgs 153 Saves a dictonary of Data objects to an VTK XML input file. The keywords are used as identifier
311 jgs 117
312     This has to be implemented by the actual Domain adapter.
313 jgs 110 */
314 woo409 757 ESCRIPT_DLL_API
315 jgs 153 virtual void saveVTK(const std::string& filename,const boost::python::dict& arg) const;
316 jgs 110
317     /**
318     \brief
319 jgs 82 returns the function space representation of the type functionSpaceCode on this domain
320     as a vtkObject.
321 jgs 117
322     This has to be implemented by the actual Domain adapter.
323 jgs 82 */
324     //virtual vtkObject createVtkObject(int functionSpaceCode) const;
325    
326 jgs 115 /**
327 gross 767 \brief assigns new tag newTag to all samples of functionspace with a positive
328     value of mask for any its sample point.
329    
330     */
331     ESCRIPT_DLL_API
332     virtual void setTags(const int functionSpaceType, const int newTag, const escript::Data& mask) const;
333    
334     /**
335 jgs 82 \brief
336     returns true if data on this domain and a function space of type functionSpaceCode has to
337     considered as cell centered data.
338 jgs 117
339     This has to be implemented by the actual Domain adapter.
340 jgs 82 */
341 woo409 757 ESCRIPT_DLL_API
342 jgs 82 virtual bool isCellOriented(int functionSpaceCode) const;
343    
344 jgs 117 /**
345     \brief
346 gross 797 returns status of the domain.
347    
348     This has to be implemented by the actual Domain adapter.
349     */
350     ESCRIPT_DLL_API
351     virtual StatusType getStatus() const;
352    
353     /**
354     \brief
355 jgs 117 Throw a standard exception. This function is called if any attempt
356     is made to use a base class function.
357     */
358 woo409 757 ESCRIPT_DLL_API
359 jgs 117 void throwStandardException(const std::string& functionName) const;
360    
361 jgs 82 protected:
362    
363     private:
364 jgs 115
365 gross 797 // buffer for coordinates used by function spaces
366 gross 1137 //BufferMapType m_x_buffer;
367 gross 797
368     // buffer for normal vectors used by function spaces
369 gross 1137 //BufferMapType m_normal_buffer;
370 gross 797
371     // buffer for normal element size used by function spaces
372 gross 1137 //BufferMapType m_size_buffer;
373 gross 797
374 jgs 82 };
375    
376     } // end of namespace
377 jgs 117
378 jgs 82 #endif

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.26