/[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 4154 by jfenwick, Tue Jan 22 09:30:23 2013 UTC
# Line 1  Line 1 
1    
2  /* $Id$ */  /*****************************************************************************
3    *
4    * Copyright (c) 2003-2013 by University of Queensland
5    * http://www.uq.edu.au
6    *
7    * Primary Business: Queensland, Australia
8    * Licensed under the Open Software License version 3.0
9    * http://www.opensource.org/licenses/osl-3.0.php
10    *
11    * Development until 2012 by Earth Systems Science Computational Center (ESSCC)
12    * Development since 2012 by School of Earth Sciences
13    *
14    *****************************************************************************/
15    
 /*******************************************************  
  *  
  *           Copyright 2003-2007 by ACceSS MNRF  
  *       Copyright 2007 by University of Queensland  
  *  
  *                http://esscc.uq.edu.au  
  *        Primary Business: Queensland, Australia  
  *  Licensed under the Open Software License version 3.0  
  *     http://www.opensource.org/licenses/osl-3.0.php  
  *  
  *******************************************************/  
16    
17  #if !defined escript_DataConstant_20040323_H  #if !defined escript_DataConstant_20040323_H
18  #define escript_DataConstant_20040323_H  #define escript_DataConstant_20040323_H
19  #include "system_dep.h"  #include "system_dep.h"
20    
21  #include "DataAbstract.h"  #include "DataReady.h"
22  #include "DataArrayView.h"  #include "WrappedArray.h"
23    
 #include <boost/python/numeric.hpp>  
24    
25  namespace escript {  namespace escript {
26    
# Line 33  namespace escript { Line 33  namespace escript {
33     DataConstant stores a single data point which represents the entire     DataConstant stores a single data point which represents the entire
34     function space.     function space.
35  */  */
36  class DataConstant : public DataAbstract  {  class DataConstant : public DataReady  {
37    typedef DataReady parent;
38   public:   public:
39    
40    /**    /**
# Line 48  class DataConstant : public DataAbstract Line 48  class DataConstant : public DataAbstract
48       \param what - Input - A description of what this data object represents.       \param what - Input - A description of what this data object represents.
49    */    */
50    ESCRIPT_DLL_API    ESCRIPT_DLL_API
51    DataConstant(const boost::python::numeric::array& value,    DataConstant(const WrappedArray& value,
52                 const FunctionSpace& what);                 const FunctionSpace& what);
53    
54    
55    /**    /**
56       \brief       \brief
57       Copy constructor. Performs a deep copy.       Copy constructor. Performs a deep copy.
# Line 58  class DataConstant : public DataAbstract Line 59  class DataConstant : public DataAbstract
59    ESCRIPT_DLL_API    ESCRIPT_DLL_API
60    DataConstant(const DataConstant& other);    DataConstant(const DataConstant& other);
61    
   /**  
      \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);  
62    
63    /**    /**
64       \brief       \brief
# Line 82  class DataConstant : public DataAbstract Line 71  class DataConstant : public DataAbstract
71    */    */
72    ESCRIPT_DLL_API    ESCRIPT_DLL_API
73    DataConstant(const DataConstant& other,    DataConstant(const DataConstant& other,
74                 const DataArrayView::RegionType& region);                 const DataTypes::RegionType& region);
75    
76    /**    /**
77       \brief       \brief
# Line 96  class DataConstant : public DataAbstract Line 85  class DataConstant : public DataAbstract
85    */    */
86    ESCRIPT_DLL_API    ESCRIPT_DLL_API
87    DataConstant(const FunctionSpace& what,    DataConstant(const FunctionSpace& what,
88                 const DataArrayView::ShapeType &shape,                 const DataTypes::ShapeType &shape,
89                 const DataArrayView::ValueType &data);                 const DataTypes::ValueType &data);
90    
91      ESCRIPT_DLL_API
92      DataConstant(const FunctionSpace& what,
93                               const DataTypes::ShapeType &shape,
94                               const double v);
95              
96              
97      ESCRIPT_DLL_API
98      bool
99      isConstant() const
100      {
101        return true;
102      };
103    
104      /**
105      \brief Return true if the value contains a NaN.
106      */
107      ESCRIPT_DLL_API
108      bool
109      hasNaN() const;
110    
111    /**    /**
112       \brief       \brief
# Line 106  class DataConstant : public DataAbstract Line 115  class DataConstant : public DataAbstract
115    ESCRIPT_DLL_API    ESCRIPT_DLL_API
116    std::string    std::string
117    toString() const;    toString() const;
118    
119      /**
120         \brief Return a deep copy of the current object.
121      */
122      ESCRIPT_DLL_API
123      virtual
124      DataAbstract*
125      deepCopy();
126    
127    
128   /**   /**
129       \brief       \brief
130       dumps the object into a netCDF file       dumps the object into a netCDF file
# Line 135  class DataConstant : public DataAbstract Line 154  class DataConstant : public DataAbstract
154     */     */
155    ESCRIPT_DLL_API    ESCRIPT_DLL_API
156    virtual    virtual
157    DataArrayView::ValueType::size_type    DataTypes::ValueType::size_type
158    getPointOffset(int sampleNo,    getPointOffset(int sampleNo,
159                   int dataPointNo) const;                   int dataPointNo) const;
160    
   /**  
      \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.  
   */  
161    ESCRIPT_DLL_API    ESCRIPT_DLL_API
162    virtual    virtual
163    DataArrayView    DataTypes::ValueType::size_type
164    getDataPoint(int sampleNo,    getPointOffset(int sampleNo,
165                 int dataPointNo);                   int dataPointNo);
166    
167    /**    /**
168       \brief       \brief
# Line 157  class DataConstant : public DataAbstract Line 170  class DataConstant : public DataAbstract
170    */    */
171    ESCRIPT_DLL_API    ESCRIPT_DLL_API
172    virtual    virtual
173    DataArrayView::ValueType::size_type    DataTypes::ValueType::size_type
174    getLength() const;    getLength() const;
175    
176    /**    /**
# Line 170  class DataConstant : public DataAbstract Line 183  class DataConstant : public DataAbstract
183    ESCRIPT_DLL_API    ESCRIPT_DLL_API
184    virtual    virtual
185    DataAbstract*    DataAbstract*
186    getSlice(const DataArrayView::RegionType& region) const;    getSlice(const DataTypes::RegionType& region) const;
187    
188    /**    /**
189       \brief       \brief
# Line 182  class DataConstant : public DataAbstract Line 195  class DataConstant : public DataAbstract
195    virtual    virtual
196    void    void
197    setSlice(const DataAbstract* value,    setSlice(const DataAbstract* value,
198             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.  
199    
     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);  
200    
201    /**    /**
202       \brief       \brief
# Line 236  class DataConstant : public DataAbstract Line 225  class DataConstant : public DataAbstract
225       Computes the trace of a matrix       Computes the trace of a matrix
226    
227       \param ev - Output - trace of matrix       \param ev - Output - trace of matrix
228         \param axis_offset
229    
230    */    */
231    ESCRIPT_DLL_API    ESCRIPT_DLL_API
# Line 247  class DataConstant : public DataAbstract Line 237  class DataConstant : public DataAbstract
237       Transpose each data point of this Data object around the given axis.       Transpose each data point of this Data object around the given axis.
238    
239       \param ev - Output - transpose of matrix       \param ev - Output - transpose of matrix
240         \param axis_offset
241    */    */
242    ESCRIPT_DLL_API    ESCRIPT_DLL_API
243    virtual void    virtual void
# Line 258  class DataConstant : public DataAbstract Line 248  class DataConstant : public DataAbstract
248       swaps components axis0 and axis1       swaps components axis0 and axis1
249    
250       \param ev - Output - swapped components       \param ev - Output - swapped components
251         \param axis0
252         \param axis1
253    */    */
254    ESCRIPT_DLL_API    ESCRIPT_DLL_API
255    virtual void    virtual void
# Line 292  class DataConstant : public DataAbstract Line 283  class DataConstant : public DataAbstract
283    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);
284    
285    
286      /**
287        \brief invert square matricies
288        \param out - Where to store the results
289        \return errorcode (0 indicates success)
290      */
291      ESCRIPT_DLL_API
292      virtual int
293      matrixInverse(DataAbstract* out) const;
294    
295      /**
296         \brief
297         Return a reference to the underlying DataVector.
298      */
299      ESCRIPT_DLL_API
300      DataTypes::ValueType&
301      getVectorRW();
302    
303    
304      ESCRIPT_DLL_API
305      const DataTypes::ValueType&
306      getVectorRO() const;
307    
308   protected:   protected:
309    
310   private:   private:
311    //    //
312    // the actual data    // the actual data
313    DataArrayView::ValueType m_data;    DataTypes::ValueType m_data;
314    
315  };  };
316    

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

  ViewVC Help
Powered by ViewVC 1.1.26