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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 153 - (hide annotations)
Tue Oct 25 01:51:20 2005 UTC (14 years, 1 month ago) by jgs
Original Path: trunk/esys2/escript/src/Data/AbstractDomain.h
File MIME type: text/plain
File size: 8544 byte(s)
Merge of development branch dev-02 back to main trunk on 2005-10-25

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

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.26