/[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 2644 by jfenwick, Wed Sep 2 04:14:03 2009 UTC
# Line 1  Line 1 
1    
 /* $Id$ */  
   
2  /*******************************************************  /*******************************************************
3   *  *
4   *           Copyright 2003-2007 by ACceSS MNRF  * Copyright (c) 2003-2009 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    
22  #include <boost/python/numeric.hpp>  #include <boost/python/numeric.hpp>
23    
# Line 33  namespace escript { Line 32  namespace escript {
32     DataConstant stores a single data point which represents the entire     DataConstant stores a single data point which represents the entire
33     function space.     function space.
34  */  */
35  class DataConstant : public DataAbstract  {  class DataConstant : public DataReady  {
36    typedef DataReady parent;
37   public:   public:
38    
39    /**    /**
# Line 48  class DataConstant : public DataAbstract Line 47  class DataConstant : public DataAbstract
47       \param what - Input - A description of what this data object represents.       \param what - Input - A description of what this data object represents.
48    */    */
49    ESCRIPT_DLL_API    ESCRIPT_DLL_API
50    DataConstant(const boost::python::numeric::array& value,    DataConstant(const WrappedArray& value,
51                 const FunctionSpace& what);                 const FunctionSpace& what);
52    
53    
54    /**    /**
55       \brief       \brief
56       Copy constructor. Performs a deep copy.       Copy constructor. Performs a deep copy.
# Line 58  class DataConstant : public DataAbstract Line 58  class DataConstant : public DataAbstract
58    ESCRIPT_DLL_API    ESCRIPT_DLL_API
59    DataConstant(const DataConstant& other);    DataConstant(const DataConstant& other);
60    
   /**  
      \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);  
61    
62    /**    /**
63       \brief       \brief
# Line 82  class DataConstant : public DataAbstract Line 70  class DataConstant : public DataAbstract
70    */    */
71    ESCRIPT_DLL_API    ESCRIPT_DLL_API
72    DataConstant(const DataConstant& other,    DataConstant(const DataConstant& other,
73                 const DataArrayView::RegionType& region);                 const DataTypes::RegionType& region);
74    
75    /**    /**
76       \brief       \brief
# Line 96  class DataConstant : public DataAbstract Line 84  class DataConstant : public DataAbstract
84    */    */
85    ESCRIPT_DLL_API    ESCRIPT_DLL_API
86    DataConstant(const FunctionSpace& what,    DataConstant(const FunctionSpace& what,
87                 const DataArrayView::ShapeType &shape,                 const DataTypes::ShapeType &shape,
88                 const DataArrayView::ValueType &data);                 const DataTypes::ValueType &data);
89    
90    
91      ESCRIPT_DLL_API
92      bool
93      isConstant() const
94      {
95        return true;
96      };
97    
98    /**    /**
99       \brief       \brief
# Line 106  class DataConstant : public DataAbstract Line 102  class DataConstant : public DataAbstract
102    ESCRIPT_DLL_API    ESCRIPT_DLL_API
103    std::string    std::string
104    toString() const;    toString() const;
105    
106      /**
107         \brief Return a deep copy of the current object.
108      */
109      ESCRIPT_DLL_API
110      virtual
111      DataAbstract*
112      deepCopy();
113    
114    
115   /**   /**
116       \brief       \brief
117       dumps the object into a netCDF file       dumps the object into a netCDF file
# Line 135  class DataConstant : public DataAbstract Line 141  class DataConstant : public DataAbstract
141     */     */
142    ESCRIPT_DLL_API    ESCRIPT_DLL_API
143    virtual    virtual
144    DataArrayView::ValueType::size_type    DataTypes::ValueType::size_type
145    getPointOffset(int sampleNo,    getPointOffset(int sampleNo,
146                   int dataPointNo) const;                   int dataPointNo) const;
147    
   /**  
      \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.  
   */  
148    ESCRIPT_DLL_API    ESCRIPT_DLL_API
149    virtual    virtual
150    DataArrayView    DataTypes::ValueType::size_type
151    getDataPoint(int sampleNo,    getPointOffset(int sampleNo,
152                 int dataPointNo);                   int dataPointNo);
153    
154    /**    /**
155       \brief       \brief
# Line 157  class DataConstant : public DataAbstract Line 157  class DataConstant : public DataAbstract
157    */    */
158    ESCRIPT_DLL_API    ESCRIPT_DLL_API
159    virtual    virtual
160    DataArrayView::ValueType::size_type    DataTypes::ValueType::size_type
161    getLength() const;    getLength() const;
162    
163    /**    /**
# Line 170  class DataConstant : public DataAbstract Line 170  class DataConstant : public DataAbstract
170    ESCRIPT_DLL_API    ESCRIPT_DLL_API
171    virtual    virtual
172    DataAbstract*    DataAbstract*
173    getSlice(const DataArrayView::RegionType& region) const;    getSlice(const DataTypes::RegionType& region) const;
174    
175    /**    /**
176       \brief       \brief
# Line 182  class DataConstant : public DataAbstract Line 182  class DataConstant : public DataAbstract
182    virtual    virtual
183    void    void
184    setSlice(const DataAbstract* value,    setSlice(const DataAbstract* value,
185             const DataArrayView::RegionType& region);             const DataTypes::RegionType& region);
186    
   /**  
     \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);  
187    
188    /**    /**
189       \brief       \brief
# Line 236  class DataConstant : public DataAbstract Line 212  class DataConstant : public DataAbstract
212       Computes the trace of a matrix       Computes the trace of a matrix
213    
214       \param ev - Output - trace of matrix       \param ev - Output - trace of matrix
215         \param axis_offset
216    
217    */    */
218    ESCRIPT_DLL_API    ESCRIPT_DLL_API
# Line 247  class DataConstant : public DataAbstract Line 224  class DataConstant : public DataAbstract
224       Transpose each data point of this Data object around the given axis.       Transpose each data point of this Data object around the given axis.
225    
226       \param ev - Output - transpose of matrix       \param ev - Output - transpose of matrix
227         \param axis_offset
228    */    */
229    ESCRIPT_DLL_API    ESCRIPT_DLL_API
230    virtual void    virtual void
# Line 258  class DataConstant : public DataAbstract Line 235  class DataConstant : public DataAbstract
235       swaps components axis0 and axis1       swaps components axis0 and axis1
236    
237       \param ev - Output - swapped components       \param ev - Output - swapped components
238         \param axis0
239         \param axis1
240    */    */
241    ESCRIPT_DLL_API    ESCRIPT_DLL_API
242    virtual void    virtual void
# Line 292  class DataConstant : public DataAbstract Line 270  class DataConstant : public DataAbstract
270    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);
271    
272    
273      /**
274         \brief
275         Return a reference to the underlying DataVector.
276      */
277      ESCRIPT_DLL_API
278      DataTypes::ValueType&
279      getVectorRW();
280    
281    
282      ESCRIPT_DLL_API
283      const DataTypes::ValueType&
284      getVectorRO() const;
285    
286   protected:   protected:
287    
288   private:   private:
289    //    //
290    // the actual data    // the actual data
291    DataArrayView::ValueType m_data;    DataTypes::ValueType m_data;
292    
293  };  };
294    

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

  ViewVC Help
Powered by ViewVC 1.1.26