/[escript]/branches/arrayview_from_1695_trunk/escript/test/DataArrayViewTestCase.cpp
ViewVC logotype

Diff of /branches/arrayview_from_1695_trunk/escript/test/DataArrayViewTestCase.cpp

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

trunk/escript/test/DataArrayView/DataArrayViewTestCase.cpp revision 468 by jgs, Wed Jan 25 06:50:39 2006 UTC branches/arrayview_from_1695_trunk/escript/test/DataArrayViewTestCase.cpp revision 1714 by jfenwick, Thu Aug 21 00:01:55 2008 UTC
# Line 1  Line 1 
1  /*  
2   *****************************************************************************  /* $Id$ */
3   *                                                                           *  
4   *       COPYRIGHT  ACcESS  -  All Rights Reserved                           *  /*******************************************************
5   *                                                                           *   *
6   * This software is the property of ACcESS. No part of this code             *   *           Copyright 2003-2007 by ACceSS MNRF
7   * may be copied in any form or by any means without the expressed written   *   *       Copyright 2007 by University of Queensland
8   * consent of ACcESS.  Copying, use or modification of this software         *   *
9   * by any unauthorised person is illegal unless that person has a software   *   *                http://esscc.uq.edu.au
10   * license agreement with ACcESS.                                            *   *        Primary Business: Queensland, Australia
11   *                                                                           *   *  Licensed under the Open Software License version 3.0
12   *****************************************************************************   *     http://www.opensource.org/licenses/osl-3.0.php
13  */   *
14  #include "escript/Data/DataArray.h"   *******************************************************/
15  #include "escript/Data/DataArrayView.h"  
16  #include "escript/Data/DataAlgorithm.h"  #include "escript/DataArrayView.h"
17  #include "EsysException.h"  #include "escript/DataAlgorithm.h"
18    #include "escript/DataVector.h"
19    #include "esysUtils/EsysException.h"
20    
21  #include "DataArrayViewTestCase.h"  #include "DataArrayViewTestCase.h"
22    #include "escript/DataTypes.h"
23    
24  #include <iostream>  #include <iostream>
25    
# Line 28  using namespace std; Line 31  using namespace std;
31  void DataArrayViewTestCase::setUp() {  void DataArrayViewTestCase::setUp() {
32    //    //
33    // This is called before each test is run    // This is called before each test is run
34    
35  }  }
36    
37  void DataArrayViewTestCase::tearDown() {  void DataArrayViewTestCase::tearDown() {
38    //    //
39    // This is called after each test has been run    // This is called after each test has been run
40    
41  }  }
42    
43  void DataArrayViewTestCase::testResultSliceShape() {  void DataArrayViewTestCase::testResultSliceShape() {
# Line 42  void DataArrayViewTestCase::testResultSl Line 45  void DataArrayViewTestCase::testResultSl
45    cout << endl;    cout << endl;
46    cout << "\tTest getResultSliceShape method." << endl;    cout << "\tTest getResultSliceShape method." << endl;
47    
48    DataArrayView::RegionType region;    DataTypes::RegionType region;
49    DataArrayView::ShapeType resultShape;    DataTypes::ShapeType resultShape;
50    
51    region.push_back(DataArrayView::RegionType::value_type(1,5));    region.push_back(DataTypes::RegionType::value_type(1,5));
52    resultShape.push_back(4);    resultShape.push_back(4);
53    assert(DataArrayView::getResultSliceShape(region)==resultShape);    assert(DataTypes::getResultSliceShape(region)==resultShape);
54    
55    region.push_back(DataArrayView::RegionType::value_type(2,5));    region.push_back(DataTypes::RegionType::value_type(2,5));
56    resultShape.push_back(3);    resultShape.push_back(3);
57    assert(DataArrayView::getResultSliceShape(region)==resultShape);    assert(DataTypes::getResultSliceShape(region)==resultShape);
58    
59    region.push_back(DataArrayView::RegionType::value_type(3,9));    region.push_back(DataTypes::RegionType::value_type(3,9));
60    resultShape.push_back(6);    resultShape.push_back(6);
61    assert(DataArrayView::getResultSliceShape(region)==resultShape);    assert(DataTypes::getResultSliceShape(region)==resultShape);
62    
63    region.push_back(DataArrayView::RegionType::value_type(1,7));    region.push_back(DataTypes::RegionType::value_type(1,7));
64    resultShape.push_back(6);    resultShape.push_back(6);
65    assert(DataArrayView::getResultSliceShape(region)==resultShape);    assert(DataTypes::getResultSliceShape(region)==resultShape);
66    
67  }  }
68    
# Line 70  void DataArrayViewTestCase::testSlicing( Line 73  void DataArrayViewTestCase::testSlicing(
73      cout << "\tSlice a scalar to a scalar.";      cout << "\tSlice a scalar to a scalar.";
74    
75      // Define slice region.      // Define slice region.
76      DataArrayView::RegionType region;      DataTypes::RegionType region;
77    
78      // Define shape of views.      // Define shape of views.
79      DataArrayView::ShapeType sourceShape;      DataTypes::ShapeType sourceShape;
80    
81      // Create source and target views.      // Create source and target views.
82      DataArray source(sourceShape,2.0);      int len = DataTypes::noValues(sourceShape);
83      DataArrayView sourceView=source.getView();      DataVector sourceData(len, 2.0, len);
84        DataArrayView sourceView(sourceData, sourceShape);
85      DataArray target;      DataVector targetData(1, 2.0, 1);
86      DataArrayView targetView=target.getView();      DataArrayView targetView(targetData, DataTypes::ShapeType());
87    
88      // Copy source view to target view.      // Copy source view to target view.
89      targetView.copySlice(sourceView,region);      targetView.copySlice(sourceView,region);
# Line 94  void DataArrayViewTestCase::testSlicing( Line 97  void DataArrayViewTestCase::testSlicing(
97      cout << "\tSlice a scalar from a scalar.";      cout << "\tSlice a scalar from a scalar.";
98    
99      // Define slice region.      // Define slice region.
100      DataArrayView::RegionType region;      DataTypes::RegionType region;
101    
102      // Define shape of views.      // Define shape of views.
103      DataArrayView::ShapeType sourceShape;      DataTypes::ShapeType sourceShape;
104    
105      // Create source and target views.      // Create source and target views.
106      DataArray source(sourceShape,2.0);      int len = DataTypes::noValues(sourceShape);
107      DataArrayView sourceView=source.getView();      DataVector sourceData(len, 2.0, len);
108        DataArrayView sourceView(sourceData, sourceShape);
109      DataArray target;      DataVector targetData(1, 2.0, 1);
110      DataArrayView targetView=target.getView();      DataArrayView targetView(targetData, DataTypes::ShapeType());
111    
112      // Copy source view to target view.      // Copy source view to target view.
113      targetView.copySliceFrom(sourceView,region);      targetView.copySliceFrom(sourceView,region);
# Line 118  void DataArrayViewTestCase::testSlicing( Line 121  void DataArrayViewTestCase::testSlicing(
121      cout << "\tSlice a 1 dimensional slice to a 1 dimensional array.";      cout << "\tSlice a 1 dimensional slice to a 1 dimensional array.";
122    
123      // Define slice region.      // Define slice region.
124      DataArrayView::RegionType region;      DataTypes::RegionType region;
125      region.push_back(DataArrayView::RegionType::value_type(2,4));      region.push_back(DataTypes::RegionType::value_type(2,4));
126    
127      // Define shapes of views.      // Define shapes of views.
128      DataArrayView::ShapeType sourceShape;      DataTypes::ShapeType sourceShape;
129      sourceShape.push_back(6);      sourceShape.push_back(6);
130      DataArrayView::ShapeType targetShape = DataArrayView::getResultSliceShape(region);      DataTypes::ShapeType targetShape = DataTypes::getResultSliceShape(region);
131    
132      // Create source and target views.      // Create source and target views.
133      DataArray source(sourceShape);      int len = DataTypes::noValues(sourceShape);
134      DataArrayView sourceView=source.getView();      DataVector sourceData(len, 2.0, len);
135        DataArrayView sourceView(sourceData, sourceShape);
136      for (int i=0;i<sourceShape[0];i++) {      for (int i=0;i<sourceShape[0];i++) {
137        sourceView(i)=i;        sourceView(i)=i;
138      }      }
139    
140      DataArray target(targetShape);      len = DataTypes::noValues(targetShape);
141      DataArrayView targetView=target.getView();      DataVector targetData(len, 2.0, len);
142        DataArrayView targetView(targetData, targetShape);
143    
144      // Copy source view to target view.      // Copy source view to target view.
145      targetView.copySlice(sourceView,region);      targetView.copySlice(sourceView,region);
# Line 151  void DataArrayViewTestCase::testSlicing( Line 156  void DataArrayViewTestCase::testSlicing(
156      cout << "\tSlice a 1 dimensional slice to a scalar.";      cout << "\tSlice a 1 dimensional slice to a scalar.";
157    
158      // Define slice region.      // Define slice region.
159      DataArrayView::RegionType region;      DataTypes::RegionType region;
160      region.push_back(DataArrayView::RegionType::value_type(2,3));      region.push_back(DataTypes::RegionType::value_type(2,3));
161    
162      // Define shapes of views.      // Define shapes of views.
163      DataArrayView::ShapeType sourceShape;      DataTypes::ShapeType sourceShape;
164      sourceShape.push_back(6);      sourceShape.push_back(6);
165      DataArrayView::ShapeType targetShape;      DataTypes::ShapeType targetShape;
166    
167      // Create source and target views.      // Create source and target views.
168      DataArray source(sourceShape);      int len = DataTypes::noValues(sourceShape);
169      DataArrayView sourceView=source.getView();      DataVector sourceData(len, 2.0, len);
170        DataArrayView sourceView(sourceData, sourceShape);
171    
172      for (int i=0;i<sourceShape[0];i++) {      for (int i=0;i<sourceShape[0];i++) {
173        sourceView(i)=i;        sourceView(i)=i;
174      }      }
175    
176      DataArray target(targetShape);      len = DataTypes::noValues(targetShape);
177      DataArrayView targetView=target.getView();      DataVector targetData(len, 2.0, len);
178        DataArrayView targetView(targetData, targetShape);
179    
180      // Copy source view to target view.      // Copy source view to target view.
181      targetView.copySlice(sourceView,region);      targetView.copySlice(sourceView,region);
# Line 184  void DataArrayViewTestCase::testSlicing( Line 192  void DataArrayViewTestCase::testSlicing(
192      cout << "\tSlice a 1 dimensional slice from a 1 dimensional array.";      cout << "\tSlice a 1 dimensional slice from a 1 dimensional array.";
193    
194      // Define slice region.      // Define slice region.
195      DataArrayView::RegionType region;      DataTypes::RegionType region;
196      region.push_back(DataArrayView::RegionType::value_type(2,4));      region.push_back(DataTypes::RegionType::value_type(2,4));
197    
198      // Define shapes of views.      // Define shapes of views.
199      DataArrayView::ShapeType sourceShape = DataArrayView::getResultSliceShape(region);      DataTypes::ShapeType sourceShape = DataTypes::getResultSliceShape(region);
200      DataArrayView::ShapeType targetShape;      DataTypes::ShapeType targetShape;
201      targetShape.push_back(6);      targetShape.push_back(6);
202    
203      // Create source and target views.      // Create source and target views.
204      DataArray source(sourceShape);      int len = DataTypes::noValues(sourceShape);
205      DataArrayView sourceView=source.getView();      DataVector sourceData(len, 2.0, len);
206        DataArrayView sourceView(sourceData, sourceShape);
207      for (int i=0;i<sourceShape[0];i++) {      for (int i=0;i<sourceShape[0];i++) {
208        sourceView(i)=i;        sourceView(i)=i;
209      }      }
210    
211      DataArray target(targetShape);      len = DataTypes::noValues(targetShape);
212      DataArrayView targetView=target.getView();      DataVector targetData(len, 2.0, len);
213        DataArrayView targetView(targetData, targetShape);
214    
215      // Copy source view to target view.      // Copy source view to target view.
216      targetView.copySliceFrom(sourceView,region);      targetView.copySliceFrom(sourceView,region);
# Line 217  void DataArrayViewTestCase::testSlicing( Line 227  void DataArrayViewTestCase::testSlicing(
227      cout << "\tSlice a 1 dimensional slice from a scalar.";      cout << "\tSlice a 1 dimensional slice from a scalar.";
228    
229      // Define slice region.      // Define slice region.
230      DataArrayView::RegionType region;      DataTypes::RegionType region;
231      region.push_back(DataArrayView::RegionType::value_type(2,4));      region.push_back(DataTypes::RegionType::value_type(2,4));
232    
233      // Define shapes of views.      // Define shapes of views.
234      DataArrayView::ShapeType sourceShape;      DataTypes::ShapeType sourceShape;
235      DataArrayView::ShapeType targetShape;      DataTypes::ShapeType targetShape;
236      targetShape.push_back(6);      targetShape.push_back(6);
237    
238      // Create source and target views.      // Create source and target views.
239      DataArray source(sourceShape);      int len = DataTypes::noValues(sourceShape);
240      DataArrayView sourceView=source.getView();      DataVector sourceData(len, 2.0, len);
241        DataArrayView sourceView(sourceData, sourceShape);
242      sourceView()=5;      sourceView()=5;
243    
244      DataArray target(targetShape);      len = DataTypes::noValues(targetShape);
245      DataArrayView targetView=target.getView();      DataVector targetData(len, 2.0, len);
246        DataArrayView targetView(targetData, targetShape);
247    
248      // Copy source view to target view.      // Copy source view to target view.
249      targetView.copySliceFrom(sourceView,region);      targetView.copySliceFrom(sourceView,region);
# Line 248  void DataArrayViewTestCase::testSlicing( Line 260  void DataArrayViewTestCase::testSlicing(
260      cout << "\tSlice a 2 dimensional slice to a 2 dimensional array.";      cout << "\tSlice a 2 dimensional slice to a 2 dimensional array.";
261    
262      // Define slice region.      // Define slice region.
263      DataArrayView::RegionType region;      DataTypes::RegionType region;
264      region.push_back(DataArrayView::RegionType::value_type(2,4));      region.push_back(DataTypes::RegionType::value_type(2,4));
265      region.push_back(DataArrayView::RegionType::value_type(0,2));      region.push_back(DataTypes::RegionType::value_type(0,2));
266    
267      // Define shapes of views.      // Define shapes of views.
268      DataArrayView::ShapeType sourceShape;      DataTypes::ShapeType sourceShape;
269      sourceShape.push_back(6);      sourceShape.push_back(6);
270      sourceShape.push_back(3);      sourceShape.push_back(3);
271      DataArrayView::ShapeType targetShape = DataArrayView::getResultSliceShape(region);      DataTypes::ShapeType targetShape = DataTypes::getResultSliceShape(region);
272    
273      // Create source and target views.      // Create source and target views.
274      DataArray source(sourceShape);      int len = DataTypes::noValues(sourceShape);
275      DataArrayView sourceView=source.getView();      DataVector sourceData(len, 2.0, len);
276        DataArrayView sourceView(sourceData, sourceShape);
277      int val=0;      int val=0;
278      for (int i=0;i<sourceShape[0];i++) {      for (int i=0;i<sourceShape[0];i++) {
279        for (int j=0;j<sourceShape[1];j++) {        for (int j=0;j<sourceShape[1];j++) {
# Line 268  void DataArrayViewTestCase::testSlicing( Line 281  void DataArrayViewTestCase::testSlicing(
281        }        }
282      }      }
283    
284      DataArray target(targetShape);      len = DataTypes::noValues(targetShape);
285      DataArrayView targetView=target.getView();      DataVector targetData(len, 2.0, len);
286        DataArrayView targetView(targetData, targetShape);
287    
288      // Copy source view to target view.      // Copy source view to target view.
289      targetView.copySlice(sourceView,region);      targetView.copySlice(sourceView,region);
# Line 288  void DataArrayViewTestCase::testSlicing( Line 302  void DataArrayViewTestCase::testSlicing(
302      cout << "\tSlice a 2 dimensional slice to a 1 dimensional array.";      cout << "\tSlice a 2 dimensional slice to a 1 dimensional array.";
303    
304      // Define slice region.      // Define slice region.
305      DataArrayView::RegionType region;      DataTypes::RegionType region;
306      region.push_back(DataArrayView::RegionType::value_type(0,3));      region.push_back(DataTypes::RegionType::value_type(0,3));
307      region.push_back(DataArrayView::RegionType::value_type(1,2));      region.push_back(DataTypes::RegionType::value_type(1,2));
308    
309      // Define shapes of views.      // Define shapes of views.
310      DataArrayView::ShapeType sourceShape;      DataTypes::ShapeType sourceShape;
311      sourceShape.push_back(3);      sourceShape.push_back(3);
312      sourceShape.push_back(6);      sourceShape.push_back(6);
313      DataArrayView::ShapeType targetShape;      DataTypes::ShapeType targetShape;
314      targetShape.push_back(3);      targetShape.push_back(3);
315    
316      // Create source and target views.      // Create source and target views.
317      DataArray source(sourceShape);      int len = DataTypes::noValues(sourceShape);
318      DataArrayView sourceView=source.getView();      DataVector sourceData(len, 2.0, len);
319        DataArrayView sourceView(sourceData, sourceShape);
320      int val=0;      int val=0;
321      for (int i=0;i<sourceShape[0];i++) {      for (int i=0;i<sourceShape[0];i++) {
322        for (int j=0;j<sourceShape[1];j++) {        for (int j=0;j<sourceShape[1];j++) {
# Line 309  void DataArrayViewTestCase::testSlicing( Line 324  void DataArrayViewTestCase::testSlicing(
324        }        }
325      }      }
326    
327      DataArray target(targetShape);      len = DataTypes::noValues(targetShape);
328      DataArrayView targetView=target.getView();      DataVector targetData(len, 2.0, len);
329        DataArrayView targetView(targetData, targetShape);
330    
331      // Copy source view to target view.      // Copy source view to target view.
332      targetView.copySlice(sourceView,region);      targetView.copySlice(sourceView,region);
# Line 329  void DataArrayViewTestCase::testSlicing( Line 345  void DataArrayViewTestCase::testSlicing(
345      cout << "\tSlice a 2 dimensional slice to a scalar.";      cout << "\tSlice a 2 dimensional slice to a scalar.";
346    
347      // Define slice region.      // Define slice region.
348      DataArrayView::RegionType region;      DataTypes::RegionType region;
349      region.push_back(DataArrayView::RegionType::value_type(2,3));      region.push_back(DataTypes::RegionType::value_type(2,3));
350      region.push_back(DataArrayView::RegionType::value_type(1,2));      region.push_back(DataTypes::RegionType::value_type(1,2));
351    
352      // Define shapes of views.      // Define shapes of views.
353      DataArrayView::ShapeType sourceShape;      DataTypes::ShapeType sourceShape;
354      sourceShape.push_back(3);      sourceShape.push_back(3);
355      sourceShape.push_back(6);      sourceShape.push_back(6);
356      DataArrayView::ShapeType targetShape;      DataTypes::ShapeType targetShape;
357    
358      // Create source and target views.      // Create source and target views.
359      DataArray source(sourceShape);      int len = DataTypes::noValues(sourceShape);
360      DataArrayView sourceView=source.getView();      DataVector sourceData(len, 2.0, len);
361        DataArrayView sourceView(sourceData, sourceShape);
362      int val=0;      int val=0;
363      for (int i=0;i<sourceShape[0];i++) {      for (int i=0;i<sourceShape[0];i++) {
364        for (int j=0;j<sourceShape[1];j++) {        for (int j=0;j<sourceShape[1];j++) {
# Line 349  void DataArrayViewTestCase::testSlicing( Line 366  void DataArrayViewTestCase::testSlicing(
366        }        }
367      }      }
368    
369      DataArray target(targetShape);      len = DataTypes::noValues(targetShape);
370      DataArrayView targetView=target.getView();      DataVector targetData(len, 2.0, len);
371        DataArrayView targetView(targetData, targetShape);
372    
373      // Copy source view to target view.      // Copy source view to target view.
374      targetView.copySlice(sourceView,region);      targetView.copySlice(sourceView,region);
# Line 368  void DataArrayViewTestCase::testSlicing( Line 386  void DataArrayViewTestCase::testSlicing(
386      cout << "\tSlice a 2 dimensional slice from a 2 dimensional array.";      cout << "\tSlice a 2 dimensional slice from a 2 dimensional array.";
387    
388      // Define slice region.      // Define slice region.
389      DataArrayView::RegionType region;      DataTypes::RegionType region;
390      region.push_back(DataArrayView::RegionType::value_type(2,4));      region.push_back(DataTypes::RegionType::value_type(2,4));
391      region.push_back(DataArrayView::RegionType::value_type(0,2));      region.push_back(DataTypes::RegionType::value_type(0,2));
392    
393      // Define shapes of views.      // Define shapes of views.
394      DataArrayView::ShapeType sourceShape = DataArrayView::getResultSliceShape(region);      DataTypes::ShapeType sourceShape = DataTypes::getResultSliceShape(region);
395      DataArrayView::ShapeType targetShape;      DataTypes::ShapeType targetShape;
396      targetShape.push_back(6);      targetShape.push_back(6);
397      targetShape.push_back(3);      targetShape.push_back(3);
398    
399      // Create source and target views.      // Create source and target views.
400      DataArray source(sourceShape);      int len = DataTypes::noValues(sourceShape);
401      DataArrayView sourceView=source.getView();      DataVector sourceData(len, 2.0, len);
402        DataArrayView sourceView(sourceData, sourceShape);
403      int val=0;      int val=0;
404      for (int i=0;i<sourceShape[0];i++) {      for (int i=0;i<sourceShape[0];i++) {
405        for (int j=0;j<sourceShape[1];j++) {        for (int j=0;j<sourceShape[1];j++) {
# Line 388  void DataArrayViewTestCase::testSlicing( Line 407  void DataArrayViewTestCase::testSlicing(
407        }        }
408      }      }
409    
410      DataArray target(targetShape);      len = DataTypes::noValues(targetShape);
411      DataArrayView targetView=target.getView();      DataVector targetData(len, 2.0, len);
412        DataArrayView targetView(targetData, targetShape);
413    
414      // Copy source view to target view.      // Copy source view to target view.
415      targetView.copySliceFrom(sourceView,region);      targetView.copySliceFrom(sourceView,region);
# Line 408  void DataArrayViewTestCase::testSlicing( Line 428  void DataArrayViewTestCase::testSlicing(
428      cout << "\tSlice a 2 dimensional slice from a scalar.";      cout << "\tSlice a 2 dimensional slice from a scalar.";
429    
430      // Define slice region.      // Define slice region.
431      DataArrayView::RegionType region;      DataTypes::RegionType region;
432      region.push_back(DataArrayView::RegionType::value_type(2,4));      region.push_back(DataTypes::RegionType::value_type(2,4));
433      region.push_back(DataArrayView::RegionType::value_type(0,2));      region.push_back(DataTypes::RegionType::value_type(0,2));
434    
435      // Define shapes of views.      // Define shapes of views.
436      DataArrayView::ShapeType sourceShape;      DataTypes::ShapeType sourceShape;
437      DataArrayView::ShapeType targetShape;      DataTypes::ShapeType targetShape;
438      targetShape.push_back(6);      targetShape.push_back(6);
439      targetShape.push_back(3);      targetShape.push_back(3);
440    
441      // Create source and target views.      // Create source and target views.
442      DataArray source(sourceShape);      int len = DataTypes::noValues(sourceShape);
443      DataArrayView sourceView=source.getView();      DataVector sourceData(len, 2.0, len);
444        DataArrayView sourceView(sourceData, sourceShape);
445      sourceView()=5;      sourceView()=5;
446    
447      DataArray target(targetShape);      len = DataTypes::noValues(targetShape);
448      DataArrayView targetView=target.getView();      DataVector targetData(len, 2.0, len);
449        DataArrayView targetView(targetData, targetShape);
450    
451      // Copy source view to target view.      // Copy source view to target view.
452      targetView.copySliceFrom(sourceView,region);      targetView.copySliceFrom(sourceView,region);
# Line 443  void DataArrayViewTestCase::testSlicing( Line 465  void DataArrayViewTestCase::testSlicing(
465      cout << "\tSlice a 3 dimensional slice to a 3 dimensional array.";      cout << "\tSlice a 3 dimensional slice to a 3 dimensional array.";
466    
467      // Define slice region.      // Define slice region.
468      DataArrayView::RegionType region;      DataTypes::RegionType region;
469      region.push_back(DataArrayView::RegionType::value_type(2,4));      region.push_back(DataTypes::RegionType::value_type(2,4));
470      region.push_back(DataArrayView::RegionType::value_type(0,2));      region.push_back(DataTypes::RegionType::value_type(0,2));
471      region.push_back(DataArrayView::RegionType::value_type(5,9));      region.push_back(DataTypes::RegionType::value_type(5,9));
472    
473      // Define shapes of views.      // Define shapes of views.
474      DataArrayView::ShapeType sourceShape;      DataTypes::ShapeType sourceShape;
475      sourceShape.push_back(6);      sourceShape.push_back(6);
476      sourceShape.push_back(3);      sourceShape.push_back(3);
477      sourceShape.push_back(13);      sourceShape.push_back(13);
478      DataArrayView::ShapeType targetShape = DataArrayView::getResultSliceShape(region);      DataTypes::ShapeType targetShape = DataTypes::getResultSliceShape(region);
479    
480      // Create source and target views.      // Create source and target views.
481      DataArray source(sourceShape);      int len = DataTypes::noValues(sourceShape);
482      DataArrayView sourceView=source.getView();      DataVector sourceData(len, 2.0, len);
483        DataArrayView sourceView(sourceData, sourceShape);
484      int val=0;      int val=0;
485      for (int i=0;i<sourceShape[0];i++) {      for (int i=0;i<sourceShape[0];i++) {
486        for (int j=0;j<sourceShape[1];j++) {        for (int j=0;j<sourceShape[1];j++) {
# Line 467  void DataArrayViewTestCase::testSlicing( Line 490  void DataArrayViewTestCase::testSlicing(
490        }        }
491      }      }
492    
493      DataArray target(targetShape);      len = DataTypes::noValues(targetShape);
494      DataArrayView targetView=target.getView();      DataVector targetData(len, 2.0, len);
495        DataArrayView targetView(targetData, targetShape);
496    
497      // Copy source view to target view.      // Copy source view to target view.
498      targetView.copySlice(sourceView,region);      targetView.copySlice(sourceView,region);
# Line 489  void DataArrayViewTestCase::testSlicing( Line 513  void DataArrayViewTestCase::testSlicing(
513      cout << "\tSlice a 3 dimensional slice to a 2 dimensional array.";      cout << "\tSlice a 3 dimensional slice to a 2 dimensional array.";
514    
515      // Define slice region.      // Define slice region.
516      DataArrayView::RegionType region;      DataTypes::RegionType region;
517      region.push_back(DataArrayView::RegionType::value_type(2,4));      region.push_back(DataTypes::RegionType::value_type(2,4));
518      region.push_back(DataArrayView::RegionType::value_type(0,1));      region.push_back(DataTypes::RegionType::value_type(0,1));
519      region.push_back(DataArrayView::RegionType::value_type(5,9));      region.push_back(DataTypes::RegionType::value_type(5,9));
520    
521      // Define shapes of views.      // Define shapes of views.
522      DataArrayView::ShapeType sourceShape;      DataTypes::ShapeType sourceShape;
523      sourceShape.push_back(6);      sourceShape.push_back(6);
524      sourceShape.push_back(3);      sourceShape.push_back(3);
525      sourceShape.push_back(13);      sourceShape.push_back(13);
526      DataArrayView::ShapeType targetShape;      DataTypes::ShapeType targetShape;
527      targetShape.push_back(2);      targetShape.push_back(2);
528      targetShape.push_back(4);      targetShape.push_back(4);
529    
530      // Create source and target views.      // Create source and target views.
531      DataArray source(sourceShape);      int len = DataTypes::noValues(sourceShape);
532      DataArrayView sourceView=source.getView();      DataVector sourceData(len, 2.0, len);
533        DataArrayView sourceView(sourceData, sourceShape);
534      int val=0;      int val=0;
535      for (int i=0;i<sourceShape[0];i++) {      for (int i=0;i<sourceShape[0];i++) {
536        for (int j=0;j<sourceShape[1];j++) {        for (int j=0;j<sourceShape[1];j++) {
# Line 515  void DataArrayViewTestCase::testSlicing( Line 540  void DataArrayViewTestCase::testSlicing(
540        }        }
541      }      }
542    
543      DataArray target(targetShape);      len = DataTypes::noValues(targetShape);
544      DataArrayView targetView=target.getView();      DataVector targetData(len, 2.0, len);
545        DataArrayView targetView(targetData, targetShape);
546    
547      // Copy source view to target view.      // Copy source view to target view.
548      targetView.copySlice(sourceView,region);      targetView.copySlice(sourceView,region);
# Line 537  void DataArrayViewTestCase::testSlicing( Line 563  void DataArrayViewTestCase::testSlicing(
563      cout << "\tSlice a 3 dimensional slice to a 1 dimensional array.";      cout << "\tSlice a 3 dimensional slice to a 1 dimensional array.";
564    
565      // Define slice region.      // Define slice region.
566      DataArrayView::RegionType region;      DataTypes::RegionType region;
567      region.push_back(DataArrayView::RegionType::value_type(3,4));      region.push_back(DataTypes::RegionType::value_type(3,4));
568      region.push_back(DataArrayView::RegionType::value_type(0,1));      region.push_back(DataTypes::RegionType::value_type(0,1));
569      region.push_back(DataArrayView::RegionType::value_type(5,9));      region.push_back(DataTypes::RegionType::value_type(5,9));
570    
571      // Define shapes of views.      // Define shapes of views.
572      DataArrayView::ShapeType sourceShape;      DataTypes::ShapeType sourceShape;
573      sourceShape.push_back(6);      sourceShape.push_back(6);
574      sourceShape.push_back(3);      sourceShape.push_back(3);
575      sourceShape.push_back(13);      sourceShape.push_back(13);
576      DataArrayView::ShapeType targetShape;      DataTypes::ShapeType targetShape;
577      targetShape.push_back(4);      targetShape.push_back(4);
578    
579      // Create source and target views.      // Create source and target views.
580      DataArray source(sourceShape);      int len = DataTypes::noValues(sourceShape);
581      DataArrayView sourceView=source.getView();      DataVector sourceData(len, 2.0, len);
582        DataArrayView sourceView(sourceData, sourceShape);
583      int val=0;      int val=0;
584      for (int i=0;i<sourceShape[0];i++) {      for (int i=0;i<sourceShape[0];i++) {
585        for (int j=0;j<sourceShape[1];j++) {        for (int j=0;j<sourceShape[1];j++) {
# Line 562  void DataArrayViewTestCase::testSlicing( Line 589  void DataArrayViewTestCase::testSlicing(
589        }        }
590      }      }
591    
592      DataArray target(targetShape);      len = DataTypes::noValues(targetShape);
593      DataArrayView targetView=target.getView();      DataVector targetData(len, 2.0, len);
594        DataArrayView targetView(targetData, targetShape);
595    
596      // Copy source view to target view.      // Copy source view to target view.
597      targetView.copySlice(sourceView,region);      targetView.copySlice(sourceView,region);
# Line 584  void DataArrayViewTestCase::testSlicing( Line 612  void DataArrayViewTestCase::testSlicing(
612      cout << "\tSlice a 3 dimensional slice to a scalar.";      cout << "\tSlice a 3 dimensional slice to a scalar.";
613    
614      // Define slice region.      // Define slice region.
615      DataArrayView::RegionType region;      DataTypes::RegionType region;
616      region.push_back(DataArrayView::RegionType::value_type(3,4));      region.push_back(DataTypes::RegionType::value_type(3,4));
617      region.push_back(DataArrayView::RegionType::value_type(0,1));      region.push_back(DataTypes::RegionType::value_type(0,1));
618      region.push_back(DataArrayView::RegionType::value_type(5,6));      region.push_back(DataTypes::RegionType::value_type(5,6));
619    
620      // Define shapes of views.      // Define shapes of views.
621      DataArrayView::ShapeType sourceShape;      DataTypes::ShapeType sourceShape;
622      sourceShape.push_back(6);      sourceShape.push_back(6);
623      sourceShape.push_back(3);      sourceShape.push_back(3);
624      sourceShape.push_back(13);      sourceShape.push_back(13);
625      DataArrayView::ShapeType targetShape;      DataTypes::ShapeType targetShape;
626    
627      // Create source and target views.      // Create source and target views.
628      DataArray source(sourceShape);      int len = DataTypes::noValues(sourceShape);
629      DataArrayView sourceView=source.getView();      DataVector sourceData(len, 2.0, len);
630        DataArrayView sourceView(sourceData, sourceShape);
631      int val=0;      int val=0;
632      for (int i=0;i<sourceShape[0];i++) {      for (int i=0;i<sourceShape[0];i++) {
633        for (int j=0;j<sourceShape[1];j++) {        for (int j=0;j<sourceShape[1];j++) {
# Line 608  void DataArrayViewTestCase::testSlicing( Line 637  void DataArrayViewTestCase::testSlicing(
637        }        }
638      }      }
639    
640      DataArray target(targetShape);      len = DataTypes::noValues(targetShape);
641      DataArrayView targetView=target.getView();      DataVector targetData(len, 2.0, len);
642        DataArrayView targetView(targetData, targetShape);
643    
644      // Copy source view to target view.      // Copy source view to target view.
645      targetView.copySlice(sourceView,region);      targetView.copySlice(sourceView,region);
# Line 630  void DataArrayViewTestCase::testSlicing( Line 660  void DataArrayViewTestCase::testSlicing(
660      cout << "\tSlice a 3 dimensional slice from a 3 dimensional array.";      cout << "\tSlice a 3 dimensional slice from a 3 dimensional array.";
661    
662      // Define slice region.      // Define slice region.
663      DataArrayView::RegionType region;      DataTypes::RegionType region;
664      region.push_back(DataArrayView::RegionType::value_type(4,7));      region.push_back(DataTypes::RegionType::value_type(4,7));
665      region.push_back(DataArrayView::RegionType::value_type(2,5));      region.push_back(DataTypes::RegionType::value_type(2,5));
666      region.push_back(DataArrayView::RegionType::value_type(6,7));      region.push_back(DataTypes::RegionType::value_type(6,7));
667    
668      // Define shapes of views.      // Define shapes of views.
669      DataArrayView::ShapeType sourceShape = DataArrayView::getResultSliceShape(region);      DataTypes::ShapeType sourceShape = DataTypes::getResultSliceShape(region);
670      DataArrayView::ShapeType targetShape;      DataTypes::ShapeType targetShape;
671      targetShape.push_back(11);      targetShape.push_back(11);
672      targetShape.push_back(8);      targetShape.push_back(8);
673      targetShape.push_back(9);      targetShape.push_back(9);
674    
675      // Create source and target views.      // Create source and target views.
676      DataArray source(sourceShape);      int len = DataTypes::noValues(sourceShape);
677      DataArrayView sourceView=source.getView();      DataVector sourceData(len, 2.0, len);
678        DataArrayView sourceView(sourceData, sourceShape);
679      int val=0;      int val=0;
680      for (int i=0;i<sourceShape[0];i++) {      for (int i=0;i<sourceShape[0];i++) {
681        for (int j=0;j<sourceShape[1];j++) {        for (int j=0;j<sourceShape[1];j++) {
# Line 654  void DataArrayViewTestCase::testSlicing( Line 685  void DataArrayViewTestCase::testSlicing(
685        }        }
686      }      }
687    
688      DataArray target(targetShape);      len = DataTypes::noValues(targetShape);
689      DataArrayView targetView=target.getView();      DataVector targetData(len, 2.0, len);
690        DataArrayView targetView(targetData, targetShape);
691    
692      // Copy source view to target view.      // Copy source view to target view.
693      targetView.copySliceFrom(sourceView,region);      targetView.copySliceFrom(sourceView,region);
# Line 676  void DataArrayViewTestCase::testSlicing( Line 708  void DataArrayViewTestCase::testSlicing(
708      cout << "\tSlice a 3 dimensional slice from a scalar.";      cout << "\tSlice a 3 dimensional slice from a scalar.";
709    
710      // Define slice region.      // Define slice region.
711      DataArrayView::RegionType region;      DataTypes::RegionType region;
712      region.push_back(DataArrayView::RegionType::value_type(4,7));      region.push_back(DataTypes::RegionType::value_type(4,7));
713      region.push_back(DataArrayView::RegionType::value_type(2,5));      region.push_back(DataTypes::RegionType::value_type(2,5));
714      region.push_back(DataArrayView::RegionType::value_type(6,7));      region.push_back(DataTypes::RegionType::value_type(6,7));
715    
716      // Define shapes of views.      // Define shapes of views.
717      DataArrayView::ShapeType sourceShape;      DataTypes::ShapeType sourceShape;
718      DataArrayView::ShapeType targetShape;      DataTypes::ShapeType targetShape;
719      targetShape.push_back(11);      targetShape.push_back(11);
720      targetShape.push_back(8);      targetShape.push_back(8);
721      targetShape.push_back(9);      targetShape.push_back(9);
722    
723      // Create source and target views.      // Create source and target views.
724      DataArray source(sourceShape);      int len = DataTypes::noValues(sourceShape);
725      DataArrayView sourceView=source.getView();      DataVector sourceData(len, 2.0, len);
726        DataArrayView sourceView(sourceData, sourceShape);
727      sourceView()=5;      sourceView()=5;
728    
729      DataArray target(targetShape);      len = DataTypes::noValues(targetShape);
730      DataArrayView targetView=target.getView();      DataVector targetData(len, 2.0, len);
731        DataArrayView targetView(targetData, targetShape);
732    
733      // Copy source view to target view.      // Copy source view to target view.
734      targetView.copySliceFrom(sourceView,region);      targetView.copySliceFrom(sourceView,region);
# Line 715  void DataArrayViewTestCase::testSlicing( Line 749  void DataArrayViewTestCase::testSlicing(
749      cout << "\tSlice a 4 dimensional slice to a 4 dimensional array.";      cout << "\tSlice a 4 dimensional slice to a 4 dimensional array.";
750    
751      // Define slice region.      // Define slice region.
752      DataArrayView::RegionType region;      DataTypes::RegionType region;
753      region.push_back(DataArrayView::RegionType::value_type(2,4));      region.push_back(DataTypes::RegionType::value_type(2,4));
754      region.push_back(DataArrayView::RegionType::value_type(0,2));      region.push_back(DataTypes::RegionType::value_type(0,2));
755      region.push_back(DataArrayView::RegionType::value_type(5,9));      region.push_back(DataTypes::RegionType::value_type(5,9));
756      region.push_back(DataArrayView::RegionType::value_type(3,5));      region.push_back(DataTypes::RegionType::value_type(3,5));
757    
758      // Define shapes of views.      // Define shapes of views.
759      DataArrayView::ShapeType sourceShape;      DataTypes::ShapeType sourceShape;
760      sourceShape.push_back(6);      sourceShape.push_back(6);
761      sourceShape.push_back(3);      sourceShape.push_back(3);
762      sourceShape.push_back(13);      sourceShape.push_back(13);
763      sourceShape.push_back(9);      sourceShape.push_back(9);
764      DataArrayView::ShapeType targetShape = DataArrayView::getResultSliceShape(region);      DataTypes::ShapeType targetShape = DataTypes::getResultSliceShape(region);
765    
766      // Create source and target views.      // Create source and target views.
767      DataArray source(sourceShape);      int len = DataTypes::noValues(sourceShape);
768      DataArrayView sourceView=source.getView();      DataVector sourceData(len, 2.0, len);
769        DataArrayView sourceView(sourceData, sourceShape);
770      int val=0;      int val=0;
771      for (int i=0;i<sourceShape[0];i++) {      for (int i=0;i<sourceShape[0];i++) {
772        for (int j=0;j<sourceShape[1];j++) {        for (int j=0;j<sourceShape[1];j++) {
# Line 743  void DataArrayViewTestCase::testSlicing( Line 778  void DataArrayViewTestCase::testSlicing(
778        }        }
779      }      }
780    
781      DataArray target(targetShape);      len = DataTypes::noValues(targetShape);
782      DataArrayView targetView=target.getView();      DataVector targetData(len, 2.0, len);
783        DataArrayView targetView(targetData, targetShape);
784    
785      // Copy source view to target view.      // Copy source view to target view.
786      targetView.copySlice(sourceView,region);      targetView.copySlice(sourceView,region);
# Line 767  void DataArrayViewTestCase::testSlicing( Line 803  void DataArrayViewTestCase::testSlicing(
803      cout << "\tSlice a 4 dimensional slice to a 3 dimensional array.";      cout << "\tSlice a 4 dimensional slice to a 3 dimensional array.";
804    
805      // Define slice region.      // Define slice region.
806      DataArrayView::RegionType region;      DataTypes::RegionType region;
807      region.push_back(DataArrayView::RegionType::value_type(2,4));      region.push_back(DataTypes::RegionType::value_type(2,4));
808      region.push_back(DataArrayView::RegionType::value_type(0,2));      region.push_back(DataTypes::RegionType::value_type(0,2));
809      region.push_back(DataArrayView::RegionType::value_type(5,6));      region.push_back(DataTypes::RegionType::value_type(5,6));
810      region.push_back(DataArrayView::RegionType::value_type(3,5));      region.push_back(DataTypes::RegionType::value_type(3,5));
811    
812      // Define shapes of views.      // Define shapes of views.
813      DataArrayView::ShapeType sourceShape;      DataTypes::ShapeType sourceShape;
814      sourceShape.push_back(6);      sourceShape.push_back(6);
815      sourceShape.push_back(3);      sourceShape.push_back(3);
816      sourceShape.push_back(13);      sourceShape.push_back(13);
817      sourceShape.push_back(9);      sourceShape.push_back(9);
818      DataArrayView::ShapeType targetShape;      DataTypes::ShapeType targetShape;
819      targetShape.push_back(2);      targetShape.push_back(2);
820      targetShape.push_back(2);      targetShape.push_back(2);
821      targetShape.push_back(2);      targetShape.push_back(2);
822    
823      // Create source and target views.      // Create source and target views.
824      DataArray source(sourceShape);      int len = DataTypes::noValues(sourceShape);
825      DataArrayView sourceView=source.getView();      DataVector sourceData(len, 2.0, len);
826        DataArrayView sourceView(sourceData, sourceShape);
827      int val=0;      int val=0;
828      for (int i=0;i<sourceShape[0];i++) {      for (int i=0;i<sourceShape[0];i++) {
829        for (int j=0;j<sourceShape[1];j++) {        for (int j=0;j<sourceShape[1];j++) {
# Line 798  void DataArrayViewTestCase::testSlicing( Line 835  void DataArrayViewTestCase::testSlicing(
835        }        }
836      }      }
837    
838      DataArray target(targetShape);      len = DataTypes::noValues(targetShape);
839      DataArrayView targetView=target.getView();      DataVector targetData(len, 2.0, len);
840        DataArrayView targetView(targetData, targetShape);
841    
842      // Copy source view to target view.      // Copy source view to target view.
843      targetView.copySlice(sourceView,region);      targetView.copySlice(sourceView,region);
# Line 822  void DataArrayViewTestCase::testSlicing( Line 860  void DataArrayViewTestCase::testSlicing(
860      cout << "\tSlice a 4 dimensional slice to a 2 dimensional array.";      cout << "\tSlice a 4 dimensional slice to a 2 dimensional array.";
861    
862      // Define slice region.      // Define slice region.
863      DataArrayView::RegionType region;      DataTypes::RegionType region;
864      region.push_back(DataArrayView::RegionType::value_type(2,4));      region.push_back(DataTypes::RegionType::value_type(2,4));
865      region.push_back(DataArrayView::RegionType::value_type(0,2));      region.push_back(DataTypes::RegionType::value_type(0,2));
866      region.push_back(DataArrayView::RegionType::value_type(5,6));      region.push_back(DataTypes::RegionType::value_type(5,6));
867      region.push_back(DataArrayView::RegionType::value_type(4,5));      region.push_back(DataTypes::RegionType::value_type(4,5));
868    
869      // Define shapes of views.      // Define shapes of views.
870      DataArrayView::ShapeType sourceShape;      DataTypes::ShapeType sourceShape;
871      sourceShape.push_back(6);      sourceShape.push_back(6);
872      sourceShape.push_back(3);      sourceShape.push_back(3);
873      sourceShape.push_back(13);      sourceShape.push_back(13);
874      sourceShape.push_back(9);      sourceShape.push_back(9);
875      DataArrayView::ShapeType targetShape;      DataTypes::ShapeType targetShape;
876      targetShape.push_back(2);      targetShape.push_back(2);
877      targetShape.push_back(2);      targetShape.push_back(2);
878    
879      // Create source and target views.      // Create source and target views.
880      DataArray source(sourceShape);      int len = DataTypes::noValues(sourceShape);
881      DataArrayView sourceView=source.getView();      DataVector sourceData(len, 2.0, len);
882        DataArrayView sourceView(sourceData, sourceShape);
883      int val=0;      int val=0;
884      for (int i=0;i<sourceShape[0];i++) {      for (int i=0;i<sourceShape[0];i++) {
885        for (int j=0;j<sourceShape[1];j++) {        for (int j=0;j<sourceShape[1];j++) {
# Line 852  void DataArrayViewTestCase::testSlicing( Line 891  void DataArrayViewTestCase::testSlicing(
891        }        }
892      }      }
893    
894      DataArray target(targetShape);      len = DataTypes::noValues(targetShape);
895      DataArrayView targetView=target.getView();      DataVector targetData(len, 2.0, len);
896        DataArrayView targetView(targetData, targetShape);
897    
898      // Copy source view to target view.      // Copy source view to target view.
899      targetView.copySlice(sourceView,region);      targetView.copySlice(sourceView,region);
# Line 876  void DataArrayViewTestCase::testSlicing( Line 916  void DataArrayViewTestCase::testSlicing(
916      cout << "\tSlice a 4 dimensional slice to a 1 dimensional array.";      cout << "\tSlice a 4 dimensional slice to a 1 dimensional array.";
917    
918      // Define slice region.      // Define slice region.
919      DataArrayView::RegionType region;      DataTypes::RegionType region;
920      region.push_back(DataArrayView::RegionType::value_type(3,4));      region.push_back(DataTypes::RegionType::value_type(3,4));
921      region.push_back(DataArrayView::RegionType::value_type(0,2));      region.push_back(DataTypes::RegionType::value_type(0,2));
922      region.push_back(DataArrayView::RegionType::value_type(5,6));      region.push_back(DataTypes::RegionType::value_type(5,6));
923      region.push_back(DataArrayView::RegionType::value_type(4,5));      region.push_back(DataTypes::RegionType::value_type(4,5));
924    
925      // Define shapes of views.      // Define shapes of views.
926      DataArrayView::ShapeType sourceShape;      DataTypes::ShapeType sourceShape;
927      sourceShape.push_back(6);      sourceShape.push_back(6);
928      sourceShape.push_back(3);      sourceShape.push_back(3);
929      sourceShape.push_back(13);      sourceShape.push_back(13);
930      sourceShape.push_back(9);      sourceShape.push_back(9);
931      DataArrayView::ShapeType targetShape;      DataTypes::ShapeType targetShape;
932      targetShape.push_back(2);      targetShape.push_back(2);
933    
934      // Create source and target views.      // Create source and target views.
935      DataArray source(sourceShape);      int len = DataTypes::noValues(sourceShape);
936      DataArrayView sourceView=source.getView();      DataVector sourceData(len, 2.0, len);
937        DataArrayView sourceView(sourceData, sourceShape);
938      int val=0;      int val=0;
939      for (int i=0;i<sourceShape[0];i++) {      for (int i=0;i<sourceShape[0];i++) {
940        for (int j=0;j<sourceShape[1];j++) {        for (int j=0;j<sourceShape[1];j++) {
# Line 905  void DataArrayViewTestCase::testSlicing( Line 946  void DataArrayViewTestCase::testSlicing(
946        }        }
947      }      }
948    
949      DataArray target(targetShape);      len = DataTypes::noValues(targetShape);
950      DataArrayView targetView=target.getView();      DataVector targetData(len, 2.0, len);
951        DataArrayView targetView(targetData, targetShape);
952    
953      // Copy source view to target view.      // Copy source view to target view.
954      targetView.copySlice(sourceView,region);      targetView.copySlice(sourceView,region);
# Line 929  void DataArrayViewTestCase::testSlicing( Line 971  void DataArrayViewTestCase::testSlicing(
971      cout << "\tSlice a 4 dimensional slice to a scalar.";      cout << "\tSlice a 4 dimensional slice to a scalar.";
972    
973      // Define slice region.      // Define slice region.
974      DataArrayView::RegionType region;      DataTypes::RegionType region;
975      region.push_back(DataArrayView::RegionType::value_type(3,4));      region.push_back(DataTypes::RegionType::value_type(3,4));
976      region.push_back(DataArrayView::RegionType::value_type(1,2));      region.push_back(DataTypes::RegionType::value_type(1,2));
977      region.push_back(DataArrayView::RegionType::value_type(5,6));      region.push_back(DataTypes::RegionType::value_type(5,6));
978      region.push_back(DataArrayView::RegionType::value_type(4,5));      region.push_back(DataTypes::RegionType::value_type(4,5));
979    
980      // Define shapes of views.      // Define shapes of views.
981      DataArrayView::ShapeType sourceShape;      DataTypes::ShapeType sourceShape;
982      sourceShape.push_back(6);      sourceShape.push_back(6);
983      sourceShape.push_back(3);      sourceShape.push_back(3);
984      sourceShape.push_back(13);      sourceShape.push_back(13);
985      sourceShape.push_back(9);      sourceShape.push_back(9);
986      DataArrayView::ShapeType targetShape;      DataTypes::ShapeType targetShape;
987    
988      // Create source and target views.      // Create source and target views.
989      DataArray source(sourceShape);      int len = DataTypes::noValues(sourceShape);
990      DataArrayView sourceView=source.getView();      DataVector sourceData(len, 2.0, len);
991        DataArrayView sourceView(sourceData, sourceShape);
992      int val=0;      int val=0;
993      for (int i=0;i<sourceShape[0];i++) {      for (int i=0;i<sourceShape[0];i++) {
994        for (int j=0;j<sourceShape[1];j++) {        for (int j=0;j<sourceShape[1];j++) {
# Line 957  void DataArrayViewTestCase::testSlicing( Line 1000  void DataArrayViewTestCase::testSlicing(
1000        }        }
1001      }      }
1002    
1003      DataArray target(targetShape);      len = DataTypes::noValues(targetShape);
1004      DataArrayView targetView=target.getView();      DataVector targetData(len, 2.0, len);
1005        DataArrayView targetView(targetData, targetShape);
1006    
1007      // Copy source view to target view.      // Copy source view to target view.
1008      targetView.copySlice(sourceView,region);      targetView.copySlice(sourceView,region);
# Line 981  void DataArrayViewTestCase::testSlicing( Line 1025  void DataArrayViewTestCase::testSlicing(
1025      cout << "\tSlice a 4 dimensional slice from a 4 dimensional array.";      cout << "\tSlice a 4 dimensional slice from a 4 dimensional array.";
1026    
1027      // Define slice region.      // Define slice region.
1028      DataArrayView::RegionType region;      DataTypes::RegionType region;
1029      region.push_back(DataArrayView::RegionType::value_type(14,37));      region.push_back(DataTypes::RegionType::value_type(14,37));
1030      region.push_back(DataArrayView::RegionType::value_type(22,57));      region.push_back(DataTypes::RegionType::value_type(22,57));
1031      region.push_back(DataArrayView::RegionType::value_type(63,71));      region.push_back(DataTypes::RegionType::value_type(63,71));
1032      region.push_back(DataArrayView::RegionType::value_type(23,51));      region.push_back(DataTypes::RegionType::value_type(23,51));
1033    
1034      // Define shapes of views.      // Define shapes of views.
1035      DataArrayView::ShapeType sourceShape = DataArrayView::getResultSliceShape(region);      DataTypes::ShapeType sourceShape = DataTypes::getResultSliceShape(region);
1036      DataArrayView::ShapeType targetShape;      DataTypes::ShapeType targetShape;
1037      targetShape.push_back(50);      targetShape.push_back(50);
1038      targetShape.push_back(65);      targetShape.push_back(65);
1039      targetShape.push_back(80);      targetShape.push_back(80);
1040      targetShape.push_back(90);      targetShape.push_back(90);
1041    
1042      // Create source and target views.      // Create source and target views.
1043      DataArray source(sourceShape);      int len = DataTypes::noValues(sourceShape);
1044      DataArrayView sourceView=source.getView();      DataVector sourceData(len, 2.0, len);
1045        DataArrayView sourceView(sourceData, sourceShape);
1046      int val=0;      int val=0;
1047      for (int i=0;i<sourceShape[0];i++) {      for (int i=0;i<sourceShape[0];i++) {
1048        for (int j=0;j<sourceShape[1];j++) {        for (int j=0;j<sourceShape[1];j++) {
# Line 1009  void DataArrayViewTestCase::testSlicing( Line 1054  void DataArrayViewTestCase::testSlicing(
1054        }        }
1055      }      }
1056    
1057      DataArray target(targetShape);      len = DataTypes::noValues(targetShape);
1058      DataArrayView targetView=target.getView();      DataVector targetData(len, 2.0, len);
1059        DataArrayView targetView(targetData, targetShape);
1060    
1061      // Copy source view to target view.      // Copy source view to target view.
1062      targetView.copySliceFrom(sourceView,region);      targetView.copySliceFrom(sourceView,region);
# Line 1033  void DataArrayViewTestCase::testSlicing( Line 1079  void DataArrayViewTestCase::testSlicing(
1079      cout << "\tSlice a 4 dimensional slice from a scalar.";      cout << "\tSlice a 4 dimensional slice from a scalar.";
1080    
1081      // Define slice region.      // Define slice region.
1082      DataArrayView::RegionType region;      DataTypes::RegionType region;
1083      region.push_back(DataArrayView::RegionType::value_type(14,37));      region.push_back(DataTypes::RegionType::value_type(14,37));
1084      region.push_back(DataArrayView::RegionType::value_type(22,57));      region.push_back(DataTypes::RegionType::value_type(22,57));
1085      region.push_back(DataArrayView::RegionType::value_type(63,71));      region.push_back(DataTypes::RegionType::value_type(63,71));
1086      region.push_back(DataArrayView::RegionType::value_type(23,51));      region.push_back(DataTypes::RegionType::value_type(23,51));
1087    
1088      // Define shapes of views.      // Define shapes of views.
1089      DataArrayView::ShapeType sourceShape;      DataTypes::ShapeType sourceShape;
1090      DataArrayView::ShapeType targetShape;      DataTypes::ShapeType targetShape;
1091      targetShape.push_back(50);      targetShape.push_back(50);
1092      targetShape.push_back(65);      targetShape.push_back(65);
1093      targetShape.push_back(80);      targetShape.push_back(80);
1094      targetShape.push_back(90);      targetShape.push_back(90);
1095    
1096      // Create source and target views.      // Create source and target views.
1097      DataArray source(sourceShape);      int len = DataTypes::noValues(sourceShape);
1098      DataArrayView sourceView=source.getView();      DataVector sourceData(len, 2.0, len);
1099        DataArrayView sourceView(sourceData, sourceShape);
1100      sourceView()=5;      sourceView()=5;
1101    
1102      DataArray target(targetShape);      len = DataTypes::noValues(targetShape);
1103      DataArrayView targetView=target.getView();      DataVector targetData(len, 2.0, len);
1104        DataArrayView targetView(targetData, targetShape);
1105    
1106      // Copy source view to target view.      // Copy source view to target view.
1107      targetView.copySliceFrom(sourceView,region);      targetView.copySliceFrom(sourceView,region);
# Line 1080  void DataArrayViewTestCase::testShapeToS Line 1128  void DataArrayViewTestCase::testShapeToS
1128    cout << endl;    cout << endl;
1129    cout << "\tTest shapeToString for a variety of shapes." << endl;    cout << "\tTest shapeToString for a variety of shapes." << endl;
1130    
1131    DataArrayView::ShapeType shape;    DataTypes::ShapeType shape;
1132    assert(DataArrayView::shapeToString(shape)=="()");    assert(DataTypes::shapeToString(shape)=="()");
1133    shape.push_back(5);    shape.push_back(5);
1134    assert(DataArrayView::shapeToString(shape)=="(5)");    assert(DataTypes::shapeToString(shape)=="(5)");
1135    shape.push_back(2);    shape.push_back(2);
1136    assert(DataArrayView::shapeToString(shape)=="(5,2)");    assert(DataTypes::shapeToString(shape)=="(5,2)");
1137    shape.push_back(9);    shape.push_back(9);
1138    assert(DataArrayView::shapeToString(shape)=="(5,2,9)");    assert(DataTypes::shapeToString(shape)=="(5,2,9)");
1139    shape.push_back(4);    shape.push_back(4);
1140    assert(DataArrayView::shapeToString(shape)=="(5,2,9,4)");    assert(DataTypes::shapeToString(shape)=="(5,2,9,4)");
1141    
1142  }  }
1143    
# Line 1100  void DataArrayViewTestCase::testScalarVi Line 1148  void DataArrayViewTestCase::testScalarVi
1148    
1149    // Create a vector containing enough data for three scalars    // Create a vector containing enough data for three scalars
1150    // and check three scalar views return the appropriate data    // and check three scalar views return the appropriate data
1151    DataArrayView::ShapeType vShape;    DataTypes::ShapeType vShape;
1152    DataArrayView::ValueType vData(3);    DataTypes::ValueType vData(3);
1153    vData[0]=0;    vData[0]=0;
1154    vData[1]=1;    vData[1]=1;
1155    vData[2]=2;    vData[2]=2;
# Line 1165  void DataArrayViewTestCase::testAll() Line 1213  void DataArrayViewTestCase::testAll()
1213      assert(defView.getRank()==0);      assert(defView.getRank()==0);
1214      assert(defView.noValues()==0);      assert(defView.noValues()==0);
1215      assert(defView.getShape().empty());      assert(defView.getShape().empty());
1216      assert(defView.checkShape(DataArrayView::ShapeType()));      assert(defView.checkShape(DataTypes::ShapeType()));
1217    }    }
1218    
1219    {    {
# Line 1173  void DataArrayViewTestCase::testAll() Line 1221  void DataArrayViewTestCase::testAll()
1221      cout << "\tTest DataArrayView - shape (5).";      cout << "\tTest DataArrayView - shape (5).";
1222    
1223      // define the shape for the DataArrayView      // define the shape for the DataArrayView
1224      DataArrayView::ShapeType shape;      DataTypes::ShapeType shape;
1225      shape.push_back(5);      shape.push_back(5);
1226    
1227      // allocate the data for the DataArrayView      // allocate the data for the DataArrayView
1228      DataArrayView::ValueType data(DataArrayView::noValues(shape),0);      DataTypes::ValueType data(DataTypes::noValues(shape),0);
1229    
1230      // constructor      // constructor
1231      int offset=0;      int offset=0;
# Line 1204  void DataArrayViewTestCase::testAll() Line 1252  void DataArrayViewTestCase::testAll()
1252      cout << "\tTest DataArrayView - shape (2,3).";      cout << "\tTest DataArrayView - shape (2,3).";
1253    
1254      // define the shape for the DataArrayView      // define the shape for the DataArrayView
1255      DataArrayView::ShapeType shape;      DataTypes::ShapeType shape;
1256      shape.push_back(2);      shape.push_back(2);
1257      shape.push_back(3);      shape.push_back(3);
1258    
1259      // allocate the data for the DataArrayView      // allocate the data for the DataArrayView
1260      int npoints=4;      int npoints=4;
1261      DataArrayView::ValueType data(DataArrayView::noValues(shape)*npoints,0);      DataTypes::ValueType data(DataTypes::noValues(shape)*npoints,0);
1262    
1263      // constructor      // constructor
1264      DataArrayView dataView(data,shape);      DataArrayView dataView(data,shape);
# Line 1249  void DataArrayViewTestCase::testAll() Line 1297  void DataArrayViewTestCase::testAll()
1297      cout << "\tTest DataArrayView - shape (4,7,9).";      cout << "\tTest DataArrayView - shape (4,7,9).";
1298    
1299      // define the shape for the DataArrayView      // define the shape for the DataArrayView
1300      DataArrayView::ShapeType shape;      DataTypes::ShapeType shape;
1301      shape.push_back(4);      shape.push_back(4);
1302      shape.push_back(7);      shape.push_back(7);
1303      shape.push_back(9);      shape.push_back(9);
1304    
1305      // allocate the data for the DataArrayView      // allocate the data for the DataArrayView
1306      int npoints=10;      int npoints=10;
1307      DataArrayView::ValueType data(DataArrayView::noValues(shape)*npoints,0);      DataTypes::ValueType data(DataTypes::noValues(shape)*npoints,0);
1308    
1309      // constructor      // constructor
1310      DataArrayView dataView(data,shape);      DataArrayView dataView(data,shape);
# Line 1297  void DataArrayViewTestCase::testAll() Line 1345  void DataArrayViewTestCase::testAll()
1345      cout << "\tTest DataArrayView - shape (12,4,5,14).";      cout << "\tTest DataArrayView - shape (12,4,5,14).";
1346    
1347      // define the shape for the DataArrayView      // define the shape for the DataArrayView
1348      DataArrayView::ShapeType shape;      DataTypes::ShapeType shape;
1349      shape.push_back(12);      shape.push_back(12);
1350      shape.push_back(4);      shape.push_back(4);
1351      shape.push_back(5);      shape.push_back(5);
# Line 1305  void DataArrayViewTestCase::testAll() Line 1353  void DataArrayViewTestCase::testAll()
1353    
1354      // allocate the data for the DataArrayView      // allocate the data for the DataArrayView
1355      int npoints=100;      int npoints=100;
1356      DataArrayView::ValueType data(DataArrayView::noValues(shape)*npoints,0);      DataTypes::ValueType data(DataTypes::noValues(shape)*npoints,0);
1357    
1358      // constructor      // constructor
1359      DataArrayView dataView(data,shape);      DataArrayView dataView(data,shape);
# Line 1348  void DataArrayViewTestCase::testAll() Line 1396  void DataArrayViewTestCase::testAll()
1396      cout << "\tTest DataArrayView copy constructor - shape (5).";      cout << "\tTest DataArrayView copy constructor - shape (5).";
1397    
1398      // define the shape for the DataArrayView      // define the shape for the DataArrayView
1399      DataArrayView::ShapeType shape;      DataTypes::ShapeType shape;
1400      shape.push_back(5);      shape.push_back(5);
1401    
1402      // allocate the data for the DataArrayView      // allocate the data for the DataArrayView
1403      DataArrayView::ValueType data(DataArrayView::noValues(shape),0);      DataTypes::ValueType data(DataTypes::noValues(shape),0);
1404    
1405      // constructor      // constructor
1406      DataArrayView dataView(data,shape);      DataArrayView dataView(data,shape);
# Line 1381  void DataArrayViewTestCase::testAll() Line 1429  void DataArrayViewTestCase::testAll()
1429      cout << "\tTest DataArrayView copy constructor - shape (5,6,7).";      cout << "\tTest DataArrayView copy constructor - shape (5,6,7).";
1430    
1431      // define the shape for the DataArrayView      // define the shape for the DataArrayView
1432      DataArrayView::ShapeType shape;      DataTypes::ShapeType shape;
1433      shape.push_back(5);      shape.push_back(5);
1434      shape.push_back(6);      shape.push_back(6);
1435      shape.push_back(7);      shape.push_back(7);
1436    
1437      // allocate the data for the DataArrayView      // allocate the data for the DataArrayView
1438      DataArrayView::ValueType data(DataArrayView::noValues(shape),0);      DataTypes::ValueType data(DataTypes::noValues(shape),0);
1439    
1440      // constructor      // constructor
1441      DataArrayView dataView(data,shape);      DataArrayView dataView(data,shape);
# Line 1416  void DataArrayViewTestCase::testAll() Line 1464  void DataArrayViewTestCase::testAll()
1464      cout << "\tTest DataArrayView copy method - shape (2,3).";      cout << "\tTest DataArrayView copy method - shape (2,3).";
1465    
1466      // define the shape for the DataArrayViews      // define the shape for the DataArrayViews
1467      DataArrayView::ShapeType shape;      DataTypes::ShapeType shape;
1468      shape.push_back(2);      shape.push_back(2);
1469      shape.push_back(3);      shape.push_back(3);
1470    
1471      // allocate the data for the DataArrayViews      // allocate the data for the DataArrayViews
1472      int npoints=4;      int npoints=4;
1473      DataArrayView::ValueType data1(DataArrayView::noValues(shape)*npoints,0);      DataTypes::ValueType data1(DataTypes::noValues(shape)*npoints,0);
1474      DataArrayView::ValueType data2(DataArrayView::noValues(shape)*npoints,0);      DataTypes::ValueType data2(DataTypes::noValues(shape)*npoints,0);
1475    
1476      // construct two views      // construct two views
1477      DataArrayView dataView1(data1,shape);      DataArrayView dataView1(data1,shape);
# Line 1463  void DataArrayViewTestCase::testAll() Line 1511  void DataArrayViewTestCase::testAll()
1511      cout << "\tTest DataArrayView copy method - shape (2,3,8,9).";      cout << "\tTest DataArrayView copy method - shape (2,3,8,9).";
1512    
1513      // define the shape for the DataArrayViews      // define the shape for the DataArrayViews
1514      DataArrayView::ShapeType shape;      DataTypes::ShapeType shape;
1515      shape.push_back(2);      shape.push_back(2);
1516      shape.push_back(3);      shape.push_back(3);
1517      shape.push_back(8);      shape.push_back(8);
# Line 1471  void DataArrayViewTestCase::testAll() Line 1519  void DataArrayViewTestCase::testAll()
1519    
1520      // allocate the data for the DataArrayViews      // allocate the data for the DataArrayViews
1521      int npoints=10;      int npoints=10;
1522      DataArrayView::ValueType data1(DataArrayView::noValues(shape)*npoints,0);      DataTypes::ValueType data1(DataTypes::noValues(shape)*npoints,0);
1523      DataArrayView::ValueType data2(DataArrayView::noValues(shape)*npoints,0);      DataTypes::ValueType data2(DataTypes::noValues(shape)*npoints,0);
1524    
1525      // construct two views      // construct two views
1526      DataArrayView dataView1(data1,shape);      DataArrayView dataView1(data1,shape);
# Line 1520  void DataArrayViewTestCase::testAll() Line 1568  void DataArrayViewTestCase::testAll()
1568      cout << "\tTest DataArrayView copy with offset method - shape (2,3).";      cout << "\tTest DataArrayView copy with offset method - shape (2,3).";
1569    
1570      // define the shape for the DataArrayViews      // define the shape for the DataArrayViews
1571      DataArrayView::ShapeType shape;      DataTypes::ShapeType shape;
1572      shape.push_back(2);      shape.push_back(2);
1573      shape.push_back(3);      shape.push_back(3);
1574    
1575      // allocate the data for the DataArrayViews      // allocate the data for the DataArrayViews
1576      int npoints=4;      int npoints=4;
1577      DataArrayView::ValueType data1(DataArrayView::noValues(shape)*npoints,0);      DataTypes::ValueType data1(DataTypes::noValues(shape)*npoints,0);
1578      DataArrayView::ValueType data2(DataArrayView::noValues(shape)*npoints,0);      DataTypes::ValueType data2(DataTypes::noValues(shape)*npoints,0);
1579    
1580      // construct two views      // construct two views
1581      DataArrayView dataView1(data1,shape);      DataArrayView dataView1(data1,shape);
# Line 1558  void DataArrayViewTestCase::testAll() Line 1606  void DataArrayViewTestCase::testAll()
1606      cout << "\tTest DataArrayView copy with value method - shape (5,8).";      cout << "\tTest DataArrayView copy with value method - shape (5,8).";
1607    
1608      // define the shape for the DataArrayView      // define the shape for the DataArrayView
1609      DataArrayView::ShapeType shape;      DataTypes::ShapeType shape;
1610      shape.push_back(5);      shape.push_back(5);
1611      shape.push_back(8);      shape.push_back(8);
1612    
1613      // allocate the data for the DataArrayView      // allocate the data for the DataArrayView
1614      int npoints=4;      int npoints=4;
1615      DataArrayView::ValueType data(DataArrayView::noValues(shape)*npoints,0);      DataTypes::ValueType data(DataTypes::noValues(shape)*npoints,0);
1616    
1617      // construct view      // construct view
1618      DataArrayView dataView(data,shape);      DataArrayView dataView(data,shape);
# Line 1582  void DataArrayViewTestCase::testAll() Line 1630  void DataArrayViewTestCase::testAll()
1630    
1631    }    }
1632    
1633      #if defined DOASSERT
1634    {    {
1635      cout << endl;      cout << endl;
1636      cout << "\tTest too many indices for shape exception.";      cout << "\tTest too many indices for shape exception.";
1637    
1638      DataArrayView::ShapeType shape;      DataTypes::ShapeType shape;
1639      DataArrayView::ValueType data(DataArrayView::noValues(shape),0);      DataTypes::ValueType data(DataTypes::noValues(shape),0);
1640      DataArrayView dataView(data,shape);      DataArrayView dataView(data,shape);
1641    
1642      // Should be a scalar      // Should be a scalar
# Line 1626  void DataArrayViewTestCase::testAll() Line 1675  void DataArrayViewTestCase::testAll()
1675      }      }
1676    
1677    }    }
1678      #endif
1679    
1680      #if defined DOASSERT
1681    {    {
1682      cout << endl;      cout << endl;
1683      cout << "\tTest invalid index exception.";      cout << "\tTest invalid index exception.";
1684    
1685      DataArrayView::ShapeType shape;      DataTypes::ShapeType shape;
1686      shape.push_back(4);      shape.push_back(4);
1687      DataArrayView::ValueType data(DataArrayView::noValues(shape),0);      DataTypes::ValueType data(DataTypes::noValues(shape),0);
1688      DataArrayView dataView(data,shape);      DataArrayView dataView(data,shape);
1689    
1690      try {      try {
# Line 1644  void DataArrayViewTestCase::testAll() Line 1695  void DataArrayViewTestCase::testAll()
1695        assert(true);        assert(true);
1696      }      }
1697    }    }
1698      #endif
1699    
1700    {    {
1701      cout << endl;      cout << endl;
1702      cout << "\tTest insufficient data exception.";      cout << "\tTest insufficient data exception.";
1703    
1704      DataArrayView::ShapeType shape;      DataTypes::ShapeType shape;
1705      DataArrayView::ValueType data;      DataTypes::ValueType data;
1706    
1707      try {      try {
1708        DataArrayView dataView(data,shape);        DataArrayView dataView(data,shape);
1709        assert(false);        assert(false);
1710      }      }
1711      catch (EsysException& e) {      catch (EsysException&) {
1712        assert(true);        assert(true);
1713      }      }
1714    }    }
# Line 1672  void DataArrayViewTestCase::testMatMult( Line 1724  void DataArrayViewTestCase::testMatMult(
1724      cout << endl;      cout << endl;
1725      cout << "\tTest result shape." << endl;      cout << "\tTest result shape." << endl;
1726    
1727      DataArrayView::ShapeType leftShape;      DataTypes::ShapeType leftShape;
1728      leftShape.push_back(1);      leftShape.push_back(1);
1729      leftShape.push_back(3);      leftShape.push_back(3);
1730      DataArrayView::ValueType leftData(DataArrayView::noValues(leftShape),0);      DataTypes::ValueType leftData(DataTypes::noValues(leftShape),0);
1731      DataArrayView leftDataView(leftData,leftShape);      DataArrayView leftDataView(leftData,leftShape);
1732    
1733      DataArrayView::ShapeType rightShape;      DataTypes::ShapeType rightShape;
1734      rightShape.push_back(3);      rightShape.push_back(3);
1735      rightShape.push_back(2);      rightShape.push_back(2);
1736      DataArrayView::ValueType rightData(DataArrayView::noValues(rightShape),0);      DataTypes::ValueType rightData(DataTypes::noValues(rightShape),0);
1737      DataArrayView rightDataView(rightData,rightShape);      DataArrayView rightDataView(rightData,rightShape);
1738    
1739      DataArrayView::ShapeType resultShape=DataArrayView::determineResultShape(leftDataView,rightDataView);      DataTypes::ShapeType resultShape=DataArrayView::determineResultShape(leftDataView,rightDataView);
1740    
1741      assert(resultShape.size()==2);      assert(resultShape.size()==2);
1742      assert(resultShape[0]==1);      assert(resultShape[0]==1);
1743      assert(resultShape[1]==2);      assert(resultShape[1]==2);
1744    
1745      DataArrayView::ValueType resultData(DataArrayView::noValues(resultShape),0);      DataTypes::ValueType resultData(DataTypes::noValues(resultShape),0);
1746      DataArrayView resultDataView(resultData,resultShape);      DataArrayView resultDataView(resultData,resultShape);
1747      
1748      cout << "\tTest matrix multiplication.";      cout << "\tTest matrix multiplication.";
1749      double aValue=0.0;      double aValue=0.0;
1750      for (int i=0;i<leftShape[0];i++) {      for (int i=0;i<leftShape[0];i++) {
# Line 1726  void DataArrayViewTestCase::testUnaryOp( Line 1778  void DataArrayViewTestCase::testUnaryOp(
1778      cout << "\tTest unaryOp on scalar DataArrayView.";      cout << "\tTest unaryOp on scalar DataArrayView.";
1779    
1780      // define the shape for the DataArrayView      // define the shape for the DataArrayView
1781      DataArrayView::ShapeType shape;      DataTypes::ShapeType shape;
1782    
1783      // allocate the data for the DataArrayView      // allocate the data for the DataArrayView
1784      int npoints=4;      int npoints=4;
1785      DataArrayView::ValueType data(DataArrayView::noValues(shape)*npoints,0);      DataTypes::ValueType data(DataTypes::noValues(shape)*npoints,0);
1786    
1787      // constructor      // constructor
1788      DataArrayView dataView(data,shape);      DataArrayView dataView(data,shape);
# Line 1747  void DataArrayViewTestCase::testUnaryOp( Line 1799  void DataArrayViewTestCase::testUnaryOp(
1799    
1800        // check the results        // check the results
1801        tmp = std::sin((double)p);        tmp = std::sin((double)p);
1802        assert(dataView()==tmp);        assert(std::abs(dataView()-tmp)<=REL_TOL*std::abs(tmp));
1803    
1804        if (p<npoints-1) {        if (p<npoints-1) {
1805          dataView.incrOffset();          dataView.incrOffset();
# Line 1762  void DataArrayViewTestCase::testUnaryOp( Line 1814  void DataArrayViewTestCase::testUnaryOp(
1814      cout << "\tTest unaryOp on shape (2,3) DataArrayView.";      cout << "\tTest unaryOp on shape (2,3) DataArrayView.";
1815    
1816      // define the shape for the DataArrayView      // define the shape for the DataArrayView
1817      DataArrayView::ShapeType shape;      DataTypes::ShapeType shape;
1818      shape.push_back(2);      shape.push_back(2);
1819      shape.push_back(3);      shape.push_back(3);
1820    
1821      // allocate the data for the DataArrayView      // allocate the data for the DataArrayView
1822      int npoints=4;      int npoints=4;
1823      DataArrayView::ValueType data(DataArrayView::noValues(shape)*npoints,0);      DataTypes::ValueType data(DataTypes::noValues(shape)*npoints,0);
1824    
1825      // constructor      // constructor
1826      DataArrayView dataView(data,shape);      DataArrayView dataView(data,shape);
# Line 1789  void DataArrayViewTestCase::testUnaryOp( Line 1841  void DataArrayViewTestCase::testUnaryOp(
1841        // check the results        // check the results
1842        for (int i=0;i<shape[0];i++) {        for (int i=0;i<shape[0];i++) {
1843          for (int j=0;j<shape[1];j++) {          for (int j=0;j<shape[1];j++) {
1844            assert(dataView(i,j)==std::sqrt((double)dataView.index(i,j)));            assert(std::abs(dataView(i,j)-std::sqrt((double)dataView.index(i,j)))<=REL_TOL*std::sqrt((double)dataView.index(i,j)));
1845          }          }
1846        }        }
1847    
# Line 1806  void DataArrayViewTestCase::testUnaryOp( Line 1858  void DataArrayViewTestCase::testUnaryOp(
1858      cout << "\tTest unaryOp on shape (9,8,5,11) DataArrayView.";      cout << "\tTest unaryOp on shape (9,8,5,11) DataArrayView.";
1859    
1860      // define the shape for the DataArrayView      // define the shape for the DataArrayView
1861      DataArrayView::ShapeType shape;      DataTypes::ShapeType shape;
1862      shape.push_back(9);      shape.push_back(9);
1863      shape.push_back(8);      shape.push_back(8);
1864      shape.push_back(5);      shape.push_back(5);
# Line 1814  void DataArrayViewTestCase::testUnaryOp( Line 1866  void DataArrayViewTestCase::testUnaryOp(
1866    
1867      // allocate the data for the DataArrayView      // allocate the data for the DataArrayView
1868      int npoints=4;      int npoints=4;
1869      DataArrayView::ValueType data(DataArrayView::noValues(shape)*npoints,0);      DataTypes::ValueType data(DataTypes::noValues(shape)*npoints,0);
1870    
1871      // constructor      // constructor
1872      DataArrayView dataView(data,shape);      DataArrayView dataView(data,shape);
# Line 1827  void DataArrayViewTestCase::testUnaryOp( Line 1879  void DataArrayViewTestCase::testUnaryOp(
1879          for (int j=0;j<shape[1];j++) {          for (int j=0;j<shape[1];j++) {
1880            for (int k=0;k<shape[2];k++) {            for (int k=0;k<shape[2];k++) {
1881              for (int l=0;l<shape[3];l++) {              for (int l=0;l<shape[3];l++) {
1882                dataView(i,j,k,l)=dataView.index(i,j,k,l);                dataView(i,j,k,l)=dataView.index(i,j,k,l)+1;
1883              }              }
1884            }            }
1885          }          }
# Line 1841  void DataArrayViewTestCase::testUnaryOp( Line 1893  void DataArrayViewTestCase::testUnaryOp(
1893          for (int j=0;j<shape[1];j++) {          for (int j=0;j<shape[1];j++) {
1894            for (int k=0;k<shape[2];k++) {            for (int k=0;k<shape[2];k++) {
1895              for (int l=0;l<shape[3];l++) {              for (int l=0;l<shape[3];l++) {
1896                assert(dataView(i,j,k,l)==std::log((double)dataView.index(i,j,k,l)));                assert(std::abs(dataView(i,j,k,l)-std::log(1+(double)dataView.index(i,j,k,l)))<=REL_TOL*std::abs(std::log(1+(double)dataView.index(i,j,k,l))));
1897              }              }
1898            }            }
1899          }          }
# Line 1871  void DataArrayViewTestCase::testBinaryOp Line 1923  void DataArrayViewTestCase::testBinaryOp
1923      cout << "\tTest binaryOp on scalar DataArrayViews.";      cout << "\tTest binaryOp on scalar DataArrayViews.";
1924    
1925      // define the shape for the DataArrayViews      // define the shape for the DataArrayViews
1926      DataArrayView::ShapeType shape;      DataTypes::ShapeType shape;
1927    
1928      // allocate the data for the DataArrayViews      // allocate the data for the DataArrayViews
1929      int npoints=4;      int npoints=4;
1930      DataArrayView::ValueType data1(DataArrayView::noValues(shape)*npoints,0);      DataTypes::ValueType data1(DataTypes::noValues(shape)*npoints,0);
1931      DataArrayView::ValueType data2(DataArrayView::noValues(shape)*npoints,0);      DataTypes::ValueType data2(DataTypes::noValues(shape)*npoints,0);
1932    
1933      // constructor      // constructor
1934      DataArrayView dataView1(data1,shape);      DataArrayView dataView1(data1,shape);
# Line 1909  void DataArrayViewTestCase::testBinaryOp Line 1961  void DataArrayViewTestCase::testBinaryOp
1961      cout << "\tTest binaryOp on shape (2,3) DataArrayViews.";      cout << "\tTest binaryOp on shape (2,3) DataArrayViews.";
1962    
1963      // define the shape for the DataArrayViews      // define the shape for the DataArrayViews
1964      DataArrayView::ShapeType shape;      DataTypes::ShapeType shape;
1965      shape.push_back(2);      shape.push_back(2);
1966      shape.push_back(3);      shape.push_back(3);
1967    
1968      // allocate the data for the DataArrayViews      // allocate the data for the DataArrayViews
1969      int npoints=4;      int npoints=4;
1970      DataArrayView::ValueType data1(DataArrayView::noValues(shape)*npoints,0);      DataTypes::ValueType data1(DataTypes::noValues(shape)*npoints,0);
1971      DataArrayView::ValueType data2(DataArrayView::noValues(shape)*npoints,0);      DataTypes::ValueType data2(DataTypes::noValues(shape)*npoints,0);
1972    
1973      // constructor      // constructor
1974      DataArrayView dataView1(data1,shape);      DataArrayView dataView1(data1,shape);
# Line 1957  void DataArrayViewTestCase::testBinaryOp Line 2009  void DataArrayViewTestCase::testBinaryOp
2009      cout << "\tTest binaryOp on shape (9,8,5,11) DataArrayViews.";      cout << "\tTest binaryOp on shape (9,8,5,11) DataArrayViews.";
2010    
2011      // define the shape for the DataArrayViews      // define the shape for the DataArrayViews
2012      DataArrayView::ShapeType shape;      DataTypes::ShapeType shape;
2013      shape.push_back(9);      shape.push_back(9);
2014      shape.push_back(8);      shape.push_back(8);
2015      shape.push_back(5);      shape.push_back(5);
# Line 1965  void DataArrayViewTestCase::testBinaryOp Line 2017  void DataArrayViewTestCase::testBinaryOp
2017    
2018      // allocate the data for the DataArrayViews      // allocate the data for the DataArrayViews
2019      int npoints=4;      int npoints=4;
2020      DataArrayView::ValueType data1(DataArrayView::noValues(shape)*npoints,0);      DataTypes::ValueType data1(DataTypes::noValues(shape)*npoints,0);
2021      DataArrayView::ValueType data2(DataArrayView::noValues(shape)*npoints,0);      DataTypes::ValueType data2(DataTypes::noValues(shape)*npoints,0);
2022    
2023      // constructor      // constructor
2024      DataArrayView dataView1(data1,shape);      DataArrayView dataView1(data1,shape);
# Line 2015  void DataArrayViewTestCase::testBinaryOp Line 2067  void DataArrayViewTestCase::testBinaryOp
2067      cout << "\tTest binaryOp on scalar DataArrayView and single value.";      cout << "\tTest binaryOp on scalar DataArrayView and single value.";
2068    
2069      // define the shape for the DataArrayView      // define the shape for the DataArrayView
2070      DataArrayView::ShapeType shape;      DataTypes::ShapeType shape;
2071    
2072      // allocate the data for the DataArrayView      // allocate the data for the DataArrayView
2073      int npoints=4;      int npoints=4;
2074      DataArrayView::ValueType data(DataArrayView::noValues(shape)*npoints,0);      DataTypes::ValueType data(DataTypes::noValues(shape)*npoints,0);
2075    
2076      // constructor      // constructor
2077      DataArrayView dataView(data,shape);      DataArrayView dataView(data,shape);
# Line 2049  void DataArrayViewTestCase::testBinaryOp Line 2101  void DataArrayViewTestCase::testBinaryOp
2101      cout << "\tTest binaryOp on shape (2,3) DataArrayView and single value.";      cout << "\tTest binaryOp on shape (2,3) DataArrayView and single value.";
2102    
2103      // define the shape for the DataArrayView      // define the shape for the DataArrayView
2104      DataArrayView::ShapeType shape;      DataTypes::ShapeType shape;
2105      shape.push_back(2);      shape.push_back(2);
2106      shape.push_back(3);      shape.push_back(3);
2107    
2108      // allocate the data for the DataArrayView      // allocate the data for the DataArrayView
2109      int npoints=4;      int npoints=4;
2110      DataArrayView::ValueType data(DataArrayView::noValues(shape)*npoints,0);      DataTypes::ValueType data(DataTypes::noValues(shape)*npoints,0);
2111    
2112      // constructor      // constructor
2113      DataArrayView dataView(data,shape);      DataArrayView dataView(data,shape);
# Line 2078  void DataArrayViewTestCase::testBinaryOp Line 2130  void DataArrayViewTestCase::testBinaryOp
2130        for (int i=0;i<shape[0];i++) {        for (int i=0;i<shape[0];i++) {
2131          for (int j=0;j<shape[1];j++) {          for (int j=0;j<shape[1];j++) {
2132            tmp=5.8*dataView.index(i,j);            tmp=5.8*dataView.index(i,j);
2133            assert(dataView(i,j)==tmp);            assert(std::abs(dataView(i,j)-tmp)<=REL_TOL*std::abs(tmp));
2134          }          }
2135        }        }
2136    
# Line 2095  void DataArrayViewTestCase::testBinaryOp Line 2147  void DataArrayViewTestCase::testBinaryOp
2147      cout << "\tTest binaryOp on shape (9,8,5,11) DataArrayView and single value.";      cout << "\tTest binaryOp on shape (9,8,5,11) DataArrayView and single value.";
2148    
2149      // define the shape for the DataArrayView      // define the shape for the DataArrayView
2150      DataArrayView::ShapeType shape;      DataTypes::ShapeType shape;
2151      shape.push_back(9);      shape.push_back(9);
2152      shape.push_back(8);      shape.push_back(8);
2153      shape.push_back(5);      shape.push_back(5);
# Line 2103  void DataArrayViewTestCase::testBinaryOp Line 2155  void DataArrayViewTestCase::testBinaryOp
2155    
2156      // allocate the data for the DataArrayView      // allocate the data for the DataArrayView
2157      int npoints=4;      int npoints=4;
2158      DataArrayView::ValueType data(DataArrayView::noValues(shape)*npoints,0);      DataTypes::ValueType data(DataTypes::noValues(shape)*npoints,0);
2159    
2160      // constructor      // constructor
2161      DataArrayView dataView(data,shape);      DataArrayView dataView(data,shape);
# Line 2132  void DataArrayViewTestCase::testBinaryOp Line 2184  void DataArrayViewTestCase::testBinaryOp
2184            for (int k=0;k<shape[2];k++) {            for (int k=0;k<shape[2];k++) {
2185              for (int l=0;l<shape[3];l++) {              for (int l=0;l<shape[3];l++) {
2186                tmp=5.4*dataView.index(i,j,k,l);                tmp=5.4*dataView.index(i,j,k,l);
2187                assert(dataView(i,j,k,l)==tmp);                assert(std::abs(dataView(i,j,k,l)-tmp)<=REL_TOL*std::abs(tmp));
2188              }              }
2189            }            }
2190          }          }
# Line 2158  void DataArrayViewTestCase::testReductio Line 2210  void DataArrayViewTestCase::testReductio
2210      cout << "\tTest reductionOp on scalar DataArrayView.";      cout << "\tTest reductionOp on scalar DataArrayView.";
2211    
2212      // define the shape for the DataArrayView      // define the shape for the DataArrayView
2213      DataArrayView::ShapeType shape;      DataTypes::ShapeType shape;
2214    
2215      // allocate the data for the DataArrayView      // allocate the data for the DataArrayView
2216      int npoints=4;      int npoints=4;
2217      DataArrayView::ValueType data(DataArrayView::noValues(shape)*npoints,0);      DataTypes::ValueType data(DataTypes::noValues(shape)*npoints,0);
2218    
2219      // constructor      // constructor
2220      DataArrayView dataView(data,shape);      DataArrayView dataView(data,shape);
# Line 2175  void DataArrayViewTestCase::testReductio Line 2227  void DataArrayViewTestCase::testReductio
2227    
2228        // apply a reduction operation to this data point and check the results        // apply a reduction operation to this data point and check the results
2229        FMax fmax_func;        FMax fmax_func;
2230        assert(dataView.reductionOp(fmax_func,numeric_limits<double>::max()*-1)==p);        assert(std::abs(dataView.reductionOp(fmax_func,numeric_limits<double>::max()*-1)-p)<=REL_TOL*p);
2231    
2232        if (p<npoints-1) {        if (p<npoints-1) {
2233          dataView.incrOffset();          dataView.incrOffset();
# Line 2190  void DataArrayViewTestCase::testReductio Line 2242  void DataArrayViewTestCase::testReductio
2242      cout << "\tTest reductionOp on shape (2,3) DataArrayView.";      cout << "\tTest reductionOp on shape (2,3) DataArrayView.";
2243    
2244      // define the shape for the DataArrayView      // define the shape for the DataArrayView
2245      DataArrayView::ShapeType shape;      DataTypes::ShapeType shape;
2246      shape.push_back(2);      shape.push_back(2);
2247      shape.push_back(3);      shape.push_back(3);
2248    
2249      // allocate the data for the DataArrayView      // allocate the data for the DataArrayView
2250      int npoints=4;      int npoints=4;
2251      DataArrayView::ValueType data(DataArrayView::noValues(shape)*npoints,0);      DataTypes::ValueType data(DataTypes::noValues(shape)*npoints,0);
2252    
2253      // constructor      // constructor
2254      DataArrayView dataView(data,shape);      DataArrayView dataView(data,shape);
# Line 2213  void DataArrayViewTestCase::testReductio Line 2265  void DataArrayViewTestCase::testReductio
2265    
2266        // apply a reduction operation to this data point and check the results        // apply a reduction operation to this data point and check the results
2267        FMin fmin_func;        FMin fmin_func;
2268        assert(dataView.reductionOp(fmin_func,numeric_limits<double>::max())==dataView.index(0,0));        assert(std::abs(dataView.reductionOp(fmin_func,numeric_limits<double>::max())-dataView.index(0,0))<=REL_TOL*std::abs(dataView.index(0,0)));
2269    
2270        if (p<npoints-1) {        if (p<npoints-1) {
2271          dataView.incrOffset();          dataView.incrOffset();
# Line 2228  void DataArrayViewTestCase::testReductio Line 2280  void DataArrayViewTestCase::testReductio
2280      cout << "\tTest reductionOp on shape (9,8,5,11) DataArrayView.";      cout << "\tTest reductionOp on shape (9,8,5,11) DataArrayView.";
2281    
2282      // define the shape for the DataArrayView      // define the shape for the DataArrayView
2283      DataArrayView::ShapeType shape;      DataTypes::ShapeType shape;
2284      shape.push_back(9);      shape.push_back(9);
2285      shape.push_back(8);      shape.push_back(8);
2286      shape.push_back(5);      shape.push_back(5);
# Line 2236  void DataArrayViewTestCase::testReductio Line 2288  void DataArrayViewTestCase::testReductio
2288    
2289      // allocate the data for the DataArrayView      // allocate the data for the DataArrayView
2290      int npoints=4;      int npoints=4;
2291      DataArrayView::ValueType data(DataArrayView::noValues(shape)*npoints,0);      DataTypes::ValueType data(DataTypes::noValues(shape)*npoints,0);
2292    
2293      // constructor      // constructor
2294      DataArrayView dataView(data,shape);      DataArrayView dataView(data,shape);

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

  ViewVC Help
Powered by ViewVC 1.1.26