/[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/escript/src/AbstractDomain.h revision 547 by gross, Tue Feb 21 06:10:54 2006 UTC temp/escript/src/AbstractDomain.h revision 1387 by trankine, Fri Jan 11 07:45:26 2008 UTC
# Line 1  Line 1 
1  // $Id$  
2  /*  /* $Id$ */
3   ******************************************************************************  
4   *                                                                            *  /*******************************************************
5   *       COPYRIGHT  ACcESS 2004 -  All Rights Reserved                        *   *
6   *                                                                            *   *           Copyright 2003-2007 by ACceSS MNRF
7   * This software is the property of ACcESS. No part of this code              *   *       Copyright 2007 by University of Queensland
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          *   *                http://esscc.uq.edu.au
10   * by any unauthorised person is illegal unless that person has a software    *   *        Primary Business: Queensland, Australia
11   * license agreement with ACcESS.                                             *   *  Licensed under the Open Software License version 3.0
12   *                                                                            *   *     http://www.opensource.org/licenses/osl-3.0.php
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 "system_dep.h"
20    
21  #include <string>  #include <string>
22    #include <map>
23  #include <boost/python/dict.hpp>  #include <boost/python/dict.hpp>
24    
25  namespace escript {  namespace escript {
26    // class forward declarations
 //  
 // forward declarations  
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    /**    /**
89       \brief       \brief
90         return the number of processors used for this domain
91      */
92      ESCRIPT_DLL_API
93      virtual int getMPISize() const;
94      /**
95         \brief
96         return the number MPI rank of this processor
97      */
98    
99      ESCRIPT_DLL_API
100      virtual int getMPIRank() const;
101    
102    
103    
104      /**
105         \brief
106       Returns true if the given integer is a valid function space type       Returns true if the given integer is a valid function space type
107       for this domain.       for this domain.
108    */    */
109      ESCRIPT_DLL_API
110    virtual bool isValidFunctionSpaceType(int functionSpaceType) const;    virtual bool isValidFunctionSpaceType(int functionSpaceType) const;
111    
112    /**    /**
113       \brief       \brief
114       Return a description for this domain.       Return a description for this domain.
115    */    */
116      ESCRIPT_DLL_API
117    virtual std::string getDescription() const;    virtual std::string getDescription() const;
118    
119    /**    /**
120       \brief       \brief
121       Return a description for the given function space type code.       Return a description for the given function space type code.
122    */    */
123      ESCRIPT_DLL_API
124    virtual std::string functionSpaceTypeAsString(int functionSpaceType) const;    virtual std::string functionSpaceTypeAsString(int functionSpaceType) const;
125    
126    /**    /**
# Line 95  class AbstractDomain { Line 129  class AbstractDomain {
129    
130        This has to be implemented by the actual Domain adapter.        This has to be implemented by the actual Domain adapter.
131    */    */
132      ESCRIPT_DLL_API
133    virtual int getDim() const;    virtual int getDim() const;
134    
135    /**    /**
136       \brief       \brief
137       Return true if given domains are equal.       Return true if given domains are equal.
138    */    */
139      ESCRIPT_DLL_API
140    virtual bool operator==(const AbstractDomain& other) const;    virtual bool operator==(const AbstractDomain& other) const;
141      ESCRIPT_DLL_API
142    virtual bool operator!=(const AbstractDomain& other) const;    virtual bool operator!=(const AbstractDomain& other) const;
143    
144    /**    /**
# Line 110  class AbstractDomain { Line 147  class AbstractDomain {
147    
148       This has to be implemented by the actual Domain adapter.       This has to be implemented by the actual Domain adapter.
149    */    */
150      ESCRIPT_DLL_API
151    virtual void write(const std::string& filename) const;    virtual void write(const std::string& filename) const;
152    
153    /**    /**
154       \brief       \brief
155         dumps the domain to an external file filename.
156    
157         This has to be implemented by the actual Domain adapter.
158      */
159      ESCRIPT_DLL_API
160      virtual void dump(const std::string& filename) const;
161    
162      /**
163         \brief
164       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.
165    
166       This has to be implemented by the actual Domain adapter.       This has to be implemented by the actual Domain adapter.
# Line 121  class AbstractDomain { Line 168  class AbstractDomain {
168       \param functionSpaceCode Input - Code for the function space type.       \param functionSpaceCode Input - Code for the function space type.
169       \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
170    */    */
171      ESCRIPT_DLL_API
172    virtual std::pair<int,int> getDataShape(int functionSpaceCode) const;    virtual std::pair<int,int> getDataShape(int functionSpaceCode) const;
173    
174    /**    /**
# Line 129  class AbstractDomain { Line 177  class AbstractDomain {
177       \param functionSpaceType Input - The function space type.       \param functionSpaceType Input - The function space type.
178       \param sampleNo Input - The sample number.       \param sampleNo Input - The sample number.
179    */    */
180      ESCRIPT_DLL_API
181    virtual int getTagFromSampleNo(int functionSpaceType, int sampleNo) const;    virtual int getTagFromSampleNo(int functionSpaceType, int sampleNo) const;
182    
183    /**    /**
184       \brief       \brief
185       Return the reference number of the given sample number.       sets a map from a clear tag name to a tag key
186         \param name Input - tag name.
187         \param tag Input - tag key.
188      */
189      ESCRIPT_DLL_API
190      virtual void setTagMap(const std::string& name,  int tag);
191    
192      /**
193         \brief
194         Return the tag key for tag name.
195         \param name Input - tag name
196      */
197      ESCRIPT_DLL_API
198      virtual int getTag(const std::string& name) const;
199    
200      /**
201         \brief
202         Returns True if name is a defined tag name
203         \param name Input - tag name
204      */
205      ESCRIPT_DLL_API
206      virtual bool isValidTagName(const std::string& name) const;
207    
208      /**
209         \brief
210         Returns all tag names in a single string sperated by commas
211      */
212      ESCRIPT_DLL_API
213      virtual std::string showTagNames() const;
214    
215      /**
216         \brief
217         Return a borrowed pointer to the sample reference number id list
218       \param functionSpaceType Input - The function space type.       \param functionSpaceType Input - The function space type.
      \param sampleNo Input - The sample number.  
219    */    */
220    virtual int getReferenceNoFromSampleNo(int functionSpaceType, int sampleNo) const;    ESCRIPT_DLL_API
221      virtual int* borrowSampleReferenceIDs(int functionSpaceType) const;
222    
223    /**    /**
224       \brief       \brief
# Line 145  class AbstractDomain { Line 226  class AbstractDomain {
226    
227       This has to be implemented by the actual Domain adapter.       This has to be implemented by the actual Domain adapter.
228    */    */
229      ESCRIPT_DLL_API
230    virtual void setNewX(const escript::Data& arg);    virtual void setNewX(const escript::Data& arg);
231    
232    /**    /**
# Line 153  class AbstractDomain { Line 235  class AbstractDomain {
235    
236       This has to be implemented by the actual Domain adapter.       This has to be implemented by the actual Domain adapter.
237    */    */
238      ESCRIPT_DLL_API
239    virtual void interpolateOnDomain(escript::Data& target,const escript::Data& source) const;    virtual void interpolateOnDomain(escript::Data& target,const escript::Data& source) const;
240      ESCRIPT_DLL_API
241    virtual bool probeInterpolationOnDomain(int functionSpaceType_source,int functionSpaceType_target) const;    virtual bool probeInterpolationOnDomain(int functionSpaceType_source,int functionSpaceType_target) const;
242    
243    /**    /**
# Line 162  class AbstractDomain { Line 246  class AbstractDomain {
246    
247       This has to be implemented by the actual Domain adapter.       This has to be implemented by the actual Domain adapter.
248    */    */
249      ESCRIPT_DLL_API
250    virtual void interpolateACross(escript::Data& target, const escript::Data& source) const;    virtual void interpolateACross(escript::Data& target, const escript::Data& source) const;
251      ESCRIPT_DLL_API
252    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;
253    
254    /**    /**
255       \brief       \brief
256       Returns locations in the domain. The function space is chosen appropriately.       Returns locations in the domain. The function space is chosen appropriately.
257    */    */
258      ESCRIPT_DLL_API
259    virtual escript::Data getX() const;    virtual escript::Data getX() const;
260    
261    /**    /**
262       \brief       \brief
263       Return boundary normals. The function space is chosen appropriately.       Return boundary normals. The function space is chosen appropriately.
264    */    */
265      ESCRIPT_DLL_API
266    virtual escript::Data getNormal() const;    virtual escript::Data getNormal() const;
267    
268    /**    /**
269       \brief       \brief
270       Returns the local size of samples. The function space is chosen appropriately.       Returns the local size of samples. The function space is chosen appropriately.
271    */    */
272      ESCRIPT_DLL_API
273    virtual escript::Data getSize() const;    virtual escript::Data getSize() const;
274        
275    /**    /**
# Line 191  class AbstractDomain { Line 280  class AbstractDomain {
280    
281       This has to be implemented by the actual Domain adapter.       This has to be implemented by the actual Domain adapter.
282    */    */
283      ESCRIPT_DLL_API
284    virtual void setToX(escript::Data& out) const;    virtual void setToX(escript::Data& out) const;
285    
286    /**    /**
# Line 201  class AbstractDomain { Line 291  class AbstractDomain {
291    
292       This has to be implemented by the actual Domain adapter.       This has to be implemented by the actual Domain adapter.
293    */    */
294      ESCRIPT_DLL_API
295    virtual void setToNormal(escript::Data& out) const;    virtual void setToNormal(escript::Data& out) const;
296    
297    /**    /**
# Line 211  class AbstractDomain { Line 302  class AbstractDomain {
302    
303       This has to be implemented by the actual Domain adapter.       This has to be implemented by the actual Domain adapter.
304    */    */
305      ESCRIPT_DLL_API
306    virtual void setToSize(escript::Data& out) const;    virtual void setToSize(escript::Data& out) const;
307    
308    /**    /**
# Line 220  class AbstractDomain { Line 312  class AbstractDomain {
312    
313       This has to be implemented by the actual Domain adapter.       This has to be implemented by the actual Domain adapter.
314    */    */
315      ESCRIPT_DLL_API
316    virtual void setToGradient(escript::Data& grad, const escript::Data& arg) const;    virtual void setToGradient(escript::Data& grad, const escript::Data& arg) const;
317    /**    /**
318       \brief       \brief
# Line 227  class AbstractDomain { Line 320  class AbstractDomain {
320    
321       This has to be implemented by the actual Domain adapter.       This has to be implemented by the actual Domain adapter.
322    */    */
323      ESCRIPT_DLL_API
324    virtual void saveDX(const std::string& filename,const boost::python::dict& arg) const;    virtual void saveDX(const std::string& filename,const boost::python::dict& arg) const;
325    
326    /**    /**
# Line 235  class AbstractDomain { Line 329  class AbstractDomain {
329    
330       This has to be implemented by the actual Domain adapter.       This has to be implemented by the actual Domain adapter.
331    */    */
332      ESCRIPT_DLL_API
333    virtual void saveVTK(const std::string& filename,const boost::python::dict& arg) const;    virtual void saveVTK(const std::string& filename,const boost::python::dict& arg) const;
334    
335    /**    /**
# Line 247  class AbstractDomain { Line 342  class AbstractDomain {
342    //virtual vtkObject createVtkObject(int functionSpaceCode) const;    //virtual vtkObject createVtkObject(int functionSpaceCode) const;
343    
344    /**    /**
345         \brief assigns new tag newTag to all samples of functionspace with a positive
346         value of mask for any its sample point.
347    
348      */
349      ESCRIPT_DLL_API
350      virtual void setTags(const int functionSpaceType, const int newTag, const escript::Data& mask) const;
351    
352      /**
353       \brief       \brief
354       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
355       considered as cell centered data.       considered as cell centered data.
356    
357       This has to be implemented by the actual Domain adapter.       This has to be implemented by the actual Domain adapter.
358    */    */
359      ESCRIPT_DLL_API
360    virtual bool isCellOriented(int functionSpaceCode) const;    virtual bool isCellOriented(int functionSpaceCode) const;
361    
362    /**    /**
363       \brief       \brief
364         returns status of the domain.
365    
366         This has to be implemented by the actual Domain adapter.
367      */
368      ESCRIPT_DLL_API
369      virtual StatusType getStatus() const;
370    
371      /**
372         \brief
373       Throw a standard exception. This function is called if any attempt       Throw a standard exception. This function is called if any attempt
374       is made to use a base class function.       is made to use a base class function.
375    */    */
376      ESCRIPT_DLL_API
377    void throwStandardException(const std::string& functionName) const;    void throwStandardException(const std::string& functionName) const;
378    
379   protected:   protected:
380    
381   private:   private:
382    
383       // buffer for coordinates used by function spaces
384       BufferMapType m_x_buffer;
385    
386       // buffer for normal vectors used by function spaces
387       BufferMapType m_normal_buffer;
388    
389       // buffer for normal element size used by function spaces
390       BufferMapType m_size_buffer;
391    
392  };  };
393    
394  } // end of namespace  } // end of namespace

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

  ViewVC Help
Powered by ViewVC 1.1.26