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

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

  ViewVC Help
Powered by ViewVC 1.1.26