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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 115 - (show annotations)
Fri Mar 4 07:12:47 2005 UTC (14 years, 6 months ago) by jgs
Original Path: trunk/esys2/escript/src/Data/AbstractDomain.h
File MIME type: text/plain
File size: 8379 byte(s)
*** empty log message ***

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
22 namespace escript {
23
24 // forward declarations of certain classes which will be used
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 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 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 Throw a standard exception. This function is called if any attempt
94 is made to use a base class function.
95 */
96 void throwStandardException(const std::string& functionName) const;
97
98 /**
99 \brief
100 Returns the spatial dimension of the domain.
101 has to be implemented by the actual Domain adapter.
102 */
103 virtual int getDim() const;
104
105 /**
106 \brief
107 Return true if given domains are equal.
108 */
109 bool operator==(const AbstractDomain& other) const;
110 bool operator!=(const AbstractDomain& other) const;
111
112 /**
113 \brief
114 Writes the doamin to an external file filename.
115 This has to be implemented by the actual Domain adapter.
116 */
117 virtual void write(const std::string& filename) const;
118
119 /**
120 \brief
121 Sets the tagList pointer and length of tag list numTags.
122 */
123 virtual void getTagList(int functionSpaceType, int** tagList, int* numTags) const;
124
125 /**
126 \brief
127 Sets the referenceNoList pointer and length of tag list numReferenceNo.
128 */
129 virtual void getReferenceNoList(int functionSpaceType, int** referenceNoList, int* numReferenceNo) const;
130
131 /**
132 \brief
133 Return the number of data points per sample, and the number of samples as a pair.
134 has to be implemented by the actual Domain adapter.
135 \param functionSpaceCode Input - Code for the function space type.
136 \return pair, first - number of data points per sample, second - number of samples
137 */
138 virtual std::pair<int,int> getDataShape(int functionSpaceCode) const;
139
140 /**
141 \brief
142 Return the tag key for the given sample number.
143 \param functionSpaceType Input - The function space type.
144 \param sampleNo Input - The sample number.
145 */
146 virtual int getTagFromSampleNo(int functionSpaceType, int sampleNo) const;
147
148 /**
149 \brief
150 Return the reference number of the given sample number.
151 \param functionSpaceType Input - The function space type.
152 \param sampleNo Input - The sample number.
153 */
154 virtual int getReferenceNoFromSampleNo(int functionSpaceType, int sampleNo) const;
155
156 /**
157 \brief
158 Assigns new location to the domain
159 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 has to be implemented by the actual Domain adapter.
167 */
168 virtual void interpolateOnDomain(escript::Data& target,const escript::Data& source) const;
169 virtual bool probeInterpolationOnDomain(int functionSpaceType_source,int functionSpaceType_target) const;
170
171 /**
172 \brief
173 Interpolates data given on source onto target where source and target are given on different domains.
174 has to be implemented by the actual Domain adapter.
175 */
176 virtual void interpolateACross(escript::Data& target, const escript::Data& source) const;
177 virtual bool probeInterpolationACross(int functionSpaceType_source,const AbstractDomain& targetDomain, int functionSpaceType_target) const;
178
179 /**
180 \brief returns locations in the domain. The function space is chosen appropriately.
181 */
182 virtual escript::Data getX() const;
183
184 /**
185 \brief return boundary normals. The function space is chosen appropriately.
186 */
187 virtual escript::Data getNormal() const;
188
189 /**
190 \brief returns the local size of samples. The function space is chosen appropriately.
191 */
192 virtual escript::Data getSize() const;
193
194 /**
195 \brief
196 Copies the location of data points on the domain into out.
197 The actual function space to be considered
198 is defined by out. out has to be defined on this.
199 has to be implemented by the actual Domain adapter.
200 */
201 virtual void setToX(escript::Data& out) const;
202
203 /**
204 \brief
205 Copies the surface normals at data points into out.
206 The actual function space to be considered
207 is defined by out. out has to be defined on this.
208 has to be implemented by the actual Domain adapter.
209 */
210 virtual void setToNormal(escript::Data& out) const;
211
212 /**
213 \brief
214 Copies the size of samples into out. The actual
215 function space to be considered
216 is defined by out. out has to be defined on this.
217 has to be implemented by the actual Domain adapter.
218 */
219 virtual void setToSize(escript::Data& out) const;
220
221 /**
222 \brief
223 Copies the gradient of arg into grad. The actual function space to be considered
224 for the gradient is defined by grad. arg and grad have to be defined on this.
225 has to be implemented by the actual Domain adapter.
226 */
227 virtual void setToGradient(escript::Data& grad, const escript::Data& arg) const;
228
229 /**
230 \brief
231 Saves data arg to an OpenDX input file.
232 considered as cell centered data.
233 has to be implemented by the actual Domain adapter.
234 */
235 virtual void saveDX(const std::string& filename,const escript::Data& arg) const;
236
237 /**
238 \brief
239 saves data arg to a VTK input file.
240 considered as cell centered data.
241 has to be implemented by the actual Domain adapter.
242 */
243 virtual void saveVTK(const std::string& filename,const escript::Data& arg) const;
244
245 /**
246 \brief
247 returns the function space representation of the type functionSpaceCode on this domain
248 as a vtkObject.
249 has to be implemented by the actual Domain adapter.
250 */
251 //virtual vtkObject createVtkObject(int functionSpaceCode) const;
252
253 /**
254 \brief
255 returns true if data on this domain and a function space of type functionSpaceCode has to
256 considered as cell centered data.
257 has to be implemented by the actual Domain adapter.
258 */
259 virtual bool isCellOriented(int functionSpaceCode) const;
260
261 protected:
262
263 private:
264
265 };
266
267 } // end of namespace
268 #endif

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.26