/[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 5863 by jfenwick, Wed Jan 13 02:25:48 2016 UTC
# Line 1  Line 1 
1    
2  /* $Id$ */  /*****************************************************************************
3    *
4    * Copyright (c) 2003-2016 by The 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 replaces all NaN values with value
114      */
115      ESCRIPT_DLL_API
116      void
117      replaceNaN(double value);
118    
119    /**    /**
120       \brief       \brief
# Line 106  class DataConstant : public DataAbstract Line 123  class DataConstant : public DataAbstract
123    ESCRIPT_DLL_API    ESCRIPT_DLL_API
124    std::string    std::string
125    toString() const;    toString() const;
126    
127      /**
128         \brief Return a deep copy of the current object.
129      */
130      ESCRIPT_DLL_API
131      virtual
132      DataAbstract*
133      deepCopy();
134    
135    
136   /**   /**
137       \brief       \brief
138       dumps the object into a netCDF file       dumps the object into a netCDF file
# Line 135  class DataConstant : public DataAbstract Line 162  class DataConstant : public DataAbstract
162     */     */
163    ESCRIPT_DLL_API    ESCRIPT_DLL_API
164    virtual    virtual
165    DataArrayView::ValueType::size_type    DataTypes::ValueType::size_type
166    getPointOffset(int sampleNo,    getPointOffset(int sampleNo,
167                   int dataPointNo) const;                   int dataPointNo) const;
168    
   /**  
      \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.  
   */  
169    ESCRIPT_DLL_API    ESCRIPT_DLL_API
170    virtual    virtual
171    DataArrayView    DataTypes::ValueType::size_type
172    getDataPoint(int sampleNo,    getPointOffset(int sampleNo,
173                 int dataPointNo);                   int dataPointNo);
174    
175    /**    /**
176       \brief       \brief
# Line 157  class DataConstant : public DataAbstract Line 178  class DataConstant : public DataAbstract
178    */    */
179    ESCRIPT_DLL_API    ESCRIPT_DLL_API
180    virtual    virtual
181    DataArrayView::ValueType::size_type    DataTypes::ValueType::size_type
182    getLength() const;    getLength() const;
183    
184    /**    /**
# Line 170  class DataConstant : public DataAbstract Line 191  class DataConstant : public DataAbstract
191    ESCRIPT_DLL_API    ESCRIPT_DLL_API
192    virtual    virtual
193    DataAbstract*    DataAbstract*
194    getSlice(const DataArrayView::RegionType& region) const;    getSlice(const DataTypes::RegionType& region) const;
195    
196    /**    /**
197       \brief       \brief
# Line 182  class DataConstant : public DataAbstract Line 203  class DataConstant : public DataAbstract
203    virtual    virtual
204    void    void
205    setSlice(const DataAbstract* value,    setSlice(const DataAbstract* value,
206             const DataArrayView::RegionType& region);             const DataTypes::RegionType& region);
207    
   /**  
     \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);  
208    
209    /**    /**
210       \brief       \brief
# Line 236  class DataConstant : public DataAbstract Line 233  class DataConstant : public DataAbstract
233       Computes the trace of a matrix       Computes the trace of a matrix
234    
235       \param ev - Output - trace of matrix       \param ev - Output - trace of matrix
236         \param axis_offset
237    
238    */    */
239    ESCRIPT_DLL_API    ESCRIPT_DLL_API
# Line 247  class DataConstant : public DataAbstract Line 245  class DataConstant : public DataAbstract
245       Transpose each data point of this Data object around the given axis.       Transpose each data point of this Data object around the given axis.
246    
247       \param ev - Output - transpose of matrix       \param ev - Output - transpose of matrix
248         \param axis_offset
249    */    */
250    ESCRIPT_DLL_API    ESCRIPT_DLL_API
251    virtual void    virtual void
# Line 258  class DataConstant : public DataAbstract Line 256  class DataConstant : public DataAbstract
256       swaps components axis0 and axis1       swaps components axis0 and axis1
257    
258       \param ev - Output - swapped components       \param ev - Output - swapped components
259         \param axis0
260         \param axis1
261    */    */
262    ESCRIPT_DLL_API    ESCRIPT_DLL_API
263    virtual void    virtual void
# 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 invert square matricies
296        \param out - Where to store the results
297        \return errorcode (0 indicates success)
298      */
299      ESCRIPT_DLL_API
300      virtual int
301      matrixInverse(DataAbstract* out) const;
302    
303      /**
304         \brief
305         Return a reference to the underlying DataVector.
306      */
307      ESCRIPT_DLL_API
308      DataTypes::ValueType&
309      getVectorRW();
310    
311    
312      ESCRIPT_DLL_API
313      const DataTypes::ValueType&
314      getVectorRO() const;
315    
316   protected:   protected:
317    
318   private:   private:
319    //    //
320    // the actual data    // the actual data
321    DataArrayView::ValueType m_data;    DataTypes::ValueType m_data;
322    
323  };  };
324    

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

  ViewVC Help
Powered by ViewVC 1.1.26