/[escript]/trunk/escript/src/DataConstant.h
ViewVC logotype

Diff of /trunk/escript/src/DataConstant.h

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

trunk/esys2/escript/src/Data/DataConstant.h revision 119 by jgs, Tue Apr 12 04:45:05 2005 UTC trunk/escript/src/DataConstant.h revision 950 by gross, Tue Feb 6 07:01:11 2007 UTC
# Line 1  Line 1 
1  //$Id$  //$Id$
2  /*  /*
3   ******************************************************************************   ************************************************************
4   *                                                                            *   *          Copyright 2006 by ACcESS MNRF                   *
5   *       COPYRIGHT  ACcESS 2004 -  All Rights Reserved                        *   *                                                          *
6   *                                                                            *   *              http://www.access.edu.au                    *
7   * This software is the property of ACcESS. No part of this code              *   *       Primary Business: Queensland, Australia            *
8   * may be copied in any form or by any means without the expressed written    *   *  Licensed under the Open Software License version 3.0    *
9   * consent of ACcESS.  Copying, use or modification of this software          *   *     http://www.opensource.org/licenses/osl-3.0.php       *
10   * by any unauthorised person is illegal unless that person has a software    *   *                                                          *
11   * license agreement with ACcESS.                                             *   ************************************************************
  *                                                                            *  
  ******************************************************************************  
12  */  */
13                                                                              
14  #if !defined escript_DataConstant_20040323_H  #if !defined escript_DataConstant_20040323_H
15  #define escript_DataConstant_20040323_H  #define escript_DataConstant_20040323_H
16    #include "system_dep.h"
17    
18  #include "escript/Data/DataAbstract.h"  #include "DataAbstract.h"
19  #include "escript/Data/DataArray.h"  #include "DataArrayView.h"
 #include "escript/Data/DataArrayView.h"  
20    
21  #include <boost/python/numeric.hpp>  #include <boost/python/numeric.hpp>
22    
# Line 47  class DataConstant : public DataAbstract Line 45  class DataConstant : public DataAbstract
45       \param value - Input - Data value for a single point.       \param value - Input - Data value for a single point.
46       \param what - Input - A description of what this data object represents.       \param what - Input - A description of what this data object represents.
47    */    */
48      ESCRIPT_DLL_API
49    DataConstant(const boost::python::numeric::array& value,    DataConstant(const boost::python::numeric::array& value,
50                 const FunctionSpace& what);                 const FunctionSpace& what);
51    
# Line 54  class DataConstant : public DataAbstract Line 53  class DataConstant : public DataAbstract
53       \brief       \brief
54       Copy constructor. Performs a deep copy.       Copy constructor. Performs a deep copy.
55    */    */
56      ESCRIPT_DLL_API
57    DataConstant(const DataConstant& other);    DataConstant(const DataConstant& other);
58    
59    /**    /**
# Line 65  class DataConstant : public DataAbstract Line 65  class DataConstant : public DataAbstract
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
69    DataConstant(const DataArrayView& value,    DataConstant(const DataArrayView& value,
70                 const FunctionSpace& what);                 const FunctionSpace& what);
71    
# Line 77  class DataConstant : public DataAbstract Line 78  class DataConstant : public DataAbstract
78       \param other - Input - Data object to copy from.       \param other - Input - Data object to copy from.
79       \param region - Input - region to copy.       \param region - Input - region to copy.
80    */    */
81      ESCRIPT_DLL_API
82    DataConstant(const DataConstant& other,    DataConstant(const DataConstant& other,
83                 const DataArrayView::RegionType& region);                 const DataArrayView::RegionType& region);
84    
# Line 90  class DataConstant : public DataAbstract Line 92  class DataConstant : public DataAbstract
92       \param shape - Input - the shape of each data-point.       \param shape - Input - the shape of each data-point.
93       \param data - the data values for each data-point.       \param data - the data values for each data-point.
94    */    */
95      ESCRIPT_DLL_API
96    DataConstant(const FunctionSpace& what,    DataConstant(const FunctionSpace& what,
97                 const DataArrayView::ShapeType &shape,                 const DataArrayView::ShapeType &shape,
98                 const DataArrayView::ValueType &data);                 const DataArrayView::ValueType &data);
# Line 98  class DataConstant : public DataAbstract Line 101  class DataConstant : public DataAbstract
101       \brief       \brief
102       Write the data as a string.       Write the data as a string.
103    */    */
104      ESCRIPT_DLL_API
105    std::string    std::string
106    toString() const;    toString() const;
107     /**
108         \brief
109         dumps the object into a netCDF file
110      */
111      ESCRIPT_DLL_API
112      virtual
113      void
114      dump(const std::string fileName) const;
115    
116    
117    /**    /**
118       \brief       \brief
# Line 110  class DataConstant : public DataAbstract Line 123  class DataConstant : public DataAbstract
123       \param sampleNo - Input - sample number.       \param sampleNo - Input - sample number.
124       \param dataPointNo - Input - data point number for the sample.       \param dataPointNo - Input - data point number for the sample.
125     */     */
126      ESCRIPT_DLL_API
127    virtual    virtual
128    DataArrayView::ValueType::size_type    DataArrayView::ValueType::size_type
129    getPointOffset(int sampleNo,    getPointOffset(int sampleNo,
# Line 121  class DataConstant : public DataAbstract Line 135  class DataConstant : public DataAbstract
135       \param sampleNo - Input - sample number.       \param sampleNo - Input - sample number.
136       \param dataPointNo - Input - data point number for the sample.       \param dataPointNo - Input - data point number for the sample.
137    */    */
138      ESCRIPT_DLL_API
139    virtual    virtual
140    DataArrayView    DataArrayView
141    getDataPoint(int sampleNo,    getDataPoint(int sampleNo,
# Line 130  class DataConstant : public DataAbstract Line 145  class DataConstant : public DataAbstract
145       \brief       \brief
146       Return the number of doubles stored for the Data object.       Return the number of doubles stored for the Data object.
147    */    */
148      ESCRIPT_DLL_API
149    virtual    virtual
150    DataArrayView::ValueType::size_type    DataArrayView::ValueType::size_type
151    getLength() const;    getLength() const;
# Line 141  class DataConstant : public DataAbstract Line 157  class DataConstant : public DataAbstract
157       The caller is reponsible for managing the object created.       The caller is reponsible for managing the object created.
158       \param region - Input - region to slice from this object.       \param region - Input - region to slice from this object.
159    */    */
160      ESCRIPT_DLL_API
161    virtual    virtual
162    DataAbstract*    DataAbstract*
163    getSlice(const DataArrayView::RegionType& region) const;    getSlice(const DataArrayView::RegionType& region) const;
# Line 151  class DataConstant : public DataAbstract Line 168  class DataConstant : public DataAbstract
168       \param value - Input - Data object to copy from.       \param value - Input - Data object to copy from.
169       \param region - Input - Region to copy.       \param region - Input - Region to copy.
170    */    */
171      ESCRIPT_DLL_API
172    virtual    virtual
173    void    void
174    setSlice(const DataAbstract* value,    setSlice(const DataAbstract* value,
175             const DataArrayView::RegionType& region);             const DataArrayView::RegionType& region);
176    
177    /**    /**
178        \brief
179        Archive the underlying data values to the file referenced
180        by ofstream. A count of the number of values expected to be written
181        is provided as a cross-check.
182    
183        The return value indicates success (0) or otherwise (1).
184      */
185      ESCRIPT_DLL_API
186      int
187      archiveData(std::ofstream& archiveFile,
188                  const DataArrayView::ValueType::size_type noValues) const;
189    
190      /**
191        \brief
192        Extract the number of values specified by noValues from the file
193        referenced by ifstream to the underlying data structure.
194    
195        The return value indicates success (0) or otherwise (1).
196      */
197      ESCRIPT_DLL_API
198      int
199      extractData(std::ifstream& archiveFile,
200                  const DataArrayView::ValueType::size_type noValues);
201    
202      /**
203       \brief       \brief
204       Reshape the data point if the data point is currently rank 0.       Computes a symmetric matrix (A + AT) / 2
205       The original data point value is used for all values of the new  
206       data point.       \param ev - Output - symmetric matrix
207    
208    */    */
209    void    ESCRIPT_DLL_API
210    reshapeDataPoint(const DataArrayView::ShapeType& shape);    virtual void
211      symmetric(DataAbstract* ev);
212    
213      /**
214         \brief
215         Computes a nonsymmetric matrix (A - AT) / 2
216    
217         \param ev - Output - nonsymmetric matrix
218    
219      */
220      ESCRIPT_DLL_API
221      virtual void
222      nonsymmetric(DataAbstract* ev);
223    
224      /**
225         \brief
226         Computes the trace of a matrix
227    
228         \param ev - Output - trace of matrix
229    
230      */
231      ESCRIPT_DLL_API
232      virtual void
233      trace(DataAbstract* ev, int axis_offset);
234    
235      /**
236         \brief
237         Transpose each data point of this Data object around the given axis.
238    
239         \param ev - Output - transpose of matrix
240    
241      */
242      ESCRIPT_DLL_API
243      virtual void
244      transpose(DataAbstract* ev, int axis_offset);
245    
246      /**
247         \brief
248         swaps components axis0 and axis1
249    
250         \param ev - Output - swapped components
251    
252      */
253      ESCRIPT_DLL_API
254      virtual void
255      swapaxes(DataAbstract* ev, int axis0, int axis1);
256    
257    
258      /**
259         \brief
260         solves the eigenvalue problem this*V=ev*V for the eigenvalues ev
261    
262         \param ev - Output - eigenvalues in increasing order at each data point
263    
264      */
265      ESCRIPT_DLL_API
266      virtual void
267      eigenvalues(DataAbstract* ev);
268    
269      /**
270         \brief
271         solves the eigenvalue problem this*V=ev*V for the eigenvalues ev and eigenvectors V
272    
273         \param ev - Output - eigenvalues in increasing order at each data point
274         \param V - Output - corresponding eigenvectors. They are normalized such that their length is one
275                             and the first nonzero component is positive.
276         \param tol - Input - eigenvalue with relative distance tol are treated as equal.
277    
278      */
279    
280      ESCRIPT_DLL_API
281      virtual void
282      eigenvalues_and_eigenvectors(DataAbstract* ev,DataAbstract* V,const double tol=1.e-13);
283    
284    
285   protected:   protected:
286    

Legend:
Removed from v.119  
changed lines
  Added in v.950

  ViewVC Help
Powered by ViewVC 1.1.26