/[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/DataArrayViewTestCase.cpp revision 1312 by ksteube, Mon Sep 24 06:18:44 2007 UTC temp/escript/test/DataArrayViewTestCase.cpp revision 1387 by trankine, Fri Jan 11 07:45:26 2008 UTC
# Line 13  Line 13 
13   *   *
14   *******************************************************/   *******************************************************/
15    
 #include "escript/DataArray.h"  
16  #include "escript/DataArrayView.h"  #include "escript/DataArrayView.h"
17  #include "escript/DataAlgorithm.h"  #include "escript/DataAlgorithm.h"
18    #include "escript/DataVector.h"
19  #include "esysUtils/EsysException.h"  #include "esysUtils/EsysException.h"
20    
21  #include "DataArrayViewTestCase.h"  #include "DataArrayViewTestCase.h"
# Line 30  using namespace std; Line 30  using namespace std;
30  void DataArrayViewTestCase::setUp() {  void DataArrayViewTestCase::setUp() {
31    //    //
32    // This is called before each test is run    // This is called before each test is run
33    
34  }  }
35    
36  void DataArrayViewTestCase::tearDown() {  void DataArrayViewTestCase::tearDown() {
37    //    //
38    // This is called after each test has been run    // This is called after each test has been run
39    
40  }  }
41    
42  void DataArrayViewTestCase::testResultSliceShape() {  void DataArrayViewTestCase::testResultSliceShape() {
# Line 78  void DataArrayViewTestCase::testSlicing( Line 78  void DataArrayViewTestCase::testSlicing(
78      DataArrayView::ShapeType sourceShape;      DataArrayView::ShapeType sourceShape;
79    
80      // Create source and target views.      // Create source and target views.
81      DataArray source(sourceShape,2.0);      int len = DataArrayView::noValues(sourceShape);
82      DataArrayView sourceView=source.getView();      DataVector sourceData(len, 2.0, len);
83        DataArrayView sourceView(sourceData, sourceShape);
84      DataArray target;      DataVector targetData(1, 2.0, 1);
85      DataArrayView targetView=target.getView();      DataArrayView targetView(targetData, DataArrayView::ShapeType());
86    
87      // Copy source view to target view.      // Copy source view to target view.
88      targetView.copySlice(sourceView,region);      targetView.copySlice(sourceView,region);
# Line 102  void DataArrayViewTestCase::testSlicing( Line 102  void DataArrayViewTestCase::testSlicing(
102      DataArrayView::ShapeType sourceShape;      DataArrayView::ShapeType sourceShape;
103    
104      // Create source and target views.      // Create source and target views.
105      DataArray source(sourceShape,2.0);      int len = DataArrayView::noValues(sourceShape);
106      DataArrayView sourceView=source.getView();      DataVector sourceData(len, 2.0, len);
107        DataArrayView sourceView(sourceData, sourceShape);
108      DataArray target;      DataVector targetData(1, 2.0, 1);
109      DataArrayView targetView=target.getView();      DataArrayView targetView(targetData, DataArrayView::ShapeType());
110    
111      // Copy source view to target view.      // Copy source view to target view.
112      targetView.copySliceFrom(sourceView,region);      targetView.copySliceFrom(sourceView,region);
# Line 129  void DataArrayViewTestCase::testSlicing( Line 129  void DataArrayViewTestCase::testSlicing(
129      DataArrayView::ShapeType targetShape = DataArrayView::getResultSliceShape(region);      DataArrayView::ShapeType targetShape = DataArrayView::getResultSliceShape(region);
130    
131      // Create source and target views.      // Create source and target views.
132      DataArray source(sourceShape);      int len = DataArrayView::noValues(sourceShape);
133      DataArrayView sourceView=source.getView();      DataVector sourceData(len, 2.0, len);
134        DataArrayView sourceView(sourceData, sourceShape);
135      for (int i=0;i<sourceShape[0];i++) {      for (int i=0;i<sourceShape[0];i++) {
136        sourceView(i)=i;        sourceView(i)=i;
137      }      }
138    
139      DataArray target(targetShape);      len = DataArrayView::noValues(targetShape);
140      DataArrayView targetView=target.getView();      DataVector targetData(len, 2.0, len);
141        DataArrayView targetView(targetData, targetShape);
142    
143      // Copy source view to target view.      // Copy source view to target view.
144      targetView.copySlice(sourceView,region);      targetView.copySlice(sourceView,region);
# Line 162  void DataArrayViewTestCase::testSlicing( Line 164  void DataArrayViewTestCase::testSlicing(
164      DataArrayView::ShapeType targetShape;      DataArrayView::ShapeType targetShape;
165    
166      // Create source and target views.      // Create source and target views.
167      DataArray source(sourceShape);      int len = DataArrayView::noValues(sourceShape);
168      DataArrayView sourceView=source.getView();      DataVector sourceData(len, 2.0, len);
169        DataArrayView sourceView(sourceData, sourceShape);
170    
171      for (int i=0;i<sourceShape[0];i++) {      for (int i=0;i<sourceShape[0];i++) {
172        sourceView(i)=i;        sourceView(i)=i;
173      }      }
174    
175      DataArray target(targetShape);      len = DataArrayView::noValues(targetShape);
176      DataArrayView targetView=target.getView();      DataVector targetData(len, 2.0, len);
177        DataArrayView targetView(targetData, targetShape);
178    
179      // Copy source view to target view.      // Copy source view to target view.
180      targetView.copySlice(sourceView,region);      targetView.copySlice(sourceView,region);
# Line 195  void DataArrayViewTestCase::testSlicing( Line 200  void DataArrayViewTestCase::testSlicing(
200      targetShape.push_back(6);      targetShape.push_back(6);
201    
202      // Create source and target views.      // Create source and target views.
203      DataArray source(sourceShape);      int len = DataArrayView::noValues(sourceShape);
204      DataArrayView sourceView=source.getView();      DataVector sourceData(len, 2.0, len);
205        DataArrayView sourceView(sourceData, sourceShape);
206      for (int i=0;i<sourceShape[0];i++) {      for (int i=0;i<sourceShape[0];i++) {
207        sourceView(i)=i;        sourceView(i)=i;
208      }      }
209    
210      DataArray target(targetShape);      len = DataArrayView::noValues(targetShape);
211      DataArrayView targetView=target.getView();      DataVector targetData(len, 2.0, len);
212        DataArrayView targetView(targetData, targetShape);
213    
214      // Copy source view to target view.      // Copy source view to target view.
215      targetView.copySliceFrom(sourceView,region);      targetView.copySliceFrom(sourceView,region);
# Line 228  void DataArrayViewTestCase::testSlicing( Line 235  void DataArrayViewTestCase::testSlicing(
235      targetShape.push_back(6);      targetShape.push_back(6);
236    
237      // Create source and target views.      // Create source and target views.
238      DataArray source(sourceShape);      int len = DataArrayView::noValues(sourceShape);
239      DataArrayView sourceView=source.getView();      DataVector sourceData(len, 2.0, len);
240        DataArrayView sourceView(sourceData, sourceShape);
241      sourceView()=5;      sourceView()=5;
242    
243      DataArray target(targetShape);      len = DataArrayView::noValues(targetShape);
244      DataArrayView targetView=target.getView();      DataVector targetData(len, 2.0, len);
245        DataArrayView targetView(targetData, targetShape);
246    
247      // Copy source view to target view.      // Copy source view to target view.
248      targetView.copySliceFrom(sourceView,region);      targetView.copySliceFrom(sourceView,region);
# Line 261  void DataArrayViewTestCase::testSlicing( Line 270  void DataArrayViewTestCase::testSlicing(
270      DataArrayView::ShapeType targetShape = DataArrayView::getResultSliceShape(region);      DataArrayView::ShapeType targetShape = DataArrayView::getResultSliceShape(region);
271    
272      // Create source and target views.      // Create source and target views.
273      DataArray source(sourceShape);      int len = DataArrayView::noValues(sourceShape);
274      DataArrayView sourceView=source.getView();      DataVector sourceData(len, 2.0, len);
275        DataArrayView sourceView(sourceData, sourceShape);
276      int val=0;      int val=0;
277      for (int i=0;i<sourceShape[0];i++) {      for (int i=0;i<sourceShape[0];i++) {
278        for (int j=0;j<sourceShape[1];j++) {        for (int j=0;j<sourceShape[1];j++) {
# Line 270  void DataArrayViewTestCase::testSlicing( Line 280  void DataArrayViewTestCase::testSlicing(
280        }        }
281      }      }
282    
283      DataArray target(targetShape);      len = DataArrayView::noValues(targetShape);
284      DataArrayView targetView=target.getView();      DataVector targetData(len, 2.0, len);
285        DataArrayView targetView(targetData, targetShape);
286    
287      // Copy source view to target view.      // Copy source view to target view.
288      targetView.copySlice(sourceView,region);      targetView.copySlice(sourceView,region);
# Line 302  void DataArrayViewTestCase::testSlicing( Line 313  void DataArrayViewTestCase::testSlicing(
313      targetShape.push_back(3);      targetShape.push_back(3);
314    
315      // Create source and target views.      // Create source and target views.
316      DataArray source(sourceShape);      int len = DataArrayView::noValues(sourceShape);
317      DataArrayView sourceView=source.getView();      DataVector sourceData(len, 2.0, len);
318        DataArrayView sourceView(sourceData, sourceShape);
319      int val=0;      int val=0;
320      for (int i=0;i<sourceShape[0];i++) {      for (int i=0;i<sourceShape[0];i++) {
321        for (int j=0;j<sourceShape[1];j++) {        for (int j=0;j<sourceShape[1];j++) {
# Line 311  void DataArrayViewTestCase::testSlicing( Line 323  void DataArrayViewTestCase::testSlicing(
323        }        }
324      }      }
325    
326      DataArray target(targetShape);      len = DataArrayView::noValues(targetShape);
327      DataArrayView targetView=target.getView();      DataVector targetData(len, 2.0, len);
328        DataArrayView targetView(targetData, targetShape);
329    
330      // Copy source view to target view.      // Copy source view to target view.
331      targetView.copySlice(sourceView,region);      targetView.copySlice(sourceView,region);
# Line 342  void DataArrayViewTestCase::testSlicing( Line 355  void DataArrayViewTestCase::testSlicing(
355      DataArrayView::ShapeType targetShape;      DataArrayView::ShapeType targetShape;
356    
357      // Create source and target views.      // Create source and target views.
358      DataArray source(sourceShape);      int len = DataArrayView::noValues(sourceShape);
359      DataArrayView sourceView=source.getView();      DataVector sourceData(len, 2.0, len);
360        DataArrayView sourceView(sourceData, sourceShape);
361      int val=0;      int val=0;
362      for (int i=0;i<sourceShape[0];i++) {      for (int i=0;i<sourceShape[0];i++) {
363        for (int j=0;j<sourceShape[1];j++) {        for (int j=0;j<sourceShape[1];j++) {
# Line 351  void DataArrayViewTestCase::testSlicing( Line 365  void DataArrayViewTestCase::testSlicing(
365        }        }
366      }      }
367    
368      DataArray target(targetShape);      len = DataArrayView::noValues(targetShape);
369      DataArrayView targetView=target.getView();      DataVector targetData(len, 2.0, len);
370        DataArrayView targetView(targetData, targetShape);
371    
372      // Copy source view to target view.      // Copy source view to target view.
373      targetView.copySlice(sourceView,region);      targetView.copySlice(sourceView,region);
# Line 381  void DataArrayViewTestCase::testSlicing( Line 396  void DataArrayViewTestCase::testSlicing(
396      targetShape.push_back(3);      targetShape.push_back(3);
397    
398      // Create source and target views.      // Create source and target views.
399      DataArray source(sourceShape);      int len = DataArrayView::noValues(sourceShape);
400      DataArrayView sourceView=source.getView();      DataVector sourceData(len, 2.0, len);
401        DataArrayView sourceView(sourceData, sourceShape);
402      int val=0;      int val=0;
403      for (int i=0;i<sourceShape[0];i++) {      for (int i=0;i<sourceShape[0];i++) {
404        for (int j=0;j<sourceShape[1];j++) {        for (int j=0;j<sourceShape[1];j++) {
# Line 390  void DataArrayViewTestCase::testSlicing( Line 406  void DataArrayViewTestCase::testSlicing(
406        }        }
407      }      }
408    
409      DataArray target(targetShape);      len = DataArrayView::noValues(targetShape);
410      DataArrayView targetView=target.getView();      DataVector targetData(len, 2.0, len);
411        DataArrayView targetView(targetData, targetShape);
412    
413      // Copy source view to target view.      // Copy source view to target view.
414      targetView.copySliceFrom(sourceView,region);      targetView.copySliceFrom(sourceView,region);
# Line 421  void DataArrayViewTestCase::testSlicing( Line 438  void DataArrayViewTestCase::testSlicing(
438      targetShape.push_back(3);      targetShape.push_back(3);
439    
440      // Create source and target views.      // Create source and target views.
441      DataArray source(sourceShape);      int len = DataArrayView::noValues(sourceShape);
442      DataArrayView sourceView=source.getView();      DataVector sourceData(len, 2.0, len);
443        DataArrayView sourceView(sourceData, sourceShape);
444      sourceView()=5;      sourceView()=5;
445    
446      DataArray target(targetShape);      len = DataArrayView::noValues(targetShape);
447      DataArrayView targetView=target.getView();      DataVector targetData(len, 2.0, len);
448        DataArrayView targetView(targetData, targetShape);
449    
450      // Copy source view to target view.      // Copy source view to target view.
451      targetView.copySliceFrom(sourceView,region);      targetView.copySliceFrom(sourceView,region);
# Line 458  void DataArrayViewTestCase::testSlicing( Line 477  void DataArrayViewTestCase::testSlicing(
477      DataArrayView::ShapeType targetShape = DataArrayView::getResultSliceShape(region);      DataArrayView::ShapeType targetShape = DataArrayView::getResultSliceShape(region);
478    
479      // Create source and target views.      // Create source and target views.
480      DataArray source(sourceShape);      int len = DataArrayView::noValues(sourceShape);
481      DataArrayView sourceView=source.getView();      DataVector sourceData(len, 2.0, len);
482        DataArrayView sourceView(sourceData, sourceShape);
483      int val=0;      int val=0;
484      for (int i=0;i<sourceShape[0];i++) {      for (int i=0;i<sourceShape[0];i++) {
485        for (int j=0;j<sourceShape[1];j++) {        for (int j=0;j<sourceShape[1];j++) {
# Line 469  void DataArrayViewTestCase::testSlicing( Line 489  void DataArrayViewTestCase::testSlicing(
489        }        }
490      }      }
491    
492      DataArray target(targetShape);      len = DataArrayView::noValues(targetShape);
493      DataArrayView targetView=target.getView();      DataVector targetData(len, 2.0, len);
494        DataArrayView targetView(targetData, targetShape);
495    
496      // Copy source view to target view.      // Copy source view to target view.
497      targetView.copySlice(sourceView,region);      targetView.copySlice(sourceView,region);
# Line 506  void DataArrayViewTestCase::testSlicing( Line 527  void DataArrayViewTestCase::testSlicing(
527      targetShape.push_back(4);      targetShape.push_back(4);
528    
529      // Create source and target views.      // Create source and target views.
530      DataArray source(sourceShape);      int len = DataArrayView::noValues(sourceShape);
531      DataArrayView sourceView=source.getView();      DataVector sourceData(len, 2.0, len);
532        DataArrayView sourceView(sourceData, sourceShape);
533      int val=0;      int val=0;
534      for (int i=0;i<sourceShape[0];i++) {      for (int i=0;i<sourceShape[0];i++) {
535        for (int j=0;j<sourceShape[1];j++) {        for (int j=0;j<sourceShape[1];j++) {
# Line 517  void DataArrayViewTestCase::testSlicing( Line 539  void DataArrayViewTestCase::testSlicing(
539        }        }
540      }      }
541    
542      DataArray target(targetShape);      len = DataArrayView::noValues(targetShape);
543      DataArrayView targetView=target.getView();      DataVector targetData(len, 2.0, len);
544        DataArrayView targetView(targetData, targetShape);
545    
546      // Copy source view to target view.      // Copy source view to target view.
547      targetView.copySlice(sourceView,region);      targetView.copySlice(sourceView,region);
# Line 553  void DataArrayViewTestCase::testSlicing( Line 576  void DataArrayViewTestCase::testSlicing(
576      targetShape.push_back(4);      targetShape.push_back(4);
577    
578      // Create source and target views.      // Create source and target views.
579      DataArray source(sourceShape);      int len = DataArrayView::noValues(sourceShape);
580      DataArrayView sourceView=source.getView();      DataVector sourceData(len, 2.0, len);
581        DataArrayView sourceView(sourceData, sourceShape);
582      int val=0;      int val=0;
583      for (int i=0;i<sourceShape[0];i++) {      for (int i=0;i<sourceShape[0];i++) {
584        for (int j=0;j<sourceShape[1];j++) {        for (int j=0;j<sourceShape[1];j++) {
# Line 564  void DataArrayViewTestCase::testSlicing( Line 588  void DataArrayViewTestCase::testSlicing(
588        }        }
589      }      }
590    
591      DataArray target(targetShape);      len = DataArrayView::noValues(targetShape);
592      DataArrayView targetView=target.getView();      DataVector targetData(len, 2.0, len);
593        DataArrayView targetView(targetData, targetShape);
594    
595      // Copy source view to target view.      // Copy source view to target view.
596      targetView.copySlice(sourceView,region);      targetView.copySlice(sourceView,region);
# Line 599  void DataArrayViewTestCase::testSlicing( Line 624  void DataArrayViewTestCase::testSlicing(
624      DataArrayView::ShapeType targetShape;      DataArrayView::ShapeType targetShape;
625    
626      // Create source and target views.      // Create source and target views.
627      DataArray source(sourceShape);      int len = DataArrayView::noValues(sourceShape);
628      DataArrayView sourceView=source.getView();      DataVector sourceData(len, 2.0, len);
629        DataArrayView sourceView(sourceData, sourceShape);
630      int val=0;      int val=0;
631      for (int i=0;i<sourceShape[0];i++) {      for (int i=0;i<sourceShape[0];i++) {
632        for (int j=0;j<sourceShape[1];j++) {        for (int j=0;j<sourceShape[1];j++) {
# Line 610  void DataArrayViewTestCase::testSlicing( Line 636  void DataArrayViewTestCase::testSlicing(
636        }        }
637      }      }
638    
639      DataArray target(targetShape);      len = DataArrayView::noValues(targetShape);
640      DataArrayView targetView=target.getView();      DataVector targetData(len, 2.0, len);
641        DataArrayView targetView(targetData, targetShape);
642    
643      // Copy source view to target view.      // Copy source view to target view.
644      targetView.copySlice(sourceView,region);      targetView.copySlice(sourceView,region);
# Line 645  void DataArrayViewTestCase::testSlicing( Line 672  void DataArrayViewTestCase::testSlicing(
672      targetShape.push_back(9);      targetShape.push_back(9);
673    
674      // Create source and target views.      // Create source and target views.
675      DataArray source(sourceShape);      int len = DataArrayView::noValues(sourceShape);
676      DataArrayView sourceView=source.getView();      DataVector sourceData(len, 2.0, len);
677        DataArrayView sourceView(sourceData, sourceShape);
678      int val=0;      int val=0;
679      for (int i=0;i<sourceShape[0];i++) {      for (int i=0;i<sourceShape[0];i++) {
680        for (int j=0;j<sourceShape[1];j++) {        for (int j=0;j<sourceShape[1];j++) {
# Line 656  void DataArrayViewTestCase::testSlicing( Line 684  void DataArrayViewTestCase::testSlicing(
684        }        }
685      }      }
686    
687      DataArray target(targetShape);      len = DataArrayView::noValues(targetShape);
688      DataArrayView targetView=target.getView();      DataVector targetData(len, 2.0, len);
689        DataArrayView targetView(targetData, targetShape);
690    
691      // Copy source view to target view.      // Copy source view to target view.
692      targetView.copySliceFrom(sourceView,region);      targetView.copySliceFrom(sourceView,region);
# Line 691  void DataArrayViewTestCase::testSlicing( Line 720  void DataArrayViewTestCase::testSlicing(
720      targetShape.push_back(9);      targetShape.push_back(9);
721    
722      // Create source and target views.      // Create source and target views.
723      DataArray source(sourceShape);      int len = DataArrayView::noValues(sourceShape);
724      DataArrayView sourceView=source.getView();      DataVector sourceData(len, 2.0, len);
725        DataArrayView sourceView(sourceData, sourceShape);
726      sourceView()=5;      sourceView()=5;
727    
728      DataArray target(targetShape);      len = DataArrayView::noValues(targetShape);
729      DataArrayView targetView=target.getView();      DataVector targetData(len, 2.0, len);
730        DataArrayView targetView(targetData, targetShape);
731    
732      // Copy source view to target view.      // Copy source view to target view.
733      targetView.copySliceFrom(sourceView,region);      targetView.copySliceFrom(sourceView,region);
# Line 732  void DataArrayViewTestCase::testSlicing( Line 763  void DataArrayViewTestCase::testSlicing(
763      DataArrayView::ShapeType targetShape = DataArrayView::getResultSliceShape(region);      DataArrayView::ShapeType targetShape = DataArrayView::getResultSliceShape(region);
764    
765      // Create source and target views.      // Create source and target views.
766      DataArray source(sourceShape);      int len = DataArrayView::noValues(sourceShape);
767      DataArrayView sourceView=source.getView();      DataVector sourceData(len, 2.0, len);
768        DataArrayView sourceView(sourceData, sourceShape);
769      int val=0;      int val=0;
770      for (int i=0;i<sourceShape[0];i++) {      for (int i=0;i<sourceShape[0];i++) {
771        for (int j=0;j<sourceShape[1];j++) {        for (int j=0;j<sourceShape[1];j++) {
# Line 745  void DataArrayViewTestCase::testSlicing( Line 777  void DataArrayViewTestCase::testSlicing(
777        }        }
778      }      }
779    
780      DataArray target(targetShape);      len = DataArrayView::noValues(targetShape);
781      DataArrayView targetView=target.getView();      DataVector targetData(len, 2.0, len);
782        DataArrayView targetView(targetData, targetShape);
783    
784      // Copy source view to target view.      // Copy source view to target view.
785      targetView.copySlice(sourceView,region);      targetView.copySlice(sourceView,region);
# Line 787  void DataArrayViewTestCase::testSlicing( Line 820  void DataArrayViewTestCase::testSlicing(
820      targetShape.push_back(2);      targetShape.push_back(2);
821    
822      // Create source and target views.      // Create source and target views.
823      DataArray source(sourceShape);      int len = DataArrayView::noValues(sourceShape);
824      DataArrayView sourceView=source.getView();      DataVector sourceData(len, 2.0, len);
825        DataArrayView sourceView(sourceData, sourceShape);
826      int val=0;      int val=0;
827      for (int i=0;i<sourceShape[0];i++) {      for (int i=0;i<sourceShape[0];i++) {
828        for (int j=0;j<sourceShape[1];j++) {        for (int j=0;j<sourceShape[1];j++) {
# Line 800  void DataArrayViewTestCase::testSlicing( Line 834  void DataArrayViewTestCase::testSlicing(
834        }        }
835      }      }
836    
837      DataArray target(targetShape);      len = DataArrayView::noValues(targetShape);
838      DataArrayView targetView=target.getView();      DataVector targetData(len, 2.0, len);
839        DataArrayView targetView(targetData, targetShape);
840    
841      // Copy source view to target view.      // Copy source view to target view.
842      targetView.copySlice(sourceView,region);      targetView.copySlice(sourceView,region);
# Line 841  void DataArrayViewTestCase::testSlicing( Line 876  void DataArrayViewTestCase::testSlicing(
876      targetShape.push_back(2);      targetShape.push_back(2);
877    
878      // Create source and target views.      // Create source and target views.
879      DataArray source(sourceShape);      int len = DataArrayView::noValues(sourceShape);
880      DataArrayView sourceView=source.getView();      DataVector sourceData(len, 2.0, len);
881        DataArrayView sourceView(sourceData, sourceShape);
882      int val=0;      int val=0;
883      for (int i=0;i<sourceShape[0];i++) {      for (int i=0;i<sourceShape[0];i++) {
884        for (int j=0;j<sourceShape[1];j++) {        for (int j=0;j<sourceShape[1];j++) {
# Line 854  void DataArrayViewTestCase::testSlicing( Line 890  void DataArrayViewTestCase::testSlicing(
890        }        }
891      }      }
892    
893      DataArray target(targetShape);      len = DataArrayView::noValues(targetShape);
894      DataArrayView targetView=target.getView();      DataVector targetData(len, 2.0, len);
895        DataArrayView targetView(targetData, targetShape);
896    
897      // Copy source view to target view.      // Copy source view to target view.
898      targetView.copySlice(sourceView,region);      targetView.copySlice(sourceView,region);
# Line 894  void DataArrayViewTestCase::testSlicing( Line 931  void DataArrayViewTestCase::testSlicing(
931      targetShape.push_back(2);      targetShape.push_back(2);
932    
933      // Create source and target views.      // Create source and target views.
934      DataArray source(sourceShape);      int len = DataArrayView::noValues(sourceShape);
935      DataArrayView sourceView=source.getView();      DataVector sourceData(len, 2.0, len);
936        DataArrayView sourceView(sourceData, sourceShape);
937      int val=0;      int val=0;
938      for (int i=0;i<sourceShape[0];i++) {      for (int i=0;i<sourceShape[0];i++) {
939        for (int j=0;j<sourceShape[1];j++) {        for (int j=0;j<sourceShape[1];j++) {
# Line 907  void DataArrayViewTestCase::testSlicing( Line 945  void DataArrayViewTestCase::testSlicing(
945        }        }
946      }      }
947    
948      DataArray target(targetShape);      len = DataArrayView::noValues(targetShape);
949      DataArrayView targetView=target.getView();      DataVector targetData(len, 2.0, len);
950        DataArrayView targetView(targetData, targetShape);
951    
952      // Copy source view to target view.      // Copy source view to target view.
953      targetView.copySlice(sourceView,region);      targetView.copySlice(sourceView,region);
# Line 946  void DataArrayViewTestCase::testSlicing( Line 985  void DataArrayViewTestCase::testSlicing(
985      DataArrayView::ShapeType targetShape;      DataArrayView::ShapeType targetShape;
986    
987      // Create source and target views.      // Create source and target views.
988      DataArray source(sourceShape);      int len = DataArrayView::noValues(sourceShape);
989      DataArrayView sourceView=source.getView();      DataVector sourceData(len, 2.0, len);
990        DataArrayView sourceView(sourceData, sourceShape);
991      int val=0;      int val=0;
992      for (int i=0;i<sourceShape[0];i++) {      for (int i=0;i<sourceShape[0];i++) {
993        for (int j=0;j<sourceShape[1];j++) {        for (int j=0;j<sourceShape[1];j++) {
# Line 959  void DataArrayViewTestCase::testSlicing( Line 999  void DataArrayViewTestCase::testSlicing(
999        }        }
1000      }      }
1001    
1002      DataArray target(targetShape);      len = DataArrayView::noValues(targetShape);
1003      DataArrayView targetView=target.getView();      DataVector targetData(len, 2.0, len);
1004        DataArrayView targetView(targetData, targetShape);
1005    
1006      // Copy source view to target view.      // Copy source view to target view.
1007      targetView.copySlice(sourceView,region);      targetView.copySlice(sourceView,region);
# Line 998  void DataArrayViewTestCase::testSlicing( Line 1039  void DataArrayViewTestCase::testSlicing(
1039      targetShape.push_back(90);      targetShape.push_back(90);
1040    
1041      // Create source and target views.      // Create source and target views.
1042      DataArray source(sourceShape);      int len = DataArrayView::noValues(sourceShape);
1043      DataArrayView sourceView=source.getView();      DataVector sourceData(len, 2.0, len);
1044        DataArrayView sourceView(sourceData, sourceShape);
1045      int val=0;      int val=0;
1046      for (int i=0;i<sourceShape[0];i++) {      for (int i=0;i<sourceShape[0];i++) {
1047        for (int j=0;j<sourceShape[1];j++) {        for (int j=0;j<sourceShape[1];j++) {
# Line 1011  void DataArrayViewTestCase::testSlicing( Line 1053  void DataArrayViewTestCase::testSlicing(
1053        }        }
1054      }      }
1055    
1056      DataArray target(targetShape);      len = DataArrayView::noValues(targetShape);
1057      DataArrayView targetView=target.getView();      DataVector targetData(len, 2.0, len);
1058        DataArrayView targetView(targetData, targetShape);
1059    
1060      // Copy source view to target view.      // Copy source view to target view.
1061      targetView.copySliceFrom(sourceView,region);      targetView.copySliceFrom(sourceView,region);
# Line 1050  void DataArrayViewTestCase::testSlicing( Line 1093  void DataArrayViewTestCase::testSlicing(
1093      targetShape.push_back(90);      targetShape.push_back(90);
1094    
1095      // Create source and target views.      // Create source and target views.
1096      DataArray source(sourceShape);      int len = DataArrayView::noValues(sourceShape);
1097      DataArrayView sourceView=source.getView();      DataVector sourceData(len, 2.0, len);
1098        DataArrayView sourceView(sourceData, sourceShape);
1099      sourceView()=5;      sourceView()=5;
1100    
1101      DataArray target(targetShape);      len = DataArrayView::noValues(targetShape);
1102      DataArrayView targetView=target.getView();      DataVector targetData(len, 2.0, len);
1103        DataArrayView targetView(targetData, targetShape);
1104    
1105      // Copy source view to target view.      // Copy source view to target view.
1106      targetView.copySliceFrom(sourceView,region);      targetView.copySliceFrom(sourceView,region);
# Line 1698  void DataArrayViewTestCase::testMatMult( Line 1743  void DataArrayViewTestCase::testMatMult(
1743    
1744      DataArrayView::ValueType resultData(DataArrayView::noValues(resultShape),0);      DataArrayView::ValueType resultData(DataArrayView::noValues(resultShape),0);
1745      DataArrayView resultDataView(resultData,resultShape);      DataArrayView resultDataView(resultData,resultShape);
1746      
1747      cout << "\tTest matrix multiplication.";      cout << "\tTest matrix multiplication.";
1748      double aValue=0.0;      double aValue=0.0;
1749      for (int i=0;i<leftShape[0];i++) {      for (int i=0;i<leftShape[0];i++) {

Legend:
Removed from v.1312  
changed lines
  Added in v.1387

  ViewVC Help
Powered by ViewVC 1.1.26