/[escript]/trunk/escript/src/DataArrayView.cpp
ViewVC logotype

Diff of /trunk/escript/src/DataArrayView.cpp

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

revision 97 by jgs, Tue Dec 14 05:39:33 2004 UTC revision 100 by jgs, Wed Dec 15 03:48:48 2004 UTC
# Line 54  DataArrayView::DataArrayView(ValueType& Line 54  DataArrayView::DataArrayView(ValueType&
54         << m_maxRank;         << m_maxRank;
55        throw DataException(temp.str());        throw DataException(temp.str());
56      }      }
57      if (m_data->size() < (noValues()+m_offset)) {      if (m_data->size()<(noValues()+m_offset)) {
58        stringstream temp;        stringstream temp;
59        temp << "Error- Couldn't construct DataArrayView, insufficient storage."        temp << "Error- Couldn't construct DataArrayView, insufficient storage."
60         << " Shape requires: " << noValues()+m_offset << " values."         << " Shape requires: " << noValues()+m_offset << " values."
# Line 119  DataArrayView::copy(const boost::python: Line 119  DataArrayView::copy(const boost::python:
119        }        }
120      }      }
121  }  }
122      
123  void  void
124  DataArrayView::copy(const DataArrayView& other)  DataArrayView::copy(const DataArrayView& other)
125  {  {
# Line 180  DataArrayView::noValues(const ShapeType& Line 180  DataArrayView::noValues(const ShapeType&
180      }      }
181      return noValues;      return noValues;
182  }  }
183      
184  int  int
185  DataArrayView::noValues() const  DataArrayView::noValues() const
186  {  {
# Line 207  DataArrayView::createShapeErrorMessage(c Line 207  DataArrayView::createShapeErrorMessage(c
207  void  void
208  DataArrayView::setOffset(ValueType::size_type offset)  DataArrayView::setOffset(ValueType::size_type offset)
209  {  {
210      EsysAssert((m_data->size() >= (noValues()+offset)), "Invalid offset");      EsysAssert((m_data->size()>=(noValues()+offset)), "Invalid offset");
211      m_offset=offset;      m_offset=offset;
212  }  }
213    
214  DataArrayView::ShapeType  DataArrayView::ShapeType
215  DataArrayView::getResultSliceShape(const RegionType& region)  DataArrayView::getResultSliceShape(const RegionType& region)
216  {  {
     int dimSize;  
217      RegionType::const_iterator i;      RegionType::const_iterator i;
218      DataArrayView::ShapeType result;      DataArrayView::ShapeType result;
219      for (i=region.begin();i!=region.end();i++) {      for (i=region.begin();i!=region.end();++i) {
220        dimSize=((i->second) - (i->first));        int dimSize=(i->second-i->first);
221        if (dimSize!=0) {        if (dimSize!=0) {
222      result.push_back(dimSize);      result.push_back(dimSize);
223        }        }
# Line 226  DataArrayView::getResultSliceShape(const Line 225  DataArrayView::getResultSliceShape(const
225      return result;      return result;
226  }  }
227    
 DataArrayView::RegionType  
 DataArrayView::getSliceRegion(const boost::python::object& key) const  
 {  
   int slice_rank, out_rank, i;  
   int this_rank=getRank();  
   /* allow for case where key is singular eg: [1], this implies we  
      want to generate a rank-1 dimension object, as opposed to eg: [1,2]  
      which implies we want to take a rank dimensional object with one  
      dimension of size 1 */  
   extract<tuple> key_tuple(key);  
   if (key_tuple.check()) {  
       slice_rank=extract<int> (key.attr("__len__")());  
   } else {  
       slice_rank=1;  
   }  
   /* ensure slice is correctly dimensioned */  
   if (slice_rank>=this_rank) {  
        out_rank=slice_rank;  
   } else {  
        out_rank=this_rank;  
   }  
   DataArrayView::RegionType out(out_rank);  
   /* calculate values for slice range */  
   if (key_tuple.check()) {  
     for (i=0;i<slice_rank;i++) {  
       out[i]=getSliceRange(key[i],getShape()[i]);  
     }  
   } else {  
     out[0]=getSliceRange(key,getShape()[0]);  
   }  
   for (i=slice_rank;i<this_rank;i++) {  
     out[i]=std::pair<int,int>(0,getShape()[i]);  
   }  
   return out;  
 }  
   
 std::pair<int,int>  
 getSliceRange(const boost::python::object& key,  
               const int shape)  
 {  
   /* default slice range is range of entire shape dimension */  
   int s0=0, s1=shape;;  
   extract<int> slice_int(key);  
   if (slice_int.check()) {  
     /* if the key is a single int set start=key and end=key */  
     /* in this case, we want to return a rank-1 dimension object from  
        this object, taken from a single index value for one of this  
        object's dimensions */  
     s0=slice_int();  
     s1=s0;  
   } else {  
     /* if key is a pair extract begin and end values */  
     extract<int> step(key.attr("step"));  
     if (step.check() && step()!=1) {  
        throw DataException("Error - Data does not support increments in slicing ");  
     } else {  
       extract<int> start(key.attr("start"));  
       if (start.check()) {  
         s0=start();  
       }  
       extract<int> stop(key.attr("stop"));  
       if (stop.check()) {  
         s1=stop();  
       }  
     }  
   }  
   return std::pair<int,int>(s0,s1);  
 }  
   
228  void  void
229  DataArrayView::copySlice(const DataArrayView& other,  DataArrayView::copySlice(const DataArrayView& other,
230                           const RegionType& region)                           const RegionType& region)
231  {  {
232      //      //
233      // version of copySlice that uses the default offsets      // version of slice that uses the default offset
234      copySlice(m_offset,other,other.m_offset,region);      copySlice(m_offset,other,other.m_offset,region);
235  }  }
236    
# Line 310  DataArrayView::copySlice(ValueType::size Line 240  DataArrayView::copySlice(ValueType::size
240                           ValueType::size_type otherOffset,                           ValueType::size_type otherOffset,
241                           const RegionType& region)                           const RegionType& region)
242  {  {
   
     //  
     // Make sure this object is not empty  
     EsysAssert(!isEmpty(),"Error - this data object is empty.");  
   
243      //      //
244      // Modify region to copy from in order to      // Assume region is okay, Other asserts will detect range errors
245      // deal with the case where one range in the region contains identical indexes,      EsysAssert((other.getRank()==region.size()),"Error - Invalid slice region.");
246      // eg: <<1,1><0,3><0,3>>      EsysAssert((!isEmpty()&&checkShape(getResultSliceShape(region))),
247      // This situation implies we want to copy from an object with rank greater than that of this             createShapeErrorMessage("Error - Couldn't copy slice due to shape mismatch.",getResultSliceShape(region)));
248      // object. eg: we want to copy the values from a two dimensional slice out of a three      //
249      // dimensional object into a two dimensional object.      // take a local copy of the region and modify for the case
250      // We do this by taking a slice from the other object where one dimension of      // of 2:2 being equivalent to 2:3. The only difference in meaning being in
251      // the slice region is of size 1. So in the above example, we modify the above      // determining the output shape.
252      // region like so: <<1,2><0,3><0,3>> and take this slice.      RegionType localRegion=region;
253        for (int i=0;i<localRegion.size();++i) {
254      RegionType slice_region=region;        if (localRegion[i].first==localRegion[i].second) {
255      for (int i=0;i<slice_region.size();i++) {      ++(localRegion[i].second);
       if (slice_region[i].first==slice_region[i].second) {  
         (slice_region[i].second)++;  
256        }        }
257      }      }
   
     //  
     // Check the object to be sliced from is compatible with the region to be sliced,  
     // and that the region to be sliced is compatible with this object:  
     // 1: the region to be sliced should be the same rank as the other object.  
     // 2: the other object should have at least as many datapoints at the region requires.  
     // 3: the region should have the same number of datapoints as this object  
   
     DataArrayView::ShapeType slice_shape=getResultSliceShape(slice_region);  
     EsysAssert(other.getRank()==slice_region.size(),  
                "Error - slice rank incompatible with object to be sliced from.");  
     EsysAssert((noValues(slice_shape)<=other.noValues()),  
                "Error - slice shape incompatible with object to be sliced from.");  
     EsysAssert((noValues(slice_shape)==noValues()),  
                "Error - slice shape incompatible with this object.");  
   
     //  
     // copy the values in the specified slice_region of the other object into this object  
   
258      int numCopy=0;      int numCopy=0;
259      switch (slice_region.size()) {      switch (localRegion.size()) {
260      case 0:      case 0:
       /* this case should never be encountered, as python will never pass us an empty slice */  
261        (*m_data)[thisOffset]=(*other.m_data)[otherOffset];        (*m_data)[thisOffset]=(*other.m_data)[otherOffset];
262        break;        break;
263      case 1:      case 1:
264        for (int i=slice_region[0].first;i<slice_region[0].second;i++) {        for (int i=localRegion[0].first;i<localRegion[0].second;++i) {
265      (*m_data)[numCopy+thisOffset]=(*other.m_data)[i+otherOffset];      (*m_data)[numCopy+thisOffset]=(*other.m_data)[i+otherOffset];
266      numCopy++;      ++numCopy;
267        }        }
268        break;        break;
269      case 2:      case 2:
270        for (int j=slice_region[1].first;j<slice_region[1].second;j++) {        for (int j=localRegion[1].first;j<localRegion[1].second;++j) {
271      for (int i=slice_region[0].first;i<slice_region[0].second;i++) {      for (int i=localRegion[0].first;i<localRegion[0].second;++i) {
272        (*m_data)[numCopy+thisOffset]=(*other.m_data)[other.relIndex(i,j)+otherOffset];        (*m_data)[numCopy+thisOffset]=(*other.m_data)[other.relIndex(i,j)+otherOffset];
273        numCopy++;        ++numCopy;
274      }      }
275        }        }
276        break;        break;
277      case 3:      case 3:
278        for (int k=slice_region[2].first;k<slice_region[2].second;k++) {        for (int k=localRegion[2].first;k<localRegion[2].second;++k) {
279      for (int j=slice_region[1].first;j<slice_region[1].second;j++) {      for (int j=localRegion[1].first;j<localRegion[1].second;++j) {
280        for (int i=slice_region[0].first;i<slice_region[0].second;i++) {        for (int i=localRegion[0].first;i<localRegion[0].second;++i) {
281          (*m_data)[numCopy+thisOffset]=(*other.m_data)[other.relIndex(i,j,k)+otherOffset];          (*m_data)[numCopy+thisOffset]=(*other.m_data)[other.relIndex(i,j,k)+otherOffset];
282          numCopy++;          ++numCopy;
283        }        }
284      }      }
285        }        }
286        break;        break;
287      case 4:      case 4:
288        for (int l=slice_region[3].first;l<slice_region[3].second;l++) {        for (int m=localRegion[2].first;m<localRegion[2].second;++m) {
289      for (int k=slice_region[2].first;k<slice_region[2].second;k++) {      for (int k=localRegion[2].first;k<localRegion[2].second;++k) {
290        for (int j=slice_region[1].first;j<slice_region[1].second;j++) {        for (int j=localRegion[1].first;j<localRegion[1].second;++j) {
291          for (int i=slice_region[0].first;i<slice_region[0].second;i++) {          for (int i=localRegion[0].first;i<localRegion[0].second;++i) {
292            (*m_data)[numCopy+thisOffset]=(*other.m_data)[other.relIndex(i,j,k,l)+otherOffset];            (*m_data)[numCopy+thisOffset]=(*other.m_data)[other.relIndex(i,j,k,m)+otherOffset];
293            numCopy++;            ++numCopy;
294          }          }
295        }        }
296      }      }
# Line 395  DataArrayView::copySlice(ValueType::size Line 298  DataArrayView::copySlice(ValueType::size
298        break;        break;
299      default:      default:
300        stringstream mess;        stringstream mess;
301        mess << "Error - (copySlice) Invalid rank: " << slice_region.size() << " for region.";        mess << "Error - (copySlice) Invalid rank.";
302        throw DataException(mess.str());        throw DataException(mess.str());
303      }      }
304  }  }
305      
306  void  void
307  DataArrayView::copySliceFrom(const DataArrayView& other,  DataArrayView::copySliceFrom(const DataArrayView& other,
308                               const RegionType& region)                               const RegionType& region)
# Line 415  DataArrayView::copySliceFrom(ValueType:: Line 318  DataArrayView::copySliceFrom(ValueType::
318                               ValueType::size_type otherOffset,                               ValueType::size_type otherOffset,
319                               const RegionType& region)                               const RegionType& region)
320  {  {
   
321      //      //
322      // Make sure this object is not empty      // Assume region is okay, Other asserts will detect range errors
323      EsysAssert(!isEmpty(),"Error - this data object is empty.");      EsysAssert((getRank()==region.size()),"Error - Invalid slice region.");
324        EsysAssert((!isEmpty()&&other.checkShape(getResultSliceShape(region))),
325      //             createShapeErrorMessage("Error - Couldn't copy slice due to shape mismatch.",
326      // Modify region to copy in order to                         getResultSliceShape(region)));
327      // deal with the case where one range in the region contains identical idexes,      //
328      // eg: <<1,1><0,3><0,3>>      // take a local copy of the region and modify for the case
329      // This situation implies we want to copy from an object with rank less than that of this      // of 2:2 being equivalent to 2:3. The only difference in meaning being in
330      // object. eg: we want to copy the values from a two dimensional object into a two dimensional      // determining the output shape.
331      // slice of a three dimensional object.      RegionType localRegion=region;
332      // We do this by copying to a slice from this object where one dimension of      for (int i=0;i<localRegion.size();++i) {
333      // the slice region is of size 1. So in the above example, we modify the above        if (localRegion[i].first==localRegion[i].second) {
334      // region like so: <<1,2><0,3><0,3>> and copy into this slice.      ++(localRegion[i].second);
   
     RegionType slice_region=region;  
     for (int i=0;i<slice_region.size();i++) {  
       if (slice_region[i].first==slice_region[i].second) {  
         (slice_region[i].second)++;  
335        }        }
336      }      }
   
     //  
     // Check the object to be coped from is compatible with the slice region to be copied  
     // into, and that the region to be sliced into is compatible with this object:  
     // 1: the region to be sliced into should be the same rank as this object.  
     // 2: the other object should have exactly the same number of data points as the  
     //    region to be sliced into requires.  
     // 3: the region can be a higher rank than the other object, provided 2 holds.  
     // 4: this object must have at least as many data points as the region requires.  
   
     //  
     // Check region size and shape  
     DataArrayView::ShapeType slice_shape=getResultSliceShape(slice_region);  
     EsysAssert((getRank()==slice_region.size()),"Error - Invalid slice region.");  
     EsysAssert((noValues(slice_shape)==other.noValues()),  
                "Error - slice shape incompatible with object to be sliced from.");  
     EsysAssert(other.getRank()<=slice_region.size(),  
                "Error - slice rank incompatible with object to be sliced from.");  
     EsysAssert((noValues(slice_shape)<=noValues()),  
                "Error - slice shape incompatible with this object.");  
   
     //  
     // copy the values in the other object into the specified slice_region of this object  
   
337      int numCopy=0;      int numCopy=0;
338      switch (slice_region.size()) {      switch (localRegion.size()) {
339      case 0:      case 0:
       /* this case should never be encountered, as python will never pass us an empty slice */  
340        (*m_data)[thisOffset]=(*other.m_data)[otherOffset];        (*m_data)[thisOffset]=(*other.m_data)[otherOffset];
341        break;        break;
342      case 1:      case 1:
343        for (int i=slice_region[0].first;i<slice_region[0].second;i++) {        for (int i=localRegion[0].first;i<localRegion[0].second;++i) {
344      (*m_data)[i+thisOffset]=(*other.m_data)[numCopy+otherOffset];      (*m_data)[i+thisOffset]=(*other.m_data)[numCopy+otherOffset];
345      numCopy++;      ++numCopy;
346        }        }
347        break;        break;
348      case 2:      case 2:
349        for (int j=slice_region[1].first;j<slice_region[1].second;j++) {        for (int j=localRegion[1].first;j<localRegion[1].second;++j) {
350      for (int i=slice_region[0].first;i<slice_region[0].second;i++) {      for (int i=localRegion[0].first;i<localRegion[0].second;++i) {
351        (*m_data)[relIndex(i,j)+thisOffset]=(*other.m_data)[numCopy+otherOffset];        (*m_data)[relIndex(i,j)+thisOffset]=(*other.m_data)[numCopy+otherOffset];
352        numCopy++;        ++numCopy;
353      }      }
354        }        }
355        break;        break;
356      case 3:      case 3:
357        for (int k=slice_region[2].first;k<slice_region[2].second;k++) {        for (int k=localRegion[2].first;k<localRegion[2].second;++k) {
358      for (int j=slice_region[1].first;j<slice_region[1].second;j++) {      for (int j=localRegion[1].first;j<localRegion[1].second;++j) {
359        for (int i=slice_region[0].first;i<slice_region[0].second;i++) {        for (int i=localRegion[0].first;i<localRegion[0].second;++i) {
360          (*m_data)[relIndex(i,j,k)+thisOffset]=(*other.m_data)[numCopy+otherOffset];          (*m_data)[relIndex(i,j,k)+thisOffset]=(*other.m_data)[numCopy+otherOffset];
361          numCopy++;          ++numCopy;
362        }        }
363      }      }
364        }        }
365        break;        break;
366      case 4:      case 4:
367        for (int l=slice_region[3].first;l<slice_region[3].second;l++) {        for (int m=localRegion[2].first;m<localRegion[2].second;++m) {
368      for (int k=slice_region[2].first;k<slice_region[2].second;k++) {      for (int k=localRegion[2].first;k<localRegion[2].second;++k) {
369        for (int j=slice_region[1].first;j<slice_region[1].second;j++) {        for (int j=localRegion[1].first;j<localRegion[1].second;++j) {
370          for (int i=slice_region[0].first;i<slice_region[0].second;i++) {          for (int i=localRegion[0].first;i<localRegion[0].second;++i) {
371            (*m_data)[relIndex(i,j,k,l)+thisOffset]=(*other.m_data)[numCopy+otherOffset];            (*m_data)[relIndex(i,j,k,m)+thisOffset]=(*other.m_data)[numCopy+otherOffset];
372            numCopy++;            ++numCopy;
373          }          }
374        }        }
375      }      }
# Line 505  DataArrayView::copySliceFrom(ValueType:: Line 377  DataArrayView::copySliceFrom(ValueType::
377        break;        break;
378      default:      default:
379        stringstream mess;        stringstream mess;
380        mess << "Error - (copySliceFrom) Invalid rank: " << slice_region.size() << " for region.";        mess << "Error - (copySliceFrom) Invalid rank: " << localRegion.size() << " for region.";
381        throw DataException(mess.str());        throw DataException(mess.str());
382      }      }
383  }  }
384      
385  DataArrayView::ShapeType  DataArrayView::ShapeType
386  DataArrayView::determineResultShape(const DataArrayView& left,  DataArrayView::determineResultShape(const DataArrayView& left,
387                                      const DataArrayView& right)                                      const DataArrayView& right)
388  {  {
389      DataArrayView::ShapeType temp;      DataArrayView::ShapeType temp;
390      for (int i=0; i<(left.getRank()-1); i++) {      for (int i=0; i<(left.getRank()-1); ++i) {
391        temp.push_back(left.getShape()[i]);        temp.push_back(left.getShape()[i]);
392      }      }
393      for (int i=1; i<right.getRank(); i++) {      for (int i=1; i<right.getRank(); ++i) {
394        temp.push_back(right.getShape()[i]);        temp.push_back(right.getShape()[i]);
395      }      }
396      return temp;      return temp;
# Line 538  DataArrayView::toString(const string& su Line 410  DataArrayView::toString(const string& su
410        temp << finalSuffix << (*this)();        temp << finalSuffix << (*this)();
411        break;        break;
412      case 1:      case 1:
413        for (int i=0;i<getShape()[0];i++) {        for (int i=0;i<getShape()[0];++i) {
414      temp << "(" << i << ") " << finalSuffix << (*this)(i);      temp << "(" << i << ") " << finalSuffix << (*this)(i);
415      if (i!=(getShape()[0]-1)) {      if (i!=(getShape()[0]-1)) {
416        temp << endl;        temp << endl;
# Line 546  DataArrayView::toString(const string& su Line 418  DataArrayView::toString(const string& su
418        }        }
419        break;        break;
420      case 2:      case 2:
421        for (int i=0;i<getShape()[0];i++) {        for (int i=0;i<getShape()[0];++i) {
422      for (int j=0;j<getShape()[1];j++) {      for (int j=0;j<getShape()[1];++j) {
423        temp << "(" << i << "," << j << ") " << finalSuffix << (*this)(i,j);        temp << "(" << i << "," << j << ") " << finalSuffix << (*this)(i,j);
424        if (!(i==(getShape()[0]-1) && j==(getShape()[1]-1))) {        if (!(i==(getShape()[0]-1) && j==(getShape()[1]-1))) {
425          temp << endl;          temp << endl;
# Line 556  DataArrayView::toString(const string& su Line 428  DataArrayView::toString(const string& su
428        }        }
429        break;        break;
430      case 3:      case 3:
431        for (int i=0;i<getShape()[0];i++) {        for (int i=0;i<getShape()[0];++i) {
432      for (int j=0;j<getShape()[1];j++) {      for (int j=0;j<getShape()[1];++j) {
433        for (int k=0;k<getShape()[2];k++) {        for (int k=0;k<getShape()[2];++k) {
434          temp << "(" << i << "," << j << "," << k << ") " << finalSuffix << (*this)(i,j,k);          temp << "("
435          if (!(i==(getShape()[0]-1) && j==(getShape()[1]-1) && k==(getShape()[2]-1))) {           << i << ","
436             << j << ","
437             << k << ") "
438             << finalSuffix << (*this)(i,j,k);
439            //
440            // don't put an endl after the last value
441            if (!(i==(getShape()[0]-1) &&
442              j==(getShape()[1]-1) &&
443              k==(getShape()[2]-1))) {
444            temp << endl;            temp << endl;
445          }          }
446        }        }
# Line 568  DataArrayView::toString(const string& su Line 448  DataArrayView::toString(const string& su
448        }        }
449        break;        break;
450      case 4:      case 4:
451        for (int i=0;i<getShape()[0];i++) {        // break;
     for (int j=0;j<getShape()[1];j++) {  
       for (int k=0;k<getShape()[2];k++) {  
         for (int l=0;l<getShape()[3];l++) {  
           temp << "(" << i << "," << j << "," << k << "," << l << ") " << finalSuffix << (*this)(i,j,k,l);  
           if (!(i==(getShape()[0]-1) && j==(getShape()[1]-1) && k==(getShape()[2]-1) && l==(getShape()[3]-1))) {  
             temp << endl;  
           }  
             }  
       }  
     }  
       }  
       break;  
452      default:      default:
453        stringstream mess;        stringstream mess;
454        mess << "Error - (toString) Invalid rank: " << getRank();        mess << "Error - (toString) Invalid rank: " << getRank();
# Line 594  DataArrayView::shapeToString(const DataA Line 462  DataArrayView::shapeToString(const DataA
462  {  {
463      stringstream temp;      stringstream temp;
464      temp << "(";      temp << "(";
465      for (int i=0;i<shape.size();i++) {      for (int i=0;i<shape.size();++i) {
466        temp << shape[i];        temp << shape[i];
467        if (i < shape.size()-1) {        if (shape.size()-i != 1) {
468      temp << ",";      temp << ",";
469        }        }
470      }      }
# Line 721  DataArrayView::matMult(const DataArrayVi Line 589  DataArrayView::matMult(const DataArrayVi
589      }      }
590  }  }
591    
592    DataArrayView::RegionType
593    DataArrayView::getSliceRegion(const boost::python::object& key) const
594    {
595        int slice_len=0,i=0,rank=getRank(),out_len=0;
596        extract<tuple> key_tuple(key);
597        if (key_tuple.check()) {
598            slice_len=extract<int>(key.attr("__len__")());
599        } else {
600            slice_len=1;
601        }
602        if (slice_len>=rank) {
603             out_len=slice_len;
604        } else {
605             out_len=rank;
606        }
607        DataArrayView::RegionType out(out_len);
608        if (key_tuple.check()) {
609             for (i=0;i<slice_len;i++) out[i]=getSliceRange(getShape()[i],key[i]);
610        } else {
611             out[0]=getSliceRange(getShape()[0],key);
612        }
613        for (i=slice_len;i<rank;i++) out[i]=std::pair<int,int>(0,getShape()[i]);
614        // throw DataException("Error - number of slices is bigger then the rank.");
615        return out;
616    }
617    
618    std::pair<int,int>
619    getSliceRange(const int s,
620                  const boost::python::object& key)
621    {
622       int s1=s;
623       int s0=0;
624       /* if the key is an int we set start=end=key */
625       extract<int> slice_int(key);
626       if (slice_int.check()) {
627             s0=slice_int();
628             s1=s0;
629       } else {
630           extract<int> step(key.attr("step"));
631           if (step.check() && step()!=1) {
632                throw DataException("Error - Data does not support increments in slicing ");
633           } else {
634              extract<int> start(key.attr("start"));
635              if (start.check()) s0=start();
636              extract<int> stop(key.attr("stop"));
637              if (stop.check()) s1=stop();
638           }
639       }
640       return std::pair<int,int>(s0,s1);
641    }
642    
643  bool operator==(const DataArrayView& left, const DataArrayView& right)  bool operator==(const DataArrayView& left, const DataArrayView& right)
644  {  {
645      //      //

Legend:
Removed from v.97  
changed lines
  Added in v.100

  ViewVC Help
Powered by ViewVC 1.1.26