/[escript]/branches/arrayview_from_1695_trunk/escript/src/DataTypes.h
ViewVC logotype

Diff of /branches/arrayview_from_1695_trunk/escript/src/DataTypes.h

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

revision 1715 by jfenwick, Thu Aug 21 04:52:14 2008 UTC revision 1734 by jfenwick, Thu Aug 28 06:11:56 2008 UTC
# Line 18  Line 18 
18  #include "system_dep.h"  #include "system_dep.h"
19  #include "DataVector.h"  #include "DataVector.h"
20  #include <vector>  #include <vector>
21    #include <string>
22  #include <boost/python/object.hpp>  #include <boost/python/object.hpp>
23    
24  namespace escript {  namespace escript {
# Line 124  namespace escript { Line 125  namespace escript {
125           getSliceRegion(0:1)         => < <0,1> <0,4> <0,6> >           getSliceRegion(0:1)         => < <0,1> <0,4> <0,6> >
126           getSliceRegion(:1,0:2)      => < <0,1> <0,2> <0,6> >           getSliceRegion(:1,0:2)      => < <0,1> <0,2> <0,6> >
127    
128    
129         Note: Not unit tested in c++.
130    */    */
131     ESCRIPT_DLL_API     ESCRIPT_DLL_API
132     DataTypes::RegionType     DataTypes::RegionType
# Line 168  namespace escript { Line 171  namespace escript {
171    getRelIndex(const DataTypes::ShapeType& shape, DataTypes::ValueType::size_type i,    getRelIndex(const DataTypes::ShapeType& shape, DataTypes::ValueType::size_type i,
172         DataTypes::ValueType::size_type j)         DataTypes::ValueType::size_type j)
173    {    {
174      EsysAssert((getRank()==2),"Incorrect number of indices for the rank of this object.");      EsysAssert((getRank(shape)==2),"Incorrect number of indices for the rank of this object.");
175      DataTypes::ValueType::size_type temp=i+j*shape[0];      DataTypes::ValueType::size_type temp=i+j*shape[0];
176      EsysAssert((temp < DataTypes::noValues(shape)), "Error - Invalid index.");      EsysAssert((temp < DataTypes::noValues(shape)), "Error - Invalid index.");
177      return temp;      return temp;
# Line 180  namespace escript { Line 183  namespace escript {
183    getRelIndex(const DataTypes::ShapeType& shape, DataTypes::ValueType::size_type i,    getRelIndex(const DataTypes::ShapeType& shape, DataTypes::ValueType::size_type i,
184         DataTypes::ValueType::size_type j, DataTypes::ValueType::size_type k)         DataTypes::ValueType::size_type j, DataTypes::ValueType::size_type k)
185    {    {
186      EsysAssert((getRank()==3),"Incorrect number of indices for the rank of this object.");      EsysAssert((getRank(shape)==3),"Incorrect number of indices for the rank of this object.");
187      DataTypes::ValueType::size_type temp=i+j*shape[0]+k*shape[1]*shape[0];      DataTypes::ValueType::size_type temp=i+j*shape[0]+k*shape[1]*shape[0];
188      EsysAssert((temp < DataTypes::noValues(shape)), "Error - Invalid index.");      EsysAssert((temp < DataTypes::noValues(shape)), "Error - Invalid index.");
189      return temp;      return temp;
# Line 193  namespace escript { Line 196  namespace escript {
196         DataTypes::ValueType::size_type j, DataTypes::ValueType::size_type k,         DataTypes::ValueType::size_type j, DataTypes::ValueType::size_type k,
197         DataTypes::ValueType::size_type m)         DataTypes::ValueType::size_type m)
198    {    {
199      EsysAssert((getRank()==4),"Incorrect number of indices for the rank of this object.");      EsysAssert((getRank(shape)==4),"Incorrect number of indices for the rank of this object.");
200      DataTypes::ValueType::size_type temp=i+j*shape[0]+k*shape[1]*shape[0]+m*shape[2]*shape[1]*shape[0];      DataTypes::ValueType::size_type temp=i+j*shape[0]+k*shape[1]*shape[0]+m*shape[2]*shape[1]*shape[0];
201      EsysAssert((temp < DataTypes::noValues(m_shape)), "Error - Invalid index.");      EsysAssert((temp < DataTypes::noValues(shape)), "Error - Invalid index.");
202      return temp;      return temp;
203    }    }
204    
# Line 207  namespace escript { Line 210  namespace escript {
210      return s1==s2;      return s1==s2;
211    }    }
212    
213       std::string
214       createShapeErrorMessage(const std::string& messagePrefix,
215                                              const DataTypes::ShapeType& other,
216                          const DataTypes::ShapeType& thisShape);
217    
218    
219      /**
220         \brief
221         Copy a data slice specified by the given region and offset from the
222         given view into this view at the given offset.
223    
224         \param thisOffset - Input -
225                          Copy the slice to this offset in this view.
226         \param other - Input -
227                          View to copy data from.
228         \param otherOffset - Input -
229                          Copy the slice from this offset in the given view.
230         \param region - Input -
231                          Region in other view to copy data from.
232      */
233       void
234       copySlice(ValueType& left,
235                    const ShapeType& leftShape,
236                    ValueType::size_type thisOffset,
237                                const ValueType& other,
238                    const ShapeType& otherShape,
239                                ValueType::size_type otherOffset,
240                                const RegionLoopRangeType& region);
241    
242      /**
243         \brief
244         Copy data into a slice specified by the given region and offset in
245         this view from the given view at the given offset.
246    
247         \param thisOffset - Input -
248                        Copy the slice to this offset in this view.
249         \param other - Input -
250                        View to copy data from.
251         \param otherOffset - Input -
252                        Copy the slice from this offset in the given view.
253         \param region - Input -
254                        Region in this view to copy data to.
255      */
256       void
257       copySliceFrom(ValueType& left,
258                    const ShapeType& leftShape,
259                    ValueType::size_type thisOffset,
260                                    const ValueType& other,
261                    const ShapeType& otherShape,
262                                    ValueType::size_type otherOffset,
263                                    const RegionLoopRangeType& region);
264    
265    
266   }   // End namespace DataTypes   }   // End namespace DataTypes
267    
268    

Legend:
Removed from v.1715  
changed lines
  Added in v.1734

  ViewVC Help
Powered by ViewVC 1.1.26