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

temp/escript/src/DataExpanded.h revision 1387 by trankine, Fri Jan 11 07:45:26 2008 UTC trunk/escript/src/DataExpanded.h revision 2458 by jfenwick, Wed Jun 3 06:18:21 2009 UTC
# Line 1  Line 1 
1    
 /* $Id$ */  
   
2  /*******************************************************  /*******************************************************
3   *  *
4   *           Copyright 2003-2007 by ACceSS MNRF  * Copyright (c) 2003-2008 by University of Queensland
5   *       Copyright 2007 by University of Queensland  * Earth Systems Science Computational Center (ESSCC)
6   *  * http://www.uq.edu.au/esscc
7   *                http://esscc.uq.edu.au  *
8   *        Primary Business: Queensland, Australia  * Primary Business: Queensland, Australia
9   *  Licensed under the Open Software License version 3.0  * Licensed under the Open Software License version 3.0
10   *     http://www.opensource.org/licenses/osl-3.0.php  * http://www.opensource.org/licenses/osl-3.0.php
11   *  *
12   *******************************************************/  *******************************************************/
13    
14    
15  #if !defined escript_DataExpanded_20040323_H  #if !defined escript_DataExpanded_20040323_H
16  #define escript_DataExpanded_20040323_H  #define escript_DataExpanded_20040323_H
17  #include "system_dep.h"  #include "system_dep.h"
18    
19  #include "DataAbstract.h"  #include "DataReady.h"
20  #include "DataBlocks2D.h"  #include "DataBlocks2D.h"
 #include "DataArrayView.h"  
21    
22  #include <boost/python/numeric.hpp>  #include <boost/python/numeric.hpp>
23    
# Line 42  class DataTagged; Line 40  class DataTagged;
40     template must satisfy.     template must satisfy.
41  */  */
42    
43  class DataExpanded : public DataAbstract {  class DataExpanded : public DataReady {
44    
45    typedef DataReady parent;
46    
47   public:   public:
48    
# Line 57  class DataExpanded : public DataAbstract Line 57  class DataExpanded : public DataAbstract
57       this data object, where the number of data points is defined by       this data object, where the number of data points is defined by
58       the given function space.       the given function space.
59    
60       \param value - Input - A single data value.       \param value - Input - The value of a single data point.
61       \param what - Input - A description of what this data represents.       \param what - Input - A description of what this data represents.
62    */    */
63    ESCRIPT_DLL_API    ESCRIPT_DLL_API
64    DataExpanded(const boost::python::numeric::array& value,    DataExpanded(const WrappedArray& value,
                const FunctionSpace& what);  
   
   /**  
      \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,  
65                 const FunctionSpace& what);                 const FunctionSpace& what);
66    
67    /**    /**
# Line 92  class DataExpanded : public DataAbstract Line 74  class DataExpanded : public DataAbstract
74    */    */
75    ESCRIPT_DLL_API    ESCRIPT_DLL_API
76    DataExpanded(const DataExpanded& other,    DataExpanded(const DataExpanded& other,
77                 const DataArrayView::RegionType& region);                 const DataTypes::RegionType& region);
78    
79    /**    /**
80       \brief       \brief
# Line 103  class DataExpanded : public DataAbstract Line 85  class DataExpanded : public DataAbstract
85       \param what - Input - A description of what this data object represents.       \param what - Input - A description of what this data object represents.
86       \param shape - Input - the shape of each data-point.       \param shape - Input - the shape of each data-point.
87       \param data - the array of data values for the data-points.       \param data - the array of data values for the data-points.
88    
89    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.
90    */    */
91    ESCRIPT_DLL_API    ESCRIPT_DLL_API
92    DataExpanded(const FunctionSpace& what,    DataExpanded(const FunctionSpace& what,
93                 const DataArrayView::ShapeType &shape,                 const DataTypes::ShapeType &shape,
94                 const DataArrayView::ValueType &data);                 const DataTypes::ValueType &data);
95    
96    /**    /**
97       \brief       \brief
# Line 141  class DataExpanded : public DataAbstract Line 125  class DataExpanded : public DataAbstract
125    virtual    virtual
126    ~DataExpanded();    ~DataExpanded();
127    
128      ESCRIPT_DLL_API
129      bool
130      isExpanded() const
131      {
132        return true;
133      };
134    
135      ESCRIPT_DLL_API
136      bool
137      actsExpanded() const
138      {
139        return true;
140      }
141    
142    /**    /**
143       \brief       \brief
144       Return a textual representation of the data.       Return a textual representation of the data.
# Line 149  class DataExpanded : public DataAbstract Line 147  class DataExpanded : public DataAbstract
147    virtual    virtual
148    std::string    std::string
149    toString() const;    toString() const;
150    
151      /**
152         \brief Return a deep copy of the current object.
153      */
154      ESCRIPT_DLL_API
155      virtual
156      DataAbstract*
157      deepCopy();
158    
159    
160   /**   /**
161       \brief       \brief
162       dumps the object into a netCDF file       dumps the object into a netCDF file
# Line 178  class DataExpanded : public DataAbstract Line 186  class DataExpanded : public DataAbstract
186    */    */
187    ESCRIPT_DLL_API    ESCRIPT_DLL_API
188    virtual    virtual
189    DataArrayView::ValueType::size_type    DataTypes::ValueType::size_type
190    getPointOffset(int sampleNo,    getPointOffset(int sampleNo,
191                   int dataPointNo) const;                   int dataPointNo) const;
192    
193      ESCRIPT_DLL_API
194      virtual
195      DataTypes::ValueType::size_type
196      getPointOffset(int sampleNo,
197                     int dataPointNo);
198    
199    /**    /**
200       \brief       \brief
201       Return a view into the data array for the data point specified.       Return a a reference to the underlying DataVector.
202      */
203    
204       NOTE: Construction of the DataArrayView is a relatively expensive    ESCRIPT_DLL_API
205       operation.    DataTypes::ValueType&
206      getVectorRW();
207    
      \param sampleNo - Input - sample number.  
      \param dataPointNo - Input - data point number.  
      \return DataArrayView for the data point.  
   */  
208    ESCRIPT_DLL_API    ESCRIPT_DLL_API
209    DataArrayView    const DataTypes::ValueType&
210    getDataPoint(int sampleNo,    getVectorRO() const;
211                 int dataPointNo);  
212    
213    
214    /**    /**
215       \brief       \brief
# Line 217  class DataExpanded : public DataAbstract Line 230  class DataExpanded : public DataAbstract
230    ESCRIPT_DLL_API    ESCRIPT_DLL_API
231    virtual    virtual
232    DataAbstract*    DataAbstract*
233    getSlice(const DataArrayView::RegionType& region) const;    getSlice(const DataTypes::RegionType& region) const;
234    
235    /**    /**
236       \brief       \brief
# Line 230  class DataExpanded : public DataAbstract Line 243  class DataExpanded : public DataAbstract
243    virtual    virtual
244    void    void
245    setSlice(const DataAbstract* value,    setSlice(const DataAbstract* value,
246             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.  
   
     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);  
247    
248    /**    /**
249       \brief       \brief
# Line 265  class DataExpanded : public DataAbstract Line 253  class DataExpanded : public DataAbstract
253       uses tag to set a new value       uses tag to set a new value
254    
255       \param tagKey - Input - Integer key.       \param tagKey - Input - Integer key.
256       \param value - Input - Single DataArrayView value to be assigned to the tag.       \param pointshape - Input - The shape of the value parameter
257         \param value - Input - .
258    */    */
259    ESCRIPT_DLL_API    void  
   virtual  
   void  
260    setTaggedValue(int tagKey,    setTaggedValue(int tagKey,
261                   const DataArrayView& value);               const DataTypes::ShapeType& pointshape,
262                     const DataTypes::ValueType& value,
263             int dataOffset=0);
264    
265    
266    
267    /**    /**
268       \brief       \brief
# Line 355  class DataExpanded : public DataAbstract Line 346  class DataExpanded : public DataAbstract
346    virtual void    virtual void
347    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);
348    
349    /**
350     *      \brief
351     *           reorders data sample ordered by reference_ids to the ordering of the functions space
352     *
353     *                \param reference_ids - Input - reference_ids used for current ordering
354     *                  */
355      ESCRIPT_DLL_API
356      virtual void
357      reorderByReferenceIDs(int *reference_ids);
358    
359    
360    
361   protected:   protected:
362    
# Line 371  class DataExpanded : public DataAbstract Line 373  class DataExpanded : public DataAbstract
373       given shape and number of data points, and creates the corresponding       given shape and number of data points, and creates the corresponding
374       DataArrayView of this data.       DataArrayView of this data.
375    
      \param shape - Input - The shape of the point data.  
376       \param noSamples - Input - number of samples.       \param noSamples - Input - number of samples.
377       \param noDataPointsPerSample - Input - number of data points per sample.       \param noDataPointsPerSample - Input - number of data points per sample.
378    */    */
379    void    void
380    initialise(const DataArrayView::ShapeType& shape,    initialise(int noSamples,
              int noSamples,  
381               int noDataPointsPerSample);               int noDataPointsPerSample);
382    
383    /**    /**
# Line 390  class DataExpanded : public DataAbstract Line 390  class DataExpanded : public DataAbstract
390       \param value Input - A single data point value.       \param value Input - A single data point value.
391    */    */
392    void    void
393    copy(const DataArrayView& value);    copy(const DataConstant& value);
   
   /**  
      \brief  
      Copy the given data point value given a numarray object to all data points in this object.  
394    
      Description:  
      Copy the given data point value given a numarray object to all data points in this object.  
395    
      \param value Input - A single data point value.  
   */  
   void  
   copy(const boost::python::numeric::array& value);  
396    
397    /**    /**
398       \brief       \brief
399       Copy the numarray object to the data points in this object.       Copy the given data point value to all data points in this object.
   
      Description:  
      Copy the numarray object to the data points in this object.  
400    
401       \param value Input - new values for the data points       \param value Input - A single data point value.
402    */    */
403    
404    void    void
405    copyAll(const boost::python::numeric::array& value);    copy(const WrappedArray& value);
406    
407    
408    /**    /**
409       \brief       \brief
# Line 434  class DataExpanded : public DataAbstract Line 423  class DataExpanded : public DataAbstract
423    
424    /**    /**
425       \brief       \brief
426       Copy the numarray object to the data point dataPointNo of sample sampleNo in this object.       Copy the value to the data point dataPointNo of sample sampleNo in this object.
   
      Description:  
      Copy the numarray object to the data point dataPointNo of sample sampleNo in this object.  
427    
428       \param sampleNo Input - sample number       \param sampleNo Input - sample number
429       \param dataPointNo Input - data point of the sample       \param dataPointNo Input - data point of the sample
430       \param value Input - new values for the data point       \param value Input - new values for the data point
431    */    */
432    void    ESCRIPT_DLL_API
433    copyToDataPoint(const int sampleNo, const int dataPointNo, const boost::python::numeric::array& value);    virtual void
434      copyToDataPoint(const int sampleNo, const int dataPointNo, const WrappedArray& value);
435    
436    //    //
437    // The main data storage array, a 2D array of data blocks.    // The main data storage array, a 2D array of data blocks.

Legend:
Removed from v.1387  
changed lines
  Added in v.2458

  ViewVC Help
Powered by ViewVC 1.1.26