/[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/Data/AbstractDomain.h revision 155 by jgs, Wed Nov 9 02:02:19 2005 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 <utility>
21    #include <boost/python/dict.hpp>
22    
23  namespace escript {  namespace escript {
24    
25      class Data;  //
26      class AbstractSystemMatrix;  // forward declarations
27      class FunctionSpace;  class Data;
28    class AbstractSystemMatrix;
29    class FunctionSpace;
30    
31  /**  /**
32     \brief     \brief
33     Base class for all escript domains.     Base class for all escript domains.
# Line 31  namespace escript { Line 35  namespace escript {
35     Description:     Description:
36     Base class for all escript domains.     Base class for all escript domains.
37  */  */
38    
39  class AbstractDomain {  class AbstractDomain {
40    
41   public:   public:
42    
43    /**    /**
44       \brief       \brief
45       Default constructor for AbstractDomain       Default constructor for AbstractDomain.
46    
47       Description:       Description:
48       Default constructor for AbstractDomain. As the name suggests       Default constructor for AbstractDomain. As the name suggests
49       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
50       constructable avoid a boost.python wrapper class. A call to       constructable we avoid a boost.python wrapper class. A call to
51       almost any of the base class functions will throw an exception       almost any of the base class functions will throw an exception
52       as they are not intended to be used.       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:       Preconditions:
58       Describe any preconditions       Describe any preconditions.
59    
60       Throws:       Throws:
61       Describe any exceptions thrown       Describe any exceptions thrown.
62    */    */
63    AbstractDomain();    AbstractDomain();
64    
65    /**    /**
66       \brief       \brief
67       Destructor for AbstractDomain       Destructor for AbstractDomain.
68    
69       Description:       Description:
70       Destructor for AbstractDomain       Destructor for AbstractDomain.
71    */    */
72    virtual ~AbstractDomain();    virtual ~AbstractDomain();
73    
74    /**    /**
75       \brief       \brief
76       Returns true if the given integer is a valid function space type       Returns true if the given integer is a valid function space type
77       for this domain.       for this domain.
78    */    */
79    virtual bool isValidFunctionSpaceType(int functionSpaceType) const;    virtual bool isValidFunctionSpaceType(int functionSpaceType) const;
80    
81    /**    /**
82       \brief       \brief
83       Return a description for this domain       Return a description for this domain.
84    */    */
85    virtual std::string getDescription() const;    virtual std::string getDescription() const;
86    
87    /**    /**
88       \brief       \brief
89       Return a description for the given function space type code       Return a description for the given function space type code.
90    */    */
91    virtual std::string functionSpaceTypeAsString(int functionSpaceType) const;    virtual std::string functionSpaceTypeAsString(int functionSpaceType) const;
92    
93    /**    /**
94       \brief       \brief
95       Throw a standard exception. This function is called if any attempt        Returns the spatial dimension of the domain.
96       is made to use a base class function.  
97    */        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.  
98    */    */
99    virtual int getDim() const;    virtual int getDim() const;
100    
101    /**    /**
102     \brief       \brief
103     Return true if domains equal.       Return true if given domains are equal.
104    */    */
105    bool operator==(const AbstractDomain& other) const;    virtual bool operator==(const AbstractDomain& other) const;
106    bool operator!=(const AbstractDomain& other) const;    virtual bool operator!=(const AbstractDomain& other) const;
107    
108    /**    /**
109       \brief       \brief
110       writes the doamin to an external file filename.       Writes the domain to an external file filename.
111       has to be implemented by the actual Domain adapter.  
112         This has to be implemented by the actual Domain adapter.
113    */    */
114    virtual void write(const std::string& filename) const;    virtual void write(const std::string& filename) const;
115    
116    /**    /**
117       \brief       \brief
118       sets the tagList pointer and length of tag list numTags.       Sets the tagList pointer and length of tag list numTags.
      *tagList may be null in which case on tags are used for functionSpaceType on the Domain.  
      has to be implemented by the actual Domain adapter.  
119    */    */
120    virtual void getTagList(int functionSpaceType, int** tagList, int* numTags) const;    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       \brief
130       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.
131       has to be implemented by the actual Domain adapter.  
132         This has to be implemented by the actual Domain adapter.
133    
134       \param functionSpaceCode Input - Code for the function space type.       \param functionSpaceCode Input - Code for the function space type.
135       \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
136    */    */
# Line 127  class AbstractDomain { Line 143  class AbstractDomain {
143       \param sampleNo Input - The sample number.       \param sampleNo Input - The sample number.
144    */    */
145    virtual int getTagFromSampleNo(int functionSpaceType, int sampleNo) const;    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       \brief
157       assigns new location to the domain       Assigns new location to the domain.
158       has to be implemented by the actual Domain adapter.  
159         This has to be implemented by the actual Domain adapter.
160    */    */
161    virtual void setNewX(const escript::Data& arg);    virtual void setNewX(const escript::Data& arg);
162    
163    /**    /**
164       \brief       \brief
165       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.
166       has to be implemented by the actual Domain adapter.  
167         This has to be implemented by the actual Domain adapter.
168    */    */
169    virtual void interpolateOnDomain(escript::Data& target,const escript::Data& source) const;    virtual void interpolateOnDomain(escript::Data& target,const escript::Data& source) const;
170    virtual bool probeInterpolationOnDomain(int functionSpaceType_source,int functionSpaceType_target) const;    virtual bool probeInterpolationOnDomain(int functionSpaceType_source,int functionSpaceType_target) const;
171    
172    /**    /**
173       \brief       \brief
174       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.
175       has to be implemented by the actual Domain adapter.  
176         This has to be implemented by the actual Domain adapter.
177    */    */
178    virtual void interpolateACross(escript::Data& target, const escript::Data& source) const;    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;    virtual bool probeInterpolationACross(int functionSpaceType_source,const AbstractDomain& targetDomain, int functionSpaceType_target) const;
180    
181    /**    /**
182       \brief returns locations in the domain. The function space is chosen appropriatly.       \brief
183         Returns locations in the domain. The function space is chosen appropriately.
184    */    */
185    virtual escript::Data getX() const;    virtual escript::Data getX() const;
186    
187    /**    /**
188       \brief return boundary normals. The function space is chosen appropriatly.       \brief
189         Return boundary normals. The function space is chosen appropriately.
190    */    */
191    virtual escript::Data getNormal() const;    virtual escript::Data getNormal() const;
192    
193    /**    /**
194       \brief returns the local size od samples. The function space is chosen appropriatly.       \brief
195         Returns the local size of samples. The function space is chosen appropriately.
196    */    */
197    virtual escript::Data getSize() const;    virtual escript::Data getSize() const;
198        
199    /**    /**
200       \brief       \brief
201       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.
202         The actual function space to be considered
203       is defined by out. out has to be defined on this.       is defined by out. out has to be defined on this.
204       has to be implemented by the actual Domain adapter.  
205         This has to be implemented by the actual Domain adapter.
206    */    */
207    virtual void setToX(escript::Data& out) const;    virtual void setToX(escript::Data& out) const;
208    
209    /**    /**
210       \brief       \brief
211       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.
212         The actual function space to be considered
213       is defined by out. out has to be defined on this.       is defined by out. out has to be defined on this.
214       has to be implemented by the actual Domain adapter.  
215         This has to be implemented by the actual Domain adapter.
216    */    */
217    virtual void setToNormal(escript::Data& out) const;    virtual void setToNormal(escript::Data& out) const;
218    
219    /**    /**
220       \brief       \brief
221       copies the size of samples into out. The actual function space to be considered       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.       is defined by out. out has to be defined on this.
224       has to be implemented by the actual Domain adapter.  
225         This has to be implemented by the actual Domain adapter.
226    */    */
227    virtual void setToSize(escript::Data& out) const;    virtual void setToSize(escript::Data& out) const;
228    
229    /**    /**
230       \brief       \brief
231       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
232       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.
233       has to be implemented by the actual Domain adapter.  
234         This has to be implemented by the actual Domain adapter.
235    */    */
236    virtual void setToGradient(escript::Data& grad, const escript::Data& arg) const;    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       \brief
247       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
248       considered as cell centered data.  
249       has to be implemented by the actual Domain adapter.       This has to be implemented by the actual Domain adapter.
250    */    */
251    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;
252    
253    /**    /**
254       \brief       \brief
255       returns the function space representation of the type functionSpaceCode on this domain       returns the function space representation of the type functionSpaceCode on this domain
256       as a vtkObject.       as a vtkObject.
257       has to be implemented by the actual Domain adapter.  
258         This has to be implemented by the actual Domain adapter.
259    */    */
260    //virtual vtkObject createVtkObject(int functionSpaceCode) const;    //virtual vtkObject createVtkObject(int functionSpaceCode) const;
261    
262      /**    /**
263       \brief       \brief
264       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
265       considered as cell centered data.       considered as cell centered data.
266       has to be implemented by the actual Domain adapter.  
267         This has to be implemented by the actual Domain adapter.
268    */    */
269    virtual bool isCellOriented(int functionSpaceCode) const;    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:   protected:
279    
280   private:   private:
281    
282  };  };
283    
284  } // end of namespace  } // end of namespace
285    
286  #endif  #endif

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

  ViewVC Help
Powered by ViewVC 1.1.26