/[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 2005 by jfenwick, Mon Nov 10 01:21:39 2008 UTC
# Line 1  Line 1 
1    
 /* $Id$ */  
   
2  /*******************************************************  /*******************************************************
3   *  *
4   *           Copyright 2003-2007 by ACceSS MNRF  * Copyright (c) 2003-2008 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"
 #include "DataArrayView.h"  
20    
21  #include <boost/python/numeric.hpp>  #include <boost/python/numeric.hpp>
22    
# 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 58  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 82  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 96  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      ESCRIPT_DLL_API
102      bool
103      isConstant() const
104      {
105        return true;
106      };
107    
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
167         Return a view into the data for the data point specified.
168         \param sampleNo - Input - sample number.
169         \param dataPointNo - Input - data point number for the sample.*/
170    //  */
171    //   ESCRIPT_DLL_API
172    //   virtual
173    //   DataArrayView
174    //   getDataPoint(int sampleNo,
175    //                int dataPointNo);
176    
177    /**    /**
178       \brief       \brief
# Line 157  class DataConstant : public DataAbstract Line 180  class DataConstant : public DataAbstract
180    */    */
181    ESCRIPT_DLL_API    ESCRIPT_DLL_API
182    virtual    virtual
183    DataArrayView::ValueType::size_type    DataTypes::ValueType::size_type
184    getLength() const;    getLength() const;
185    
186    /**    /**
# Line 170  class DataConstant : public DataAbstract Line 193  class DataConstant : public DataAbstract
193    ESCRIPT_DLL_API    ESCRIPT_DLL_API
194    virtual    virtual
195    DataAbstract*    DataAbstract*
196    getSlice(const DataArrayView::RegionType& region) const;    getSlice(const DataTypes::RegionType& region) const;
197    
198    /**    /**
199       \brief       \brief
# Line 182  class DataConstant : public DataAbstract Line 205  class DataConstant : public DataAbstract
205    virtual    virtual
206    void    void
207    setSlice(const DataAbstract* value,    setSlice(const DataAbstract* value,
208             const DataArrayView::RegionType& region);             const DataTypes::RegionType& region);
209    
   /**  
     \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);  
210    
211    /**    /**
212       \brief       \brief
# Line 292  class DataConstant : public DataAbstract Line 291  class DataConstant : public DataAbstract
291    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);
292    
293    
294      /**
295         \brief
296         Return a reference to the underlying DataVector.
297      */
298      ESCRIPT_DLL_API
299      DataTypes::ValueType&
300      getVector();
301    
302      ESCRIPT_DLL_API
303      const DataTypes::ValueType&
304      getVector() const;
305    
306    
307   protected:   protected:
308    
309   private:   private:
310    //    //
311    // the actual data    // the actual data
312    DataArrayView::ValueType m_data;    DataTypes::ValueType m_data;
313    
314  };  };
315    
316    inline
317    DataTypes::ValueType&
318    DataConstant::getVector()
319    {
320      return m_data;
321    }
322    
323    inline
324    const DataTypes::ValueType&
325    DataConstant::getVector() const
326    {
327      return m_data;
328    }
329    
330    
331  } // end of namespace  } // end of namespace
332  #endif  #endif

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

  ViewVC Help
Powered by ViewVC 1.1.26