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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 767 - (show annotations)
Fri Jun 30 07:29:08 2006 UTC (13 years, 5 months ago) by gross
File MIME type: text/plain
File size: 8620 byte(s)
new FunctionSpace method setTags added
1 // $Id$
2 /*
3 ************************************************************
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 */
14
15 #if !defined escript_AbstractDomain_20040609_H
16 #define escript_AbstractDomain_20040609_H
17
18 #include "system_dep.h"
19
20 #include <string>
21 #include <boost/python/dict.hpp>
22
23 namespace escript {
24
25 //
26 // forward declarations
27 class Data;
28 //class AbstractSystemMatrix;
29 //class FunctionSpace;
30
31 /**
32 \brief
33 Base class for all escript domains.
34
35 Description:
36 Base class for all escript domains.
37 */
38
39 class AbstractDomain {
40
41 public:
42
43 /**
44 \brief
45 Default constructor for AbstractDomain.
46
47 Description:
48 Default constructor for AbstractDomain. As the name suggests
49 this is intended to be an abstract base class but by making it
50 constructable we avoid a boost.python wrapper class. A call to
51 almost any of the base class functions will throw an exception
52 as they are not intended to be used directly, but are overridden
53 by the underlying solver package which escript is linked to.
54
55 By default, this class is overridden by the class NullDomain.
56
57 Preconditions:
58 Describe any preconditions.
59
60 Throws:
61 Describe any exceptions thrown.
62 */
63 ESCRIPT_DLL_API
64 AbstractDomain();
65
66 /**
67 \brief
68 Destructor for AbstractDomain.
69
70 Description:
71 Destructor for AbstractDomain.
72 */
73 ESCRIPT_DLL_API
74 virtual ~AbstractDomain();
75
76 /**
77 \brief
78 Returns true if the given integer is a valid function space type
79 for this domain.
80 */
81 ESCRIPT_DLL_API
82 virtual bool isValidFunctionSpaceType(int functionSpaceType) const;
83
84 /**
85 \brief
86 Return a description for this domain.
87 */
88 ESCRIPT_DLL_API
89 virtual std::string getDescription() const;
90
91 /**
92 \brief
93 Return a description for the given function space type code.
94 */
95 ESCRIPT_DLL_API
96 virtual std::string functionSpaceTypeAsString(int functionSpaceType) const;
97
98 /**
99 \brief
100 Returns the spatial dimension of the domain.
101
102 This has to be implemented by the actual Domain adapter.
103 */
104 ESCRIPT_DLL_API
105 virtual int getDim() const;
106
107 /**
108 \brief
109 Return true if given domains are equal.
110 */
111 ESCRIPT_DLL_API
112 virtual bool operator==(const AbstractDomain& other) const;
113 ESCRIPT_DLL_API
114 virtual bool operator!=(const AbstractDomain& other) const;
115
116 /**
117 \brief
118 Writes the domain to an external file filename.
119
120 This has to be implemented by the actual Domain adapter.
121 */
122 ESCRIPT_DLL_API
123 virtual void write(const std::string& filename) const;
124
125 /**
126 \brief
127 Return the number of data points per sample, and the number of samples as a pair.
128
129 This has to be implemented by the actual Domain adapter.
130
131 \param functionSpaceCode Input - Code for the function space type.
132 \return pair, first - number of data points per sample, second - number of samples
133 */
134 ESCRIPT_DLL_API
135 virtual std::pair<int,int> getDataShape(int functionSpaceCode) const;
136
137 /**
138 \brief
139 Return the tag key for the given sample number.
140 \param functionSpaceType Input - The function space type.
141 \param sampleNo Input - The sample number.
142 */
143 ESCRIPT_DLL_API
144 virtual int getTagFromSampleNo(int functionSpaceType, int sampleNo) const;
145
146 /**
147 \brief
148 Return the reference number of the given sample number.
149 \param functionSpaceType Input - The function space type.
150 \param sampleNo Input - The sample number.
151 */
152 ESCRIPT_DLL_API
153 virtual int getReferenceNoFromSampleNo(int functionSpaceType, int sampleNo) const;
154
155 /**
156 \brief
157 Assigns new location to the domain.
158
159 This has to be implemented by the actual Domain adapter.
160 */
161 ESCRIPT_DLL_API
162 virtual void setNewX(const escript::Data& arg);
163
164 /**
165 \brief
166 Interpolates data given on source onto target where source and target have to be given on the same domain.
167
168 This has to be implemented by the actual Domain adapter.
169 */
170 ESCRIPT_DLL_API
171 virtual void interpolateOnDomain(escript::Data& target,const escript::Data& source) const;
172 ESCRIPT_DLL_API
173 virtual bool probeInterpolationOnDomain(int functionSpaceType_source,int functionSpaceType_target) const;
174
175 /**
176 \brief
177 Interpolates data given on source onto target where source and target are given on different domains.
178
179 This has to be implemented by the actual Domain adapter.
180 */
181 ESCRIPT_DLL_API
182 virtual void interpolateACross(escript::Data& target, const escript::Data& source) const;
183 ESCRIPT_DLL_API
184 virtual bool probeInterpolationACross(int functionSpaceType_source,const AbstractDomain& targetDomain, int functionSpaceType_target) const;
185
186 /**
187 \brief
188 Returns locations in the domain. The function space is chosen appropriately.
189 */
190 ESCRIPT_DLL_API
191 virtual escript::Data getX() const;
192
193 /**
194 \brief
195 Return boundary normals. The function space is chosen appropriately.
196 */
197 ESCRIPT_DLL_API
198 virtual escript::Data getNormal() const;
199
200 /**
201 \brief
202 Returns the local size of samples. The function space is chosen appropriately.
203 */
204 ESCRIPT_DLL_API
205 virtual escript::Data getSize() const;
206
207 /**
208 \brief
209 Copies the location of data points on the domain into out.
210 The actual function space to be considered
211 is defined by out. out has to be defined on this.
212
213 This has to be implemented by the actual Domain adapter.
214 */
215 ESCRIPT_DLL_API
216 virtual void setToX(escript::Data& out) const;
217
218 /**
219 \brief
220 Copies the surface normals at data points into out.
221 The actual function space to be considered
222 is defined by out. out has to be defined on this.
223
224 This has to be implemented by the actual Domain adapter.
225 */
226 ESCRIPT_DLL_API
227 virtual void setToNormal(escript::Data& out) const;
228
229 /**
230 \brief
231 Copies the size of samples into out. The actual
232 function space to be considered
233 is defined by out. out has to be defined on this.
234
235 This has to be implemented by the actual Domain adapter.
236 */
237 ESCRIPT_DLL_API
238 virtual void setToSize(escript::Data& out) const;
239
240 /**
241 \brief
242 Copies the gradient of arg into grad. The actual function space to be considered
243 for the gradient is defined by grad. arg and grad have to be defined on this.
244
245 This has to be implemented by the actual Domain adapter.
246 */
247 ESCRIPT_DLL_API
248 virtual void setToGradient(escript::Data& grad, const escript::Data& arg) const;
249 /**
250 \brief
251 Saves a dictonary of Data objects to an OpenDX input file. The keywords are used as identifier
252
253 This has to be implemented by the actual Domain adapter.
254 */
255 ESCRIPT_DLL_API
256 virtual void saveDX(const std::string& filename,const boost::python::dict& arg) const;
257
258 /**
259 \brief
260 Saves a dictonary of Data objects to an VTK XML input file. The keywords are used as identifier
261
262 This has to be implemented by the actual Domain adapter.
263 */
264 ESCRIPT_DLL_API
265 virtual void saveVTK(const std::string& filename,const boost::python::dict& arg) const;
266
267 /**
268 \brief
269 returns the function space representation of the type functionSpaceCode on this domain
270 as a vtkObject.
271
272 This has to be implemented by the actual Domain adapter.
273 */
274 //virtual vtkObject createVtkObject(int functionSpaceCode) const;
275
276 /**
277 \brief assigns new tag newTag to all samples of functionspace with a positive
278 value of mask for any its sample point.
279
280 */
281 ESCRIPT_DLL_API
282 virtual void setTags(const int functionSpaceType, const int newTag, const escript::Data& mask) const;
283
284 /**
285 \brief
286 returns true if data on this domain and a function space of type functionSpaceCode has to
287 considered as cell centered data.
288
289 This has to be implemented by the actual Domain adapter.
290 */
291 ESCRIPT_DLL_API
292 virtual bool isCellOriented(int functionSpaceCode) const;
293
294 /**
295 \brief
296 Throw a standard exception. This function is called if any attempt
297 is made to use a base class function.
298 */
299 ESCRIPT_DLL_API
300 void throwStandardException(const std::string& functionName) const;
301
302 protected:
303
304 private:
305
306 };
307
308 } // end of namespace
309
310 #endif

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.26