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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1811 - (hide annotations)
Thu Sep 25 23:11:13 2008 UTC (11 years, 1 month ago) by ksteube
File MIME type: text/plain
File size: 10881 byte(s)
Copyright updated in all files

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

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.26