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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 480 - (hide annotations)
Wed Feb 1 05:15:12 2006 UTC (13 years, 7 months ago) by jgs
File MIME type: text/plain
File size: 8529 byte(s)
rationalise #includes and forward declarations

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

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.26