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

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

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

revision 474 by jgs, Mon Jan 30 04:23:44 2006 UTC revision 757 by woo409, Mon Jun 26 13:12:56 2006 UTC
# Line 1  Line 1 
1  /*  /*
2   ******************************************************************************   ************************************************************
3   *                                                                            *   *          Copyright 2006 by ACcESS MNRF                   *
4   *       COPYRIGHT  ACcESS 2004 -  All Rights Reserved                        *   *                                                          *
5   *                                                                            *   *              http://www.access.edu.au                    *
6   * This software is the property of ACcESS. No part of this code              *   *       Primary Business: Queensland, Australia            *
7   * may be copied in any form or by any means without the expressed written    *   *  Licensed under the Open Software License version 3.0    *
8   * consent of ACcESS.  Copying, use or modification of this software          *   *     http://www.opensource.org/licenses/osl-3.0.php       *
9   * by any unauthorised person is illegal unless that person has a software    *   *                                                          *
10   * license agreement with ACcESS.                                             *   ************************************************************
  *                                                                            *  
  ******************************************************************************  
11  */  */
12    
13  #if !defined escript_DataBlocks2D_20040405_H  #if !defined escript_DataBlocks2D_20040405_H
14  #define escript_DataBlocks2D_20040405_H  #define escript_DataBlocks2D_20040405_H
15    #include "system_dep.h"
16    
17  #include "DataVector.h"  #include "DataVector.h"
 #include "DataException.h"  
   
 #include "EsysAssert.h"  
18    
19  #include <sstream>  #include <sstream>
20  #include <iostream>  #include <iostream>
 #include <vector>  
21    
22  namespace escript {  namespace escript {
23    
# Line 43  class DataBlocks2D { Line 38  class DataBlocks2D {
38    // The type of the underlying data array under management.    // The type of the underlying data array under management.
39    // The multi-dimensional data points are flattened and stored    // The multi-dimensional data points are flattened and stored
40    // serially as a vector of doubles.    // serially as a vector of doubles.
   //typedef std::vector<double> ValueType;  
41    typedef DataVector ValueType;    typedef DataVector ValueType;
42    
43    /**    /**
# Line 54  class DataBlocks2D { Line 48  class DataBlocks2D {
48       Default constructor for DataBlocks2D.       Default constructor for DataBlocks2D.
49       Creates an empty DataBlocks2D object.       Creates an empty DataBlocks2D object.
50    */    */
51      ESCRIPT_DLL_API
52    DataBlocks2D();    DataBlocks2D();
53    
54    /**    /**
# Line 63  class DataBlocks2D { Line 58  class DataBlocks2D {
58       Description:       Description:
59       Copy constructor for DataBlocks2D.       Copy constructor for DataBlocks2D.
60    */    */
61      ESCRIPT_DLL_API
62    DataBlocks2D(const DataBlocks2D& other);    DataBlocks2D(const DataBlocks2D& other);
63    
64    /**    /**
# Line 78  class DataBlocks2D { Line 74  class DataBlocks2D {
74    
75       All parameters must be >0, else an exception will be thrown.       All parameters must be >0, else an exception will be thrown.
76    */    */
77      ESCRIPT_DLL_API
78    DataBlocks2D(int numRows, int numCols, int blockSize);    DataBlocks2D(int numRows, int numCols, int blockSize);
79    
80    /**    /**
# Line 87  class DataBlocks2D { Line 84  class DataBlocks2D {
84       Description:       Description:
85       Default destructor for DataBlocks2D.       Default destructor for DataBlocks2D.
86    */    */
87      ESCRIPT_DLL_API
88    ~DataBlocks2D();    ~DataBlocks2D();
89    
90    /**    /**
# Line 94  class DataBlocks2D { Line 92  class DataBlocks2D {
92       Return the size of the underlying data array.       Return the size of the underlying data array.
93       ie: Number of rows * Number of columns * Number of elements per data point.       ie: Number of rows * Number of columns * Number of elements per data point.
94    */    */
95      ESCRIPT_DLL_API
96    inline    inline
97    ValueType::size_type    ValueType::size_type
98    size() const;    size() const;
# Line 102  class DataBlocks2D { Line 101  class DataBlocks2D {
101       \brief       \brief
102       Return the number of rows in this DataBlocks2D array.       Return the number of rows in this DataBlocks2D array.
103    */    */
104      ESCRIPT_DLL_API
105    inline    inline
106    ValueType::size_type    ValueType::size_type
107    getNumRows() const;    getNumRows() const;
# Line 110  class DataBlocks2D { Line 110  class DataBlocks2D {
110       \brief       \brief
111       Return the number of columns in this DataBlocks2D array.       Return the number of columns in this DataBlocks2D array.
112    */    */
113      ESCRIPT_DLL_API
114    inline    inline
115    ValueType::size_type    ValueType::size_type
116    getNumCols() const;    getNumCols() const;
# Line 118  class DataBlocks2D { Line 119  class DataBlocks2D {
119       \brief       \brief
120       Return the data point size for this DataBlocks2D array.       Return the data point size for this DataBlocks2D array.
121    */    */
122      ESCRIPT_DLL_API
123    inline    inline
124    ValueType::size_type    ValueType::size_type
125    getBlockSize() const;    getBlockSize() const;
# Line 133  class DataBlocks2D { Line 135  class DataBlocks2D {
135    
136       All parameters must be >0, else an exception will be thrown.       All parameters must be >0, else an exception will be thrown.
137    */    */
138      ESCRIPT_DLL_API
139    void    void
140    resize(int numRows, int numCols, int blockSize);    resize(int numRows, int numCols, int blockSize);
141    
# Line 141  class DataBlocks2D { Line 144  class DataBlocks2D {
144       DataBlocks2D assignment operator =       DataBlocks2D assignment operator =
145       Assign the given DataBlocks2D object to this one.       Assign the given DataBlocks2D object to this one.
146    */    */
147      ESCRIPT_DLL_API
148    DataBlocks2D&    DataBlocks2D&
149    operator=(const DataBlocks2D& other);    operator=(const DataBlocks2D& other);
150    
# Line 148  class DataBlocks2D { Line 152  class DataBlocks2D {
152       \brief       \brief
153       Swap all the values managed by the given DataBlocks2D objects.       Swap all the values managed by the given DataBlocks2D objects.
154    */    */
155      ESCRIPT_DLL_API
156    void    void
157    Swap(DataBlocks2D& other);    Swap(DataBlocks2D& other);
158    
# Line 159  class DataBlocks2D { Line 164  class DataBlocks2D {
164      Subsequent elements of this data point can be accessed by manually      Subsequent elements of this data point can be accessed by manually
165      incrementing the returned index value.      incrementing the returned index value.
166    */    */
167      ESCRIPT_DLL_API
168    inline    inline
169    ValueType::size_type    ValueType::size_type
170    index(int row, int col) const;    index(int row, int col) const;
# Line 168  class DataBlocks2D { Line 174  class DataBlocks2D {
174      Return a reference to the first element for the data-point with index i      Return a reference to the first element for the data-point with index i
175      within the underlying data array as determined by the index(i,j) method.      within the underlying data array as determined by the index(i,j) method.
176    */    */
177      ESCRIPT_DLL_API
178    inline    inline
179    ValueType::reference    ValueType::reference
180    operator[](ValueType::size_type i);    operator[](ValueType::size_type i);
181    
182      ESCRIPT_DLL_API
183    inline    inline
184    ValueType::const_reference    ValueType::const_reference
185    operator[](ValueType::size_type i) const;    operator[](ValueType::size_type i) const;
# Line 180  class DataBlocks2D { Line 188  class DataBlocks2D {
188      \brief      \brief
189      Return a reference to the first element for the data-point (i,j).      Return a reference to the first element for the data-point (i,j).
190    */    */
191      ESCRIPT_DLL_API
192    inline    inline
193    ValueType::reference    ValueType::reference
194    operator()(int row, int col);    operator()(int row, int col);
195    
196      ESCRIPT_DLL_API
197    inline    inline
198    ValueType::const_reference    ValueType::const_reference
199    operator()(int row, int col) const;    operator()(int row, int col) const;
# Line 194  class DataBlocks2D { Line 204  class DataBlocks2D {
204       Data returned is an array type object that can be indexed via indexes generated       Data returned is an array type object that can be indexed via indexes generated
205       by DataBlocks2D::index.       by DataBlocks2D::index.
206    */    */
207      ESCRIPT_DLL_API
208    inline    inline
209    ValueType&    ValueType&
210    getData();    getData();
211    
212      ESCRIPT_DLL_API
213    inline    inline
214    const ValueType&    const ValueType&
215    getData() const;    getData() const;
# Line 210  class DataBlocks2D { Line 222  class DataBlocks2D {
222    
223      The return value indicates success (0) or otherwise (1).      The return value indicates success (0) or otherwise (1).
224    */    */
225      ESCRIPT_DLL_API
226    int    int
227    archiveData(std::ofstream& archiveFile,    archiveData(std::ofstream& archiveFile,
228                const ValueType::size_type noValues) const;                const ValueType::size_type noValues) const;
# Line 221  class DataBlocks2D { Line 234  class DataBlocks2D {
234    
235      The return value indicates success (0) or otherwise (1).      The return value indicates success (0) or otherwise (1).
236    */    */
237      ESCRIPT_DLL_API
238    int    int
239    extractData(std::ifstream& archiveFile,    extractData(std::ifstream& archiveFile,
240                const ValueType::size_type noValues);                const ValueType::size_type noValues);

Legend:
Removed from v.474  
changed lines
  Added in v.757

  ViewVC Help
Powered by ViewVC 1.1.26