/[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 117 by jgs, Fri Apr 1 05:48:57 2005 UTC trunk/escript/src/AbstractDomain.h revision 1137 by gross, Thu May 10 08:11:31 2007 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 "system_dep.h"
19    
20  #include <string>  #include <string>
21  #include <utility>  #include <map>
22    #include <boost/python/dict.hpp>
23    #include <boost/python/str.hpp>
24    
25  namespace escript {  namespace escript {
26    // class forward declarations
 //  
 // forward declarations of certain classes which will be used  
27  class Data;  class Data;
 class AbstractSystemMatrix;  
 class FunctionSpace;  
   
28  /**  /**
29     \brief     \brief
30     Base class for all escript domains.     Base class for all escript domains.
# Line 39  class AbstractDomain { Line 37  class AbstractDomain {
37    
38   public:   public:
39    
40      
41       // structure holding values for X, size and normal
42       typedef int StatusType;
43       // struct ValueBuffer
44       // {
45       //    StatusType m_status;
46       //    boost::shared_ptr<Data> m_data;
47       //};
48       // typedef struct ValueBuffer ValueBuffer;
49    
50       //
51       // map from function space type code to value buffer
52       // typedef std::map<int, ValueBuffer> BufferMapType;
53    
54    
55    /**    /**
56       \brief       \brief
57       Default constructor for AbstractDomain.       Default constructor for AbstractDomain.
# Line 59  class AbstractDomain { Line 72  class AbstractDomain {
72       Throws:       Throws:
73       Describe any exceptions thrown.       Describe any exceptions thrown.
74    */    */
75      ESCRIPT_DLL_API
76    AbstractDomain();    AbstractDomain();
77    
78    /**    /**
# Line 68  class AbstractDomain { Line 82  class AbstractDomain {
82       Description:       Description:
83       Destructor for AbstractDomain.       Destructor for AbstractDomain.
84    */    */
85      ESCRIPT_DLL_API
86    virtual ~AbstractDomain();    virtual ~AbstractDomain();
87    
88    /**    /**
# Line 75  class AbstractDomain { Line 90  class AbstractDomain {
90       Returns true if the given integer is a valid function space type       Returns true if the given integer is a valid function space type
91       for this domain.       for this domain.
92    */    */
93      ESCRIPT_DLL_API
94    virtual bool isValidFunctionSpaceType(int functionSpaceType) const;    virtual bool isValidFunctionSpaceType(int functionSpaceType) const;
95    
96    /**    /**
97       \brief       \brief
98       Return a description for this domain.       Return a description for this domain.
99    */    */
100      ESCRIPT_DLL_API
101    virtual std::string getDescription() const;    virtual std::string getDescription() const;
102    
103    /**    /**
104       \brief       \brief
105         Return a description for this domain for python.
106      */
107      ESCRIPT_DLL_API
108      const boost::python::str str() const;
109      
110      /**
111         \brief
112       Return a description for the given function space type code.       Return a description for the given function space type code.
113    */    */
114      ESCRIPT_DLL_API
115    virtual std::string functionSpaceTypeAsString(int functionSpaceType) const;    virtual std::string functionSpaceTypeAsString(int functionSpaceType) const;
116    
117    /**    /**
# Line 95  class AbstractDomain { Line 120  class AbstractDomain {
120    
121        This has to be implemented by the actual Domain adapter.        This has to be implemented by the actual Domain adapter.
122    */    */
123      ESCRIPT_DLL_API
124    virtual int getDim() const;    virtual int getDim() const;
125    
126    /**    /**
127       \brief       \brief
128       Return true if given domains are equal.       Return true if given domains are equal.
129    */    */
130    bool operator==(const AbstractDomain& other) const;    ESCRIPT_DLL_API
131    bool operator!=(const AbstractDomain& other) const;    virtual bool operator==(const AbstractDomain& other) const;
132      ESCRIPT_DLL_API
133      virtual bool operator!=(const AbstractDomain& other) const;
134    
135    /**    /**
136       \brief       \brief
# Line 110  class AbstractDomain { Line 138  class AbstractDomain {
138    
139       This has to be implemented by the actual Domain adapter.       This has to be implemented by the actual Domain adapter.
140    */    */
141      ESCRIPT_DLL_API
142    virtual void write(const std::string& filename) const;    virtual void write(const std::string& filename) const;
143    
144    /**    /**
145       \brief       \brief
      Sets the tagList pointer and length of tag list numTags.  
   */  
   virtual void getTagList(int functionSpaceType, int** tagList, int* numTags) const;  
   
   /**  
      \brief  
      Sets the referenceNoList pointer and length of tag list numReferenceNo.  
   */  
   virtual void getReferenceNoList(int functionSpaceType, int** referenceNoList, int* numReferenceNo) const;  
   
   /**  
      \brief  
146       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.
147    
148       This has to be implemented by the actual Domain adapter.       This has to be implemented by the actual Domain adapter.
# Line 133  class AbstractDomain { Line 150  class AbstractDomain {
150       \param functionSpaceCode Input - Code for the function space type.       \param functionSpaceCode Input - Code for the function space type.
151       \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
152    */    */
153      ESCRIPT_DLL_API
154    virtual std::pair<int,int> getDataShape(int functionSpaceCode) const;    virtual std::pair<int,int> getDataShape(int functionSpaceCode) const;
155    
156    /**    /**
# Line 141  class AbstractDomain { Line 159  class AbstractDomain {
159       \param functionSpaceType Input - The function space type.       \param functionSpaceType Input - The function space type.
160       \param sampleNo Input - The sample number.       \param sampleNo Input - The sample number.
161    */    */
162      ESCRIPT_DLL_API
163    virtual int getTagFromSampleNo(int functionSpaceType, int sampleNo) const;    virtual int getTagFromSampleNo(int functionSpaceType, int sampleNo) const;
164    
165    /**    /**
166       \brief       \brief
167       Return the reference number of the given sample number.       sets a map from a clear tag name to a tag key
168         \param name Input - tag name.
169         \param tag Input - tag key.
170      */
171      ESCRIPT_DLL_API
172      virtual void setTagMap(const std::string& name,  int tag);
173    
174      /**
175         \brief
176         Return the tag key for tag name.
177         \param name Input - tag name
178      */
179      ESCRIPT_DLL_API
180      virtual int getTag(const std::string& name) const;
181    
182      /**
183         \brief
184         Returns True if name is a defined tag name
185         \param name Input - tag name
186      */
187      ESCRIPT_DLL_API
188      virtual bool isValidTagName(const std::string& name) const;
189    
190      /**
191         \brief
192         Returns all tag names in a single string sperated by commas
193      */
194      ESCRIPT_DLL_API
195      virtual std::string showTagNames() const;
196    
197      /**
198         \brief
199         Return a borrowed pointer to the sample reference number id list
200       \param functionSpaceType Input - The function space type.       \param functionSpaceType Input - The function space type.
      \param sampleNo Input - The sample number.  
201    */    */
202    virtual int getReferenceNoFromSampleNo(int functionSpaceType, int sampleNo) const;    ESCRIPT_DLL_API
203      virtual int* borrowSampleReferenceIDs(int functionSpaceType) const;
204    
205    /**    /**
206       \brief       \brief
# Line 157  class AbstractDomain { Line 208  class AbstractDomain {
208    
209       This has to be implemented by the actual Domain adapter.       This has to be implemented by the actual Domain adapter.
210    */    */
211      ESCRIPT_DLL_API
212    virtual void setNewX(const escript::Data& arg);    virtual void setNewX(const escript::Data& arg);
213    
214    /**    /**
# Line 165  class AbstractDomain { Line 217  class AbstractDomain {
217    
218       This has to be implemented by the actual Domain adapter.       This has to be implemented by the actual Domain adapter.
219    */    */
220      ESCRIPT_DLL_API
221    virtual void interpolateOnDomain(escript::Data& target,const escript::Data& source) const;    virtual void interpolateOnDomain(escript::Data& target,const escript::Data& source) const;
222      ESCRIPT_DLL_API
223    virtual bool probeInterpolationOnDomain(int functionSpaceType_source,int functionSpaceType_target) const;    virtual bool probeInterpolationOnDomain(int functionSpaceType_source,int functionSpaceType_target) const;
224    
225    /**    /**
# Line 174  class AbstractDomain { Line 228  class AbstractDomain {
228    
229       This has to be implemented by the actual Domain adapter.       This has to be implemented by the actual Domain adapter.
230    */    */
231      ESCRIPT_DLL_API
232    virtual void interpolateACross(escript::Data& target, const escript::Data& source) const;    virtual void interpolateACross(escript::Data& target, const escript::Data& source) const;
233      ESCRIPT_DLL_API
234    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;
235    
236    /**    /**
237       \brief       \brief
238       Returns locations in the domain. The function space is chosen appropriately.       Returns locations in the domain. The function space is chosen appropriately.
239    */    */
240      ESCRIPT_DLL_API
241    virtual escript::Data getX() const;    virtual escript::Data getX() const;
242    
243    /**    /**
244       \brief       \brief
245       Return boundary normals. The function space is chosen appropriately.       Return boundary normals. The function space is chosen appropriately.
246    */    */
247      ESCRIPT_DLL_API
248    virtual escript::Data getNormal() const;    virtual escript::Data getNormal() const;
249    
250    /**    /**
251       \brief       \brief
252       Returns the local size of samples. The function space is chosen appropriately.       Returns the local size of samples. The function space is chosen appropriately.
253    */    */
254      ESCRIPT_DLL_API
255    virtual escript::Data getSize() const;    virtual escript::Data getSize() const;
256        
257    /**    /**
# Line 203  class AbstractDomain { Line 262  class AbstractDomain {
262    
263       This has to be implemented by the actual Domain adapter.       This has to be implemented by the actual Domain adapter.
264    */    */
265      ESCRIPT_DLL_API
266    virtual void setToX(escript::Data& out) const;    virtual void setToX(escript::Data& out) const;
267    
268    /**    /**
# Line 213  class AbstractDomain { Line 273  class AbstractDomain {
273    
274       This has to be implemented by the actual Domain adapter.       This has to be implemented by the actual Domain adapter.
275    */    */
276      ESCRIPT_DLL_API
277    virtual void setToNormal(escript::Data& out) const;    virtual void setToNormal(escript::Data& out) const;
278    
279    /**    /**
# Line 223  class AbstractDomain { Line 284  class AbstractDomain {
284    
285       This has to be implemented by the actual Domain adapter.       This has to be implemented by the actual Domain adapter.
286    */    */
287      ESCRIPT_DLL_API
288    virtual void setToSize(escript::Data& out) const;    virtual void setToSize(escript::Data& out) const;
289    
290    /**    /**
# Line 232  class AbstractDomain { Line 294  class AbstractDomain {
294    
295       This has to be implemented by the actual Domain adapter.       This has to be implemented by the actual Domain adapter.
296    */    */
297      ESCRIPT_DLL_API
298    virtual void setToGradient(escript::Data& grad, const escript::Data& arg) const;    virtual void setToGradient(escript::Data& grad, const escript::Data& arg) const;
   
299    /**    /**
300       \brief       \brief
301       Saves data arg to an OpenDX input file.       Saves a dictonary of Data objects to an OpenDX input file. The keywords are used as identifier
      considered as cell centered data.  
302    
303       This has to be implemented by the actual Domain adapter.       This has to be implemented by the actual Domain adapter.
304    */    */
305    virtual void saveDX(const std::string& filename,const escript::Data& arg) const;    ESCRIPT_DLL_API
306      virtual void saveDX(const std::string& filename,const boost::python::dict& arg) const;
307    
308    /**    /**
309       \brief       \brief
310       saves data arg to a VTK input file.       Saves a dictonary of Data objects to an VTK XML input file. The keywords are used as identifier
      considered as cell centered data.  
311    
312       This has to be implemented by the actual Domain adapter.       This has to be implemented by the actual Domain adapter.
313    */    */
314    virtual void saveVTK(const std::string& filename,const escript::Data& arg) const;    ESCRIPT_DLL_API
315      virtual void saveVTK(const std::string& filename,const boost::python::dict& arg) const;
316    
317    /**    /**
318       \brief       \brief
# Line 262  class AbstractDomain { Line 324  class AbstractDomain {
324    //virtual vtkObject createVtkObject(int functionSpaceCode) const;    //virtual vtkObject createVtkObject(int functionSpaceCode) const;
325    
326    /**    /**
327         \brief assigns new tag newTag to all samples of functionspace with a positive
328         value of mask for any its sample point.
329    
330      */
331      ESCRIPT_DLL_API
332      virtual void setTags(const int functionSpaceType, const int newTag, const escript::Data& mask) const;
333    
334      /**
335       \brief       \brief
336       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
337       considered as cell centered data.       considered as cell centered data.
338    
339       This has to be implemented by the actual Domain adapter.       This has to be implemented by the actual Domain adapter.
340    */    */
341      ESCRIPT_DLL_API
342    virtual bool isCellOriented(int functionSpaceCode) const;    virtual bool isCellOriented(int functionSpaceCode) const;
343    
344    /**    /**
345       \brief       \brief
346         returns status of the domain.
347    
348         This has to be implemented by the actual Domain adapter.
349      */
350      ESCRIPT_DLL_API
351      virtual StatusType getStatus() const;
352    
353      /**
354         \brief
355       Throw a standard exception. This function is called if any attempt       Throw a standard exception. This function is called if any attempt
356       is made to use a base class function.       is made to use a base class function.
357    */    */
358      ESCRIPT_DLL_API
359    void throwStandardException(const std::string& functionName) const;    void throwStandardException(const std::string& functionName) const;
360    
361   protected:   protected:
362    
363   private:   private:
364    
365       // buffer for coordinates used by function spaces
366       //BufferMapType m_x_buffer;
367    
368       // buffer for normal vectors used by function spaces
369       //BufferMapType m_normal_buffer;
370    
371       // buffer for normal element size used by function spaces
372       //BufferMapType m_size_buffer;
373    
374  };  };
375    
376  } // end of namespace  } // end of namespace

Legend:
Removed from v.117  
changed lines
  Added in v.1137

  ViewVC Help
Powered by ViewVC 1.1.26