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

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

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

revision 854 by gross, Thu Sep 21 05:29:42 2006 UTC revision 1799 by jfenwick, Wed Sep 17 06:33:18 2008 UTC
# Line 1  Line 1 
1  //$Id$  
2  /*  /* $Id$ */
3   ************************************************************  
4   *          Copyright 2006 by ACcESS MNRF                   *  /*******************************************************
5   *                                                          *   *
6   *              http://www.access.edu.au                    *   *           Copyright 2003-2007 by ACceSS MNRF
7   *       Primary Business: Queensland, Australia            *   *       Copyright 2007 by University of Queensland
8   *  Licensed under the Open Software License version 3.0    *   *
9   *     http://www.opensource.org/licenses/osl-3.0.php       *   *                http://esscc.uq.edu.au
10   *                                                          *   *        Primary Business: Queensland, Australia
11   ************************************************************   *  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_DataConstant_20040323_H  #if !defined escript_DataConstant_20040323_H
17  #define escript_DataConstant_20040323_H  #define escript_DataConstant_20040323_H
18  #include "system_dep.h"  #include "system_dep.h"
19    
20  #include "DataAbstract.h"  #include "DataAbstract.h"
 #include "DataArrayView.h"  
21    
22  #include <boost/python/numeric.hpp>  #include <boost/python/numeric.hpp>
23    
# Line 56  class DataConstant : public DataAbstract Line 57  class DataConstant : public DataAbstract
57    ESCRIPT_DLL_API    ESCRIPT_DLL_API
58    DataConstant(const DataConstant& other);    DataConstant(const DataConstant& other);
59    
60    /**  //  /**
61       \brief  /*     \brief
62       Alternative constructor for DataConstant objects.       Alternative constructor for DataConstant objects.
63    
64       Description:       Description:
65       Alternative Constructor for DataConstant objects.       Alternative Constructor for DataConstant objects.
66       \param value - Input - Data value for a single point.       \param value - Input - Data value for a single point.
67       \param what - Input - A description of what this data object represents.       \param what - Input - A description of what this data object represents.*/
68    */  //  */
69    ESCRIPT_DLL_API  //   ESCRIPT_DLL_API
70    DataConstant(const DataArrayView& value,  //   DataConstant(const DataArrayView& value,
71                 const FunctionSpace& what);  //                const FunctionSpace& what);
72    
73    /**    /**
74       \brief       \brief
# Line 80  class DataConstant : public DataAbstract Line 81  class DataConstant : public DataAbstract
81    */    */
82    ESCRIPT_DLL_API    ESCRIPT_DLL_API
83    DataConstant(const DataConstant& other,    DataConstant(const DataConstant& other,
84                 const DataArrayView::RegionType& region);                 const DataTypes::RegionType& region);
85    
86    /**    /**
87       \brief       \brief
# Line 94  class DataConstant : public DataAbstract Line 95  class DataConstant : public DataAbstract
95    */    */
96    ESCRIPT_DLL_API    ESCRIPT_DLL_API
97    DataConstant(const FunctionSpace& what,    DataConstant(const FunctionSpace& what,
98                 const DataArrayView::ShapeType &shape,                 const DataTypes::ShapeType &shape,
99                 const DataArrayView::ValueType &data);                 const DataTypes::ValueType &data);
100    
101    /**    /**
102       \brief       \brief
# Line 106  class DataConstant : public DataAbstract Line 107  class DataConstant : public DataAbstract
107    toString() const;    toString() const;
108    
109    /**    /**
110         \brief Return a deep copy of the current object.
111      */
112      ESCRIPT_DLL_API
113      virtual
114      DataAbstract*
115      deepCopy();
116    
117    
118     /**
119         \brief
120         dumps the object into a netCDF file
121      */
122      ESCRIPT_DLL_API
123      virtual
124      void
125      dump(const std::string fileName) const;
126    
127     /**
128         \brief
129        sets all values to zero
130      */
131      ESCRIPT_DLL_API
132      virtual
133      void
134      setToZero();
135    
136      /**
137       \brief       \brief
138       Return the offset for the given sample. This is a somewhat artificial notion       Return the offset for the given sample. This is a somewhat artificial notion
139       but returns the offset in bytes for the given point into the container       but returns the offset in bytes for the given point into the container
# Line 116  class DataConstant : public DataAbstract Line 144  class DataConstant : public DataAbstract
144     */     */
145    ESCRIPT_DLL_API    ESCRIPT_DLL_API
146    virtual    virtual
147    DataArrayView::ValueType::size_type    DataTypes::ValueType::size_type
148    getPointOffset(int sampleNo,    getPointOffset(int sampleNo,
149                   int dataPointNo) const;                   int dataPointNo) const;
150    
151    /**  //  /**
152       \brief  /*     \brief
153       Return a view into the data for the data point specified.       Return a view into the data for the data point specified.
154       \param sampleNo - Input - sample number.       \param sampleNo - Input - sample number.
155       \param dataPointNo - Input - data point number for the sample.       \param dataPointNo - Input - data point number for the sample.*/
156    */  //  */
157    ESCRIPT_DLL_API  //   ESCRIPT_DLL_API
158    virtual  //   virtual
159    DataArrayView  //   DataArrayView
160    getDataPoint(int sampleNo,  //   getDataPoint(int sampleNo,
161                 int dataPointNo);  //                int dataPointNo);
162    
163    /**    /**
164       \brief       \brief
# Line 138  class DataConstant : public DataAbstract Line 166  class DataConstant : public DataAbstract
166    */    */
167    ESCRIPT_DLL_API    ESCRIPT_DLL_API
168    virtual    virtual
169    DataArrayView::ValueType::size_type    DataTypes::ValueType::size_type
170    getLength() const;    getLength() const;
171    
172    /**    /**
# Line 151  class DataConstant : public DataAbstract Line 179  class DataConstant : public DataAbstract
179    ESCRIPT_DLL_API    ESCRIPT_DLL_API
180    virtual    virtual
181    DataAbstract*    DataAbstract*
182    getSlice(const DataArrayView::RegionType& region) const;    getSlice(const DataTypes::RegionType& region) const;
183    
184    /**    /**
185       \brief       \brief
# Line 163  class DataConstant : public DataAbstract Line 191  class DataConstant : public DataAbstract
191    virtual    virtual
192    void    void
193    setSlice(const DataAbstract* value,    setSlice(const DataAbstract* value,
194             const DataArrayView::RegionType& region);             const DataTypes::RegionType& region);
   
   /**  
     \brief  
     Archive the underlying data values to the file referenced  
     by ofstream. A count of the number of values expected to be written  
     is provided as a cross-check.  
   
     The return value indicates success (0) or otherwise (1).  
   */  
   ESCRIPT_DLL_API  
   int  
   archiveData(std::ofstream& archiveFile,  
               const DataArrayView::ValueType::size_type noValues) const;  
   
   /**  
     \brief  
     Extract the number of values specified by noValues from the file  
     referenced by ifstream to the underlying data structure.  
195    
     The return value indicates success (0) or otherwise (1).  
   */  
   ESCRIPT_DLL_API  
   int  
   extractData(std::ifstream& archiveFile,  
               const DataArrayView::ValueType::size_type noValues);  
196    
197    /**    /**
198       \brief       \brief
# Line 273  class DataConstant : public DataAbstract Line 277  class DataConstant : public DataAbstract
277    eigenvalues_and_eigenvectors(DataAbstract* ev,DataAbstract* V,const double tol=1.e-13);    eigenvalues_and_eigenvectors(DataAbstract* ev,DataAbstract* V,const double tol=1.e-13);
278    
279    
280      /**
281         \brief
282         Return a reference to the underlying DataVector.
283      */
284      ESCRIPT_DLL_API
285      DataTypes::ValueType&
286      getVector();
287    
288      ESCRIPT_DLL_API
289      const DataTypes::ValueType&
290      getVector() const;
291    
292    
293   protected:   protected:
294    
295   private:   private:
296    //    //
297    // the actual data    // the actual data
298    DataArrayView::ValueType m_data;    DataTypes::ValueType m_data;
299    
300  };  };
301    
302    inline
303    DataTypes::ValueType&
304    DataConstant::getVector()
305    {
306      return m_data;
307    }
308    
309    inline
310    const DataTypes::ValueType&
311    DataConstant::getVector() const
312    {
313      return m_data;
314    }
315    
316    
317  } // end of namespace  } // end of namespace
318  #endif  #endif

Legend:
Removed from v.854  
changed lines
  Added in v.1799

  ViewVC Help
Powered by ViewVC 1.1.26