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

Legend:
Removed from v.102  
changed lines
  Added in v.615

  ViewVC Help
Powered by ViewVC 1.1.26