/[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

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

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

  ViewVC Help
Powered by ViewVC 1.1.26