99 |
|
|
100 |
{ |
{ |
101 |
cout << endl; |
cout << endl; |
102 |
cout << "\tTest unaryOp on scalar DataArrayView."; |
cout << "\tTest unaryOp on scalar Data."; |
103 |
|
|
104 |
// define the shape for the DataArrayView |
// define the shape for the Data |
105 |
DataTypes::ShapeType shape; |
DataTypes::ShapeType shape; |
106 |
|
|
107 |
// allocate the data for the DataArrayView |
// allocate the data for the Data |
108 |
int npoints=4; |
int npoints=4; |
109 |
DataTypes::ValueType data(DataTypes::noValues(shape)*npoints,0); |
DataTypes::ValueType data(DataTypes::noValues(shape)*npoints,0); |
110 |
|
|
|
// constructor |
|
|
// DataArrayView dataView(data,shape); |
|
|
|
|
111 |
double tmp; |
double tmp; |
112 |
int offset=0; |
int offset=0; |
113 |
// step the view along each data point in the underlying data |
// step the view along each data point in the underlying data |
133 |
|
|
134 |
{ |
{ |
135 |
cout << endl; |
cout << endl; |
136 |
cout << "\tTest unaryOp on shape (2,3) DataArrayView."; |
cout << "\tTest unaryOp on shape (2,3) Data."; |
137 |
|
|
138 |
// define the shape for the DataArrayView |
// define the shape for the DataArrayView |
139 |
DataTypes::ShapeType shape; |
DataTypes::ShapeType shape; |
144 |
int npoints=4; |
int npoints=4; |
145 |
DataTypes::ValueType data(DataTypes::noValues(shape)*npoints,0); |
DataTypes::ValueType data(DataTypes::noValues(shape)*npoints,0); |
146 |
|
|
|
// constructor |
|
|
//DataArrayView dataView(data,shape); |
|
|
|
|
147 |
|
|
148 |
int offset=0; |
int offset=0; |
149 |
// step the view along each data point in the underlying data |
// step the view along each data point in the underlying data |
178 |
|
|
179 |
{ |
{ |
180 |
cout << endl; |
cout << endl; |
181 |
cout << "\tTest unaryOp on shape (9,8,5,11) DataArrayView."; |
cout << "\tTest unaryOp on shape (9,8,5,11) Data."; |
182 |
|
|
183 |
// define the shape for the DataArrayView |
// define the shape for the DataArrayView |
184 |
DataTypes::ShapeType shape; |
DataTypes::ShapeType shape; |
191 |
int npoints=4; |
int npoints=4; |
192 |
DataTypes::ValueType data(DataTypes::noValues(shape)*npoints,0); |
DataTypes::ValueType data(DataTypes::noValues(shape)*npoints,0); |
193 |
|
|
|
// constructor |
|
|
//DataArrayView dataView(data,shape); |
|
|
|
|
194 |
int offset=0; |
int offset=0; |
195 |
// step the view along each data point in the underlying data |
// step the view along each data point in the underlying data |
196 |
for (int p=0;p<npoints;p++) { |
for (int p=0;p<npoints;p++) { |
242 |
|
|
243 |
{ |
{ |
244 |
cout << endl; |
cout << endl; |
245 |
cout << "\tTest binaryOp on scalar DataArrayViews."; |
cout << "\tTest binaryOp on scalar Data."; |
246 |
|
|
247 |
// define the shape for the DataArrayViews |
// define the shape for the DataArrayViews |
248 |
DataTypes::ShapeType shape; |
DataTypes::ShapeType shape; |
252 |
DataTypes::ValueType data1(DataTypes::noValues(shape)*npoints,0); |
DataTypes::ValueType data1(DataTypes::noValues(shape)*npoints,0); |
253 |
DataTypes::ValueType data2(DataTypes::noValues(shape)*npoints,0); |
DataTypes::ValueType data2(DataTypes::noValues(shape)*npoints,0); |
254 |
|
|
|
// constructor |
|
|
//DataArrayView dataView1(data1,shape); |
|
|
//DataArrayView dataView2(data2,shape); |
|
|
|
|
255 |
int offset=0; |
int offset=0; |
256 |
// step the views along each data point in the underlying data |
// step the views along each data point in the underlying data |
257 |
for (int p=0;p<npoints;p++) { |
for (int p=0;p<npoints;p++) { |
261 |
data2[offset]=p; |
data2[offset]=p; |
262 |
|
|
263 |
// apply a binary operation to these data points |
// apply a binary operation to these data points |
|
// dataView1.binaryOp(dataView2,plus<double>()); |
|
264 |
binaryOp(data1,scalarShape,offset,data2,scalarShape,offset, plus<double>()); |
binaryOp(data1,scalarShape,offset,data2,scalarShape,offset, plus<double>()); |
265 |
|
|
266 |
// check the results |
// check the results |
276 |
|
|
277 |
{ |
{ |
278 |
cout << endl; |
cout << endl; |
279 |
cout << "\tTest binaryOp on shape (2,3) DataArrayViews."; |
cout << "\tTest binaryOp on shape (2,3) Data."; |
280 |
|
|
281 |
// define the shape for the DataArrayViews |
// define the shape for the DataArrayViews |
282 |
DataTypes::ShapeType shape; |
DataTypes::ShapeType shape; |
288 |
DataTypes::ValueType data1(DataTypes::noValues(shape)*npoints,0); |
DataTypes::ValueType data1(DataTypes::noValues(shape)*npoints,0); |
289 |
DataTypes::ValueType data2(DataTypes::noValues(shape)*npoints,0); |
DataTypes::ValueType data2(DataTypes::noValues(shape)*npoints,0); |
290 |
|
|
|
// constructor |
|
|
//DataArrayView dataView1(data1,shape); |
|
|
//DataArrayView dataView2(data2,shape); |
|
|
|
|
291 |
int offset=0; |
int offset=0; |
292 |
// step the views along each data point in the underlying data |
// step the views along each data point in the underlying data |
293 |
for (int p=0;p<npoints;p++) { |
for (int p=0;p<npoints;p++) { |
321 |
|
|
322 |
{ |
{ |
323 |
cout << endl; |
cout << endl; |
324 |
cout << "\tTest binaryOp on shape (9,8,5,11) DataArrayViews."; |
cout << "\tTest binaryOp on shape (9,8,5,11) Data."; |
325 |
|
|
326 |
// define the shape for the DataArrayViews |
// define the shape for the DataArrayViews |
327 |
DataTypes::ShapeType shape; |
DataTypes::ShapeType shape; |
335 |
DataTypes::ValueType data1(DataTypes::noValues(shape)*npoints,0); |
DataTypes::ValueType data1(DataTypes::noValues(shape)*npoints,0); |
336 |
DataTypes::ValueType data2(DataTypes::noValues(shape)*npoints,0); |
DataTypes::ValueType data2(DataTypes::noValues(shape)*npoints,0); |
337 |
|
|
|
// constructor |
|
|
//DataArrayView dataView1(data1,shape); |
|
|
//DataArrayView dataView2(data2,shape); |
|
|
|
|
338 |
int offset=0; |
int offset=0; |
339 |
// step the views along each data point in the underlying data |
// step the views along each data point in the underlying data |
340 |
for (int p=0;p<npoints;p++) { |
for (int p=0;p<npoints;p++) { |
376 |
|
|
377 |
{ |
{ |
378 |
cout << endl; |
cout << endl; |
379 |
cout << "\tTest binaryOp on scalar DataArrayView and single value."; |
cout << "\tTest binaryOp on scalar Data and single value."; |
380 |
|
|
381 |
// define the shape for the DataArrayView |
// define the shape for the DataArrayView |
382 |
DataTypes::ShapeType shape; |
DataTypes::ShapeType shape; |
385 |
int npoints=4; |
int npoints=4; |
386 |
DataTypes::ValueType data(DataTypes::noValues(shape)*npoints,0); |
DataTypes::ValueType data(DataTypes::noValues(shape)*npoints,0); |
387 |
|
|
|
// constructor |
|
|
// DataArrayView dataView(data,shape); |
|
|
|
|
388 |
int offset=0; |
int offset=0; |
389 |
// step the view along each data point in the underlying data |
// step the view along each data point in the underlying data |
390 |
for (int p=0;p<npoints;p++) { |
for (int p=0;p<npoints;p++) { |
409 |
|
|
410 |
{ |
{ |
411 |
cout << endl; |
cout << endl; |
412 |
cout << "\tTest binaryOp on shape (2,3) DataArrayView and single value."; |
cout << "\tTest binaryOp on shape (2,3) Data and single value."; |
413 |
|
|
414 |
// define the shape for the DataArrayView |
// define the shape for the DataArrayView |
415 |
DataTypes::ShapeType shape; |
DataTypes::ShapeType shape; |
420 |
int npoints=4; |
int npoints=4; |
421 |
DataTypes::ValueType data(DataTypes::noValues(shape)*npoints,0); |
DataTypes::ValueType data(DataTypes::noValues(shape)*npoints,0); |
422 |
|
|
|
// constructor |
|
|
// DataArrayView dataView(data,shape); |
|
|
|
|
|
|
|
423 |
int offset=0; |
int offset=0; |
424 |
// step the view along each data point in the underlying data |
// step the view along each data point in the underlying data |
425 |
for (int p=0;p<npoints;p++) { |
for (int p=0;p<npoints;p++) { |
454 |
|
|
455 |
{ |
{ |
456 |
cout << endl; |
cout << endl; |
457 |
cout << "\tTest binaryOp on shape (9,8,5,11) DataArrayView and single value."; |
cout << "\tTest binaryOp on shape (9,8,5,11) Data and single value."; |
458 |
|
|
459 |
// define the shape for the DataArrayView |
// define the shape for the DataArrayView |
460 |
DataTypes::ShapeType shape; |
DataTypes::ShapeType shape; |
467 |
int npoints=4; |
int npoints=4; |
468 |
DataTypes::ValueType data(DataTypes::noValues(shape)*npoints,0); |
DataTypes::ValueType data(DataTypes::noValues(shape)*npoints,0); |
469 |
|
|
|
// constructor |
|
|
// DataArrayView dataView(data,shape); |
|
|
|
|
470 |
int offset=0; |
int offset=0; |
471 |
// step the view along each data point in the underlying data |
// step the view along each data point in the underlying data |
472 |
for (int p=0;p<npoints;p++) { |
for (int p=0;p<npoints;p++) { |
516 |
|
|
517 |
{ |
{ |
518 |
cout << endl; |
cout << endl; |
519 |
cout << "\tTest reductionOp on scalar DataArrayView."; |
cout << "\tTest reductionOp on scalar Data."; |
520 |
|
|
521 |
// define the shape for the DataArrayView |
// define the shape for the DataArrayView |
522 |
DataTypes::ShapeType shape; |
DataTypes::ShapeType shape; |
525 |
int npoints=4; |
int npoints=4; |
526 |
DataTypes::ValueType data(DataTypes::noValues(shape)*npoints,0); |
DataTypes::ValueType data(DataTypes::noValues(shape)*npoints,0); |
527 |
|
|
|
// constructor |
|
|
// DataArrayView dataView(data,shape); |
|
|
|
|
528 |
int offset=0; |
int offset=0; |
529 |
// step the view along each data point in the underlying data |
// step the view along each data point in the underlying data |
530 |
for (int p=0;p<npoints;p++) { |
for (int p=0;p<npoints;p++) { |
549 |
|
|
550 |
{ |
{ |
551 |
cout << endl; |
cout << endl; |
552 |
cout << "\tTest reductionOp on shape (2,3) DataArrayView."; |
cout << "\tTest reductionOp on shape (2,3) Data."; |
553 |
|
|
554 |
// define the shape for the DataArrayView |
// define the shape for the DataArrayView |
555 |
DataTypes::ShapeType shape; |
DataTypes::ShapeType shape; |
560 |
int npoints=4; |
int npoints=4; |
561 |
DataTypes::ValueType data(DataTypes::noValues(shape)*npoints,0); |
DataTypes::ValueType data(DataTypes::noValues(shape)*npoints,0); |
562 |
|
|
|
// constructor |
|
|
// DataArrayView dataView(data,shape); |
|
|
|
|
563 |
int offset=0; |
int offset=0; |
564 |
// step the view along each data point in the underlying data |
// step the view along each data point in the underlying data |
565 |
for (int p=0;p<npoints;p++) { |
for (int p=0;p<npoints;p++) { |
585 |
|
|
586 |
{ |
{ |
587 |
cout << endl; |
cout << endl; |
588 |
cout << "\tTest reductionOp on shape (9,8,5,11) DataArrayView."; |
cout << "\tTest reductionOp on shape (9,8,5,11) Data."; |
589 |
|
|
590 |
// define the shape for the DataArrayView |
// define the shape for the DataArrayView |
591 |
DataTypes::ShapeType shape; |
DataTypes::ShapeType shape; |
598 |
int npoints=4; |
int npoints=4; |
599 |
DataTypes::ValueType data(DataTypes::noValues(shape)*npoints,0); |
DataTypes::ValueType data(DataTypes::noValues(shape)*npoints,0); |
600 |
|
|
|
// constructor |
|
|
// DataArrayView dataView(data,shape); |
|
|
|
|
601 |
int offset=0; |
int offset=0; |
602 |
// step the view along each data point in the underlying data |
// step the view along each data point in the underlying data |
603 |
for (int p=0;p<npoints;p++) { |
for (int p=0;p<npoints;p++) { |