/[escript]/trunk/escript/test/DataExpandedTestCase.cpp
ViewVC logotype

Diff of /trunk/escript/test/DataExpandedTestCase.cpp

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

revision 109 by jgs, Wed Dec 15 07:08:39 2004 UTC revision 110 by jgs, Mon Feb 14 04:14:42 2005 UTC
# Line 527  void DataExpandedTestCase::testSliceSett Line 527  void DataExpandedTestCase::testSliceSett
527    
528  }  }
529    
530    void DataExpandedTestCase::testRefValue() {
531    
532      cout << endl;
533    
534      cout << "\tTest DataExpanded refValue methods." << endl;
535    
536      //
537      // Create a rank 1 data array to create a DataExpanded object
538      DataArrayView::ShapeType shape;
539      shape.push_back(3);
540      DataArrayView::ValueType data(DataArrayView::noValues(shape),0);
541      DataArrayView dataView(data,shape);
542    
543      //
544      // Create another DataArray object to pass to refValue methods
545      DataArray data2(dataView);
546    
547      //
548      // Create a DataExpanded object
549      dataView(0)=0.0;
550      dataView(1)=1.0;
551      dataView(2)=2.0;
552      DataExpanded dataExp(dataView,FunctionSpace());
553    
554      //
555      // Try out ref value methods
556    
557      dataExp.getRefValue(1,data2);
558    
559      // check the values loaded into data2 by getRefValue
560      // match the values in dataExp
561      assert(data2.getView()(0)==0.0);
562      assert(data2.getView()(1)==1.0);
563      assert(data2.getView()(2)==2.0);
564    
565      data2.getView()(0)=3.0;
566      data2.getView()(1)=4.0;
567      data2.getView()(2)=5.0;
568    
569      dataExp.setRefValue(1,data2);
570    
571      // check the values now in dataExp match the values
572      // that were supplied in data2
573      assert(dataExp.getPointDataView()(0)==3.0);
574      assert(dataExp.getPointDataView()(1)==4.0);
575      assert(dataExp.getPointDataView()(2)==5.0);
576    
577      cout << endl;
578    
579    }
580    
581  TestSuite* DataExpandedTestCase::suite ()  TestSuite* DataExpandedTestCase::suite ()
582  {  {
583    //    //
# Line 539  TestSuite* DataExpandedTestCase::suite ( Line 590  TestSuite* DataExpandedTestCase::suite (
590    testSuite->addTest (new TestCaller< DataExpandedTestCase>("testSlicing3",&DataExpandedTestCase::testSlicing3));    testSuite->addTest (new TestCaller< DataExpandedTestCase>("testSlicing3",&DataExpandedTestCase::testSlicing3));
591    testSuite->addTest (new TestCaller< DataExpandedTestCase>("testSliceSetting",&DataExpandedTestCase::testSliceSetting));    testSuite->addTest (new TestCaller< DataExpandedTestCase>("testSliceSetting",&DataExpandedTestCase::testSliceSetting));
592    testSuite->addTest (new TestCaller< DataExpandedTestCase>("testSliceSetting2",&DataExpandedTestCase::testSliceSetting2));    testSuite->addTest (new TestCaller< DataExpandedTestCase>("testSliceSetting2",&DataExpandedTestCase::testSliceSetting2));
593      testSuite->addTest (new TestCaller< DataExpandedTestCase>("testRefValue",&DataExpandedTestCase::testRefValue));
594    return testSuite;    return testSuite;
595  }  }

Legend:
Removed from v.109  
changed lines
  Added in v.110

  ViewVC Help
Powered by ViewVC 1.1.26