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

Contents of /branches/ROBW_XPLATFORM/escript/test/DataArrayViewTestCase.cpp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 638 - (show annotations)
Thu Mar 23 13:06:01 2006 UTC (13 years, 7 months ago) by robwdcock
File size: 63617 byte(s)
+Unit tests unified into escript_UnitTest
+SConscript support for build_tests and run_tests

1 /*
2 *****************************************************************************
3 * *
4 * COPYRIGHT ACcESS - All Rights Reserved *
5 * *
6 * This software is the property of ACcESS. No part of this code *
7 * may be copied in any form or by any means without the expressed written *
8 * consent of ACcESS. Copying, use or modification of this software *
9 * by any unauthorised person is illegal unless that person has a software *
10 * license agreement with ACcESS. *
11 * *
12 *****************************************************************************
13 */
14 #include "escriptcpp/DataArray.h"
15 #include "escriptcpp/DataArrayView.h"
16 #include "escriptcpp/DataAlgorithm.h"
17 #include "esysUtils/EsysException.h"
18
19 #include "DataArrayViewTestCase.h"
20
21 #include <iostream>
22
23 using namespace CppUnitTest;
24 using namespace esysUtils;
25 using namespace escript;
26 using namespace std;
27
28 void DataArrayViewTestCase::setUp() {
29 //
30 // This is called before each test is run
31
32 }
33
34 void DataArrayViewTestCase::tearDown() {
35 //
36 // This is called after each test has been run
37
38 }
39
40 void DataArrayViewTestCase::testResultSliceShape() {
41
42 cout << endl;
43 cout << "\tTest getResultSliceShape method." << endl;
44
45 DataArrayView::RegionType region;
46 DataArrayView::ShapeType resultShape;
47
48 region.push_back(DataArrayView::RegionType::value_type(1,5));
49 resultShape.push_back(4);
50 assert(DataArrayView::getResultSliceShape(region)==resultShape);
51
52 region.push_back(DataArrayView::RegionType::value_type(2,5));
53 resultShape.push_back(3);
54 assert(DataArrayView::getResultSliceShape(region)==resultShape);
55
56 region.push_back(DataArrayView::RegionType::value_type(3,9));
57 resultShape.push_back(6);
58 assert(DataArrayView::getResultSliceShape(region)==resultShape);
59
60 region.push_back(DataArrayView::RegionType::value_type(1,7));
61 resultShape.push_back(6);
62 assert(DataArrayView::getResultSliceShape(region)==resultShape);
63
64 }
65
66 void DataArrayViewTestCase::testSlicing() {
67
68 {
69 cout << endl;
70 cout << "\tSlice a scalar to a scalar.";
71
72 // Define slice region.
73 DataArrayView::RegionType region;
74
75 // Define shape of views.
76 DataArrayView::ShapeType sourceShape;
77
78 // Create source and target views.
79 DataArray source(sourceShape,2.0);
80 DataArrayView sourceView=source.getView();
81
82 DataArray target;
83 DataArrayView targetView=target.getView();
84
85 // Copy source view to target view.
86 targetView.copySlice(sourceView,region);
87
88 // Check results of copy.
89 assert(sourceView==targetView);
90 }
91
92 {
93 cout << endl;
94 cout << "\tSlice a scalar from a scalar.";
95
96 // Define slice region.
97 DataArrayView::RegionType region;
98
99 // Define shape of views.
100 DataArrayView::ShapeType sourceShape;
101
102 // Create source and target views.
103 DataArray source(sourceShape,2.0);
104 DataArrayView sourceView=source.getView();
105
106 DataArray target;
107 DataArrayView targetView=target.getView();
108
109 // Copy source view to target view.
110 targetView.copySliceFrom(sourceView,region);
111
112 // Check results of copy.
113 assert(sourceView==targetView);
114 }
115
116 {
117 cout << endl;
118 cout << "\tSlice a 1 dimensional slice to a 1 dimensional array.";
119
120 // Define slice region.
121 DataArrayView::RegionType region;
122 region.push_back(DataArrayView::RegionType::value_type(2,4));
123
124 // Define shapes of views.
125 DataArrayView::ShapeType sourceShape;
126 sourceShape.push_back(6);
127 DataArrayView::ShapeType targetShape = DataArrayView::getResultSliceShape(region);
128
129 // Create source and target views.
130 DataArray source(sourceShape);
131 DataArrayView sourceView=source.getView();
132 for (int i=0;i<sourceShape[0];i++) {
133 sourceView(i)=i;
134 }
135
136 DataArray target(targetShape);
137 DataArrayView targetView=target.getView();
138
139 // Copy source view to target view.
140 targetView.copySlice(sourceView,region);
141
142 // Check results of copy.
143 for (int i=region[0].first;i<region[0].second;i++) {
144 assert(sourceView(i)==
145 targetView(i-region[0].first));
146 }
147 }
148
149 {
150 cout << endl;
151 cout << "\tSlice a 1 dimensional slice to a scalar.";
152
153 // Define slice region.
154 DataArrayView::RegionType region;
155 region.push_back(DataArrayView::RegionType::value_type(2,3));
156
157 // Define shapes of views.
158 DataArrayView::ShapeType sourceShape;
159 sourceShape.push_back(6);
160 DataArrayView::ShapeType targetShape;
161
162 // Create source and target views.
163 DataArray source(sourceShape);
164 DataArrayView sourceView=source.getView();
165 for (int i=0;i<sourceShape[0];i++) {
166 sourceView(i)=i;
167 }
168
169 DataArray target(targetShape);
170 DataArrayView targetView=target.getView();
171
172 // Copy source view to target view.
173 targetView.copySlice(sourceView,region);
174
175 // Check results of copy.
176 for (int i=region[0].first;i<region[0].second;i++) {
177 assert(sourceView(i)==
178 targetView());
179 }
180 }
181
182 {
183 cout << endl;
184 cout << "\tSlice a 1 dimensional slice from a 1 dimensional array.";
185
186 // Define slice region.
187 DataArrayView::RegionType region;
188 region.push_back(DataArrayView::RegionType::value_type(2,4));
189
190 // Define shapes of views.
191 DataArrayView::ShapeType sourceShape = DataArrayView::getResultSliceShape(region);
192 DataArrayView::ShapeType targetShape;
193 targetShape.push_back(6);
194
195 // Create source and target views.
196 DataArray source(sourceShape);
197 DataArrayView sourceView=source.getView();
198 for (int i=0;i<sourceShape[0];i++) {
199 sourceView(i)=i;
200 }
201
202 DataArray target(targetShape);
203 DataArrayView targetView=target.getView();
204
205 // Copy source view to target view.
206 targetView.copySliceFrom(sourceView,region);
207
208 // Check results of copy.
209 for (int i=region[0].first;i<region[0].second;i++) {
210 assert(sourceView(i-region[0].first)==
211 targetView(i));
212 }
213 }
214
215 {
216 cout << endl;
217 cout << "\tSlice a 1 dimensional slice from a scalar.";
218
219 // Define slice region.
220 DataArrayView::RegionType region;
221 region.push_back(DataArrayView::RegionType::value_type(2,4));
222
223 // Define shapes of views.
224 DataArrayView::ShapeType sourceShape;
225 DataArrayView::ShapeType targetShape;
226 targetShape.push_back(6);
227
228 // Create source and target views.
229 DataArray source(sourceShape);
230 DataArrayView sourceView=source.getView();
231 sourceView()=5;
232
233 DataArray target(targetShape);
234 DataArrayView targetView=target.getView();
235
236 // Copy source view to target view.
237 targetView.copySliceFrom(sourceView,region);
238
239 // Check results of copy.
240 for (int i=region[0].first;i<region[0].second;i++) {
241 assert(sourceView()==
242 targetView(i));
243 }
244 }
245
246 {
247 cout << endl;
248 cout << "\tSlice a 2 dimensional slice to a 2 dimensional array.";
249
250 // Define slice region.
251 DataArrayView::RegionType region;
252 region.push_back(DataArrayView::RegionType::value_type(2,4));
253 region.push_back(DataArrayView::RegionType::value_type(0,2));
254
255 // Define shapes of views.
256 DataArrayView::ShapeType sourceShape;
257 sourceShape.push_back(6);
258 sourceShape.push_back(3);
259 DataArrayView::ShapeType targetShape = DataArrayView::getResultSliceShape(region);
260
261 // Create source and target views.
262 DataArray source(sourceShape);
263 DataArrayView sourceView=source.getView();
264 int val=0;
265 for (int i=0;i<sourceShape[0];i++) {
266 for (int j=0;j<sourceShape[1];j++) {
267 sourceView(i,j)=val++;
268 }
269 }
270
271 DataArray target(targetShape);
272 DataArrayView targetView=target.getView();
273
274 // Copy source view to target view.
275 targetView.copySlice(sourceView,region);
276
277 // Check results of copy.
278 for (int i=region[0].first;i<region[0].second;i++) {
279 for (int j=region[1].first;j<region[1].second;j++) {
280 assert(sourceView(i,j)==
281 targetView(i-region[0].first,j-region[1].first));
282 }
283 }
284 }
285
286 {
287 cout << endl;
288 cout << "\tSlice a 2 dimensional slice to a 1 dimensional array.";
289
290 // Define slice region.
291 DataArrayView::RegionType region;
292 region.push_back(DataArrayView::RegionType::value_type(0,3));
293 region.push_back(DataArrayView::RegionType::value_type(1,2));
294
295 // Define shapes of views.
296 DataArrayView::ShapeType sourceShape;
297 sourceShape.push_back(3);
298 sourceShape.push_back(6);
299 DataArrayView::ShapeType targetShape;
300 targetShape.push_back(3);
301
302 // Create source and target views.
303 DataArray source(sourceShape);
304 DataArrayView sourceView=source.getView();
305 int val=0;
306 for (int i=0;i<sourceShape[0];i++) {
307 for (int j=0;j<sourceShape[1];j++) {
308 sourceView(i,j)=val++;
309 }
310 }
311
312 DataArray target(targetShape);
313 DataArrayView targetView=target.getView();
314
315 // Copy source view to target view.
316 targetView.copySlice(sourceView,region);
317
318 // Check results of copy.
319 for (int i=region[0].first;i<region[0].second;i++) {
320 for (int j=region[1].first;j<region[1].second;j++) {
321 assert(sourceView(i,j)==
322 targetView(i-region[0].first));
323 }
324 }
325 }
326
327 {
328 cout << endl;
329 cout << "\tSlice a 2 dimensional slice to a scalar.";
330
331 // Define slice region.
332 DataArrayView::RegionType region;
333 region.push_back(DataArrayView::RegionType::value_type(2,3));
334 region.push_back(DataArrayView::RegionType::value_type(1,2));
335
336 // Define shapes of views.
337 DataArrayView::ShapeType sourceShape;
338 sourceShape.push_back(3);
339 sourceShape.push_back(6);
340 DataArrayView::ShapeType targetShape;
341
342 // Create source and target views.
343 DataArray source(sourceShape);
344 DataArrayView sourceView=source.getView();
345 int val=0;
346 for (int i=0;i<sourceShape[0];i++) {
347 for (int j=0;j<sourceShape[1];j++) {
348 sourceView(i,j)=val++;
349 }
350 }
351
352 DataArray target(targetShape);
353 DataArrayView targetView=target.getView();
354
355 // Copy source view to target view.
356 targetView.copySlice(sourceView,region);
357 // Check results of copy.
358 for (int i=region[0].first;i<region[0].second;i++) {
359 for (int j=region[1].first;j<region[1].second;j++) {
360 assert(sourceView(i,j)==
361 targetView());
362 }
363 }
364 }
365
366 {
367 cout << endl;
368 cout << "\tSlice a 2 dimensional slice from a 2 dimensional array.";
369
370 // Define slice region.
371 DataArrayView::RegionType region;
372 region.push_back(DataArrayView::RegionType::value_type(2,4));
373 region.push_back(DataArrayView::RegionType::value_type(0,2));
374
375 // Define shapes of views.
376 DataArrayView::ShapeType sourceShape = DataArrayView::getResultSliceShape(region);
377 DataArrayView::ShapeType targetShape;
378 targetShape.push_back(6);
379 targetShape.push_back(3);
380
381 // Create source and target views.
382 DataArray source(sourceShape);
383 DataArrayView sourceView=source.getView();
384 int val=0;
385 for (int i=0;i<sourceShape[0];i++) {
386 for (int j=0;j<sourceShape[1];j++) {
387 sourceView(i,j)=val++;
388 }
389 }
390
391 DataArray target(targetShape);
392 DataArrayView targetView=target.getView();
393
394 // Copy source view to target view.
395 targetView.copySliceFrom(sourceView,region);
396
397 // Check results of copy.
398 for (int i=region[0].first;i<region[0].second;i++) {
399 for (int j=region[1].first;j<region[1].second;j++) {
400 assert(sourceView(i-region[0].first,j-region[1].first)==
401 targetView(i,j));
402 }
403 }
404 }
405
406 {
407 cout << endl;
408 cout << "\tSlice a 2 dimensional slice from a scalar.";
409
410 // Define slice region.
411 DataArrayView::RegionType region;
412 region.push_back(DataArrayView::RegionType::value_type(2,4));
413 region.push_back(DataArrayView::RegionType::value_type(0,2));
414
415 // Define shapes of views.
416 DataArrayView::ShapeType sourceShape;
417 DataArrayView::ShapeType targetShape;
418 targetShape.push_back(6);
419 targetShape.push_back(3);
420
421 // Create source and target views.
422 DataArray source(sourceShape);
423 DataArrayView sourceView=source.getView();
424 sourceView()=5;
425
426 DataArray target(targetShape);
427 DataArrayView targetView=target.getView();
428
429 // Copy source view to target view.
430 targetView.copySliceFrom(sourceView,region);
431
432 // Check results of copy.
433 for (int i=region[0].first;i<region[0].second;i++) {
434 for (int j=region[1].first;j<region[1].second;j++) {
435 assert(sourceView()==
436 targetView(i,j));
437 }
438 }
439 }
440
441 {
442 cout << endl;
443 cout << "\tSlice a 3 dimensional slice to a 3 dimensional array.";
444
445 // Define slice region.
446 DataArrayView::RegionType region;
447 region.push_back(DataArrayView::RegionType::value_type(2,4));
448 region.push_back(DataArrayView::RegionType::value_type(0,2));
449 region.push_back(DataArrayView::RegionType::value_type(5,9));
450
451 // Define shapes of views.
452 DataArrayView::ShapeType sourceShape;
453 sourceShape.push_back(6);
454 sourceShape.push_back(3);
455 sourceShape.push_back(13);
456 DataArrayView::ShapeType targetShape = DataArrayView::getResultSliceShape(region);
457
458 // Create source and target views.
459 DataArray source(sourceShape);
460 DataArrayView sourceView=source.getView();
461 int val=0;
462 for (int i=0;i<sourceShape[0];i++) {
463 for (int j=0;j<sourceShape[1];j++) {
464 for (int k=0;k<sourceShape[2];k++) {
465 sourceView(i,j,k)=val++;
466 }
467 }
468 }
469
470 DataArray target(targetShape);
471 DataArrayView targetView=target.getView();
472
473 // Copy source view to target view.
474 targetView.copySlice(sourceView,region);
475
476 // Check results of copy.
477 for (int i=region[0].first;i<region[0].second;i++) {
478 for (int j=region[1].first;j<region[1].second;j++) {
479 for (int k=region[2].first;k<region[2].second;k++) {
480 assert(sourceView(i,j,k)==
481 targetView(i-region[0].first,j-region[1].first,k-region[2].first));
482 }
483 }
484 }
485 }
486
487 {
488 cout << endl;
489 cout << "\tSlice a 3 dimensional slice to a 2 dimensional array.";
490
491 // Define slice region.
492 DataArrayView::RegionType region;
493 region.push_back(DataArrayView::RegionType::value_type(2,4));
494 region.push_back(DataArrayView::RegionType::value_type(0,1));
495 region.push_back(DataArrayView::RegionType::value_type(5,9));
496
497 // Define shapes of views.
498 DataArrayView::ShapeType sourceShape;
499 sourceShape.push_back(6);
500 sourceShape.push_back(3);
501 sourceShape.push_back(13);
502 DataArrayView::ShapeType targetShape;
503 targetShape.push_back(2);
504 targetShape.push_back(4);
505
506 // Create source and target views.
507 DataArray source(sourceShape);
508 DataArrayView sourceView=source.getView();
509 int val=0;
510 for (int i=0;i<sourceShape[0];i++) {
511 for (int j=0;j<sourceShape[1];j++) {
512 for (int k=0;k<sourceShape[2];k++) {
513 sourceView(i,j,k)=val++;
514 }
515 }
516 }
517
518 DataArray target(targetShape);
519 DataArrayView targetView=target.getView();
520
521 // Copy source view to target view.
522 targetView.copySlice(sourceView,region);
523
524 // Check results of copy.
525 for (int i=region[0].first;i<region[0].second;i++) {
526 for (int j=region[1].first;j<region[1].second;j++) {
527 for (int k=region[2].first;k<region[2].second;k++) {
528 assert(sourceView(i,j,k)==
529 targetView(i-region[0].first,k-region[2].first));
530 }
531 }
532 }
533 }
534
535 {
536 cout << endl;
537 cout << "\tSlice a 3 dimensional slice to a 1 dimensional array.";
538
539 // Define slice region.
540 DataArrayView::RegionType region;
541 region.push_back(DataArrayView::RegionType::value_type(3,4));
542 region.push_back(DataArrayView::RegionType::value_type(0,1));
543 region.push_back(DataArrayView::RegionType::value_type(5,9));
544
545 // Define shapes of views.
546 DataArrayView::ShapeType sourceShape;
547 sourceShape.push_back(6);
548 sourceShape.push_back(3);
549 sourceShape.push_back(13);
550 DataArrayView::ShapeType targetShape;
551 targetShape.push_back(4);
552
553 // Create source and target views.
554 DataArray source(sourceShape);
555 DataArrayView sourceView=source.getView();
556 int val=0;
557 for (int i=0;i<sourceShape[0];i++) {
558 for (int j=0;j<sourceShape[1];j++) {
559 for (int k=0;k<sourceShape[2];k++) {
560 sourceView(i,j,k)=val++;
561 }
562 }
563 }
564
565 DataArray target(targetShape);
566 DataArrayView targetView=target.getView();
567
568 // Copy source view to target view.
569 targetView.copySlice(sourceView,region);
570
571 // Check results of copy.
572 for (int i=region[0].first;i<region[0].second;i++) {
573 for (int j=region[1].first;j<region[1].second;j++) {
574 for (int k=region[2].first;k<region[2].second;k++) {
575 assert(sourceView(i,j,k)==
576 targetView(k-region[2].first));
577 }
578 }
579 }
580 }
581
582 {
583 cout << endl;
584 cout << "\tSlice a 3 dimensional slice to a scalar.";
585
586 // Define slice region.
587 DataArrayView::RegionType region;
588 region.push_back(DataArrayView::RegionType::value_type(3,4));
589 region.push_back(DataArrayView::RegionType::value_type(0,1));
590 region.push_back(DataArrayView::RegionType::value_type(5,6));
591
592 // Define shapes of views.
593 DataArrayView::ShapeType sourceShape;
594 sourceShape.push_back(6);
595 sourceShape.push_back(3);
596 sourceShape.push_back(13);
597 DataArrayView::ShapeType targetShape;
598
599 // Create source and target views.
600 DataArray source(sourceShape);
601 DataArrayView sourceView=source.getView();
602 int val=0;
603 for (int i=0;i<sourceShape[0];i++) {
604 for (int j=0;j<sourceShape[1];j++) {
605 for (int k=0;k<sourceShape[2];k++) {
606 sourceView(i,j,k)=val++;
607 }
608 }
609 }
610
611 DataArray target(targetShape);
612 DataArrayView targetView=target.getView();
613
614 // Copy source view to target view.
615 targetView.copySlice(sourceView,region);
616
617 // Check results of copy.
618 for (int i=region[0].first;i<region[0].second;i++) {
619 for (int j=region[1].first;j<region[1].second;j++) {
620 for (int k=region[2].first;k<region[2].second;k++) {
621 assert(sourceView(i,j,k)==
622 targetView());
623 }
624 }
625 }
626 }
627
628 {
629 cout << endl;
630 cout << "\tSlice a 3 dimensional slice from a 3 dimensional array.";
631
632 // Define slice region.
633 DataArrayView::RegionType region;
634 region.push_back(DataArrayView::RegionType::value_type(4,7));
635 region.push_back(DataArrayView::RegionType::value_type(2,5));
636 region.push_back(DataArrayView::RegionType::value_type(6,7));
637
638 // Define shapes of views.
639 DataArrayView::ShapeType sourceShape = DataArrayView::getResultSliceShape(region);
640 DataArrayView::ShapeType targetShape;
641 targetShape.push_back(11);
642 targetShape.push_back(8);
643 targetShape.push_back(9);
644
645 // Create source and target views.
646 DataArray source(sourceShape);
647 DataArrayView sourceView=source.getView();
648 int val=0;
649 for (int i=0;i<sourceShape[0];i++) {
650 for (int j=0;j<sourceShape[1];j++) {
651 for (int k=0;k<sourceShape[2];k++) {
652 sourceView(i,j,k)=val++;
653 }
654 }
655 }
656
657 DataArray target(targetShape);
658 DataArrayView targetView=target.getView();
659
660 // Copy source view to target view.
661 targetView.copySliceFrom(sourceView,region);
662
663 // Check results of copy.
664 for (int i=region[0].first;i<region[0].second;i++) {
665 for (int j=region[1].first;j<region[1].second;j++) {
666 for (int k=region[2].first;k<region[2].second;k++) {
667 assert(sourceView(i-region[0].first,j-region[1].first,k-region[2].first)==
668 targetView(i,j,k));
669 }
670 }
671 }
672 }
673
674 {
675 cout << endl;
676 cout << "\tSlice a 3 dimensional slice from a scalar.";
677
678 // Define slice region.
679 DataArrayView::RegionType region;
680 region.push_back(DataArrayView::RegionType::value_type(4,7));
681 region.push_back(DataArrayView::RegionType::value_type(2,5));
682 region.push_back(DataArrayView::RegionType::value_type(6,7));
683
684 // Define shapes of views.
685 DataArrayView::ShapeType sourceShape;
686 DataArrayView::ShapeType targetShape;
687 targetShape.push_back(11);
688 targetShape.push_back(8);
689 targetShape.push_back(9);
690
691 // Create source and target views.
692 DataArray source(sourceShape);
693 DataArrayView sourceView=source.getView();
694 sourceView()=5;
695
696 DataArray target(targetShape);
697 DataArrayView targetView=target.getView();
698
699 // Copy source view to target view.
700 targetView.copySliceFrom(sourceView,region);
701
702 // Check results of copy.
703 for (int i=region[0].first;i<region[0].second;i++) {
704 for (int j=region[1].first;j<region[1].second;j++) {
705 for (int k=region[2].first;k<region[2].second;k++) {
706 assert(sourceView()==
707 targetView(i,j,k));
708 }
709 }
710 }
711 }
712
713 {
714 cout << endl;
715 cout << "\tSlice a 4 dimensional slice to a 4 dimensional array.";
716
717 // Define slice region.
718 DataArrayView::RegionType region;
719 region.push_back(DataArrayView::RegionType::value_type(2,4));
720 region.push_back(DataArrayView::RegionType::value_type(0,2));
721 region.push_back(DataArrayView::RegionType::value_type(5,9));
722 region.push_back(DataArrayView::RegionType::value_type(3,5));
723
724 // Define shapes of views.
725 DataArrayView::ShapeType sourceShape;
726 sourceShape.push_back(6);
727 sourceShape.push_back(3);
728 sourceShape.push_back(13);
729 sourceShape.push_back(9);
730 DataArrayView::ShapeType targetShape = DataArrayView::getResultSliceShape(region);
731
732 // Create source and target views.
733 DataArray source(sourceShape);
734 DataArrayView sourceView=source.getView();
735 int val=0;
736 for (int i=0;i<sourceShape[0];i++) {
737 for (int j=0;j<sourceShape[1];j++) {
738 for (int k=0;k<sourceShape[2];k++) {
739 for (int l=0;l<sourceShape[3];l++) {
740 sourceView(i,j,k,l)=val++;
741 }
742 }
743 }
744 }
745
746 DataArray target(targetShape);
747 DataArrayView targetView=target.getView();
748
749 // Copy source view to target view.
750 targetView.copySlice(sourceView,region);
751
752 // Check results of copy.
753 for (int i=region[0].first;i<region[0].second;i++) {
754 for (int j=region[1].first;j<region[1].second;j++) {
755 for (int k=region[2].first;k<region[2].second;k++) {
756 for (int l=region[3].first;l<region[3].second;l++) {
757 assert(sourceView(i,j,k,l)==
758 targetView(i-region[0].first,j-region[1].first,k-region[2].first,l-region[3].first));
759 }
760 }
761 }
762 }
763 }
764
765 {
766 cout << endl;
767 cout << "\tSlice a 4 dimensional slice to a 3 dimensional array.";
768
769 // Define slice region.
770 DataArrayView::RegionType region;
771 region.push_back(DataArrayView::RegionType::value_type(2,4));
772 region.push_back(DataArrayView::RegionType::value_type(0,2));
773 region.push_back(DataArrayView::RegionType::value_type(5,6));
774 region.push_back(DataArrayView::RegionType::value_type(3,5));
775
776 // Define shapes of views.
777 DataArrayView::ShapeType sourceShape;
778 sourceShape.push_back(6);
779 sourceShape.push_back(3);
780 sourceShape.push_back(13);
781 sourceShape.push_back(9);
782 DataArrayView::ShapeType targetShape;
783 targetShape.push_back(2);
784 targetShape.push_back(2);
785 targetShape.push_back(2);
786
787 // Create source and target views.
788 DataArray source(sourceShape);
789 DataArrayView sourceView=source.getView();
790 int val=0;
791 for (int i=0;i<sourceShape[0];i++) {
792 for (int j=0;j<sourceShape[1];j++) {
793 for (int k=0;k<sourceShape[2];k++) {
794 for (int l=0;l<sourceShape[3];l++) {
795 sourceView(i,j,k,l)=val++;
796 }
797 }
798 }
799 }
800
801 DataArray target(targetShape);
802 DataArrayView targetView=target.getView();
803
804 // Copy source view to target view.
805 targetView.copySlice(sourceView,region);
806
807 // Check results of copy.
808 for (int i=region[0].first;i<region[0].second;i++) {
809 for (int j=region[1].first;j<region[1].second;j++) {
810 for (int k=region[2].first;k<region[2].second;k++) {
811 for (int l=region[3].first;l<region[3].second;l++) {
812 assert(sourceView(i,j,k,l)==
813 targetView(i-region[0].first,j-region[1].first,l-region[3].first));
814 }
815 }
816 }
817 }
818 }
819
820 {
821 cout << endl;
822 cout << "\tSlice a 4 dimensional slice to a 2 dimensional array.";
823
824 // Define slice region.
825 DataArrayView::RegionType region;
826 region.push_back(DataArrayView::RegionType::value_type(2,4));
827 region.push_back(DataArrayView::RegionType::value_type(0,2));
828 region.push_back(DataArrayView::RegionType::value_type(5,6));
829 region.push_back(DataArrayView::RegionType::value_type(4,5));
830
831 // Define shapes of views.
832 DataArrayView::ShapeType sourceShape;
833 sourceShape.push_back(6);
834 sourceShape.push_back(3);
835 sourceShape.push_back(13);
836 sourceShape.push_back(9);
837 DataArrayView::ShapeType targetShape;
838 targetShape.push_back(2);
839 targetShape.push_back(2);
840
841 // Create source and target views.
842 DataArray source(sourceShape);
843 DataArrayView sourceView=source.getView();
844 int val=0;
845 for (int i=0;i<sourceShape[0];i++) {
846 for (int j=0;j<sourceShape[1];j++) {
847 for (int k=0;k<sourceShape[2];k++) {
848 for (int l=0;l<sourceShape[3];l++) {
849 sourceView(i,j,k,l)=val++;
850 }
851 }
852 }
853 }
854
855 DataArray target(targetShape);
856 DataArrayView targetView=target.getView();
857
858 // Copy source view to target view.
859 targetView.copySlice(sourceView,region);
860
861 // Check results of copy.
862 for (int i=region[0].first;i<region[0].second;i++) {
863 for (int j=region[1].first;j<region[1].second;j++) {
864 for (int k=region[2].first;k<region[2].second;k++) {
865 for (int l=region[3].first;l<region[3].second;l++) {
866 assert(sourceView(i,j,k,l)==
867 targetView(i-region[0].first,j-region[1].first));
868 }
869 }
870 }
871 }
872 }
873
874 {
875 cout << endl;
876 cout << "\tSlice a 4 dimensional slice to a 1 dimensional array.";
877
878 // Define slice region.
879 DataArrayView::RegionType region;
880 region.push_back(DataArrayView::RegionType::value_type(3,4));
881 region.push_back(DataArrayView::RegionType::value_type(0,2));
882 region.push_back(DataArrayView::RegionType::value_type(5,6));
883 region.push_back(DataArrayView::RegionType::value_type(4,5));
884
885 // Define shapes of views.
886 DataArrayView::ShapeType sourceShape;
887 sourceShape.push_back(6);
888 sourceShape.push_back(3);
889 sourceShape.push_back(13);
890 sourceShape.push_back(9);
891 DataArrayView::ShapeType targetShape;
892 targetShape.push_back(2);
893
894 // Create source and target views.
895 DataArray source(sourceShape);
896 DataArrayView sourceView=source.getView();
897 int val=0;
898 for (int i=0;i<sourceShape[0];i++) {
899 for (int j=0;j<sourceShape[1];j++) {
900 for (int k=0;k<sourceShape[2];k++) {
901 for (int l=0;l<sourceShape[3];l++) {
902 sourceView(i,j,k,l)=val++;
903 }
904 }
905 }
906 }
907
908 DataArray target(targetShape);
909 DataArrayView targetView=target.getView();
910
911 // Copy source view to target view.
912 targetView.copySlice(sourceView,region);
913
914 // Check results of copy.
915 for (int i=region[0].first;i<region[0].second;i++) {
916 for (int j=region[1].first;j<region[1].second;j++) {
917 for (int k=region[2].first;k<region[2].second;k++) {
918 for (int l=region[3].first;l<region[3].second;l++) {
919 assert(sourceView(i,j,k,l)==
920 targetView(j-region[1].first));
921 }
922 }
923 }
924 }
925 }
926
927 {
928 cout << endl;
929 cout << "\tSlice a 4 dimensional slice to a scalar.";
930
931 // Define slice region.
932 DataArrayView::RegionType region;
933 region.push_back(DataArrayView::RegionType::value_type(3,4));
934 region.push_back(DataArrayView::RegionType::value_type(1,2));
935 region.push_back(DataArrayView::RegionType::value_type(5,6));
936 region.push_back(DataArrayView::RegionType::value_type(4,5));
937
938 // Define shapes of views.
939 DataArrayView::ShapeType sourceShape;
940 sourceShape.push_back(6);
941 sourceShape.push_back(3);
942 sourceShape.push_back(13);
943 sourceShape.push_back(9);
944 DataArrayView::ShapeType targetShape;
945
946 // Create source and target views.
947 DataArray source(sourceShape);
948 DataArrayView sourceView=source.getView();
949 int val=0;
950 for (int i=0;i<sourceShape[0];i++) {
951 for (int j=0;j<sourceShape[1];j++) {
952 for (int k=0;k<sourceShape[2];k++) {
953 for (int l=0;l<sourceShape[3];l++) {
954 sourceView(i,j,k,l)=val++;
955 }
956 }
957 }
958 }
959
960 DataArray target(targetShape);
961 DataArrayView targetView=target.getView();
962
963 // Copy source view to target view.
964 targetView.copySlice(sourceView,region);
965
966 // Check results of copy.
967 for (int i=region[0].first;i<region[0].second;i++) {
968 for (int j=region[1].first;j<region[1].second;j++) {
969 for (int k=region[2].first;k<region[2].second;k++) {
970 for (int l=region[3].first;l<region[3].second;l++) {
971 assert(sourceView(i,j,k,l)==
972 targetView());
973 }
974 }
975 }
976 }
977 }
978
979 {
980 cout << endl;
981 cout << "\tSlice a 4 dimensional slice from a 4 dimensional array.";
982
983 // Define slice region.
984 DataArrayView::RegionType region;
985 region.push_back(DataArrayView::RegionType::value_type(14,37));
986 region.push_back(DataArrayView::RegionType::value_type(22,57));
987 region.push_back(DataArrayView::RegionType::value_type(63,71));
988 region.push_back(DataArrayView::RegionType::value_type(23,51));
989
990 // Define shapes of views.
991 DataArrayView::ShapeType sourceShape = DataArrayView::getResultSliceShape(region);
992 DataArrayView::ShapeType targetShape;
993 targetShape.push_back(50);
994 targetShape.push_back(65);
995 targetShape.push_back(80);
996 targetShape.push_back(90);
997
998 // Create source and target views.
999 DataArray source(sourceShape);
1000 DataArrayView sourceView=source.getView();
1001 int val=0;
1002 for (int i=0;i<sourceShape[0];i++) {
1003 for (int j=0;j<sourceShape[1];j++) {
1004 for (int k=0;k<sourceShape[2];k++) {
1005 for (int l=0;l<sourceShape[3];l++) {
1006 sourceView(i,j,k,l)=val++;
1007 }
1008 }
1009 }
1010 }
1011
1012 DataArray target(targetShape);
1013 DataArrayView targetView=target.getView();
1014
1015 // Copy source view to target view.
1016 targetView.copySliceFrom(sourceView,region);
1017
1018 // Check results of copy.
1019 for (int i=region[0].first;i<region[0].second;i++) {
1020 for (int j=region[1].first;j<region[1].second;j++) {
1021 for (int k=region[2].first;k<region[2].second;k++) {
1022 for (int l=region[3].first;l<region[3].second;l++) {
1023 assert(sourceView(i-region[0].first,j-region[1].first,k-region[2].first,l-region[3].first)==
1024 targetView(i,j,k,l));
1025 }
1026 }
1027 }
1028 }
1029 }
1030
1031 {
1032 cout << endl;
1033 cout << "\tSlice a 4 dimensional slice from a scalar.";
1034
1035 // Define slice region.
1036 DataArrayView::RegionType region;
1037 region.push_back(DataArrayView::RegionType::value_type(14,37));
1038 region.push_back(DataArrayView::RegionType::value_type(22,57));
1039 region.push_back(DataArrayView::RegionType::value_type(63,71));
1040 region.push_back(DataArrayView::RegionType::value_type(23,51));
1041
1042 // Define shapes of views.
1043 DataArrayView::ShapeType sourceShape;
1044 DataArrayView::ShapeType targetShape;
1045 targetShape.push_back(50);
1046 targetShape.push_back(65);
1047 targetShape.push_back(80);
1048 targetShape.push_back(90);
1049
1050 // Create source and target views.
1051 DataArray source(sourceShape);
1052 DataArrayView sourceView=source.getView();
1053 sourceView()=5;
1054
1055 DataArray target(targetShape);
1056 DataArrayView targetView=target.getView();
1057
1058 // Copy source view to target view.
1059 targetView.copySliceFrom(sourceView,region);
1060
1061 // Check results of copy.
1062 for (int i=region[0].first;i<region[0].second;i++) {
1063 for (int j=region[1].first;j<region[1].second;j++) {
1064 for (int k=region[2].first;k<region[2].second;k++) {
1065 for (int l=region[3].first;l<region[3].second;l++) {
1066 assert(sourceView()==
1067 targetView(i,j,k,l));
1068 }
1069 }
1070 }
1071 }
1072 }
1073
1074 cout << endl;
1075
1076 }
1077
1078 void DataArrayViewTestCase::testShapeToString() {
1079
1080 cout << endl;
1081 cout << "\tTest shapeToString for a variety of shapes." << endl;
1082
1083 DataArrayView::ShapeType shape;
1084 assert(DataArrayView::shapeToString(shape)=="()");
1085 shape.push_back(5);
1086 assert(DataArrayView::shapeToString(shape)=="(5)");
1087 shape.push_back(2);
1088 assert(DataArrayView::shapeToString(shape)=="(5,2)");
1089 shape.push_back(9);
1090 assert(DataArrayView::shapeToString(shape)=="(5,2,9)");
1091 shape.push_back(4);
1092 assert(DataArrayView::shapeToString(shape)=="(5,2,9,4)");
1093
1094 }
1095
1096 void DataArrayViewTestCase::testScalarView() {
1097
1098 cout << endl;
1099 cout << "\tTest functionality of scalar views." << endl;
1100
1101 // Create a vector containing enough data for three scalars
1102 // and check three scalar views return the appropriate data
1103 DataArrayView::ShapeType vShape;
1104 DataArrayView::ValueType vData(3);
1105 vData[0]=0;
1106 vData[1]=1;
1107 vData[2]=2;
1108
1109 // create the three scalar views
1110 DataArrayView zView(vData,vShape,0);
1111 DataArrayView oView(vData,vShape,1);
1112 DataArrayView tView(vData,vShape,2);
1113
1114 // check attributes of the three scalar views
1115 assert(zView()==0);
1116 assert(oView()==1);
1117 assert(tView()==2);
1118 assert(zView.noValues()==1);
1119 assert(oView.noValues()==1);
1120 assert(tView.noValues()==1);
1121 assert(zView.getRank()==0);
1122 assert(oView.getRank()==0);
1123 assert(tView.getRank()==0);
1124
1125 // copy the one view to the zero view
1126 zView.copy(oView);
1127 assert(zView==oView);
1128 zView.checkShape(oView.getShape());
1129
1130 // create a single vector view of all the data
1131 vShape.push_back(3);
1132 DataArrayView oneVView(vData,vShape,0);
1133
1134 // test shape mismatch functions
1135 if (!zView.checkShape(oneVView.getShape())) {
1136 assert(true);
1137 } else {
1138 assert(false);
1139 }
1140
1141 // test some unary ops
1142 zView.unaryOp(negate<double>());
1143 assert(zView()==-1);
1144 zView.binaryOp(oView,plus<double>());
1145 assert(zView()==0);
1146
1147 // test operator !=
1148 assert(zView!=oView);
1149
1150 }
1151
1152 void DataArrayViewTestCase::testAll()
1153 {
1154
1155 {
1156 cout << endl;
1157 cout << "\tTest empty DataArrayView.";
1158
1159 // default constructor
1160 DataArrayView defView;
1161
1162 // check all attributes
1163 assert(defView.isEmpty());
1164 assert(defView.getOffset()==0);
1165 assert(defView.getRank()==0);
1166 assert(defView.noValues()==0);
1167 assert(defView.getShape().empty());
1168 assert(defView.checkShape(DataArrayView::ShapeType()));
1169 }
1170
1171 {
1172 cout << endl;
1173 cout << "\tTest DataArrayView - shape (5).";
1174
1175 // define the shape for the DataArrayView
1176 DataArrayView::ShapeType shape;
1177 shape.push_back(5);
1178
1179 // allocate the data for the DataArrayView
1180 DataArrayView::ValueType data(DataArrayView::noValues(shape),0);
1181
1182 // constructor
1183 int offset=0;
1184 DataArrayView dataView(data,shape,offset);
1185
1186 // check all attributes
1187 assert(!dataView.isEmpty());
1188 assert(dataView.getOffset()==0);
1189 assert(dataView.getRank()==1);
1190 assert(dataView.noValues()==5);
1191 assert(dataView.getShape()==shape);
1192 assert(dataView.checkShape(shape));
1193
1194 // assign values to the data
1195 for (int i=0;i<shape[0];i++) {
1196 dataView(i)=dataView.index(i);
1197 assert(dataView(i)==i);
1198 }
1199
1200 }
1201
1202 {
1203 cout << endl;
1204 cout << "\tTest DataArrayView - shape (2,3).";
1205
1206 // define the shape for the DataArrayView
1207 DataArrayView::ShapeType shape;
1208 shape.push_back(2);
1209 shape.push_back(3);
1210
1211 // allocate the data for the DataArrayView
1212 int npoints=4;
1213 DataArrayView::ValueType data(DataArrayView::noValues(shape)*npoints,0);
1214
1215 // constructor
1216 DataArrayView dataView(data,shape);
1217
1218 // check all attributes
1219 assert(!dataView.isEmpty());
1220 assert(dataView.getOffset()==0);
1221 assert(dataView.getRank()==2);
1222 assert(dataView.noValues()==6);
1223 assert(dataView.getShape()==shape);
1224 assert(dataView.checkShape(shape));
1225
1226 // step the view along each block of this shape in the underlying data
1227 for (int p=0;p<npoints;p++) {
1228
1229 assert(dataView.getOffset()==p*dataView.noValues());
1230
1231 // assign values to the data
1232 for (int i=0;i<shape[0];i++) {
1233 for (int j=0;j<shape[1];j++) {
1234 dataView(i,j)=dataView.index(i,j);
1235 assert(dataView(i,j)==dataView.index(i,j));
1236 }
1237 }
1238
1239 if (p<npoints-1) {
1240 dataView.incrOffset();
1241 }
1242
1243 }
1244
1245 }
1246
1247 {
1248 cout << endl;
1249 cout << "\tTest DataArrayView - shape (4,7,9).";
1250
1251 // define the shape for the DataArrayView
1252 DataArrayView::ShapeType shape;
1253 shape.push_back(4);
1254 shape.push_back(7);
1255 shape.push_back(9);
1256
1257 // allocate the data for the DataArrayView
1258 int npoints=10;
1259 DataArrayView::ValueType data(DataArrayView::noValues(shape)*npoints,0);
1260
1261 // constructor
1262 DataArrayView dataView(data,shape);
1263
1264 // check all attributes
1265 assert(!dataView.isEmpty());
1266 assert(dataView.getOffset()==0);
1267 assert(dataView.getRank()==3);
1268 assert(dataView.noValues()==252);
1269 assert(dataView.getShape()==shape);
1270 assert(dataView.checkShape(shape));
1271
1272 // step the view along each block of this shape in the underlying data
1273 for (int p=0;p<npoints;p++) {
1274
1275 assert(dataView.getOffset()==p*dataView.noValues());
1276
1277 // assign values to the data
1278 for (int i=0;i<shape[0];i++) {
1279 for (int j=0;j<shape[1];j++) {
1280 for (int k=0;k<shape[2];k++) {
1281 dataView(i,j,k)=dataView.index(i,j,k);
1282 assert(dataView(i,j,k)==dataView.index(i,j,k));
1283 }
1284 }
1285 }
1286
1287 if (p<npoints-1) {
1288 dataView.incrOffset();
1289 }
1290
1291 }
1292
1293 }
1294
1295 {
1296 cout << endl;
1297 cout << "\tTest DataArrayView - shape (12,4,5,14).";
1298
1299 // define the shape for the DataArrayView
1300 DataArrayView::ShapeType shape;
1301 shape.push_back(12);
1302 shape.push_back(4);
1303 shape.push_back(5);
1304 shape.push_back(14);
1305
1306 // allocate the data for the DataArrayView
1307 int npoints=100;
1308 DataArrayView::ValueType data(DataArrayView::noValues(shape)*npoints,0);
1309
1310 // constructor
1311 DataArrayView dataView(data,shape);
1312
1313 // check all attributes
1314 assert(!dataView.isEmpty());
1315 assert(dataView.getOffset()==0);
1316 assert(dataView.getRank()==4);
1317 assert(dataView.noValues()==3360);
1318 assert(dataView.getShape()==shape);
1319 assert(dataView.checkShape(shape));
1320
1321 // step the view along each block of this shape in the underlying data
1322 for (int p=0;p<npoints;p++) {
1323
1324 assert(dataView.getOffset()==p*dataView.noValues());
1325
1326 // assign values to the data
1327 for (int i=0;i<shape[0];i++) {
1328 for (int j=0;j<shape[1];j++) {
1329 for (int k=0;k<shape[2];k++) {
1330 for (int l=0;l<shape[3];l++) {
1331 dataView(i,j,k,l)=dataView.index(i,j,k,l);
1332 assert(dataView(i,j,k,l)==dataView.index(i,j,k,l));
1333 }
1334 }
1335 }
1336 }
1337
1338 if (p<npoints-1) {
1339 dataView.incrOffset();
1340 }
1341
1342 }
1343
1344 }
1345
1346 {
1347 cout << endl;
1348 cout << "\tTest DataArrayView copy constructor - shape (5).";
1349
1350 // define the shape for the DataArrayView
1351 DataArrayView::ShapeType shape;
1352 shape.push_back(5);
1353
1354 // allocate the data for the DataArrayView
1355 DataArrayView::ValueType data(DataArrayView::noValues(shape),0);
1356
1357 // constructor
1358 DataArrayView dataView(data,shape);
1359
1360 // copy constructor
1361 DataArrayView dataViewCopy(dataView);
1362
1363 // check all attributes
1364 assert(!dataViewCopy.isEmpty());
1365 assert(dataViewCopy.getOffset()==0);
1366 assert(dataViewCopy.getRank()==1);
1367 assert(dataViewCopy.noValues()==5);
1368 assert(dataViewCopy.getShape()==shape);
1369 assert(dataViewCopy.checkShape(shape));
1370
1371 // check data
1372 assert(dataView.getData()==dataViewCopy.getData());
1373 for (int i=0;i<dataView.getData().size();i++) {
1374 assert(dataView.getData(i)==dataViewCopy.getData(i));
1375 }
1376
1377 }
1378
1379 {
1380 cout << endl;
1381 cout << "\tTest DataArrayView copy constructor - shape (5,6,7).";
1382
1383 // define the shape for the DataArrayView
1384 DataArrayView::ShapeType shape;
1385 shape.push_back(5);
1386 shape.push_back(6);
1387 shape.push_back(7);
1388
1389 // allocate the data for the DataArrayView
1390 DataArrayView::ValueType data(DataArrayView::noValues(shape),0);
1391
1392 // constructor
1393 DataArrayView dataView(data,shape);
1394
1395 // copy constructor
1396 DataArrayView dataViewCopy(dataView);
1397
1398 // check all attributes
1399 assert(!dataViewCopy.isEmpty());
1400 assert(dataViewCopy.getOffset()==0);
1401 assert(dataViewCopy.getRank()==3);
1402 assert(dataViewCopy.noValues()==210);
1403 assert(dataViewCopy.getShape()==shape);
1404 assert(dataViewCopy.checkShape(shape));
1405
1406 // check data
1407 assert(dataView.getData()==dataViewCopy.getData());
1408 for (int i=0;i<dataView.getData().size();i++) {
1409 assert(dataView.getData(i)==dataViewCopy.getData(i));
1410 }
1411
1412 }
1413
1414 {
1415 cout << endl;
1416 cout << "\tTest DataArrayView copy method - shape (2,3).";
1417
1418 // define the shape for the DataArrayViews
1419 DataArrayView::ShapeType shape;
1420 shape.push_back(2);
1421 shape.push_back(3);
1422
1423 // allocate the data for the DataArrayViews
1424 int npoints=4;
1425 DataArrayView::ValueType data1(DataArrayView::noValues(shape)*npoints,0);
1426 DataArrayView::ValueType data2(DataArrayView::noValues(shape)*npoints,0);
1427
1428 // construct two views
1429 DataArrayView dataView1(data1,shape);
1430 DataArrayView dataView2(data2,shape);
1431
1432 // step the views along each block of this shape in the underlying data arrays
1433 for (int p=0;p<npoints;p++) {
1434
1435 // assign values to the data underlying the first view
1436 for (int i=0;i<shape[0];i++) {
1437 for (int j=0;j<shape[1];j++) {
1438 dataView1(i,j)=dataView1.index(i,j);
1439 }
1440 }
1441
1442 // copy data from the first view to the second
1443 dataView2.copy(dataView1);
1444
1445 // check the data underlying the second view
1446 for (int i=0;i<shape[0];i++) {
1447 for (int j=0;j<shape[1];j++) {
1448 assert(dataView2(i,j)==dataView1.index(i,j));
1449 }
1450 }
1451
1452 if (p<npoints-1) {
1453 dataView1.incrOffset();
1454 dataView2.incrOffset();
1455 }
1456
1457 }
1458
1459 }
1460
1461 {
1462 cout << endl;
1463 cout << "\tTest DataArrayView copy method - shape (2,3,8,9).";
1464
1465 // define the shape for the DataArrayViews
1466 DataArrayView::ShapeType shape;
1467 shape.push_back(2);
1468 shape.push_back(3);
1469 shape.push_back(8);
1470 shape.push_back(9);
1471
1472 // allocate the data for the DataArrayViews
1473 int npoints=10;
1474 DataArrayView::ValueType data1(DataArrayView::noValues(shape)*npoints,0);
1475 DataArrayView::ValueType data2(DataArrayView::noValues(shape)*npoints,0);
1476
1477 // construct two views
1478 DataArrayView dataView1(data1,shape);
1479 DataArrayView dataView2(data2,shape);
1480
1481 // step the views along each block of this shape in the underlying data arrays
1482 for (int p=0;p<npoints;p++) {
1483
1484 // assign values to the data underlying the first view
1485 for (int i=0;i<shape[0];i++) {
1486 for (int j=0;j<shape[1];j++) {
1487 for (int k=0;k<shape[2];k++) {
1488 for (int l=0;l<shape[3];l++) {
1489 dataView1(i,j,k,l)=dataView1.index(i,j,k,l);
1490 }
1491 }
1492 }
1493 }
1494
1495 // copy data from the first view to the second
1496 dataView2.copy(dataView1);
1497
1498 // check the data underlying the second view
1499 for (int i=0;i<shape[0];i++) {
1500 for (int j=0;j<shape[1];j++) {
1501 for (int k=0;k<shape[2];k++) {
1502 for (int l=0;l<shape[3];l++) {
1503 assert(dataView2(i,j,k,l)==dataView1.index(i,j,k,l));
1504 }
1505 }
1506 }
1507 }
1508
1509 if (p<npoints-1) {
1510 dataView1.incrOffset();
1511 dataView2.incrOffset();
1512 }
1513
1514 }
1515
1516 }
1517
1518 {
1519 cout << endl;
1520 cout << "\tTest DataArrayView copy with offset method - shape (2,3).";
1521
1522 // define the shape for the DataArrayViews
1523 DataArrayView::ShapeType shape;
1524 shape.push_back(2);
1525 shape.push_back(3);
1526
1527 // allocate the data for the DataArrayViews
1528 int npoints=4;
1529 DataArrayView::ValueType data1(DataArrayView::noValues(shape)*npoints,0);
1530 DataArrayView::ValueType data2(DataArrayView::noValues(shape)*npoints,0);
1531
1532 // construct two views
1533 DataArrayView dataView1(data1,shape);
1534 DataArrayView dataView2(data2,shape);
1535
1536 // assign values to the data underlying the first view
1537 for (int i=0;i<shape[0];i++) {
1538 for (int j=0;j<shape[1];j++) {
1539 dataView1(i,j)=dataView1.index(i,j);
1540 }
1541 }
1542
1543 // copy data from the first view to the second at an offset
1544 dataView2.copy(12,dataView1,0);
1545
1546 // check the data underlying the second view
1547 dataView2.setOffset(12);
1548 for (int i=0;i<shape[0];i++) {
1549 for (int j=0;j<shape[1];j++) {
1550 assert(dataView2(i,j)==dataView1.index(i,j));
1551 }
1552 }
1553
1554 }
1555
1556 {
1557 cout << endl;
1558 cout << "\tTest DataArrayView copy with value method - shape (5,8).";
1559
1560 // define the shape for the DataArrayView
1561 DataArrayView::ShapeType shape;
1562 shape.push_back(5);
1563 shape.push_back(8);
1564
1565 // allocate the data for the DataArrayView
1566 int npoints=4;
1567 DataArrayView::ValueType data(DataArrayView::noValues(shape)*npoints,0);
1568
1569 // construct view
1570 DataArrayView dataView(data,shape);
1571
1572 // copy a value to the view at an offset
1573 dataView.copy(80,5);
1574
1575 // check the data underlying the second view
1576 dataView.setOffset(80);
1577 for (int i=0;i<shape[0];i++) {
1578 for (int j=0;j<shape[1];j++) {
1579 assert(dataView(i,j)==5);
1580 }
1581 }
1582
1583 }
1584
1585 {
1586 cout << endl;
1587 cout << "\tTest too many indices for shape exception.";
1588
1589 DataArrayView::ShapeType shape;
1590 DataArrayView::ValueType data(DataArrayView::noValues(shape),0);
1591 DataArrayView dataView(data,shape);
1592
1593 // Should be a scalar
1594 dataView()=1;
1595
1596 try {
1597 dataView(1)=1;
1598 assert(false);
1599 }
1600 catch (EsysException& e) {
1601 assert(true);
1602 }
1603
1604 try {
1605 dataView(1,1)=1;
1606 assert(false);
1607 }
1608 catch (EsysException& e) {
1609 assert(true);
1610 }
1611
1612 try {
1613 dataView(1,1,1)=1;
1614 assert(false);
1615 }
1616 catch (EsysException& e) {
1617 assert(true);
1618 }
1619
1620 try {
1621 dataView(1,1,1,1)=1;
1622 assert(false);
1623 }
1624 catch (EsysException& e) {
1625 assert(true);
1626 }
1627
1628 }
1629
1630 {
1631 cout << endl;
1632 cout << "\tTest invalid index exception.";
1633
1634 DataArrayView::ShapeType shape;
1635 shape.push_back(4);
1636 DataArrayView::ValueType data(DataArrayView::noValues(shape),0);
1637 DataArrayView dataView(data,shape);
1638
1639 try {
1640 dataView(4000)=1;
1641 assert(false);
1642 }
1643 catch (EsysException& e) {
1644 assert(true);
1645 }
1646 }
1647
1648 {
1649 cout << endl;
1650 cout << "\tTest insufficient data exception.";
1651
1652 DataArrayView::ShapeType shape;
1653 DataArrayView::ValueType data;
1654
1655 try {
1656 DataArrayView dataView(data,shape);
1657 assert(false);
1658 }
1659 catch (EsysException& e) {
1660 assert(true);
1661 }
1662 }
1663
1664 cout << endl;
1665
1666 }
1667
1668 void DataArrayViewTestCase::testMatMult()
1669 {
1670
1671 {
1672 cout << endl;
1673 cout << "\tTest result shape." << endl;
1674
1675 DataArrayView::ShapeType leftShape;
1676 leftShape.push_back(1);
1677 leftShape.push_back(3);
1678 DataArrayView::ValueType leftData(DataArrayView::noValues(leftShape),0);
1679 DataArrayView leftDataView(leftData,leftShape);
1680
1681 DataArrayView::ShapeType rightShape;
1682 rightShape.push_back(3);
1683 rightShape.push_back(2);
1684 DataArrayView::ValueType rightData(DataArrayView::noValues(rightShape),0);
1685 DataArrayView rightDataView(rightData,rightShape);
1686
1687 DataArrayView::ShapeType resultShape=DataArrayView::determineResultShape(leftDataView,rightDataView);
1688
1689 assert(resultShape.size()==2);
1690 assert(resultShape[0]==1);
1691 assert(resultShape[1]==2);
1692
1693 DataArrayView::ValueType resultData(DataArrayView::noValues(resultShape),0);
1694 DataArrayView resultDataView(resultData,resultShape);
1695
1696 cout << "\tTest matrix multiplication.";
1697 double aValue=0.0;
1698 for (int i=0;i<leftShape[0];i++) {
1699 for (int j=0;j<leftShape[1];j++) {
1700 leftDataView(i,j)=++aValue;
1701 }
1702 }
1703 aValue=0.0;
1704 for (int i=0;i<rightShape[0];i++) {
1705 for (int j=0;j<rightShape[1];j++) {
1706 rightDataView(i,j)=++aValue;
1707 }
1708 }
1709
1710 DataArrayView::matMult(leftDataView,rightDataView,resultDataView);
1711 }
1712
1713 cout << endl;
1714
1715 }
1716
1717 void DataArrayViewTestCase::testUnaryOp()
1718 {
1719
1720 // This typedef allows function names to be cast to pointers
1721 // to unary functions of the appropriate type.
1722 typedef double (*UnaryDFunPtr)(double);
1723
1724 {
1725 cout << endl;
1726 cout << "\tTest unaryOp on scalar DataArrayView.";
1727
1728 // define the shape for the DataArrayView
1729 DataArrayView::ShapeType shape;
1730
1731 // allocate the data for the DataArrayView
1732 int npoints=4;
1733 DataArrayView::ValueType data(DataArrayView::noValues(shape)*npoints,0);
1734
1735 // constructor
1736 DataArrayView dataView(data,shape);
1737
1738 double tmp;
1739 // step the view along each data point in the underlying data
1740 for (int p=0;p<npoints;p++) {
1741
1742 // assign values to the data point
1743 dataView()=p;
1744
1745 // apply a unary operation to this data point
1746 dataView.unaryOp((UnaryDFunPtr)std::sin);
1747
1748 // check the results
1749 tmp = std::sin((double)p);
1750 assert(dataView()==tmp);
1751
1752 if (p<npoints-1) {
1753 dataView.incrOffset();
1754 }
1755
1756 }
1757
1758 }
1759
1760 {
1761 cout << endl;
1762 cout << "\tTest unaryOp on shape (2,3) DataArrayView.";
1763
1764 // define the shape for the DataArrayView
1765 DataArrayView::ShapeType shape;
1766 shape.push_back(2);
1767 shape.push_back(3);
1768
1769 // allocate the data for the DataArrayView
1770 int npoints=4;
1771 DataArrayView::ValueType data(DataArrayView::noValues(shape)*npoints,0);
1772
1773 // constructor
1774 DataArrayView dataView(data,shape);
1775
1776 // step the view along each data point in the underlying data
1777 for (int p=0;p<npoints;p++) {
1778
1779 // assign values to the data point
1780 for (int i=0;i<shape[0];i++) {
1781 for (int j=0;j<shape[1];j++) {
1782 dataView(i,j)=dataView.index(i,j);
1783 }
1784 }
1785
1786 // apply a unary operation to this data point
1787 dataView.unaryOp((UnaryDFunPtr)std::sqrt);
1788
1789 // check the results
1790 for (int i=0;i<shape[0];i++) {
1791 for (int j=0;j<shape[1];j++) {
1792 assert(dataView(i,j)==std::sqrt((double)dataView.index(i,j)));
1793 }
1794 }
1795
1796 if (p<npoints-1) {
1797 dataView.incrOffset();
1798 }
1799
1800 }
1801
1802 }
1803
1804 {
1805 cout << endl;
1806 cout << "\tTest unaryOp on shape (9,8,5,11) DataArrayView.";
1807
1808 // define the shape for the DataArrayView
1809 DataArrayView::ShapeType shape;
1810 shape.push_back(9);
1811 shape.push_back(8);
1812 shape.push_back(5);
1813 shape.push_back(11);
1814
1815 // allocate the data for the DataArrayView
1816 int npoints=4;
1817 DataArrayView::ValueType data(DataArrayView::noValues(shape)*npoints,0);
1818
1819 // constructor
1820 DataArrayView dataView(data,shape);
1821
1822 // step the view along each data point in the underlying data
1823 for (int p=0;p<npoints;p++) {
1824
1825 // assign values to the data point
1826 for (int i=0;i<shape[0];i++) {
1827 for (int j=0;j<shape[1];j++) {
1828 for (int k=0;k<shape[2];k++) {
1829 for (int l=0;l<shape[3];l++) {
1830 dataView(i,j,k,l)=dataView.index(i,j,k,l);
1831 }
1832 }
1833 }
1834 }
1835
1836 // apply a unary operation to this data point
1837 dataView.unaryOp((UnaryDFunPtr)std::log);
1838
1839 // check the results
1840 for (int i=0;i<shape[0];i++) {
1841 for (int j=0;j<shape[1];j++) {
1842 for (int k=0;k<shape[2];k++) {
1843 for (int l=0;l<shape[3];l++) {
1844 assert(dataView(i,j,k,l)==std::log((double)dataView.index(i,j,k,l)));
1845 }
1846 }
1847 }
1848 }
1849
1850 if (p<npoints-1) {
1851 dataView.incrOffset();
1852 }
1853
1854 }
1855
1856 }
1857
1858 cout << endl;
1859
1860 }
1861
1862 void DataArrayViewTestCase::testBinaryOp()
1863 {
1864
1865 // This typedef allows function names to be cast to pointers
1866 // to binary functions of the appropriate type.
1867 typedef double (*BinaryDFunPtr)(double,double);
1868
1869 {
1870 cout << endl;
1871 cout << "\tTest binaryOp on scalar DataArrayViews.";
1872
1873 // define the shape for the DataArrayViews
1874 DataArrayView::ShapeType shape;
1875
1876 // allocate the data for the DataArrayViews
1877 int npoints=4;
1878 DataArrayView::ValueType data1(DataArrayView::noValues(shape)*npoints,0);
1879 DataArrayView::ValueType data2(DataArrayView::noValues(shape)*npoints,0);
1880
1881 // constructor
1882 DataArrayView dataView1(data1,shape);
1883 DataArrayView dataView2(data2,shape);
1884
1885 // step the views along each data point in the underlying data
1886 for (int p=0;p<npoints;p++) {
1887
1888 // assign values to the data points
1889 dataView1()=p;
1890 dataView2()=p;
1891
1892 // apply a binary operation to these data points
1893 dataView1.binaryOp(dataView2,plus<double>());
1894
1895 // check the results
1896 assert(dataView1()==p+p);
1897
1898 if (p<npoints-1) {
1899 dataView1.incrOffset();
1900 dataView2.incrOffset();
1901 }
1902
1903 }
1904
1905 }
1906
1907 {
1908 cout << endl;
1909 cout << "\tTest binaryOp on shape (2,3) DataArrayViews.";
1910
1911 // define the shape for the DataArrayViews
1912 DataArrayView::ShapeType shape;
1913 shape.push_back(2);
1914 shape.push_back(3);
1915
1916 // allocate the data for the DataArrayViews
1917 int npoints=4;
1918 DataArrayView::ValueType data1(DataArrayView::noValues(shape)*npoints,0);
1919 DataArrayView::ValueType data2(DataArrayView::noValues(shape)*npoints,0);
1920
1921 // constructor
1922 DataArrayView dataView1(data1,shape);
1923 DataArrayView dataView2(data2,shape);
1924
1925 // step the views along each data point in the underlying data
1926 for (int p=0;p<npoints;p++) {
1927
1928 // assign values to the data points
1929 for (int i=0;i<shape[0];i++) {
1930 for (int j=0;j<shape[1];j++) {
1931 dataView1(i,j)=dataView1.index(i,j);
1932 dataView2(i,j)=dataView2.index(i,j);
1933 }
1934 }
1935
1936 // apply a binary operation to these data points
1937 dataView1.binaryOp(dataView2,multiplies<double>());
1938
1939 // check the results
1940 for (int i=0;i<shape[0];i++) {
1941 for (int j=0;j<shape[1];j++) {
1942 assert(dataView1(i,j)==dataView1.index(i,j)*dataView2.index(i,j));
1943 }
1944 }
1945
1946 if (p<npoints-1) {
1947 dataView1.incrOffset();
1948 dataView2.incrOffset();
1949 }
1950
1951 }
1952
1953 }
1954
1955 {
1956 cout << endl;
1957 cout << "\tTest binaryOp on shape (9,8,5,11) DataArrayViews.";
1958
1959 // define the shape for the DataArrayViews
1960 DataArrayView::ShapeType shape;
1961 shape.push_back(9);
1962 shape.push_back(8);
1963 shape.push_back(5);
1964 shape.push_back(11);
1965
1966 // allocate the data for the DataArrayViews
1967 int npoints=4;
1968 DataArrayView::ValueType data1(DataArrayView::noValues(shape)*npoints,0);
1969 DataArrayView::ValueType data2(DataArrayView::noValues(shape)*npoints,0);
1970
1971 // constructor
1972 DataArrayView dataView1(data1,shape);
1973 DataArrayView dataView2(data2,shape);
1974
1975 // step the views along each data point in the underlying data
1976 for (int p=0;p<npoints;p++) {
1977
1978 // assign values to the data points
1979 for (int i=0;i<shape[0];i++) {
1980 for (int j=0;j<shape[1];j++) {
1981 for (int k=0;k<shape[2];k++) {
1982 for (int l=0;l<shape[3];l++) {
1983 dataView1(i,j,k,l)=dataView1.index(i,j,k,l);
1984 dataView2(i,j,k,l)=dataView2.index(i,j,k,l);
1985 }
1986 }
1987 }
1988 }
1989
1990 // apply a binary operation to these data points
1991 dataView1.binaryOp(dataView2,multiplies<double>());
1992
1993 // check the results
1994 for (int i=0;i<shape[0];i++) {
1995 for (int j=0;j<shape[1];j++) {
1996 for (int k=0;k<shape[2];k++) {
1997 for (int l=0;l<shape[3];l++) {
1998 assert(dataView1(i,j,k,l)==dataView1.index(i,j,k,l)*dataView2.index(i,j,k,l));
1999 }
2000 }
2001 }
2002 }
2003
2004 if (p<npoints-1) {
2005 dataView1.incrOffset();
2006 dataView2.incrOffset();
2007 }
2008
2009 }
2010
2011 }
2012
2013 {
2014 cout << endl;
2015 cout << "\tTest binaryOp on scalar DataArrayView and single value.";
2016
2017 // define the shape for the DataArrayView
2018 DataArrayView::ShapeType shape;
2019
2020 // allocate the data for the DataArrayView
2021 int npoints=4;
2022 DataArrayView::ValueType data(DataArrayView::noValues(shape)*npoints,0);
2023
2024 // constructor
2025 DataArrayView dataView(data,shape);
2026
2027 // step the view along each data point in the underlying data
2028 for (int p=0;p<npoints;p++) {
2029
2030 // assign values to the data point
2031 dataView()=p;
2032
2033 // apply a binary operation to this data point
2034 dataView.binaryOp(4.9,plus<double>());
2035
2036 // check the results
2037 assert(dataView()==4.9+p);
2038
2039 if (p<npoints-1) {
2040 dataView.incrOffset();
2041 }
2042
2043 }
2044
2045 }
2046
2047 {
2048 cout << endl;
2049 cout << "\tTest binaryOp on shape (2,3) DataArrayView and single value.";
2050
2051 // define the shape for the DataArrayView
2052 DataArrayView::ShapeType shape;
2053 shape.push_back(2);
2054 shape.push_back(3);
2055
2056 // allocate the data for the DataArrayView
2057 int npoints=4;
2058 DataArrayView::ValueType data(DataArrayView::noValues(shape)*npoints,0);
2059
2060 // constructor
2061 DataArrayView dataView(data,shape);
2062
2063 // step the view along each data point in the underlying data
2064 for (int p=0;p<npoints;p++) {
2065
2066 // assign values to the data point
2067 for (int i=0;i<shape[0];i++) {
2068 for (int j=0;j<shape[1];j++) {
2069 dataView(i,j)=dataView.index(i,j);
2070 }
2071 }
2072
2073 // apply a binary operation to the data point
2074 dataView.binaryOp(5.8,multiplies<double>());
2075
2076 double tmp;
2077 // check the results
2078 for (int i=0;i<shape[0];i++) {
2079 for (int j=0;j<shape[1];j++) {
2080 tmp=5.8*dataView.index(i,j);
2081 assert(dataView(i,j)==tmp);
2082 }
2083 }
2084
2085 if (p<npoints-1) {
2086 dataView.incrOffset();
2087 }
2088
2089 }
2090
2091 }
2092
2093 {
2094 cout << endl;
2095 cout << "\tTest binaryOp on shape (9,8,5,11) DataArrayView and single value.";
2096
2097 // define the shape for the DataArrayView
2098 DataArrayView::ShapeType shape;
2099 shape.push_back(9);
2100 shape.push_back(8);
2101 shape.push_back(5);
2102 shape.push_back(11);
2103
2104 // allocate the data for the DataArrayView
2105 int npoints=4;
2106 DataArrayView::ValueType data(DataArrayView::noValues(shape)*npoints,0);
2107
2108 // constructor
2109 DataArrayView dataView(data,shape);
2110
2111 // step the view along each data point in the underlying data
2112 for (int p=0;p<npoints;p++) {
2113
2114 // assign values to the data point
2115 for (int i=0;i<shape[0];i++) {
2116 for (int j=0;j<shape[1];j++) {
2117 for (int k=0;k<shape[2];k++) {
2118 for (int l=0;l<shape[3];l++) {
2119 dataView(i,j,k,l)=dataView.index(i,j,k,l);
2120 }
2121 }
2122 }
2123 }
2124
2125 // apply a binary operation to the data point
2126 dataView.binaryOp(5.4,multiplies<double>());
2127
2128 double tmp;
2129 // check the results
2130 for (int i=0;i<shape[0];i++) {
2131 for (int j=0;j<shape[1];j++) {
2132 for (int k=0;k<shape[2];k++) {
2133 for (int l=0;l<shape[3];l++) {
2134 tmp=5.4*dataView.index(i,j,k,l);
2135 assert(dataView(i,j,k,l)==tmp);
2136 }
2137 }
2138 }
2139 }
2140
2141 if (p<npoints-1) {
2142 dataView.incrOffset();
2143 }
2144
2145 }
2146
2147 }
2148
2149 cout << endl;
2150
2151 }
2152
2153 void DataArrayViewTestCase::testReductionOp()
2154 {
2155
2156 {
2157 cout << endl;
2158 cout << "\tTest reductionOp on scalar DataArrayView.";
2159
2160 // define the shape for the DataArrayView
2161 DataArrayView::ShapeType shape;
2162
2163 // allocate the data for the DataArrayView
2164 int npoints=4;
2165 DataArrayView::ValueType data(DataArrayView::noValues(shape)*npoints,0);
2166
2167 // constructor
2168 DataArrayView dataView(data,shape);
2169
2170 // step the view along each data point in the underlying data
2171 for (int p=0;p<npoints;p++) {
2172
2173 // assign values to the data point
2174 dataView()=p;
2175
2176 // apply a reduction operation to this data point and check the results
2177 FMax fmax_func;
2178 assert(dataView.reductionOp(fmax_func,numeric_limits<double>::max()*-1)==p);
2179
2180 if (p<npoints-1) {
2181 dataView.incrOffset();
2182 }
2183
2184 }
2185
2186 }
2187
2188 {
2189 cout << endl;
2190 cout << "\tTest reductionOp on shape (2,3) DataArrayView.";
2191
2192 // define the shape for the DataArrayView
2193 DataArrayView::ShapeType shape;
2194 shape.push_back(2);
2195 shape.push_back(3);
2196
2197 // allocate the data for the DataArrayView
2198 int npoints=4;
2199 DataArrayView::ValueType data(DataArrayView::noValues(shape)*npoints,0);
2200
2201 // constructor
2202 DataArrayView dataView(data,shape);
2203
2204 // step the view along each data point in the underlying data
2205 for (int p=0;p<npoints;p++) {
2206
2207 // assign values to the data point
2208 for (int i=0;i<shape[0];i++) {
2209 for (int j=0;j<shape[1];j++) {
2210 dataView(i,j)=dataView.index(i,j);
2211 }
2212 }
2213
2214 // apply a reduction operation to this data point and check the results
2215 FMin fmin_func;
2216 assert(dataView.reductionOp(fmin_func,numeric_limits<double>::max())==dataView.index(0,0));
2217
2218 if (p<npoints-1) {
2219 dataView.incrOffset();
2220 }
2221
2222 }
2223
2224 }
2225
2226 {
2227 cout << endl;
2228 cout << "\tTest reductionOp on shape (9,8,5,11) DataArrayView.";
2229
2230 // define the shape for the DataArrayView
2231 DataArrayView::ShapeType shape;
2232 shape.push_back(9);
2233 shape.push_back(8);
2234 shape.push_back(5);
2235 shape.push_back(11);
2236
2237 // allocate the data for the DataArrayView
2238 int npoints=4;
2239 DataArrayView::ValueType data(DataArrayView::noValues(shape)*npoints,0);
2240
2241 // constructor
2242 DataArrayView dataView(data,shape);
2243
2244 // step the view along each data point in the underlying data
2245 for (int p=0;p<npoints;p++) {
2246
2247 // assign values to the data point
2248 for (int i=0;i<shape[0];i++) {
2249 for (int j=0;j<shape[1];j++) {
2250 for (int k=0;k<shape[2];k++) {
2251 for (int l=0;l<shape[3];l++) {
2252 dataView(i,j,k,l)=dataView.index(i,j,k,l);
2253 }
2254 }
2255 }
2256 }
2257
2258 // apply a reduction operation to this data point and check the results
2259 AbsMax absmax_func;
2260 assert(dataView.reductionOp(absmax_func,0)==dataView.index(8,7,4,10));
2261
2262 if (p<npoints-1) {
2263 dataView.incrOffset();
2264 }
2265
2266 }
2267
2268 }
2269
2270 cout << endl;
2271
2272 }
2273
2274 TestSuite* DataArrayViewTestCase::suite ()
2275 {
2276 //
2277 // create the suite of tests to perform.
2278 TestSuite *testSuite = new TestSuite ("DataArrayViewTestCase");
2279
2280 testSuite->addTest (new TestCaller< DataArrayViewTestCase>("testAll",&DataArrayViewTestCase::testAll));
2281 testSuite->addTest (new TestCaller< DataArrayViewTestCase>("testShapeToString",&DataArrayViewTestCase::testShapeToString));
2282 testSuite->addTest (new TestCaller< DataArrayViewTestCase>("testScalarView",&DataArrayViewTestCase::testScalarView));
2283 testSuite->addTest (new TestCaller< DataArrayViewTestCase>("testResultSliceShape",&DataArrayViewTestCase::testResultSliceShape));
2284 testSuite->addTest (new TestCaller< DataArrayViewTestCase>("testSlicing",&DataArrayViewTestCase::testSlicing));
2285 testSuite->addTest (new TestCaller< DataArrayViewTestCase>("testUnaryOp",&DataArrayViewTestCase::testUnaryOp));
2286 testSuite->addTest (new TestCaller< DataArrayViewTestCase>("testBinaryOp",&DataArrayViewTestCase::testBinaryOp));
2287 testSuite->addTest (new TestCaller< DataArrayViewTestCase>("testReductionOp",&DataArrayViewTestCase::testReductionOp));
2288 testSuite->addTest (new TestCaller< DataArrayViewTestCase>("testMatMult",&DataArrayViewTestCase::testMatMult));
2289 return testSuite;
2290 }

Properties

Name Value
svn:eol-style native
svn:keywords Author Date Id Revision

  ViewVC Help
Powered by ViewVC 1.1.26