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

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

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

revision 121 by jgs, Fri May 6 04:26:16 2005 UTC revision 122 by jgs, Thu Jun 9 05:38:05 2005 UTC
# Line 1735  void DataArrayViewTestCase::testUnaryOp( Line 1735  void DataArrayViewTestCase::testUnaryOp(
1735      // constructor      // constructor
1736      DataArrayView dataView(data,shape);      DataArrayView dataView(data,shape);
1737    
1738        double tmp;
1739      // step the view along each data point in the underlying data      // step the view along each data point in the underlying data
1740      for (int p=0;p<npoints;p++) {      for (int p=0;p<npoints;p++) {
1741    
# Line 1745  void DataArrayViewTestCase::testUnaryOp( Line 1746  void DataArrayViewTestCase::testUnaryOp(
1746        dataView.unaryOp((UnaryDFunPtr)std::sin);        dataView.unaryOp((UnaryDFunPtr)std::sin);
1747    
1748        // check the results        // check the results
1749        assert(dataView()==std::sin((double)p));        tmp = std::sin((double)p);
1750          assert(dataView()==tmp);
1751    
1752        if (p<npoints-1) {        if (p<npoints-1) {
1753          dataView.incrOffset();          dataView.incrOffset();
# Line 2071  void DataArrayViewTestCase::testBinaryOp Line 2073  void DataArrayViewTestCase::testBinaryOp
2073        // apply a binary operation to the data point        // apply a binary operation to the data point
2074        dataView.binaryOp(5.8,multiplies<double>());        dataView.binaryOp(5.8,multiplies<double>());
2075    
2076          double tmp;
2077        // check the results        // check the results
2078        for (int i=0;i<shape[0];i++) {        for (int i=0;i<shape[0];i++) {
2079          for (int j=0;j<shape[1];j++) {          for (int j=0;j<shape[1];j++) {
2080            assert(dataView(i,j)==5.8*dataView.index(i,j));            tmp=5.8*dataView.index(i,j);
2081              assert(dataView(i,j)==tmp);
2082          }          }
2083        }        }
2084    
# Line 2121  void DataArrayViewTestCase::testBinaryOp Line 2125  void DataArrayViewTestCase::testBinaryOp
2125        // apply a binary operation to the data point        // apply a binary operation to the data point
2126        dataView.binaryOp(5.4,multiplies<double>());        dataView.binaryOp(5.4,multiplies<double>());
2127    
2128          double tmp;
2129        // check the results        // check the results
2130        for (int i=0;i<shape[0];i++) {        for (int i=0;i<shape[0];i++) {
2131          for (int j=0;j<shape[1];j++) {          for (int j=0;j<shape[1];j++) {
2132            for (int k=0;k<shape[2];k++) {            for (int k=0;k<shape[2];k++) {
2133              for (int l=0;l<shape[3];l++) {              for (int l=0;l<shape[3];l++) {
2134                assert(dataView(i,j,k,l)==5.4*dataView.index(i,j,k,l));                tmp=5.4*dataView.index(i,j,k,l);
2135                  assert(dataView(i,j,k,l)==tmp);
2136              }              }
2137            }            }
2138          }          }

Legend:
Removed from v.121  
changed lines
  Added in v.122

  ViewVC Help
Powered by ViewVC 1.1.26