/[escript]/branches/schroedinger/escript/test/DataMathsTestCase.cpp
ViewVC logotype

Diff of /branches/schroedinger/escript/test/DataMathsTestCase.cpp

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

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

Legend:
Removed from v.1925  
changed lines
  Added in v.1926

  ViewVC Help
Powered by ViewVC 1.1.26