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

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

  ViewVC Help
Powered by ViewVC 1.1.26