/[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 757 by woo409, Mon Jun 26 13:12:56 2006 UTC revision 2742 by jfenwick, Thu Nov 12 06:03:37 2009 UTC
# Line 1  Line 1 
1  //$Id$  
2  /*  /*******************************************************
3   ************************************************************  *
4   *          Copyright 2006 by ACcESS MNRF                   *  * Copyright (c) 2003-2009 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 "DataReady.h"
20  #include "DataArrayView.h"  #include "WrappedArray.h"
21    
 #include <boost/python/numeric.hpp>  
22    
23  namespace escript {  namespace escript {
24    
# Line 31  namespace escript { Line 31  namespace escript {
31     DataConstant stores a single data point which represents the entire     DataConstant stores a single data point which represents the entire
32     function space.     function space.
33  */  */
34  class DataConstant : public DataAbstract  {  class DataConstant : public DataReady  {
35    typedef DataReady parent;
36   public:   public:
37    
38    /**    /**
# Line 46  class DataConstant : public DataAbstract Line 46  class DataConstant : public DataAbstract
46       \param what - Input - A description of what this data object represents.       \param what - Input - A description of what this data object represents.
47    */    */
48    ESCRIPT_DLL_API    ESCRIPT_DLL_API
49    DataConstant(const boost::python::numeric::array& value,    DataConstant(const WrappedArray& value,
50                 const FunctionSpace& what);                 const FunctionSpace& what);
51    
52    
53    /**    /**
54       \brief       \brief
55       Copy constructor. Performs a deep copy.       Copy constructor. Performs a deep copy.
# 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    
   /**  
      \brief  
      Alternative constructor for DataConstant objects.  
   
      Description:  
      Alternative Constructor for DataConstant objects.  
      \param value - Input - Data value for a single point.  
      \param what - Input - A description of what this data object represents.  
   */  
   ESCRIPT_DLL_API  
   DataConstant(const DataArrayView& value,  
                const FunctionSpace& what);  
60    
61    /**    /**
62       \brief       \brief
# Line 80  class DataConstant : public DataAbstract Line 69  class DataConstant : public DataAbstract
69    */    */
70    ESCRIPT_DLL_API    ESCRIPT_DLL_API
71    DataConstant(const DataConstant& other,    DataConstant(const DataConstant& other,
72                 const DataArrayView::RegionType& region);                 const DataTypes::RegionType& region);
73    
74    /**    /**
75       \brief       \brief
# Line 94  class DataConstant : public DataAbstract Line 83  class DataConstant : public DataAbstract
83    */    */
84    ESCRIPT_DLL_API    ESCRIPT_DLL_API
85    DataConstant(const FunctionSpace& what,    DataConstant(const FunctionSpace& what,
86                 const DataArrayView::ShapeType &shape,                 const DataTypes::ShapeType &shape,
87                 const DataArrayView::ValueType &data);                 const DataTypes::ValueType &data);
88    
89    
90      ESCRIPT_DLL_API
91      bool
92      isConstant() const
93      {
94        return true;
95      };
96    
97    /**    /**
98       \brief       \brief
# Line 106  class DataConstant : public DataAbstract Line 103  class DataConstant : public DataAbstract
103    toString() const;    toString() const;
104    
105    /**    /**
106         \brief Return a deep copy of the current object.
107      */
108      ESCRIPT_DLL_API
109      virtual
110      DataAbstract*
111      deepCopy();
112    
113    
114     /**
115         \brief
116         dumps the object into a netCDF file
117      */
118      ESCRIPT_DLL_API
119      virtual
120      void
121      dump(const std::string fileName) const;
122    
123     /**
124         \brief
125        sets all values to zero
126      */
127      ESCRIPT_DLL_API
128      virtual
129      void
130      setToZero();
131    
132      /**
133       \brief       \brief
134       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
135       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 140  class DataConstant : public DataAbstract
140     */     */
141    ESCRIPT_DLL_API    ESCRIPT_DLL_API
142    virtual    virtual
143    DataArrayView::ValueType::size_type    DataTypes::ValueType::size_type
144    getPointOffset(int sampleNo,    getPointOffset(int sampleNo,
145                   int dataPointNo) const;                   int dataPointNo) const;
146    
   /**  
      \brief  
      Return a view into the data for the data point specified.  
      \param sampleNo - Input - sample number.  
      \param dataPointNo - Input - data point number for the sample.  
   */  
147    ESCRIPT_DLL_API    ESCRIPT_DLL_API
148    virtual    virtual
149    DataArrayView    DataTypes::ValueType::size_type
150    getDataPoint(int sampleNo,    getPointOffset(int sampleNo,
151                 int dataPointNo);                   int dataPointNo);
152    
153    /**    /**
154       \brief       \brief
# Line 138  class DataConstant : public DataAbstract Line 156  class DataConstant : public DataAbstract
156    */    */
157    ESCRIPT_DLL_API    ESCRIPT_DLL_API
158    virtual    virtual
159    DataArrayView::ValueType::size_type    DataTypes::ValueType::size_type
160    getLength() const;    getLength() const;
161    
162    /**    /**
# Line 151  class DataConstant : public DataAbstract Line 169  class DataConstant : public DataAbstract
169    ESCRIPT_DLL_API    ESCRIPT_DLL_API
170    virtual    virtual
171    DataAbstract*    DataAbstract*
172    getSlice(const DataArrayView::RegionType& region) const;    getSlice(const DataTypes::RegionType& region) const;
173    
174    /**    /**
175       \brief       \brief
# Line 163  class DataConstant : public DataAbstract Line 181  class DataConstant : public DataAbstract
181    virtual    virtual
182    void    void
183    setSlice(const DataAbstract* value,    setSlice(const DataAbstract* value,
184             const DataArrayView::RegionType& region);             const DataTypes::RegionType& region);
185    
186    
187    /**    /**
188       \brief       \brief
189       Reshape the data point if the data point is currently rank 0.       Computes a symmetric matrix (A + AT) / 2
190       The original data point value is used for all values of the new  
191       data point.       \param ev - Output - symmetric matrix
192    
193    */    */
194    ESCRIPT_DLL_API    ESCRIPT_DLL_API
195    void    virtual void
196    reshapeDataPoint(const DataArrayView::ShapeType& shape);    symmetric(DataAbstract* ev);
197    
198    /**    /**
199      \brief       \brief
200      Archive the underlying data values to the file referenced       Computes a nonsymmetric matrix (A - AT) / 2
201      by ofstream. A count of the number of values expected to be written  
202      is provided as a cross-check.       \param ev - Output - nonsymmetric matrix
203    
     The return value indicates success (0) or otherwise (1).  
204    */    */
205    ESCRIPT_DLL_API    ESCRIPT_DLL_API
206    int    virtual void
207    archiveData(std::ofstream& archiveFile,    nonsymmetric(DataAbstract* ev);
               const DataArrayView::ValueType::size_type noValues) const;  
208    
209    /**    /**
210      \brief       \brief
211      Extract the number of values specified by noValues from the file       Computes the trace of a matrix
     referenced by ifstream to the underlying data structure.  
212    
213      The return value indicates success (0) or otherwise (1).       \param ev - Output - trace of matrix
214         \param axis_offset
215    
216      */
217      ESCRIPT_DLL_API
218      virtual void
219      trace(DataAbstract* ev, int axis_offset);
220    
221      /**
222         \brief
223         Transpose each data point of this Data object around the given axis.
224    
225         \param ev - Output - transpose of matrix
226         \param axis_offset
227    */    */
228    ESCRIPT_DLL_API    ESCRIPT_DLL_API
229    int    virtual void
230    extractData(std::ifstream& archiveFile,    transpose(DataAbstract* ev, int axis_offset);
231                const DataArrayView::ValueType::size_type noValues);  
232      /**
233         \brief
234         swaps components axis0 and axis1
235    
236         \param ev - Output - swapped components
237         \param axis0
238         \param axis1
239      */
240      ESCRIPT_DLL_API
241      virtual void
242      swapaxes(DataAbstract* ev, int axis0, int axis1);
243    
244    
245    /**    /**
246       \brief       \brief
# Line 227  class DataConstant : public DataAbstract Line 269  class DataConstant : public DataAbstract
269    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);
270    
271    
272      /**
273        \brief invert square matricies
274        \param out - Where to store the results
275      */
276      ESCRIPT_DLL_API
277      virtual void
278      matrixInverse(DataAbstract* out) const;
279    
280      /**
281         \brief
282         Return a reference to the underlying DataVector.
283      */
284      ESCRIPT_DLL_API
285      DataTypes::ValueType&
286      getVectorRW();
287    
288    
289      ESCRIPT_DLL_API
290      const DataTypes::ValueType&
291      getVectorRO() const;
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    

Legend:
Removed from v.757  
changed lines
  Added in v.2742

  ViewVC Help
Powered by ViewVC 1.1.26