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

Diff of /trunk/escript/src/DataExpanded.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 108 by jgs, Thu Jan 27 06:21:59 2005 UTC
# Line 96  DataExpanded::DataExpanded(const DataExp Line 96  DataExpanded::DataExpanded(const DataExp
96    // initialise this Data object to the shape of the slice    // initialise this Data object to the shape of the slice
97    initialise(shape,other.getNumSamples(),other.getNumDPPSample());    initialise(shape,other.getNumSamples(),other.getNumDPPSample());
98    //    //
99      DataArrayView::RegionLoopRangeType region_loop_range=getSliceRegionLoopRange(region);
100      //
101    // copy the data    // copy the data
102    DataArrayView::ValueType::size_type numRows=m_data.getNumRows();    DataArrayView::ValueType::size_type numRows=m_data.getNumRows();
103    DataArrayView::ValueType::size_type numCols=m_data.getNumCols();    DataArrayView::ValueType::size_type numCols=m_data.getNumCols();
# Line 104  DataExpanded::DataExpanded(const DataExp Line 106  DataExpanded::DataExpanded(const DataExp
106    for (i=0;i<numRows;++i) {    for (i=0;i<numRows;++i) {
107      for (j=0;j<numCols;++j) {      for (j=0;j<numCols;++j) {
108        try {        try {
109          getPointDataView().copySlice(getPointOffset(i,j),other.getPointDataView(),other.getPointOffset(i,j),region);          getPointDataView().copySlice(getPointOffset(i,j),other.getPointDataView(),other.getPointOffset(i,j),region_loop_range);
110        }        }
111        catch (std::exception& e) {        catch (std::exception& e) {
112          cout << e.what() << endl;          cout << e.what() << endl;
# Line 176  DataExpanded::setSlice(const DataAbstrac Line 178  DataExpanded::setSlice(const DataAbstrac
178    if (tempDataExp==0) {    if (tempDataExp==0) {
179      throw DataException("Programming error - casting to DataExpanded.");      throw DataException("Programming error - casting to DataExpanded.");
180    }    }
181      //
182      DataArrayView::ShapeType shape(DataArrayView::getResultSliceShape(region));
183      DataArrayView::RegionLoopRangeType region_loop_range=getSliceRegionLoopRange(region);
184      //
185      // check shape:
186    if (getPointDataView().getRank()!=region.size()) {    if (getPointDataView().getRank()!=region.size()) {
187      throw DataException("Error - Invalid slice region.");      throw DataException("Error - Invalid slice region.");
188    }    }
189    if (!value->getPointDataView().checkShape(DataArrayView::getResultSliceShape(region))) {    if (tempDataExp->getPointDataView().getRank()>0 and !value->getPointDataView().checkShape(shape)) {
190      throw DataException (value->getPointDataView().createShapeErrorMessage(      throw DataException (value->getPointDataView().createShapeErrorMessage(
191          "Error - Couldn't copy slice due to shape mismatch.",DataArrayView::getResultSliceShape(region)));          "Error - Couldn't copy slice due to shape mismatch.",shape));
192    }    }
193    //    //
194    // copy the data    // copy the data
# Line 191  DataExpanded::setSlice(const DataAbstrac Line 198  DataExpanded::setSlice(const DataAbstrac
198  #pragma omp parallel for private(i,j) schedule(static)  #pragma omp parallel for private(i,j) schedule(static)
199    for (i=0;i<numRows;i++) {    for (i=0;i<numRows;i++) {
200      for (j=0;j<numCols;j++) {      for (j=0;j<numCols;j++) {
201        getPointDataView().copySliceFrom(getPointOffset(i,j),tempDataExp->getPointDataView(),tempDataExp->getPointOffset(i,j),region);        getPointDataView().copySliceFrom(getPointOffset(i,j),tempDataExp->getPointDataView(),tempDataExp->getPointOffset(i,j),region_loop_range);
202      }      }
203    }    }
204  }  }

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

  ViewVC Help
Powered by ViewVC 1.1.26