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

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

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

revision 1713 by jfenwick, Tue Aug 12 01:13:16 2008 UTC revision 1714 by jfenwick, Thu Aug 21 00:01:55 2008 UTC
# Line 552  class DataArrayView { Line 552  class DataArrayView {
552               DataTypes::ValueType::size_type k,               DataTypes::ValueType::size_type k,
553               DataTypes::ValueType::size_type m) const;               DataTypes::ValueType::size_type m) const;
554    
555    /**  //  /**
556       \brief  /*     \brief
557       Determine the shape of the specified slice region.       Determine the shape of the specified slice region.
558       This is purely a utility method and has no bearing on this view.       This is purely a utility method and has no bearing on this view.
559    
560       \param region - Input -       \param region - Input -
561                         Slice region.                         Slice region.*/
562    */  //  */
563    ESCRIPT_DLL_API  //   ESCRIPT_DLL_API
564    static  //   static
565    DataTypes::ShapeType  //   DataTypes::ShapeType
566    getResultSliceShape(const DataTypes::RegionType& region);  //   getResultSliceShape(const DataTypes::RegionType& region);
567    
568    /**  //  /**
569       \brief  //      \brief
570       Determine the region specified by the given python slice object.  //      Determine the region specified by the given python slice object.
571    //
572       \param key - Input -  //      \param key - Input -
573                      python slice object specifying region to be returned.  //                     python slice object specifying region to be returned.
574    //
575       The slice object is a tuple of n python slice specifiers, where  //      The slice object is a tuple of n python slice specifiers, where
576       n <= the rank of this Data object. Each slice specifier specifies the  //      n <= the rank of this Data object. Each slice specifier specifies the
577       range of indexes to be sliced from the corresponding dimension. The  //      range of indexes to be sliced from the corresponding dimension. The
578       first specifier corresponds to the first dimension, the second to the  //      first specifier corresponds to the first dimension, the second to the
579       second and so on. Where n < the rank, the remaining dimensions are  //      second and so on. Where n < the rank, the remaining dimensions are
580       sliced across the full range of their indicies.  //      sliced across the full range of their indicies.
581    //
582       Each slice specifier is of the form "a:b", which specifies a slice  //      Each slice specifier is of the form "a:b", which specifies a slice
583       from index a, up to but not including index b. Where index a is ommitted  //      from index a, up to but not including index b. Where index a is ommitted
584       a is assumed to be 0. Where index b is ommitted, b is assumed to be the  //      a is assumed to be 0. Where index b is ommitted, b is assumed to be the
585       length of this dimension. Where both are ommitted (eg: ":") the slice is  //      length of this dimension. Where both are ommitted (eg: ":") the slice is
586       assumed to encompass that entire dimension.  //      assumed to encompass that entire dimension.
587    //
588       Where one of the slice specifiers is a single integer, eg: [1], we  //      Where one of the slice specifiers is a single integer, eg: [1], we
589       want to generate a rank-1 dimension object, as opposed to eg: [1,2]  //      want to generate a rank-1 dimension object, as opposed to eg: [1,2]
590       which implies we want to take a rank dimensional object with one  //      which implies we want to take a rank dimensional object with one
591       dimension of size 1.  //      dimension of size 1.
592    //
593       The return value is a vector of pairs with length equal to the rank of  //      The return value is a vector of pairs with length equal to the rank of
594       this object. Each pair corresponds to the range of indicies from the  //      this object. Each pair corresponds to the range of indicies from the
595       corresponding dimension to be sliced from, as specified in the input  //      corresponding dimension to be sliced from, as specified in the input
596       slice object.  //      slice object.
597    //
598       Examples:  //      Examples:
599    //
600         For a rank 1 object of shape(5):  //        For a rank 1 object of shape(5):
601    //
602           getSliceRegion(:)   => < <0,5> >  //          getSliceRegion(:)   => < <0,5> >
603           getSliceRegion(2:3) => < <2,3> >  //          getSliceRegion(2:3) => < <2,3> >
604           getSliceRegion(:3)  => < <0,3> >  //          getSliceRegion(:3)  => < <0,3> >
605           getSliceRegion(2:)  => < <2,5> >  //          getSliceRegion(2:)  => < <2,5> >
606    //
607         For a rank 2 object of shape(4,5):  //        For a rank 2 object of shape(4,5):
608    //
609           getSliceRegion(2:3) => < <2,3> <0,5> >  //          getSliceRegion(2:3) => < <2,3> <0,5> >
610           getSliceRegion(2)   => < <2,3> <0,5> >  //          getSliceRegion(2)   => < <2,3> <0,5> >
611             NB: but return object requested will have rank 1, shape(5), with  //            NB: but return object requested will have rank 1, shape(5), with
612                 values taken from index 2 of this object's first dimension.  //                values taken from index 2 of this object's first dimension.
613    //
614         For a rank 3 object of shape (2,4,6):  //        For a rank 3 object of shape (2,4,6):
615    //
616           getSliceRegion(0:2,0:4,0:6) => < <0,2> <0,4> <0,6> >  //          getSliceRegion(0:2,0:4,0:6) => < <0,2> <0,4> <0,6> >
617           getSliceRegion(:,:,:)       => < <0,2> <0,4> <0,6> >  //          getSliceRegion(:,:,:)       => < <0,2> <0,4> <0,6> >
618           getSliceRegion(0:1)         => < <0,1> <0,4> <0,6> >  //          getSliceRegion(0:1)         => < <0,1> <0,4> <0,6> >
619           getSliceRegion(:1,0:2)      => < <0,1> <0,2> <0,6> >  //          getSliceRegion(:1,0:2)      => < <0,1> <0,2> <0,6> >
620    
621    */  //  */
622    ESCRIPT_DLL_API  //   ESCRIPT_DLL_API
623    DataTypes::RegionType  //   DataTypes::RegionType
624    getSliceRegion(const boost::python::object& key) const;  //   getSliceRegion(const boost::python::object& key) const;
625    
626    /**    /**
627       \brief       \brief
# Line 1545  ESCRIPT_DLL_API bool operator!=(const Da Line 1545  ESCRIPT_DLL_API bool operator!=(const Da
1545  DataTypes::RegionLoopRangeType  DataTypes::RegionLoopRangeType
1546  getSliceRegionLoopRange(const DataTypes::RegionType& region);  getSliceRegionLoopRange(const DataTypes::RegionType& region);
1547    
1548  /**  ///**
1549    \brief  //  \brief
1550    Calculate the slice range from the given python key object  //  Calculate the slice range from the given python key object
1551    Used by DataArrayView::getSliceRegion.  //  Used by DataArrayView::getSliceRegion.
1552    Returns the python slice object key as a pair of ints where the first  //  Returns the python slice object key as a pair of ints where the first
1553    member is the start and the second member is the end. the presence of a possible  //  member is the start and the second member is the end. the presence of a possible
1554    step attribute with value different from one will throw an exception  //  step attribute with value different from one will throw an exception
1555    //
1556    /param key - Input - key object specifying slice range.  //  /param key - Input - key object specifying slice range.
1557  */  //*/
1558  std::pair<int,int>  // std::pair<int,int>
1559  getSliceRange(const boost::python::object& key,  // getSliceRange(const boost::python::object& key,
1560                const int shape);  //               const int shape);
1561    
1562  /**  /**
1563     Inline function definitions.     Inline function definitions.

Legend:
Removed from v.1713  
changed lines
  Added in v.1714

  ViewVC Help
Powered by ViewVC 1.1.26