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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 155 - (show annotations)
Wed Nov 9 02:02:19 2005 UTC (14 years, 1 month ago) by jgs
Original Path: trunk/escript/src/Data/AbstractDomain.h
File MIME type: text/plain
File size: 8544 byte(s)
move all directories from trunk/esys2 into trunk and remove esys2

1 // $Id$
2 /*
3 ******************************************************************************
4 * *
5 * COPYRIGHT ACcESS 2004 - All Rights Reserved *
6 * *
7 * This software is the property of ACcESS. No part of this code *
8 * may be copied in any form or by any means without the expressed written *
9 * consent of ACcESS. Copying, use or modification of this software *
10 * by any unauthorised person is illegal unless that person has a software *
11 * license agreement with ACcESS. *
12 * *
13 ******************************************************************************
14 */
15
16 #if !defined escript_AbstractDomain_20040609_H
17 #define escript_AbstractDomain_20040609_H
18
19 #include <string>
20 #include <utility>
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 AbstractDomain();
64
65 /**
66 \brief
67 Destructor for AbstractDomain.
68
69 Description:
70 Destructor for AbstractDomain.
71 */
72 virtual ~AbstractDomain();
73
74 /**
75 \brief
76 Returns true if the given integer is a valid function space type
77 for this domain.
78 */
79 virtual bool isValidFunctionSpaceType(int functionSpaceType) const;
80
81 /**
82 \brief
83 Return a description for this domain.
84 */
85 virtual std::string getDescription() const;
86
87 /**
88 \brief
89 Return a description for the given function space type code.
90 */
91 virtual std::string functionSpaceTypeAsString(int functionSpaceType) const;
92
93 /**
94 \brief
95 Returns the spatial dimension of the domain.
96
97 This has to be implemented by the actual Domain adapter.
98 */
99 virtual int getDim() const;
100
101 /**
102 \brief
103 Return true if given domains are equal.
104 */
105 virtual bool operator==(const AbstractDomain& other) const;
106 virtual bool operator!=(const AbstractDomain& other) const;
107
108 /**
109 \brief
110 Writes the domain to an external file filename.
111
112 This has to be implemented by the actual Domain adapter.
113 */
114 virtual void write(const std::string& filename) const;
115
116 /**
117 \brief
118 Sets the tagList pointer and length of tag list numTags.
119 */
120 virtual void getTagList(int functionSpaceType, int** tagList, int* numTags) const;
121
122 /**
123 \brief
124 Sets the referenceNoList pointer and length of tag list numReferenceNo.
125 */
126 virtual void getReferenceNoList(int functionSpaceType, int** referenceNoList, int* numReferenceNo) const;
127
128 /**
129 \brief
130 Return the number of data points per sample, and the number of samples as a pair.
131
132 This has to be implemented by the actual Domain adapter.
133
134 \param functionSpaceCode Input - Code for the function space type.
135 \return pair, first - number of data points per sample, second - number of samples
136 */
137 virtual std::pair<int,int> getDataShape(int functionSpaceCode) const;
138
139 /**
140 \brief
141 Return the tag key for the given sample number.
142 \param functionSpaceType Input - The function space type.
143 \param sampleNo Input - The sample number.
144 */
145 virtual int getTagFromSampleNo(int functionSpaceType, int sampleNo) const;
146
147 /**
148 \brief
149 Return the reference number of the given sample number.
150 \param functionSpaceType Input - The function space type.
151 \param sampleNo Input - The sample number.
152 */
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 virtual void setNewX(const escript::Data& arg);
162
163 /**
164 \brief
165 Interpolates data given on source onto target where source and target have to be given on the same domain.
166
167 This has to be implemented by the actual Domain adapter.
168 */
169 virtual void interpolateOnDomain(escript::Data& target,const escript::Data& source) const;
170 virtual bool probeInterpolationOnDomain(int functionSpaceType_source,int functionSpaceType_target) const;
171
172 /**
173 \brief
174 Interpolates data given on source onto target where source and target are given on different domains.
175
176 This has to be implemented by the actual Domain adapter.
177 */
178 virtual void interpolateACross(escript::Data& target, const escript::Data& source) const;
179 virtual bool probeInterpolationACross(int functionSpaceType_source,const AbstractDomain& targetDomain, int functionSpaceType_target) const;
180
181 /**
182 \brief
183 Returns locations in the domain. The function space is chosen appropriately.
184 */
185 virtual escript::Data getX() const;
186
187 /**
188 \brief
189 Return boundary normals. The function space is chosen appropriately.
190 */
191 virtual escript::Data getNormal() const;
192
193 /**
194 \brief
195 Returns the local size of samples. The function space is chosen appropriately.
196 */
197 virtual escript::Data getSize() const;
198
199 /**
200 \brief
201 Copies the location of data points on the domain into out.
202 The actual function space to be considered
203 is defined by out. out has to be defined on this.
204
205 This has to be implemented by the actual Domain adapter.
206 */
207 virtual void setToX(escript::Data& out) const;
208
209 /**
210 \brief
211 Copies the surface normals at data points into out.
212 The actual function space to be considered
213 is defined by out. out has to be defined on this.
214
215 This has to be implemented by the actual Domain adapter.
216 */
217 virtual void setToNormal(escript::Data& out) const;
218
219 /**
220 \brief
221 Copies the size of samples into out. The actual
222 function space to be considered
223 is defined by out. out has to be defined on this.
224
225 This has to be implemented by the actual Domain adapter.
226 */
227 virtual void setToSize(escript::Data& out) const;
228
229 /**
230 \brief
231 Copies the gradient of arg into grad. The actual function space to be considered
232 for the gradient is defined by grad. arg and grad have to be defined on this.
233
234 This has to be implemented by the actual Domain adapter.
235 */
236 virtual void setToGradient(escript::Data& grad, const escript::Data& arg) const;
237 /**
238 \brief
239 Saves a dictonary of Data objects to an OpenDX input file. The keywords are used as identifier
240
241 This has to be implemented by the actual Domain adapter.
242 */
243 virtual void saveDX(const std::string& filename,const boost::python::dict& arg) const;
244
245 /**
246 \brief
247 Saves a dictonary of Data objects to an VTK XML input file. The keywords are used as identifier
248
249 This has to be implemented by the actual Domain adapter.
250 */
251 virtual void saveVTK(const std::string& filename,const boost::python::dict& arg) const;
252
253 /**
254 \brief
255 returns the function space representation of the type functionSpaceCode on this domain
256 as a vtkObject.
257
258 This has to be implemented by the actual Domain adapter.
259 */
260 //virtual vtkObject createVtkObject(int functionSpaceCode) const;
261
262 /**
263 \brief
264 returns true if data on this domain and a function space of type functionSpaceCode has to
265 considered as cell centered data.
266
267 This has to be implemented by the actual Domain adapter.
268 */
269 virtual bool isCellOriented(int functionSpaceCode) const;
270
271 /**
272 \brief
273 Throw a standard exception. This function is called if any attempt
274 is made to use a base class function.
275 */
276 void throwStandardException(const std::string& functionName) const;
277
278 protected:
279
280 private:
281
282 };
283
284 } // end of namespace
285
286 #endif

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.26