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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1388 - (hide annotations)
Fri Jan 11 07:45:58 2008 UTC (11 years, 8 months ago) by trankine
File MIME type: text/plain
File size: 10388 byte(s)
And get the *(&(*&(* name right
1 elspeth 615
2 ksteube 1312 /* $Id$ */
3 jgs 115
4 ksteube 1312 /*******************************************************
5     *
6     * Copyright 2003-2007 by ACceSS MNRF
7     * Copyright 2007 by University of Queensland
8     *
9     * http://esscc.uq.edu.au
10     * Primary Business: Queensland, Australia
11     * Licensed under the Open Software License version 3.0
12     * http://www.opensource.org/licenses/osl-3.0.php
13     *
14     *******************************************************/
15    
16 jgs 115 #if !defined escript_AbstractDomain_20040609_H
17 jgs 82 #define escript_AbstractDomain_20040609_H
18 jgs 115
19 woo409 757 #include "system_dep.h"
20    
21 jgs 82 #include <string>
22 gross 797 #include <map>
23 jgs 153 #include <boost/python/dict.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 ksteube 1312
41 gross 797 // structure holding values for X, size and normal
42     typedef int StatusType;
43 ksteube 1312 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 ksteube 1312 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 ksteube 1312 return the number of processors used for this domain
91     */
92     ESCRIPT_DLL_API
93     virtual int getMPISize() const;
94     /**
95     \brief
96     return the number MPI rank of this processor
97     */
98    
99     ESCRIPT_DLL_API
100     virtual int getMPIRank() const;
101    
102    
103    
104     /**
105     \brief
106 jgs 82 Returns true if the given integer is a valid function space type
107     for this domain.
108     */
109 woo409 757 ESCRIPT_DLL_API
110 jgs 82 virtual bool isValidFunctionSpaceType(int functionSpaceType) const;
111 jgs 115
112 jgs 82 /**
113     \brief
114 jgs 117 Return a description for this domain.
115 jgs 82 */
116 woo409 757 ESCRIPT_DLL_API
117 jgs 82 virtual std::string getDescription() const;
118 jgs 115
119 jgs 82 /**
120     \brief
121 jgs 117 Return a description for the given function space type code.
122 jgs 82 */
123 woo409 757 ESCRIPT_DLL_API
124 jgs 82 virtual std::string functionSpaceTypeAsString(int functionSpaceType) const;
125 jgs 115
126 jgs 82 /**
127     \brief
128 jgs 117 Returns the spatial dimension of the domain.
129 jgs 115
130 jgs 117 This has to be implemented by the actual Domain adapter.
131 jgs 82 */
132 woo409 757 ESCRIPT_DLL_API
133 jgs 82 virtual int getDim() const;
134    
135     /**
136 jgs 117 \brief
137     Return true if given domains are equal.
138 jgs 82 */
139 woo409 757 ESCRIPT_DLL_API
140 jgs 121 virtual bool operator==(const AbstractDomain& other) const;
141 woo409 757 ESCRIPT_DLL_API
142 jgs 121 virtual bool operator!=(const AbstractDomain& other) const;
143 jgs 115
144 jgs 82 /**
145     \brief
146 jgs 117 Writes the domain to an external file filename.
147    
148 jgs 115 This has to be implemented by the actual Domain adapter.
149 jgs 82 */
150 woo409 757 ESCRIPT_DLL_API
151 jgs 82 virtual void write(const std::string& filename) const;
152    
153     /**
154     \brief
155 ksteube 1312 dumps the domain to an external file filename.
156    
157     This has to be implemented by the actual Domain adapter.
158     */
159     ESCRIPT_DLL_API
160     virtual void dump(const std::string& filename) const;
161    
162     /**
163     \brief
164 jgs 82 Return the number of data points per sample, and the number of samples as a pair.
165 jgs 117
166     This has to be implemented by the actual Domain adapter.
167    
168 jgs 82 \param functionSpaceCode Input - Code for the function space type.
169     \return pair, first - number of data points per sample, second - number of samples
170     */
171 woo409 757 ESCRIPT_DLL_API
172 jgs 82 virtual std::pair<int,int> getDataShape(int functionSpaceCode) const;
173    
174     /**
175     \brief
176     Return the tag key for the given sample number.
177     \param functionSpaceType Input - The function space type.
178     \param sampleNo Input - The sample number.
179     */
180 woo409 757 ESCRIPT_DLL_API
181 jgs 82 virtual int getTagFromSampleNo(int functionSpaceType, int sampleNo) const;
182 jgs 115
183 jgs 82 /**
184     \brief
185 gross 1044 sets a map from a clear tag name to a tag key
186     \param name Input - tag name.
187     \param tag Input - tag key.
188     */
189     ESCRIPT_DLL_API
190     virtual void setTagMap(const std::string& name, int tag);
191    
192     /**
193     \brief
194     Return the tag key for tag name.
195     \param name Input - tag name
196     */
197     ESCRIPT_DLL_API
198     virtual int getTag(const std::string& name) const;
199    
200     /**
201     \brief
202     Returns True if name is a defined tag name
203     \param name Input - tag name
204     */
205     ESCRIPT_DLL_API
206     virtual bool isValidTagName(const std::string& name) const;
207    
208     /**
209     \brief
210     Returns all tag names in a single string sperated by commas
211     */
212     ESCRIPT_DLL_API
213     virtual std::string showTagNames() const;
214    
215     /**
216     \brief
217 gross 964 Return a borrowed pointer to the sample reference number id list
218 jgs 110 \param functionSpaceType Input - The function space type.
219     */
220 woo409 757 ESCRIPT_DLL_API
221 gross 964 virtual int* borrowSampleReferenceIDs(int functionSpaceType) const;
222 jgs 115
223 jgs 110 /**
224     \brief
225 jgs 117 Assigns new location to the domain.
226    
227     This has to be implemented by the actual Domain adapter.
228 jgs 82 */
229 woo409 757 ESCRIPT_DLL_API
230 jgs 82 virtual void setNewX(const escript::Data& arg);
231    
232     /**
233     \brief
234 jgs 115 Interpolates data given on source onto target where source and target have to be given on the same domain.
235 jgs 117
236     This has to be implemented by the actual Domain adapter.
237 jgs 82 */
238 woo409 757 ESCRIPT_DLL_API
239 jgs 82 virtual void interpolateOnDomain(escript::Data& target,const escript::Data& source) const;
240 woo409 757 ESCRIPT_DLL_API
241 jgs 82 virtual bool probeInterpolationOnDomain(int functionSpaceType_source,int functionSpaceType_target) const;
242 jgs 115
243 jgs 82 /**
244     \brief
245 jgs 115 Interpolates data given on source onto target where source and target are given on different domains.
246 jgs 117
247     This has to be implemented by the actual Domain adapter.
248 jgs 82 */
249 woo409 757 ESCRIPT_DLL_API
250 jgs 82 virtual void interpolateACross(escript::Data& target, const escript::Data& source) const;
251 woo409 757 ESCRIPT_DLL_API
252 jgs 82 virtual bool probeInterpolationACross(int functionSpaceType_source,const AbstractDomain& targetDomain, int functionSpaceType_target) const;
253    
254     /**
255 jgs 117 \brief
256     Returns locations in the domain. The function space is chosen appropriately.
257 jgs 102 */
258 woo409 757 ESCRIPT_DLL_API
259 jgs 102 virtual escript::Data getX() const;
260 jgs 115
261 jgs 102 /**
262 jgs 117 \brief
263     Return boundary normals. The function space is chosen appropriately.
264 jgs 102 */
265 woo409 757 ESCRIPT_DLL_API
266 jgs 102 virtual escript::Data getNormal() const;
267 jgs 115
268 jgs 102 /**
269 jgs 117 \brief
270     Returns the local size of samples. The function space is chosen appropriately.
271 jgs 102 */
272 woo409 757 ESCRIPT_DLL_API
273 jgs 102 virtual escript::Data getSize() const;
274    
275     /**
276 jgs 82 \brief
277 jgs 115 Copies the location of data points on the domain into out.
278     The actual function space to be considered
279 jgs 82 is defined by out. out has to be defined on this.
280 jgs 117
281     This has to be implemented by the actual Domain adapter.
282 jgs 82 */
283 woo409 757 ESCRIPT_DLL_API
284 jgs 82 virtual void setToX(escript::Data& out) const;
285 jgs 115
286 jgs 82 /**
287     \brief
288 jgs 115 Copies the surface normals at data points into out.
289     The actual function space to be considered
290 jgs 82 is defined by out. out has to be defined on this.
291 jgs 117
292     This has to be implemented by the actual Domain adapter.
293 jgs 82 */
294 woo409 757 ESCRIPT_DLL_API
295 jgs 82 virtual void setToNormal(escript::Data& out) const;
296 jgs 115
297 jgs 82 /**
298     \brief
299 jgs 115 Copies the size of samples into out. The actual
300     function space to be considered
301 jgs 82 is defined by out. out has to be defined on this.
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 82 virtual void setToSize(escript::Data& out) const;
307    
308     /**
309     \brief
310 jgs 115 Copies the gradient of arg into grad. The actual function space to be considered
311 jgs 82 for the gradient is defined by grad. arg and grad have to be defined on this.
312 jgs 117
313     This has to be implemented by the actual Domain adapter.
314 jgs 82 */
315 woo409 757 ESCRIPT_DLL_API
316 jgs 82 virtual void setToGradient(escript::Data& grad, const escript::Data& arg) const;
317     /**
318     \brief
319 jgs 153 Saves a dictonary of Data objects to an OpenDX input file. The keywords are used as identifier
320 jgs 117
321     This has to be implemented by the actual Domain adapter.
322 jgs 82 */
323 woo409 757 ESCRIPT_DLL_API
324 jgs 153 virtual void saveDX(const std::string& filename,const boost::python::dict& arg) const;
325 jgs 110
326 jgs 82 /**
327     \brief
328 jgs 153 Saves a dictonary of Data objects to an VTK XML input file. The keywords are used as identifier
329 jgs 117
330     This has to be implemented by the actual Domain adapter.
331 jgs 110 */
332 woo409 757 ESCRIPT_DLL_API
333 jgs 153 virtual void saveVTK(const std::string& filename,const boost::python::dict& arg) const;
334 jgs 110
335     /**
336     \brief
337 jgs 82 returns the function space representation of the type functionSpaceCode on this domain
338     as a vtkObject.
339 jgs 117
340     This has to be implemented by the actual Domain adapter.
341 jgs 82 */
342     //virtual vtkObject createVtkObject(int functionSpaceCode) const;
343    
344 jgs 115 /**
345 gross 767 \brief assigns new tag newTag to all samples of functionspace with a positive
346     value of mask for any its sample point.
347    
348     */
349     ESCRIPT_DLL_API
350     virtual void setTags(const int functionSpaceType, const int newTag, const escript::Data& mask) const;
351    
352     /**
353 jgs 82 \brief
354     returns true if data on this domain and a function space of type functionSpaceCode has to
355     considered as cell centered data.
356 jgs 117
357     This has to be implemented by the actual Domain adapter.
358 jgs 82 */
359 woo409 757 ESCRIPT_DLL_API
360 jgs 82 virtual bool isCellOriented(int functionSpaceCode) const;
361    
362 jgs 117 /**
363     \brief
364 gross 797 returns status of the domain.
365    
366     This has to be implemented by the actual Domain adapter.
367     */
368     ESCRIPT_DLL_API
369     virtual StatusType getStatus() const;
370    
371     /**
372     \brief
373 jgs 117 Throw a standard exception. This function is called if any attempt
374     is made to use a base class function.
375     */
376 woo409 757 ESCRIPT_DLL_API
377 jgs 117 void throwStandardException(const std::string& functionName) const;
378    
379 jgs 82 protected:
380    
381     private:
382 jgs 115
383 gross 797 // buffer for coordinates used by function spaces
384 ksteube 1312 BufferMapType m_x_buffer;
385 gross 797
386     // buffer for normal vectors used by function spaces
387 ksteube 1312 BufferMapType m_normal_buffer;
388 gross 797
389     // buffer for normal element size used by function spaces
390 ksteube 1312 BufferMapType m_size_buffer;
391 gross 797
392 jgs 82 };
393    
394     } // end of namespace
395 jgs 117
396 jgs 82 #endif

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.26