/[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 1802 by jfenwick, Tue Sep 23 01:03:29 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 <utility>  #include <map>
23    #include <boost/python/dict.hpp>
24    #include <boost/python/list.hpp>
25    #include "paso/Paso_MPI.h"
26    
27  namespace escript {  namespace escript {
28    // class forward declarations
 //  
 // forward declarations of certain classes which will be used  
29  class Data;  class Data;
 class AbstractSystemMatrix;  
 class FunctionSpace;  
   
30  /**  /**
31     \brief     \brief
32     Base class for all escript domains.     Base class for all escript domains.
# Line 39  class AbstractDomain { Line 39  class AbstractDomain {
39    
40   public:   public:
41    
42    
43       // structure holding values for X, size and normal
44       typedef int StatusType;
45       struct ValueBuffer
46       {
47           StatusType m_status;
48           boost::shared_ptr<Data> m_data;
49       };
50       typedef struct ValueBuffer ValueBuffer;
51    
52       //
53       // map from function space type code to value buffer
54       typedef std::map<int, ValueBuffer> BufferMapType;
55    
56    
57    /**    /**
58       \brief       \brief
59       Default constructor for AbstractDomain.       Default constructor for AbstractDomain.
# Line 59  class AbstractDomain { Line 74  class AbstractDomain {
74       Throws:       Throws:
75       Describe any exceptions thrown.       Describe any exceptions thrown.
76    */    */
77      ESCRIPT_DLL_API
78    AbstractDomain();    AbstractDomain();
79    
80    /**    /**
# Line 68  class AbstractDomain { Line 84  class AbstractDomain {
84       Description:       Description:
85       Destructor for AbstractDomain.       Destructor for AbstractDomain.
86    */    */
87      ESCRIPT_DLL_API
88    virtual ~AbstractDomain();    virtual ~AbstractDomain();
89    
90    /**    /**
91       \brief       \brief
92         return the number of processors used for this domain
93      */
94      ESCRIPT_DLL_API
95      virtual int getMPISize() const;
96      /**
97         \brief
98         return the number MPI rank of this processor
99      */
100    
101      ESCRIPT_DLL_API
102      virtual int getMPIRank() const;
103    
104    
105    
106      /**
107         \brief
108       Returns true if the given integer is a valid function space type       Returns true if the given integer is a valid function space type
109       for this domain.       for this domain.
110    */    */
111      ESCRIPT_DLL_API
112    virtual bool isValidFunctionSpaceType(int functionSpaceType) const;    virtual bool isValidFunctionSpaceType(int functionSpaceType) const;
113    
114    /**    /**
115       \brief       \brief
116       Return a description for this domain.       Return a description for this domain.
117    */    */
118      ESCRIPT_DLL_API
119    virtual std::string getDescription() const;    virtual std::string getDescription() const;
120    
121    /**    /**
122       \brief       \brief
123       Return a description for the given function space type code.       Return a description for the given function space type code.
124    */    */
125      ESCRIPT_DLL_API
126    virtual std::string functionSpaceTypeAsString(int functionSpaceType) const;    virtual std::string functionSpaceTypeAsString(int functionSpaceType) const;
127    
128    /**    /**
# Line 95  class AbstractDomain { Line 131  class AbstractDomain {
131    
132        This has to be implemented by the actual Domain adapter.        This has to be implemented by the actual Domain adapter.
133    */    */
134      ESCRIPT_DLL_API
135    virtual int getDim() const;    virtual int getDim() const;
136    
137    /**    /**
138       \brief       \brief
139       Return true if given domains are equal.       Return true if given domains are equal.
140    */    */
141    bool operator==(const AbstractDomain& other) const;    ESCRIPT_DLL_API
142    bool operator!=(const AbstractDomain& other) const;    virtual bool operator==(const AbstractDomain& other) const;
143      ESCRIPT_DLL_API
144      virtual bool operator!=(const AbstractDomain& other) const;
145    
146    /**    /**
147       \brief       \brief
# Line 110  class AbstractDomain { Line 149  class AbstractDomain {
149    
150       This has to be implemented by the actual Domain adapter.       This has to be implemented by the actual Domain adapter.
151    */    */
152      ESCRIPT_DLL_API
153    virtual void write(const std::string& filename) const;    virtual void write(const std::string& filename) const;
154    
155    /**    /**
156       \brief       \brief
157       Sets the tagList pointer and length of tag list numTags.       dumps the domain to an external file filename.
   */  
   virtual void getTagList(int functionSpaceType, int** tagList, int* numTags) const;  
158    
159    /**       This has to be implemented by the actual Domain adapter.
      \brief  
      Sets the referenceNoList pointer and length of tag list numReferenceNo.  
160    */    */
161    virtual void getReferenceNoList(int functionSpaceType, int** referenceNoList, int* numReferenceNo) const;    ESCRIPT_DLL_API
162      virtual void dump(const std::string& filename) const;
163    
164    /**    /**
165       \brief       \brief
# Line 133  class AbstractDomain { Line 170  class AbstractDomain {
170       \param functionSpaceCode Input - Code for the function space type.       \param functionSpaceCode Input - Code for the function space type.
171       \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
172    */    */
173      ESCRIPT_DLL_API
174    virtual std::pair<int,int> getDataShape(int functionSpaceCode) const;    virtual std::pair<int,int> getDataShape(int functionSpaceCode) const;
175    
176    /**    /**
# Line 141  class AbstractDomain { Line 179  class AbstractDomain {
179       \param functionSpaceType Input - The function space type.       \param functionSpaceType Input - The function space type.
180       \param sampleNo Input - The sample number.       \param sampleNo Input - The sample number.
181    */    */
182      ESCRIPT_DLL_API
183    virtual int getTagFromSampleNo(int functionSpaceType, int sampleNo) const;    virtual int getTagFromSampleNo(int functionSpaceType, int sampleNo) const;
184    
185    /**    /**
186       \brief       \brief
187       Return the reference number of the given sample number.       sets a map from a clear tag name to a tag key
188         \param name Input - tag name.
189         \param tag Input - tag key.
190      */
191      ESCRIPT_DLL_API
192      virtual void setTagMap(const std::string& name,  int tag);
193    
194      /**
195         \brief
196         Return the tag key for tag name.
197         \param name Input - tag name
198      */
199      ESCRIPT_DLL_API
200      virtual int getTag(const std::string& name) const;
201    
202      /**
203         \brief
204         Returns True if name is a defined tag name
205         \param name Input - tag name
206      */
207      ESCRIPT_DLL_API
208      virtual bool isValidTagName(const std::string& name) const;
209    
210      /**
211         \brief
212         Returns all tag names in a single string sperated by commas
213      */
214      ESCRIPT_DLL_API
215      virtual std::string showTagNames() const;
216    
217      /**
218         \brief
219         Return a borrowed pointer to the sample reference number id list
220       \param functionSpaceType Input - The function space type.       \param functionSpaceType Input - The function space type.
      \param sampleNo Input - The sample number.  
221    */    */
222    virtual int getReferenceNoFromSampleNo(int functionSpaceType, int sampleNo) const;    ESCRIPT_DLL_API
223      virtual int* borrowSampleReferenceIDs(int functionSpaceType) const;
224    
225    /**    /**
226       \brief       \brief
# Line 157  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 setNewX(const escript::Data& arg);    virtual void setNewX(const escript::Data& arg);
233    
234    /**    /**
# Line 165  class AbstractDomain { Line 237  class AbstractDomain {
237    
238       This has to be implemented by the actual Domain adapter.       This has to be implemented by the actual Domain adapter.
239    */    */
240      ESCRIPT_DLL_API
241    virtual void interpolateOnDomain(escript::Data& target,const escript::Data& source) const;    virtual void interpolateOnDomain(escript::Data& target,const escript::Data& source) const;
242      ESCRIPT_DLL_API
243    virtual bool probeInterpolationOnDomain(int functionSpaceType_source,int functionSpaceType_target) const;    virtual bool probeInterpolationOnDomain(int functionSpaceType_source,int functionSpaceType_target) const;
244    
245    /**    /**
# Line 174  class AbstractDomain { Line 248  class AbstractDomain {
248    
249       This has to be implemented by the actual Domain adapter.       This has to be implemented by the actual Domain adapter.
250    */    */
251      ESCRIPT_DLL_API
252    virtual void interpolateACross(escript::Data& target, const escript::Data& source) const;    virtual void interpolateACross(escript::Data& target, const escript::Data& source) const;
253      ESCRIPT_DLL_API
254    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;
255    
256    /**    /**
257       \brief       \brief
258       Returns locations in the domain. The function space is chosen appropriately.       Returns locations in the domain. The function space is chosen appropriately.
259    */    */
260      ESCRIPT_DLL_API
261    virtual escript::Data getX() const;    virtual escript::Data getX() const;
262    
263    /**    /**
264       \brief       \brief
265       Return boundary normals. The function space is chosen appropriately.       Return boundary normals. The function space is chosen appropriately.
266    */    */
267      ESCRIPT_DLL_API
268    virtual escript::Data getNormal() const;    virtual escript::Data getNormal() const;
269    
270    /**    /**
271       \brief       \brief
272       Returns the local size of samples. The function space is chosen appropriately.       Returns the local size of samples. The function space is chosen appropriately.
273    */    */
274      ESCRIPT_DLL_API
275    virtual escript::Data getSize() const;    virtual escript::Data getSize() const;
276        
277    /**    /**
# Line 203  class AbstractDomain { Line 282  class AbstractDomain {
282    
283       This has to be implemented by the actual Domain adapter.       This has to be implemented by the actual Domain adapter.
284    */    */
285      ESCRIPT_DLL_API
286    virtual void setToX(escript::Data& out) const;    virtual void setToX(escript::Data& out) const;
287    
288    /**    /**
# Line 213  class AbstractDomain { Line 293  class AbstractDomain {
293    
294       This has to be implemented by the actual Domain adapter.       This has to be implemented by the actual Domain adapter.
295    */    */
296      ESCRIPT_DLL_API
297    virtual void setToNormal(escript::Data& out) const;    virtual void setToNormal(escript::Data& out) const;
298    
299    /**    /**
# Line 223  class AbstractDomain { Line 304  class AbstractDomain {
304    
305       This has to be implemented by the actual Domain adapter.       This has to be implemented by the actual Domain adapter.
306    */    */
307      ESCRIPT_DLL_API
308    virtual void setToSize(escript::Data& out) const;    virtual void setToSize(escript::Data& out) const;
309    
310    /**    /**
# Line 232  class AbstractDomain { Line 314  class AbstractDomain {
314    
315       This has to be implemented by the actual Domain adapter.       This has to be implemented by the actual Domain adapter.
316    */    */
317      ESCRIPT_DLL_API
318    virtual void setToGradient(escript::Data& grad, const escript::Data& arg) const;    virtual void setToGradient(escript::Data& grad, const escript::Data& arg) const;
   
319    /**    /**
320       \brief       \brief
321       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.  
322    
323       This has to be implemented by the actual Domain adapter.       This has to be implemented by the actual Domain adapter.
324    */    */
325    virtual void saveDX(const std::string& filename,const escript::Data& arg) const;    ESCRIPT_DLL_API
326      virtual void saveDX(const std::string& filename,const boost::python::dict& arg) const;
327    
328    /**    /**
329       \brief       \brief
330       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.  
331    
332       This has to be implemented by the actual Domain adapter.       This has to be implemented by the actual Domain adapter.
333    */    */
334    virtual void saveVTK(const std::string& filename,const escript::Data& arg) const;    ESCRIPT_DLL_API
335      virtual void saveVTK(const std::string& filename,const boost::python::dict& arg) const;
336    
337    /**    /**
338       \brief       \brief
# Line 262  class AbstractDomain { Line 344  class AbstractDomain {
344    //virtual vtkObject createVtkObject(int functionSpaceCode) const;    //virtual vtkObject createVtkObject(int functionSpaceCode) const;
345    
346    /**    /**
347         \brief assigns new tag newTag to all samples of functionspace with a positive
348         value of mask for any its sample point.
349    
350      */
351      ESCRIPT_DLL_API
352      virtual void setTags(const int functionSpaceType, const int newTag, const escript::Data& mask) const;
353    
354      /**
355       \brief       \brief
356       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
357       considered as cell centered data.       considered as cell centered data.
358    
359       This has to be implemented by the actual Domain adapter.       This has to be implemented by the actual Domain adapter.
360    */    */
361      ESCRIPT_DLL_API
362    virtual bool isCellOriented(int functionSpaceCode) const;    virtual bool isCellOriented(int functionSpaceCode) const;
363    
364    /**    /**
365       \brief       \brief
366         returns status of the domain.
367    
368         This has to be implemented by the actual Domain adapter.
369      */
370      ESCRIPT_DLL_API
371      virtual StatusType getStatus() const;
372    
373      /**
374         \brief
375       Throw a standard exception. This function is called if any attempt       Throw a standard exception. This function is called if any attempt
376       is made to use a base class function.       is made to use a base class function.
377    */    */
378      ESCRIPT_DLL_API
379    void throwStandardException(const std::string& functionName) const;    void throwStandardException(const std::string& functionName) const;
380    
381      /**
382            \brief
383                      return the number of tags in use and a pointer to an array with the number of tags in use
384      */
385      ESCRIPT_DLL_API
386      virtual int getNumberOfTagsInUse(int functionSpaceCode) const;
387    
388      ESCRIPT_DLL_API
389      virtual int* borrowListOfTagsInUse(int functionSpaceCode) const;
390    
391      /**
392        \brief Checks if this domain allows tags for the specified functionSpaceCode.
393      */
394      ESCRIPT_DLL_API
395      virtual bool canTag(int functionspacecode) const;
396    
397   protected:   protected:
398    
399   private:   private:
400    
401       // buffer for coordinates used by function spaces
402       BufferMapType m_x_buffer;
403    
404       // buffer for normal vectors used by function spaces
405       BufferMapType m_normal_buffer;
406    
407       // buffer for normal element size used by function spaces
408       BufferMapType m_size_buffer;
409    
410  };  };
411    
412  } // end of namespace  } // end of namespace

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

  ViewVC Help
Powered by ViewVC 1.1.26