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

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

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

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

Legend:
Removed from v.104  
changed lines
  Added in v.547

  ViewVC Help
Powered by ViewVC 1.1.26