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

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

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

revision 804 by gross, Thu Aug 10 01:12:16 2006 UTC revision 1808 by jfenwick, Thu Sep 25 03:14:56 2008 UTC
# Line 1  Line 1 
1  // $Id$  
2  /*  /* $Id$ */
3   ************************************************************  
4   *          Copyright 2006 by ACcESS MNRF                   *  /*******************************************************
5   *                                                          *   *
6   *              http://www.access.edu.au                    *   *           Copyright 2003-2007 by ACceSS MNRF
7   *       Primary Business: Queensland, Australia            *   *       Copyright 2007 by University of Queensland
8   *  Licensed under the Open Software License version 3.0    *   *
9   *     http://www.opensource.org/licenses/osl-3.0.php       *   *                http://esscc.uq.edu.au
10   *                                                          *   *        Primary Business: Queensland, Australia
11   ************************************************************   *  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_DataExpanded_20040323_H  #if !defined escript_DataExpanded_20040323_H
17  #define escript_DataExpanded_20040323_H  #define escript_DataExpanded_20040323_H
# Line 17  Line 19 
19    
20  #include "DataAbstract.h"  #include "DataAbstract.h"
21  #include "DataBlocks2D.h"  #include "DataBlocks2D.h"
 #include "DataArrayView.h"  
22    
23  #include <boost/python/numeric.hpp>  #include <boost/python/numeric.hpp>
24    
# Line 64  class DataExpanded : public DataAbstract Line 65  class DataExpanded : public DataAbstract
65    
66    /**    /**
67       \brief       \brief
      Alternative constructor for DataExpanded.  
   
      Description:  
      Alternative Constructor for DataExpanded.  
   
      The given single data value is copied to all the data points in  
      this data object, where the number of data points is defined by  
      the given function space.  
   
      \param value - Input - A single data value.  
      \param what - Input - A description of what this data represents.  
   */  
   ESCRIPT_DLL_API  
   DataExpanded(const DataArrayView& value,  
                const FunctionSpace& what);  
   
   /**  
      \brief  
68       Alternative constructor for DataExpanded that copies a slice from       Alternative constructor for DataExpanded that copies a slice from
69       another DataExpanded.       another DataExpanded.
70    
# Line 90  class DataExpanded : public DataAbstract Line 73  class DataExpanded : public DataAbstract
73    */    */
74    ESCRIPT_DLL_API    ESCRIPT_DLL_API
75    DataExpanded(const DataExpanded& other,    DataExpanded(const DataExpanded& other,
76                 const DataArrayView::RegionType& region);                 const DataTypes::RegionType& region);
77    
78    /**    /**
79       \brief       \brief
# Line 101  class DataExpanded : public DataAbstract Line 84  class DataExpanded : public DataAbstract
84       \param what - Input - A description of what this data object represents.       \param what - Input - A description of what this data object represents.
85       \param shape - Input - the shape of each data-point.       \param shape - Input - the shape of each data-point.
86       \param data - the array of data values for the data-points.       \param data - the array of data values for the data-points.
87    
88    TODO Note that this constructor will also copy data to all points if it only contains enough elements to hold a single point.  ie this is the merge of two separate constructors.
89    */    */
90    ESCRIPT_DLL_API    ESCRIPT_DLL_API
91    DataExpanded(const FunctionSpace& what,    DataExpanded(const FunctionSpace& what,
92                 const DataArrayView::ShapeType &shape,                 const DataTypes::ShapeType &shape,
93                 const DataArrayView::ValueType &data);                 const DataTypes::ValueType &data);
94    
95    /**    /**
96       \brief       \brief
# Line 149  class DataExpanded : public DataAbstract Line 134  class DataExpanded : public DataAbstract
134    toString() const;    toString() const;
135    
136    /**    /**
137         \brief Return a deep copy of the current object.
138      */
139      ESCRIPT_DLL_API
140      virtual
141      DataAbstract*
142      deepCopy();
143    
144    
145     /**
146       \brief       \brief
147       Reshape the data point if the data point is currently rank 0.       dumps the object into a netCDF file
      The original data point value is used for all values of the new  
      data point.  
148    */    */
149    ESCRIPT_DLL_API    ESCRIPT_DLL_API
150      virtual
151    void    void
152    reshapeDataPoint(const DataArrayView::ShapeType& shape);    dump(const std::string fileName) const;
153    
154     /**
155         \brief
156        sets all values to zero
157      */
158      ESCRIPT_DLL_API
159      virtual
160      void
161      setToZero();
162    
163    /**    /**
164       \brief       \brief
# Line 169  class DataExpanded : public DataAbstract Line 171  class DataExpanded : public DataAbstract
171    */    */
172    ESCRIPT_DLL_API    ESCRIPT_DLL_API
173    virtual    virtual
174    DataArrayView::ValueType::size_type    DataTypes::ValueType::size_type
175    getPointOffset(int sampleNo,    getPointOffset(int sampleNo,
176                   int dataPointNo) const;                   int dataPointNo) const;
177    
178    /**    /**
179       \brief       \brief
180       Return a view into the data array for the data point specified.       Return a a reference to the underlying DataVector.
181      */
182    
183       NOTE: Construction of the DataArrayView is a relatively expensive    ESCRIPT_DLL_API
184       operation.    DataTypes::ValueType&
185      getVector();
186    
      \param sampleNo - Input - sample number.  
      \param dataPointNo - Input - data point number.  
      \return DataArrayView for the data point.  
   */  
187    ESCRIPT_DLL_API    ESCRIPT_DLL_API
188    DataArrayView    const DataTypes::ValueType&
189    getDataPoint(int sampleNo,    getVector() const;
190                 int dataPointNo);  
191    
192    /**    /**
193       \brief       \brief
# Line 208  class DataExpanded : public DataAbstract Line 208  class DataExpanded : public DataAbstract
208    ESCRIPT_DLL_API    ESCRIPT_DLL_API
209    virtual    virtual
210    DataAbstract*    DataAbstract*
211    getSlice(const DataArrayView::RegionType& region) const;    getSlice(const DataTypes::RegionType& region) const;
212    
213    /**    /**
214       \brief       \brief
# Line 221  class DataExpanded : public DataAbstract Line 221  class DataExpanded : public DataAbstract
221    virtual    virtual
222    void    void
223    setSlice(const DataAbstract* value,    setSlice(const DataAbstract* value,
224             const DataArrayView::RegionType& region);             const DataTypes::RegionType& region);
225    
226    /**    /**
227       \brief       \brief
228       Assign the given value to all data-points associated with the given       setTaggedValue
      reference number.  
   
      A reference number corresponds to a sample, and thus to all data-points  
      in that sample.  
   
      If the given reference number does not correspond to any sample in this  
      Data object, an exception will be thrown.  
229    
230       If the given value is a different shape to this Data object, an exception       Description:
231       will be thrown.       uses tag to set a new value
   
      \param ref - Input - reference number which determines sample numebr to  
                           assign given values to.  
      \param value - Input - Value to assign to data-point associated with  
                             the given reference number.  
   */  
   ESCRIPT_DLL_API  
   virtual  
   void  
   setRefValue(int ref,  
               const DataArray& value);  
   
   /**  
      \brief  
      Return the value of the first data-point in the sample associated with  
      the given reference number.  
   
      A reference number corresponds to a sample, and thus to all data-points  
      in that sample. If there is more than one data-point per sample number  
      in this Data object, the value of the first data-point will be returned.  
   
      If the given reference number does not correspond to any sample in this  
      Data object, an exception will be thrown.  
   
      If the given value is a different shape to this Data object, an exception  
      will be thrown.  
   
      \param ref - Input - reference number which determines sample number to  
                           read from.  
      \param value - Output - Object to receive data-points associated with  
                             the given reference number.  
   */  
   ESCRIPT_DLL_API  
   virtual  
   void  
   getRefValue(int ref,  
               DataArray& value);  
232    
233    /**       \param tagKey - Input - Integer key.
234      \brief       \param pointshape - Input - The shape of the value parameter
235      Archive the underlying data values to the file referenced       \param value - Input - .
236      by ofstream. A count of the number of values expected to be written    */
237      is provided as a cross-check.    void  
238      setTaggedValue(int tagKey,
239                 const DataTypes::ShapeType& pointshape,
240                     const DataTypes::ValueType& value,
241             int dataOffset=0);
242    
     The return value indicates success (0) or otherwise (1).  
   */  
   ESCRIPT_DLL_API  
   int  
   archiveData(std::ofstream& archiveFile,  
               const DataArrayView::ValueType::size_type noValues) const;  
243    
   /**  
     \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);  
244    
245    /**    /**
246       \brief       \brief
# Line 381  class DataExpanded : public DataAbstract Line 324  class DataExpanded : public DataAbstract
324    virtual void    virtual void
325    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);
326    
327    /**
328     *      \brief
329     *           reorders data sample ordered by reference_ids to the ordering of the functions space
330     *
331     *                \param reference_ids - Input - reference_ids used for current ordering
332     *                  */
333      ESCRIPT_DLL_API
334      virtual void
335      reorderByReferenceIDs(int *reference_ids);
336    
337    
338    
339   protected:   protected:
340    
# Line 397  class DataExpanded : public DataAbstract Line 351  class DataExpanded : public DataAbstract
351       given shape and number of data points, and creates the corresponding       given shape and number of data points, and creates the corresponding
352       DataArrayView of this data.       DataArrayView of this data.
353    
      \param shape - Input - The shape of the point data.  
354       \param noSamples - Input - number of samples.       \param noSamples - Input - number of samples.
355       \param noDataPointsPerSample - Input - number of data points per sample.       \param noDataPointsPerSample - Input - number of data points per sample.
356    */    */
357    void    void
358    initialise(const DataArrayView::ShapeType& shape,    initialise(int noSamples,
              int noSamples,  
359               int noDataPointsPerSample);               int noDataPointsPerSample);
360    
361    /**    /**
# Line 416  class DataExpanded : public DataAbstract Line 368  class DataExpanded : public DataAbstract
368       \param value Input - A single data point value.       \param value Input - A single data point value.
369    */    */
370    void    void
371    copy(const DataArrayView& value);    copy(const DataConstant& value);
372    
373    
374    
375    /**    /**
376       \brief       \brief
# Line 442  class DataExpanded : public DataAbstract Line 396  class DataExpanded : public DataAbstract
396    void    void
397    copyAll(const boost::python::numeric::array& value);    copyAll(const boost::python::numeric::array& value);
398    
399      /**
400         \brief
401         Copy a double value to the data point dataPointNo of sample sampleNo in this object.
402    
403         Description:
404         Copy a double value to the data point dataPointNo of sample sampleNo in this object.
405    
406         \param sampleNo Input - sample number
407         \param dataPointNo Input - data point of the sample
408         \param value Input - new values for the data point
409      */
410      ESCRIPT_DLL_API
411      virtual void
412      copyToDataPoint(const int sampleNo, const int dataPointNo, const double value);
413    
414    
415      /**
416         \brief
417         Copy the numarray object to the data point dataPointNo of sample sampleNo in this object.
418    
419         Description:
420         Copy the numarray object to the data point dataPointNo of sample sampleNo in this object.
421    
422         \param sampleNo Input - sample number
423         \param dataPointNo Input - data point of the sample
424         \param value Input - new values for the data point
425      */
426      void
427      copyToDataPoint(const int sampleNo, const int dataPointNo, const boost::python::numeric::array& value);
428    
429    //    //
430    // The main data storage array, a 2D array of data blocks.    // The main data storage array, a 2D array of data blocks.
431    // noSamples * noDataPointsPerSample    // noSamples * noDataPointsPerSample

Legend:
Removed from v.804  
changed lines
  Added in v.1808

  ViewVC Help
Powered by ViewVC 1.1.26