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

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

Parent Directory Parent Directory | Revision Log Revision Log


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

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.26