/[escript]/trunk/escript/src/FunctionSpace.h
ViewVC logotype

Diff of /trunk/escript/src/FunctionSpace.h

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1425 by trankine, Fri Jan 11 07:45:58 2008 UTC revision 1426 by trankine, Wed Feb 27 06:12:15 2008 UTC
# Line 22  Line 22 
22    
23  #include <string>  #include <string>
24    
25    class FunctionSpaceTestCase;
26    
27  namespace escript {  namespace escript {
28    
29  //  //
# Line 40  class Data; Line 42  class Data;
42     template must satisfy.     template must satisfy.
43  */  */
44    
45  class ESCRIPT_DLL_API FunctionSpace {  class FunctionSpace {
46    
47      // These are using operator=()
48      friend class AbstractSystemMatrix;
49      friend class AbstractTransportProblem;
50      friend class ::FunctionSpaceTestCase;
51    
52   public:   public:
53    /**    /**
# Line 57  class ESCRIPT_DLL_API FunctionSpace { Line 64  class ESCRIPT_DLL_API FunctionSpace {
64       Throws:       Throws:
65       Describe any exceptions thrown.       Describe any exceptions thrown.
66    */    */
67      ESCRIPT_DLL_API
68    FunctionSpace();    FunctionSpace();
69    
70    /**    /**
# Line 70  class ESCRIPT_DLL_API FunctionSpace { Line 78  class ESCRIPT_DLL_API FunctionSpace {
78       for the lifetime of the FunctionSpace object. ie: domain must       for the lifetime of the FunctionSpace object. ie: domain must
79       be an externally managed object (!).       be an externally managed object (!).
80    */    */
81      ESCRIPT_DLL_API
82    FunctionSpace(const AbstractDomain& domain,    FunctionSpace(const AbstractDomain& domain,
83                  int functionSpaceType);                  int functionSpaceType);
84    
# Line 77  class ESCRIPT_DLL_API FunctionSpace { Line 86  class ESCRIPT_DLL_API FunctionSpace {
86      \brief      \brief
87      Return the function space type code.      Return the function space type code.
88    */    */
89      ESCRIPT_DLL_API
90    int    int
91    getTypeCode() const;    getTypeCode() const;
92    
# Line 84  class ESCRIPT_DLL_API FunctionSpace { Line 94  class ESCRIPT_DLL_API FunctionSpace {
94     \brief     \brief
95     Return the function space domain.     Return the function space domain.
96    */    */
97      ESCRIPT_DLL_API
98    const    const
99    AbstractDomain&    AbstractDomain&
100    getDomain() const;    getDomain() const;
101    
   /**  
    \brief  
    Assignment operator.  
    NOTE: Assignment copies the domain object pointer  
    as this object is managed externally to this class.  
   */  
   FunctionSpace&  
   operator=(const FunctionSpace& other);  
102    
103    
104    /**    /**
# Line 103  class ESCRIPT_DLL_API FunctionSpace { Line 106  class ESCRIPT_DLL_API FunctionSpace {
106       value of mask for any its sample point.       value of mask for any its sample point.
107    
108    */    */
109      ESCRIPT_DLL_API
110    void setTags(const int newTag, const escript::Data& mask) const;    void setTags(const int newTag, const escript::Data& mask) const;
111    
112    
# Line 110  class ESCRIPT_DLL_API FunctionSpace { Line 114  class ESCRIPT_DLL_API FunctionSpace {
114     \brief     \brief
115     Return the shape of the data needed to represent the function space.     Return the shape of the data needed to represent the function space.
116    */    */
117      ESCRIPT_DLL_API
118    std::pair<int,int>    std::pair<int,int>
119    getDataShape() const;    getDataShape() const;
120    
# Line 119  class ESCRIPT_DLL_API FunctionSpace { Line 124  class ESCRIPT_DLL_API FunctionSpace {
124     Return true if function spaces are equal.     Return true if function spaces are equal.
125     ie: Same domain and same function space type.     ie: Same domain and same function space type.
126    */    */
127      ESCRIPT_DLL_API
128    bool    bool
129    operator==(const FunctionSpace& other) const;    operator==(const FunctionSpace& other) const;
130    
131      ESCRIPT_DLL_API
132    bool    bool
133    operator!=(const FunctionSpace& other) const;    operator!=(const FunctionSpace& other) const;
134    
# Line 129  class ESCRIPT_DLL_API FunctionSpace { Line 136  class ESCRIPT_DLL_API FunctionSpace {
136     \brief     \brief
137     Return a text description of the function space.     Return a text description of the function space.
138    */    */
139    std::string    ESCRIPT_DLL_API
140      const std::string &
141    toString() const;    toString() const;
142    
143       //#define DEBUG_PY_STRINGS
144    
145    #ifdef DEBUG_PY_STRINGS
146      /**
147       \brief
148       Return a text description of the function space
149       as a python string.
150       NOTE: This code was used to debug a conversion of
151       std::string to python string problem on windows.
152       An alternative approach was sought.
153      */
154      ESCRIPT_DLL_API
155      PyObject *
156      toPyString() const;
157    #endif
158    
159    /**    /**
160     \brief     \brief
161     Return the tag associated with the given sample number.     Return the tag associated with the given sample number.
162    */    */
163      ESCRIPT_DLL_API
164    int    int
165    getTagFromSampleNo(int sampleNo) const;    getTagFromSampleNo(int sampleNo) const;
166    
# Line 143  class ESCRIPT_DLL_API FunctionSpace { Line 168  class ESCRIPT_DLL_API FunctionSpace {
168     \brief     \brief
169     Return the tag associated with the given data-point number.     Return the tag associated with the given data-point number.
170    */    */
171      ESCRIPT_DLL_API
172    int    int
173    getTagFromDataPointNo(int dataPointNo) const;    getTagFromDataPointNo(int dataPointNo) const;
174    
# Line 152  class ESCRIPT_DLL_API FunctionSpace { Line 178  class ESCRIPT_DLL_API FunctionSpace {
178     This function is not efficient. It is better to first call     This function is not efficient. It is better to first call
179     borrowSampleReferenceIDs and then when iterating over sampleNo to use sampleNo as an offset.     borrowSampleReferenceIDs and then when iterating over sampleNo to use sampleNo as an offset.
180    */    */
181      ESCRIPT_DLL_API
182    inline    inline
183    int    int
184    getReferenceIDOfSample(int sampleNo) const    getReferenceIDOfSample(int sampleNo) const
# Line 162  class ESCRIPT_DLL_API FunctionSpace { Line 189  class ESCRIPT_DLL_API FunctionSpace {
189     \brief     \brief
190     Return a borrowed reference to the list of sample reference IDs     Return a borrowed reference to the list of sample reference IDs
191    */    */
192      ESCRIPT_DLL_API
193    int*    int*
194    borrowSampleReferenceIDs() const;    borrowSampleReferenceIDs() const;
195    
# Line 169  class ESCRIPT_DLL_API FunctionSpace { Line 197  class ESCRIPT_DLL_API FunctionSpace {
197     \brief     \brief
198     Return the spatial locations of the data points.     Return the spatial locations of the data points.
199    */    */
200      ESCRIPT_DLL_API
201    escript::Data    escript::Data
202    getX() const;    getX() const;
203    
# Line 176  class ESCRIPT_DLL_API FunctionSpace { Line 205  class ESCRIPT_DLL_API FunctionSpace {
205     \brief     \brief
206     Return the surface normal field.     Return the surface normal field.
207    */    */
208      ESCRIPT_DLL_API
209    escript::Data    escript::Data
210    getNormal() const;    getNormal() const;
211    
# Line 183  class ESCRIPT_DLL_API FunctionSpace { Line 213  class ESCRIPT_DLL_API FunctionSpace {
213     \brief     \brief
214     Return the sample size (e.g. the diameter of elements, radius of particles).     Return the sample size (e.g. the diameter of elements, radius of particles).
215    */    */
216      ESCRIPT_DLL_API
217    escript::Data    escript::Data
218    getSize() const;    getSize() const;
219    
# Line 190  class ESCRIPT_DLL_API FunctionSpace { Line 221  class ESCRIPT_DLL_API FunctionSpace {
221     \brief     \brief
222     Return the number of samples.     Return the number of samples.
223    */    */
224      ESCRIPT_DLL_API
225    inline    inline
226    int    int
227    getNumSamples() const {    getNumSamples() const {
# Line 200  class ESCRIPT_DLL_API FunctionSpace { Line 232  class ESCRIPT_DLL_API FunctionSpace {
232     \brief     \brief
233     Return the number of data points per sample.     Return the number of data points per sample.
234    */    */
235      ESCRIPT_DLL_API
236    inline    inline
237    int    int
238    getNumDPPSample() const {    getNumDPPSample() const {
239       return getNumDataPointsPerSample();       return getNumDataPointsPerSample();
240    }    }
241    
242      ESCRIPT_DLL_API
243    inline    inline
244    int    int
245    getNumDataPointsPerSample() const {    getNumDataPointsPerSample() const {
# Line 216  class ESCRIPT_DLL_API FunctionSpace { Line 250  class ESCRIPT_DLL_API FunctionSpace {
250     \brief     \brief
251     Return the spatial dimension of the underlying domain.     Return the spatial dimension of the underlying domain.
252    */    */
253      ESCRIPT_DLL_API
254    inline    inline
255    int    int
256    getDim() const {    getDim() const {
# Line 225  class ESCRIPT_DLL_API FunctionSpace { Line 260  class ESCRIPT_DLL_API FunctionSpace {
260   protected:   protected:
261    
262   private:   private:
263      /**
264       \brief
265       Assignment operator.
266       NOTE: Assignment copies the domain object pointer
267       as this object is managed externally to this class.
268       NOTE Also, breaks the non-mutability of FunctionSpace
269       assumed by toString(). Allowing this would also have
270       unknown effects at the python level, and could
271       leave python with an incorrect view of the object.
272      */
273      // yes, yes I know, but the test case is in another
274      // linkage unit external to the dll.
275      // This IS supposed to be temporary.
276      ESCRIPT_DLL_API
277      FunctionSpace&
278      operator=(const FunctionSpace& other);
279    
280    //    //
281    // static null domain value    // static null domain value
282    static NullDomain m_nullDomainValue;    static const NullDomain nullDomainValue;
283    
284    //    //
285    // function space domain    // function space domain
# Line 238  class ESCRIPT_DLL_API FunctionSpace { Line 289  class ESCRIPT_DLL_API FunctionSpace {
289    // function space type code.    // function space type code.
290    int m_functionSpaceType;    int m_functionSpaceType;
291    
292      //
293      // return value of toString.
294      // made mutable for lazy initialisation in 1st call to toString.
295      // So, this is conceptually immutable, meaning it expects the FunctionSpace
296      // object to be immutable.
297      mutable std::string type_str;
298    
299  };  };
300    
301  } // end of namespace  } // end of namespace

Legend:
Removed from v.1425  
changed lines
  Added in v.1426

  ViewVC Help
Powered by ViewVC 1.1.26