160 |
} |
} |
161 |
|
|
162 |
DataAbstract* |
DataAbstract* |
163 |
DataExpanded::getSlice(const DataArrayView::RegionType& region) const |
DataExpanded::getSlice(const DataArrayView::RegionType& region) const |
164 |
{ |
{ |
165 |
return new DataExpanded(*this,region); |
return new DataExpanded(*this,region); |
166 |
} |
} |
167 |
|
|
168 |
void |
void |
169 |
DataExpanded::setSlice(const DataAbstract* value, |
DataExpanded::setSlice(const DataAbstract* value, |
170 |
const DataArrayView::RegionType& region) |
const DataArrayView::RegionType& region) |
171 |
{ |
{ |
172 |
const DataExpanded* tempDataExp=dynamic_cast<const DataExpanded*>(value); |
const DataExpanded* tempDataExp=dynamic_cast<const DataExpanded*>(value); |
173 |
if (tempDataExp==0) { |
if (tempDataExp==0) { |
203 |
} |
} |
204 |
|
|
205 |
void |
void |
206 |
DataExpanded::copy(const DataArrayView& value) |
DataExpanded::copy(const DataArrayView& value) |
207 |
{ |
{ |
208 |
// |
// |
209 |
// copy a single value to every data point in this object |
// copy a single value to every data point in this object |
213 |
#pragma omp parallel for private(i,j) schedule(static) |
#pragma omp parallel for private(i,j) schedule(static) |
214 |
for (i=0;i<nRows;i++) { |
for (i=0;i<nRows;i++) { |
215 |
for (j=0;j<nCols;j++) { |
for (j=0;j<nCols;j++) { |
216 |
// NOTE: An exception may be thown from this call if |
// NOTE: An exception may be thown from this call if |
217 |
// DOASSERT is on which of course will play |
// DOASSERT is on which of course will play |
218 |
// havoc with the omp threads. Run single threaded |
// havoc with the omp threads. Run single threaded |
219 |
// if using DOASSERT. |
// if using DOASSERT. |
220 |
getPointDataView().copy(m_data.index(i,j),value); |
getPointDataView().copy(m_data.index(i,j),value); |
221 |
} |
} |
222 |
} |
} |
223 |
} |
} |
224 |
|
|
225 |
void |
void |
226 |
DataExpanded::copy(const boost::python::numeric::array& value) |
DataExpanded::copy(const boost::python::numeric::array& value) |
227 |
{ |
{ |
228 |
// |
|
229 |
// first convert the numarray into a DataArray object |
// extract the shape of the numarray |
230 |
DataArray temp(value); |
DataArrayView::ShapeType tempShape; |
231 |
|
for (int i=0; i < value.getrank(); i++) { |
232 |
|
tempShape.push_back(extract<int>(value.getshape()[i])); |
233 |
|
} |
234 |
|
|
235 |
|
// get the space for the data vector |
236 |
|
int len = DataArrayView::noValues(tempShape); |
237 |
|
DataVector temp_data(len, 0.0, len); |
238 |
|
DataArrayView temp_dataView(temp_data, tempShape); |
239 |
|
temp_dataView.copy(value); |
240 |
|
|
241 |
// |
// |
242 |
// check the input shape matches this shape |
// check the input shape matches this shape |
243 |
if (!getPointDataView().checkShape(temp.getView().getShape())) { |
if (!getPointDataView().checkShape(temp_dataView.getShape())) { |
244 |
throw DataException(getPointDataView().createShapeErrorMessage( |
throw DataException(getPointDataView().createShapeErrorMessage( |
245 |
"Error - (DataExpanded) Cannot copy due to shape mismatch.", |
"Error - (DataExpanded) Cannot copy due to shape mismatch.", |
246 |
temp.getView().getShape())); |
temp_dataView.getShape())); |
247 |
} |
} |
248 |
// |
// |
249 |
// now copy over the data |
// now copy over the data |
250 |
copy(temp.getView()); |
copy(temp_dataView); |
251 |
} |
} |
252 |
|
|
253 |
void |
void |
321 |
return(m_data.extractData(archiveFile, noValues)); |
return(m_data.extractData(archiveFile, noValues)); |
322 |
} |
} |
323 |
|
|
324 |
void |
void |
325 |
DataExpanded::copyToDataPoint(const int sampleNo, const int dataPointNo, const double value) { |
DataExpanded::copyToDataPoint(const int sampleNo, const int dataPointNo, const double value) { |
326 |
// |
// |
327 |
// Get the number of samples and data-points per sample. |
// Get the number of samples and data-points per sample. |
368 |
} |
} |
369 |
} |
} |
370 |
} |
} |
371 |
} |
} |
372 |
} |
} |
373 |
} |
} |
374 |
void |
void |
375 |
DataExpanded::copyToDataPoint(const int sampleNo, const int dataPointNo, const boost::python::numeric::array& value) { |
DataExpanded::copyToDataPoint(const int sampleNo, const int dataPointNo, const boost::python::numeric::array& value) { |
376 |
// |
// |
377 |
// Get the number of samples and data-points per sample. |
// Get the number of samples and data-points per sample. |
422 |
} |
} |
423 |
} |
} |
424 |
} |
} |
425 |
} |
} |
426 |
} |
} |
427 |
} |
} |
428 |
void |
void |