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

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

  ViewVC Help
Powered by ViewVC 1.1.26