/[escript]/branches/trilinos_from_5897/escriptcore/src/DataConstant.h
ViewVC logotype

Diff of /branches/trilinos_from_5897/escriptcore/src/DataConstant.h

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

revision 1388 by trankine, Fri Jan 11 07:45:58 2008 UTC revision 3468 by jfenwick, Tue Feb 22 06:38:57 2011 UTC
# Line 1  Line 1 
1    
 /* $Id$ */  
   
2  /*******************************************************  /*******************************************************
3   *  *
4   *           Copyright 2003-2007 by ACceSS MNRF  * Copyright (c) 2003-2010 by University of Queensland
5   *       Copyright 2007 by University of Queensland  * Earth Systems Science Computational Center (ESSCC)
6   *  * http://www.uq.edu.au/esscc
7   *                http://esscc.uq.edu.au  *
8   *        Primary Business: Queensland, Australia  * Primary Business: Queensland, Australia
9   *  Licensed under the Open Software License version 3.0  * Licensed under the Open Software License version 3.0
10   *     http://www.opensource.org/licenses/osl-3.0.php  * 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 33  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 48  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 58  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 82  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 96  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      ESCRIPT_DLL_API
90      DataConstant(const FunctionSpace& what,
91                               const DataTypes::ShapeType &shape,
92                               const double v);
93              
94              
95      ESCRIPT_DLL_API
96      bool
97      isConstant() const
98      {
99        return true;
100      };
101    
102      /**
103      \brief Return true if the value contains a NaN.
104      */
105      ESCRIPT_DLL_API
106      bool
107      hasNaN() const;
108    
109    /**    /**
110       \brief       \brief
# Line 106  class DataConstant : public DataAbstract Line 113  class DataConstant : public DataAbstract
113    ESCRIPT_DLL_API    ESCRIPT_DLL_API
114    std::string    std::string
115    toString() const;    toString() const;
116    
117      /**
118         \brief Return a deep copy of the current object.
119      */
120      ESCRIPT_DLL_API
121      virtual
122      DataAbstract*
123      deepCopy();
124    
125    
126   /**   /**
127       \brief       \brief
128       dumps the object into a netCDF file       dumps the object into a netCDF file
# Line 135  class DataConstant : public DataAbstract Line 152  class DataConstant : public DataAbstract
152     */     */
153    ESCRIPT_DLL_API    ESCRIPT_DLL_API
154    virtual    virtual
155    DataArrayView::ValueType::size_type    DataTypes::ValueType::size_type
156    getPointOffset(int sampleNo,    getPointOffset(int sampleNo,
157                   int dataPointNo) const;                   int dataPointNo) const;
158    
   /**  
      \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.  
   */  
159    ESCRIPT_DLL_API    ESCRIPT_DLL_API
160    virtual    virtual
161    DataArrayView    DataTypes::ValueType::size_type
162    getDataPoint(int sampleNo,    getPointOffset(int sampleNo,
163                 int dataPointNo);                   int dataPointNo);
164    
165    /**    /**
166       \brief       \brief
# Line 157  class DataConstant : public DataAbstract Line 168  class DataConstant : public DataAbstract
168    */    */
169    ESCRIPT_DLL_API    ESCRIPT_DLL_API
170    virtual    virtual
171    DataArrayView::ValueType::size_type    DataTypes::ValueType::size_type
172    getLength() const;    getLength() const;
173    
174    /**    /**
# Line 170  class DataConstant : public DataAbstract Line 181  class DataConstant : public DataAbstract
181    ESCRIPT_DLL_API    ESCRIPT_DLL_API
182    virtual    virtual
183    DataAbstract*    DataAbstract*
184    getSlice(const DataArrayView::RegionType& region) const;    getSlice(const DataTypes::RegionType& region) const;
185    
186    /**    /**
187       \brief       \brief
# Line 182  class DataConstant : public DataAbstract Line 193  class DataConstant : public DataAbstract
193    virtual    virtual
194    void    void
195    setSlice(const DataAbstract* value,    setSlice(const DataAbstract* value,
196             const DataArrayView::RegionType& region);             const DataTypes::RegionType& region);
197    
   /**  
     \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.  
   
     The return value indicates success (0) or otherwise (1).  
   */  
   ESCRIPT_DLL_API  
   int  
   extractData(std::ifstream& archiveFile,  
               const DataArrayView::ValueType::size_type noValues);  
198    
199    /**    /**
200       \brief       \brief
# Line 236  class DataConstant : public DataAbstract Line 223  class DataConstant : public DataAbstract
223       Computes the trace of a matrix       Computes the trace of a matrix
224    
225       \param ev - Output - trace of matrix       \param ev - Output - trace of matrix
226         \param axis_offset
227    
228    */    */
229    ESCRIPT_DLL_API    ESCRIPT_DLL_API
# Line 247  class DataConstant : public DataAbstract Line 235  class DataConstant : public DataAbstract
235       Transpose each data point of this Data object around the given axis.       Transpose each data point of this Data object around the given axis.
236    
237       \param ev - Output - transpose of matrix       \param ev - Output - transpose of matrix
238         \param axis_offset
239    */    */
240    ESCRIPT_DLL_API    ESCRIPT_DLL_API
241    virtual void    virtual void
# Line 258  class DataConstant : public DataAbstract Line 246  class DataConstant : public DataAbstract
246       swaps components axis0 and axis1       swaps components axis0 and axis1
247    
248       \param ev - Output - swapped components       \param ev - Output - swapped components
249         \param axis0
250         \param axis1
251    */    */
252    ESCRIPT_DLL_API    ESCRIPT_DLL_API
253    virtual void    virtual void
# Line 292  class DataConstant : public DataAbstract Line 281  class DataConstant : public DataAbstract
281    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);
282    
283    
284      /**
285        \brief invert square matricies
286        \param out - Where to store the results
287        \return errorcode (0 indicates success)
288      */
289      ESCRIPT_DLL_API
290      virtual int
291      matrixInverse(DataAbstract* out) const;
292    
293      /**
294         \brief
295         Return a reference to the underlying DataVector.
296      */
297      ESCRIPT_DLL_API
298      DataTypes::ValueType&
299      getVectorRW();
300    
301    
302      ESCRIPT_DLL_API
303      const DataTypes::ValueType&
304      getVectorRO() const;
305    
306   protected:   protected:
307    
308   private:   private:
309    //    //
310    // the actual data    // the actual data
311    DataArrayView::ValueType m_data;    DataTypes::ValueType m_data;
312    
313  };  };
314    

Legend:
Removed from v.1388  
changed lines
  Added in v.3468

  ViewVC Help
Powered by ViewVC 1.1.26