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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 615 - (show annotations)
Wed Mar 22 02:12:00 2006 UTC (13 years, 8 months ago) by elspeth
File MIME type: text/plain
File size: 7828 byte(s)
More copyright information.

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

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.26