Remove 'test' Directory
Jeffrey Oldham
oldham at codesourcery.com
Thu Oct 4 18:15:02 UTC 2001
Stephen, OK to commit this patch?
This patch removes the four tests in the Pooma 'test' directory. If
this is not acceptable, please send email to
pooma-dev at pooma.codesourcery.com stating what should be done with
these test programs, e.g., move them into src/.../tests/ directories.
2001-10-04 Jeffrey D. Oldham <oldham at codesourcery.com>
* Domain/Loc/Characteristics/LocCharacteristics.cpp: Remove this
stale file.
* Domain/NewDomain/Constructors/NewDomainConstructor.cpp: Likewise.
* Domain/Range/Constructors/RangeConstructor.cpp: Likewise.
* Domain/Range/Constructors/makefile: Likewise.
* Engine/BrickEngine/BrickEngine/BrickEngineTest.cpp: Likewise.
Nothing to test.
Applied to mainline.
Approved by ???you???
Thanks,
Jeffrey D. Oldham
oldham at codesourcery.com
-------------- next part --------------
Index: Domain/Loc/Characteristics/LocCharacteristics.cpp
===================================================================
RCS file: LocCharacteristics.cpp
diff -N LocCharacteristics.cpp
*** /tmp/cvsm6VP8z Thu Oct 4 12:11:21 2001
--- /dev/null Fri Mar 23 21:37:44 2001
***************
*** 1,315 ****
- // -*- C++ -*-
- //--------------------------------------------------------------------
-
- // Loc Characteristics Component Test Code
- //--------------------------------------------------------------------
-
- #include "Pooma/Pooma.h"
- #include "Domain/Loc.h"
- #include <iostream.h>
- #include <string.h>
- #include <iomanip.h>
-
- void reportResults(int n, char *test, bool testStatus)
- {
- char* statusString = "passed";
- if(!testStatus) statusString = "failed";
- cout << " Test " << setw(3) << n << ", "
- << setw(10) << test << ": " << statusString << "\n";
- }
-
-
-
- void uncaughtErrorReport(const char *what, int n)
- {
- cerr << "\nAck! Caught assertion during test # " << n << ":" << endl\
- ;
- cerr << what << endl;
- }
-
- template<class T>
- Loc<1> testElement(const T &dom, int no) {
- //get the nth element of dom, and store it in a separte variable
- // T::OneDomain_t singleElem = dom[no];
- Loc<1> singleElem = dom[no];
- return singleElem;
- }
-
- // template<class T>
- // void testDom(const T &dom) {
- // //get the dom, and store it in a separte variable
- // T::Domain_t singleDomain = dom;
- // cout << "Domain " << singleDomain << endl;
- // //return singleDomain;
- // }
-
-
- template <class T1, class T2>
- struct TypeMatchTester
- {
- static const bool Result = false;
- };
-
-
- template <class T>
- struct TypeMatchTester<T,T>
- {
- static const bool Result = true;
- };
-
-
- typedef Loc<1>::Domain_t DTest_t;
- typedef Loc<1>::Element_t ETest_t;
- typedef Loc<1>::OneDomain_t ODTest_t;
-
-
- main(int argc, char *argv[]) {
-
- Pooma::initialize( argc, argv );
-
- int debug = 0;
- int testNumber = 0;
- bool testStatus;
-
- if ((argc > 1) && (!strcmp(argv[1],"-d"))) debug = 1;
- cout << "\n"
- << " =============================================================\n"
- << " Domain test for Characterists and Interface on Loc<N> object \n"
- << " =============================================================\n"
- << endl;
-
- if (debug){
- cout << "=========================DEBUG=================================="
- << endl;
- cout << endl;
- cout << "Starting domain test for Characterists and Interface on ";
- cout << " Loc<N> object" << endl;
- cout << "Loc objects represent a single point." << endl;
- cout << endl;
- cout << "first() : the single point in the Loc object" << endl;
- cout << "last() : same as first" << endl;
- cout << "stride() : this is always 1 " << endl;
- cout << "min() : same as first" << endl;
- cout << "max() : same as first" << endl;
- cout << "length() : this is always 1 " << endl;
- cout << "size() : total volume size of the domain, should " ;
- cout << "always be one "<< endl;
- cout << "empty() :this should always be false " << endl;
- cout << "dimensions : the number N " << endl;
- cout << "loopAware : this should be 0 " << endl;
- cout << "singleValued : this should be 1 " << endl;
- cout << "unitStride : this should be 1 " << endl;
- cout << endl;
- }
-
- Loc<4>Empty;
- Loc<1> n1i(-1);
- Loc<2> n2i(-1,-2);
- Loc<3> n3i(-1,-2,-3);
- Loc<4> n4i(-1,-2,-3,-4);
- Loc<5> n5i(-1,-2,-3,-4,-5);
- Loc<6> n6i(-1,-2,-3,-4,-5,-6);
-
-
- Loc<1> a1i(1);
- Loc<2> a2i(1,2);
- Loc<2> a2ia(1);
- Loc<3> a3i(1,2,3);
- Loc<3> a3ia(1,2);
- Loc<4> a4i(1,2,3,4);
- Loc<4> a4ia(1,2,3);
- Loc<5> a5i(a3i,a2i);
- Loc<5> a5ia(1,2,3,4);
- Loc<6> a6i(1,2,3,4,5,6);
- Loc<6> a6ia(1,2,3,4);
-
- //Can not use floating point values for endpoints.
- // Loc<1> f1i(1.1);
-
- //If you leave a empty endpoint it will not be intialized to zero but
- //will have random values.
- //Loc<2>(1) will give you the 001:*** where * is any random value
-
- cout << endl;
-
-
- Loc<1> a1 = Loc<1>(1);
- //Loc<1> b1(Loc<1>());
- Loc<2> b2(a1,Loc<1>(2));
- Loc<3> b3(b2,Loc<1>(3));
- Loc<4> b4(b3,Loc<1>(4));
- Loc<5> b5(b4,Loc<1>(5));
- Loc<6> b6(b5,Loc<1>(6));
- Loc<6> b6a(b3,b2,Loc<1>(6));
-
- //OneDomain_t ODT = b2[0];
- //Domain_t DT = b5;
- if (debug){
-
- cout << endl;
-
- cout << " a5i = " << a5i << endl;
- cout << " a5i[0].length() = " << a5i[0].length() << endl;
- cout << " a5i[1].length() = " << a5i[1].length() << endl;
- cout << " a5i[2].length() = " << a5i[2].length() << endl;
- cout << " a5i[3].length() = " << a5i[3].length() << endl;
- cout << " a5i[4].length() = " << a5i[4].length() << endl;
-
- cout << " a5i[0].first() = " << a5i[0].first() << endl;
- cout << " a5i[1].first() = " << a5i[1].first() << endl;
- cout << " a5i[2].first() = " << a5i[2].first() << endl;
- cout << " a5i[3].first() = " << a5i[3].first() << endl;
- cout << " a5i[4].first() = " << a5i[4].first() << endl;
-
- cout << " a5i[0].last() = " << a5i[0].last() << endl;
- cout << " a5i[1].last() = " << a5i[1].last() << endl;
- cout << " a5i[2].last() = " << a5i[2].last() << endl;
- cout << " a5i[3].last() = " << a5i[3].last() << endl;
- cout << " a5i[4].last() = " << a5i[4].last() << endl;
-
- cout << " a5i[0].stride() = " << a5i[0].stride() << endl;
- cout << " a5i[1].stride() = " << a5i[1].stride() << endl;
- cout << " a5i[2].stride() = " << a5i[2].stride() << endl;
- cout << " a5i[3].stride() = " << a5i[3].stride() << endl;
- cout << " a5i[4].stride() = " << a5i[4].stride() << endl;
-
- cout << " a5i[0].min() = " << a5i[0].min() << endl;
- cout << " a5i[1].min() = " << a5i[1].min() << endl;
- cout << " a5i[2].min() = " << a5i[2].min() << endl;
- cout << " a5i[3].min() = " << a5i[3].min() << endl;
- cout << " a5i[4].min() = " << a5i[4].min() << endl;
-
- cout << " a5i[0].max() = " << a5i[0].max() << endl;
- cout << " a5i[1].max() = " << a5i[1].max() << endl;
- cout << " a5i[2].max() = " << a5i[2].max() << endl;
- cout << " a5i[3].max() = " << a5i[3].max() << endl;
- cout << " a5i[4].max() = " << a5i[4].max() << endl;
-
- cout << " a5i.dimensions() = " << a5i.dimensions << endl;
- //cout << " a5i.loopAware() = " << a5i.loopAware() << endl;
- //cout << " a5i.singleValued()= " << a5i.singleValued() << endl;
- //cout << " a5i.unitStride() = " << a5i.unitStride() << endl;
-
- cout << endl;
-
- cout << " after a1 = 1 : a1 = " << a1 << endl;
- cout << " 2D multiple Loc<2> b2(a1,Loc<1>(2)) = " << b2 << endl;
- cout << " 3D multiple Loc<3> b3(b2,Loc<1>(3)) = " << endl;
- cout << " " << b3 << endl;
- cout << " 4D multiple Loc<4> b4(b3,Loc<1>(4)) = " << endl;
- cout << " " << b4 << endl;
- cout << " 5D multiple Loc<5> b5(b4,Loc<1>(5)) = " << endl;
- cout << " " << b5 << endl;
- cout << " 6D multiple Loc<6> b6(b5,Loc<1>(6)) = " << endl;
- cout << " " << b6 << endl;
- cout << " 6D multiple Loc<6> b6a(b3,b2,Loc<1>(6))= " << endl;
- cout << " " << b6a << endl;
- cout << " 6D multiple Loc<6> b6a(b3,b2,Loc<1>(6)).size = "
- << b6a.size() << endl;
- cout << " 6D multiple Loc<6> b6a(b3,b2,Loc<1>(6)).size = " <<
- b6a.empty() << endl;
- // cout << " OneDomain = " << OneDomain << endl;
- cout << " Empty = " << Empty << endl;
- cout << " Empty.size = " << Empty.size() << endl;
- cout << " Empty.empty = " << Empty.empty() << endl;
-
-
- cout << "=========================END DEBUG============================="
- << endl;
- cout << endl;
- }
- try {
- testStatus = (b6a.dimensions == 6);
- testStatus = (b5.dimensions == 5) && testStatus;
- testStatus = (b4.dimensions == 4) && testStatus;
- testStatus = (b3.dimensions == 3) && testStatus;
- testStatus = (b2.dimensions == 2) && testStatus;
- reportResults(testNumber++,"Loc<>.dimensions ",testStatus);
- testStatus = (b6a[0].stride() == b6a.size()) && testStatus;
- testStatus = (b5[0].stride() == b5.size()) && testStatus;
- testStatus = (b4[0].stride() == b4.size()) && testStatus;
- reportResults(testNumber++,"Loc<>.size ",testStatus);
- testStatus = (Empty.empty() == 0);
- testStatus = (b6a.empty() == 0) && testStatus;
- reportResults(testNumber++,"Loc<>.empty ",testStatus);
- testStatus = a5i[0].stride();
- testStatus = a5i[1].stride() && testStatus;
- testStatus = a5i[2].stride() && testStatus;
- testStatus = a5i[3].stride() && testStatus;
- testStatus = a5i[4].stride() && testStatus;
- reportResults(testNumber++,"Loc<>.stride ",testStatus);
- testStatus = (b6a[0].first() == b6a[0].last());
- testStatus = (b6a[1].first() == b6a[1].last()) && testStatus;
- testStatus = (b6a[2].first() == b6a[2].last()) && testStatus;
- testStatus = (b6a[3].first() == b6a[3].last()) && testStatus;
- testStatus = (b6a[4].first() == b6a[4].last()) && testStatus;
- testStatus = (b6a[5].first() == b6a[5].last()) && testStatus;
- reportResults(testNumber++,"Loc<>.first/last ",testStatus);
- testStatus = (b5[0].first() == b5[0].min());
- testStatus = (b5[1].first() == b5[1].min()) && testStatus;
- testStatus = (b5[2].first() == b5[2].min()) && testStatus;
- testStatus = (b5[3].first() == b5[3].min()) && testStatus;
- testStatus = (b5[4].first() == b5[4].min()) && testStatus;
- reportResults(testNumber++,"Loc<>.first/min ",testStatus);
- testStatus = (b4[0].first() == b4[0].max());
- testStatus = (b4[1].first() == b4[1].max()) && testStatus;
- testStatus = (b4[2].first() == b4[2].max()) && testStatus;
- testStatus = (b4[3].first() == b4[3].max()) && testStatus;
- reportResults(testNumber++,"Loc<>.first/max ",testStatus);
- testStatus = (b3[0].stride() == b3[0].length());
- testStatus =(b3[1].stride() == b3[1].length()) && testStatus;
- testStatus =(b3[2].stride() == b3[2].length()) && testStatus;
- reportResults(testNumber++,"Loc<>.length ",testStatus);
- testStatus = (!b6a.loopAware);
- testStatus = (!b5.loopAware) && testStatus;
- testStatus = (!b4.loopAware) && testStatus;
- testStatus = (!b3.loopAware) && testStatus;
- testStatus = (!b2.loopAware) && testStatus;
- reportResults(testNumber++,"Loc<>.loopAware ",testStatus);
- testStatus = (b6a.singleValued);
- testStatus = (b5.singleValued) && testStatus;
- testStatus = (b4.singleValued) && testStatus;
- testStatus = (b3.singleValued) && testStatus;
- testStatus = (b2.singleValued) && testStatus;
- reportResults(testNumber++,"Loc<>.singleValued ",testStatus);
- testStatus = (b6a.unitStride);
- testStatus = (b5.unitStride) && testStatus;
- testStatus = (b4.unitStride) && testStatus;
- testStatus = (b3.unitStride) && testStatus;
- testStatus = (b2.unitStride) && testStatus ;
- reportResults(testNumber++,"Loc<>.unitStride ",testStatus);
- testStatus = TypeMatchTester<DTest_t,Loc<1>:: Domain_t>::Result;
- reportResults(testNumber++,"Typedef Domain_t ", testStatus);
- testStatus = TypeMatchTester<ETest_t,Loc<1>:: Element_t>::Result
- && testStatus;
- reportResults(testNumber++,"Typedef Elemant_t ", testStatus);
- testStatus = TypeMatchTester<ODTest_t,Loc<1>:: OneDomain_t>::Result
- && testStatus;
- reportResults(testNumber++,"Typedef OneDomain_t ", testStatus);
- testStatus = !TypeMatchTester<DTest_t,Loc<1>:: Element_t>::Result
- && testStatus;
- reportResults(testNumber++,"Typedef Domain_t ", testStatus);
- testStatus = !TypeMatchTester<ETest_t,Loc<1>:: Domain_t>::Result
- && testStatus;
- reportResults(testNumber++,"Typedef Elemant_t ", testStatus);
- testStatus = !TypeMatchTester<ODTest_t,Loc<1>:: Element_t>::Result
- && testStatus;
- reportResults(testNumber++,"Typedef OneDomain_t ", testStatus);
- testStatus = (a1i == testElement(a4i[0],0));
- testStatus = (b6a[5] == testElement(a6i[5],5)) && testStatus;
- testStatus = (b6a[4] == testElement(b4[1],1)) && testStatus;
- testStatus = (b6a[4] != testElement(b4[2],2)) && testStatus;
- reportResults(testNumber++,"OneDomain ",testStatus);
- }
-
- catch (const char *err)
- { uncaughtErrorReport(err,testNumber); }
- catch(const Pooma::Assertion &err)
- {uncaughtErrorReport(err.what(),testNumber); }
- catch(...)
- { cerr << "Unknown exception!" << endl; }
- cout << endl;
-
- Pooma::finalize();
- }
-
--- 0 ----
Index: Domain/NewDomain/Constructors/NewDomainConstructor.cpp
===================================================================
RCS file: NewDomainConstructor.cpp
diff -N NewDomainConstructor.cpp
*** /tmp/cvsHWUAsL Thu Oct 4 12:11:21 2001
--- /dev/null Fri Mar 23 21:37:44 2001
***************
*** 1,224 ****
- // -*- C++ -*-
- //---------------------------------------------------------------------
-
- // NewDomainConstructor Component Test Code
- //---------------------------------------------------------------------
-
- #include <Domain/Loc.h>
- #include <Domain/Interval.h>
- #include <Domain/Range.h>
- #include <iostream.h>
- #include <string.h>
- #include <iomanip.h>
-
-
- void reportResults(int n, char *test, bool testStatus)
- {
- char* statusString = "passed";
- if(!testStatus) statusString = "failed";
- cout << " Test " << setw(3) << n << ", "
- << setw(10) << test << ": " << statusString << "\n";
- }
-
- void uncaughtErrorReport(const char *what, int n)
- {
- cerr << "\nAck! Caught assertion during test # " << n << ":" << endl;
- cerr << what << endl;
- }
-
- template<class T>
- Interval<1> testElement(const T &dom, int no) {
- //get the nth element of dom, and store it in a separte variable
- T::OneDomain_t singleElem = dom[no];
- return singleElem;
- }
-
- template <class T1, class T2>
- struct TypeMatchTester
- {
- static const bool Result = false;
- };
-
- template <class T>
- struct TypeMatchTester<T,T>
- {
- static const bool Result = true;
- };
-
- //typedef NewDomain<>::Type_t TTest_t;
- //typedef NewDomain<>::FullType_t FTest_t;
- //typedef NewDomain<>::SliceType_t STest_t;
-
-
- main(int argc, char *argv[]) {
-
- int debug = 0;
- int testNumber = 0;
- bool testStatus;
-
- if ((argc > 1) && (!strcmp(argv[1],"-d"))) debug = 1;
- cout << "\n"
- << " ==============================================================\n"
- << " Domain test for Constructors on NewDomain<N> object \n"
- << " ==============================================================\n"
- << endl;
-
- if (debug){
- cout << "=========================DEBUG==================================="
- << endl;
- cout << endl;
- cout << "Starting domain test for Constructors on NewDomain<N> object"
- << endl;
- cout << "A set of simple structs which tell how to combine." << endl;
- cout << endl;
- cout << " different Domain object together. TThey are named " << endl;
- cout << "NewDomain1 - NewDoamin7 and are templated on from 1 .. 7 "
- << endl;
- cout << "different domain types. If you have a domain as the last "
- << endl;
- cout << "argrment you must have a space between this argument and the"
- << endl;
- cout << "last >,NewDomain2<Loc<1>,Loc<1> >::Type_t newdomain2; "
- << endl;
- }
- cout << endl;
- Loc<1> D1(1);
- Loc<1> D2(2);
- Range<2> R1(Interval<1>(5,10),Interval<1>(-1,100));
- Range<2> R2(Range<1>(5,10,5),Range<1>(-100,100,20));
- Interval<2> I1(Interval<1>(20,40),Interval<1>(-50,10));
- Interval<2> I2(Interval<1>(20,40),Loc<1>(-99));
- Range<2> R(Range<1>(1,1,1),999);
- NewDomain2<Loc<1>,int>::Type_t newdomain2;
-
- NewDomain2<Loc<1>,int>::Type_t newdomain2a =
- NewDomain2<Loc<1>,int>::combine(D1,2);
-
- NewDomain3<Loc<2>,Range<2>,int>::Type_t newdomain3;
- NewDomain3<Loc<2>,Range<2>,int>::Type_t newdomain3a =
- NewDomain3<Loc<2>,Range<2>,int>::combine(newdomain2a,R2,999);
-
- NewDomain4<Range<2>,Interval<2>,Loc<1>,Loc<1> >::Type_t newdomain4;
-
- NewDomain4<Range<2>,Interval<2>,Loc<1>,Loc<1> >::Type_t newdomain4a =
- NewDomain4<Range<2>,Interval<2>,Loc<1>,Loc<1> >::combine(R2,I2,D1,D2);
-
- NewDomain5<Loc<2>,Range<2>,int,Loc<4>,int>::Type_t newdomain5;
- NewDomain5<Loc<2>,Range<2>,int,Loc<4>,int>::Type_t newdomain5a =
- NewDomain5<Loc<2>,Range<2>,int,Loc<4>,int>::combine
- (newdomain2a,R2,999,Loc<4>(D1,D2,newdomain2a),999);
-
- NewDomain6<Loc<2>,Range<2>,int,Loc<4>,Loc<4>,int>::Type_t newdomain6;
- NewDomain6<Loc<2>,Range<2>,int,Loc<4>,Loc<4>,int>::Type_t newdomain6a =
- NewDomain6<Loc<2>,Range<2>,int,Loc<4>,Loc<4>,int>::combine
- (newdomain2a,R1,99,Loc<4>(newdomain2a,newdomain2a),Loc<4>
- (newdomain2a,newdomain2a),999);
-
- NewDomain7<Range<2>,Range<2>,Loc<1>,Loc<1>,Interval<2>,Interval<2>,
- int>::Type_t newdomain7;
-
- NewDomain7<Range<2>,Range<2>,Loc<1>,Loc<2>,Interval<2>,Interval<2>,
- Range<2> >::Type_t newdomain7a = NewDomain7<Range<2>,Range<2>,Loc<1>,
- Loc<2>,Interval<2>,Interval<2>,Range<2> >::combine(R1,R2,D1,newdomain2a,
- I1,I2,R2);
-
-
- if (debug){
- cout << "================================================================"
- << endl;
- cout << endl;
- cout << " NewDomain7<Range<2>,Range<2>,Loc<1>,Loc<2>,Interval<2>, Interval<2>,int>::combine(R1,R2,D1,newdomain2a,I1,I2,999) " << newdomain7a << endl;
- cout << " R1 " << R1 << endl;
- cout << " R2 " << R2 << endl;
- cout << " D1 " << D1 << endl;
- cout << " newdomain2a " << newdomain2a << endl;
- cout << " I1 " << I1 << endl;
- cout << " I2 " << I2 << endl;
- cout << " newdomain2 " << newdomain2 << endl;
- cout << " newdomain2a " << newdomain2a << endl;
- cout << " newdomain3 " << newdomain3 << endl;
- cout << " newdomain3a " << newdomain3a << endl;
- cout << " newdomain4 " << newdomain4 << endl;
- cout << " newdomain4a " << newdomain4a << endl;
- cout << " newdomain5 " << newdomain5 << endl;
- cout << " newdomain5a \n" << " " << newdomain5a << endl;
- cout << " newdomain6 \n " << " " << newdomain6 << endl;
- cout << " newdomain6a \n " << " " << newdomain6a << endl;
- cout << " newdomain7 \n " << " " << newdomain7 << endl;
- cout << " newdomain7a \n " << " " << newdomain7a << endl;
- cout << " newdomain2.dimensions " << newdomain2.dimensions << endl;
- cout << " newdomain3.dimensions " << newdomain3.dimensions << endl;
- cout << " newdomain4.dimensions " << newdomain4.dimensions << endl;
- cout << " newdomain5.dimensions " << newdomain5.dimensions << endl;
- cout << " newdomain6.dimensions " << newdomain6.dimensions << endl;
- cout << " newdomain7.dimensions " << newdomain7.dimensions << endl;
- cout << " newdomain2a.dimensions " << newdomain2a.dimensions << endl;
- cout << " newdomain3a.dimensions " << newdomain3a.dimensions << endl;
- cout << " newdomain4a.dimensions " << newdomain4a.dimensions << endl;
- cout << " newdomain5a.dimensions " << newdomain5a.dimensions << endl;
- cout << " newdomain6a.dimensions " << newdomain6a.dimensions << endl;
- cout << " newdomain7a.dimensions " << newdomain7a.dimensions << endl;
- cout << endl;
- cout << "================================================================" << endl;
- }
- cout << "Testing NewDomain<*> constructors methods:" << endl;
- cout << "----------------------------------------------------------" << endl;
- try {
-
- //----------------------------------------------------------------------
- // Test NewDomain Construtor
- //----------------------------------------------------------------------
-
- testStatus = (newdomain2.dimensions == 2);
- testStatus = (newdomain3.dimensions == 5) && testStatus;
- testStatus = (newdomain4.dimensions == 6) && testStatus;
- testStatus = (newdomain5.dimensions == 10) && testStatus;
- testStatus = (newdomain6.dimensions == 14) && testStatus;
- testStatus = (newdomain7.dimensions == 11) && testStatus;
- testStatus = (newdomain7a.dimensions == 13) && testStatus;
- reportResults(testNumber++,"Empty Construtor ",testStatus);
-
- //----------------------------------------------------------------------
- // Test Combine Construtor
- //----------------------------------------------------------------------
- testStatus = (newdomain2a[1] == 2 );
- testStatus = (newdomain3a[2] == R2[0]) && testStatus;
- testStatus = (newdomain4a[5] == Loc<1>(2)) && testStatus ;
- testStatus = (newdomain5a[4] == Loc<1>(999))&& testStatus ;
- testStatus = (newdomain6a[12] == D2) && testStatus;
- //testStatus = (newdomain7a[11] == Range<1>(-100,100,20)) && testStatus;
- reportResults(testNumber++,"Combine Construtor ",testStatus);
-
- //----------------------------------------------------------------------
- // Test Fill Construtor
- //----------------------------------------------------------------------
- NewDomain2<Loc<1>,int>::fill(newdomain2,D1,2);
- testStatus = (newdomain2a ==newdomain2 );
- NewDomain6<Loc<2>,Range<2>,int,Loc<4>,Loc<4>,int>::fill
- ( newdomain6,newdomain2a,R1,99,Loc<4>(newdomain2a,newdomain2a),Loc<4>
- (newdomain2a,newdomain2a),999);
- testStatus = (newdomain6a ==newdomain6 ) && testStatus;
- NewDomain5<Loc<2>,Range<2>,int,Loc<4>,int>::fill(
- newdomain5,newdomain2a,R2,999,Loc<4>(D1,D2,newdomain2a),999);
- testStatus = (newdomain5a == newdomain5) && testStatus ;
- reportResults(testNumber++,"Fill Construtor ",testStatus);
- } // end try
-
- catch (const char *err)
- { uncaughtErrorReport(err,testNumber); }
- catch(const Pooma::Assertion &err)
- {uncaughtErrorReport(err.what(),testNumber); }
- catch(...)
- { cerr << "Unknow exception!" << endl; }
- cout << endl;
-
-
- }
-
-
-
-
-
-
-
-
--- 0 ----
Index: Domain/Range/Constructors/RangeConstructor.cpp
===================================================================
RCS file: RangeConstructor.cpp
diff -N RangeConstructor.cpp
*** /tmp/cvspsACMW Thu Oct 4 12:11:21 2001
--- /dev/null Fri Mar 23 21:37:44 2001
***************
*** 1,217 ****
- // -*- C++ -*-
- //--------------------------------------------------------------------
-
- // Range Constructor Component Test Code
- //--------------------------------------------------------------------
-
- // include files
-
- #include "Pooma/Pooma.h"
- #include "Domain/Loc.h"
- #include "Domain/Range.h"
- #include "Domain/Interval.h"
- #include <iostream.h>
- #include <string.h>
- #include <iomanip.h>
-
- void reportResults(int n, char *test, bool testStatus)
- {
- char* statusString = "passed";
- if(!testStatus) statusString = "failed";
- cout << " Test " << setw(3) << n << ", "
- << setw(10) << test << ": " << statusString << "\n";
- }
-
- void uncaughtErrorReport(const char *what, int n)
- {
- cerr << "\nAck! Caught assertion during test # " << n << ":" << endl;
- cerr << what << endl;
- }
-
-
- main(int argc, char *argv[]) {
-
- Pooma::initialize( argc, argv );
-
- int debug = 0;
- int testNumber = 0;
- bool testStatus;
-
- if ((argc > 1) && (!strcmp(argv[1],"-d"))) debug = 1;
-
-
- cout << "\n"
- << " ==============================================================\n"
- << " Domain test for Constructors on Range<N> object \n"
- << " ==============================================================\n"
- << endl;
-
- if (debug){
- cout << "=========================DEBUG==================================="
- << endl;
- cout << "Range represents a sequence of integers [a,a+s,... b], with "
- << endl;
- cout << "endpoints a and b, and stride s. Each dimension is independent"
- << endl;
- cout << "of the other. The endpoints may be positive or negative." << endl;
- cout << endl;
- cout << "If you construct a Range with 2 dimensions [Range<2> a2i]" << endl;
- cout << "and only give it one value [Range<2> a2ia(1))] the second dimension" << endl;
- cout << "value will not be intitalized to 0 but will have ramdom junk. I"
- << endl;
- cout << "have not come up with a way to do a pass/fail on the feature."
- << endl;
- cout << "Float and Double values are truncated." << endl;
- }
-
- Range<1> a1(1);
- Range<1> a2(-3);
- Range<1> a3(3);
- Range<1> a4(4);
- Range<1> a5(-5);
- Range<1> a6(6);
-
- Range<1> a1i(1);
- Range<1> a1ia(1,5);
- Range<1> a1ib(0,5);
- Range<1> a1ic(0,6,2);
- Range<1> a1id(2,8,-3);
- Range<1> a1ie(0,10,2);
- Range<1> a1if(1,1001,100);
-
-
-
- if (debug){
- cout << "Range<1> Length Constructor for test."<< endl;
- cout << " 1D default Range<1> a1(1) " << a1 << endl;
- cout << " 1D default Range<1> a2(-3) " << a2 << endl;
- cout << " 1D default Range<1> a3(3) " << a3 << endl;
- cout << " 1D default Range<1> a4(4) " << a4 << endl;
- cout << " 1D default Range<1> a5(-5) " << a5 << endl;
- cout << " 1D default Range<1> a6(6) " << a6 << endl;
- cout << " 1D default Range<1> a1i(1) " << a1i << endl;
- cout << " 1D default Range<1> a1ia(1,5) " << a1ia << endl;
- cout << " 1D default Range<1> a1ib(0,5) " << a1ib << endl;
- cout << " 1D default Range<1> a1ic(0,6,2) " << a1ic << endl;
- cout << " 1D default Range<1> a1id(2,8,-3) " << a1id << endl;
- cout << " 1D default Range<1> a1ie(0,10,2) " << a1ie << endl;
- cout << " 1D default Range<1> a1if(1,1001,100) " << a1if << endl;
- cout << endl;
- }
-
- Range<1> n1(-100);
- Range<2> n2(Range<1>(-100,100,10),Range<1>(100,-100,10));
- Range<3> n3(n2,a1);
-
- Range<1> b1(a1if);
- Range<2> b2(b1,a1);
- Range<3> b3(b2,a3);
- Range<4> b4(b3,a4);
- Range<5> b5(b4,Range<1>(1,5));
- Range<6> b6(b5,a6);
-
- Loc<1> L1;
- L1 = 3;
- Interval<1> I1(1,5);
- Interval<2> I2(Interval<1>(0,200),I1);
- Range<2> RL2(L1,b1);
- Range<3> RL3(RL2,L1);
- Range<4> RL4(RL3,I1);
- Range<5> RL5(I2,RL3);
-
- Loc<1> NL1;
- NL1 = -3;
- Interval<1> NI1(-1,5);
- Interval<1> NI1a(-10,-5);
- Interval<2> NI2(NI1,NI1a);
- Range<2> NRL2(NI1,Interval<1>(-6,0));
- Range<3> NRL3(NRL2,NI1a);
- Range<5> NRL5(NL1,NRL2,NI1a);
- double D2 = 234.877;
- float F1 = 123.5464;
- Interval<1> FI1(-1,F1);
- Interval<1> DI2(-100,D2);
- Interval<3> DI3(FI1,Interval<2>(FI1,DI2));
-
- Range<6> FDR6(DI3,NI1a, DI2);
-
- if (debug){
- cout << " 1D default Range<1> b1(a1if) " << b1 << endl;
- cout << " 2D default Range<2> b2(b1,a1) " << b2 << endl;
- cout << " 3D default Range<3> b3(b2,a3) " << b3 << endl;
- cout << " 4D default Range<4> b4(b3,a4) " << endl;
- cout << " " << b4 << endl;
- cout << " 5D default Range<5> b5(b4,Range<1>(1,5)) " << endl;
- cout << " " << b5 << endl;
- cout << " 6D default Range<6> b6(b5,a6) " << endl;
- cout << " " << b6 << endl;
- cout << " 1D Negative Range<1> n1(-100) " << n1 << endl;
- cout << " 2D Negative Range<2> n2(Range<1>(-100,100,10)," << endl;
- cout << " Range<1>(100,-100,10)) " << n2 << endl;
- cout << " 3D Negative Range<3> n3(n2,a1) " << endl;
- cout << " " << n3 << endl;
-
- cout << " 2D Mixed object Range<2> RL2(Loc<1> L1,Range<2>b1 " << endl;
- cout << " " << RL2 << endl;
- cout << " 3D Mixed object Range<3> RL3(RL1,L1) " << endl;
- cout << " " << RL3 << endl;
- cout << " 4D Mixed object Range<4> RL4(RL3,I1) = " << endl;
- cout << " " << RL4 << endl;
- cout << " 5D Mixed object Range<5> RL5(I2,RL3) " << endl;
- cout << " " << RL5 << endl;
- cout << " 2D Mixed object Negative Range<2> NRL2(NI1,Interval<1>(-6,0)) "<< endl;
- cout << " " << NRL2 << endl;
- cout << " 3D Mixed object Negative Range<3> NRL3(NRL2,NI1a) " << endl;
- cout << " " << NRL3 << endl;
- cout << " 5D Mixed object Negative Range<5> NRL5(NL1,NRL2,NI1a) "
- << endl;
- cout << " " << NRL5 << endl;
- cout << " 6D Mixed object DF Range<6> FDR6(DI3,NI1a, DI2) "
- << endl;
- cout << " " << FDR6 << endl;
- cout << "=========================END DEBUG============================"
- << endl;
- cout << endl;
- }
- try {
- testStatus = (a3 == Range<1>(3));
- testStatus = (a1ic == Range<1>(0,6,2)) && testStatus;
- testStatus = (a1ie == Range<1>(0,10,2)) && testStatus;
- reportResults(testNumber++,"Default Construtor ",testStatus);
- testStatus = (n1[0] == Range<1>(-100)) && testStatus;
- testStatus = (n2[1] == Range<1>(100,-100,10)) && testStatus ;
- testStatus = (n3[1] ==Range<1>(100,-100,10))&& testStatus ;
- reportResults(testNumber++,"Negative Construtor ",testStatus);
- testStatus = (b1 == a1if) && testStatus ;
- testStatus = (b2[0] == b1) && testStatus;
- testStatus = (b3[2] == a3) && testStatus;
- testStatus = (b4[3] == a4 ) && testStatus;
- testStatus = (b5[4] == a1ia) && testStatus;
- testStatus = (b6[5] == a6) && testStatus;
- reportResults(testNumber++,"Multiple Construtor ",testStatus);
- testStatus = (RL2[0] == L1) && testStatus;
- testStatus = (RL3[2] == L1) && testStatus;
- reportResults(testNumber++,"Mixed Loc Constructor ",testStatus);
- testStatus = (RL4[3] == I1) && testStatus;
- testStatus = (RL5[1] == I1) && testStatus;
- reportResults(testNumber++,"Mixed Intergal Constructor ",testStatus);
- testStatus = (NRL2[0] == NI1) && testStatus;
- testStatus = (NRL3[2] == NI1a) && testStatus;
- reportResults(testNumber++,"Mixed Intergal Negative Constructor",testStatus);
- testStatus = (NRL5[0] == NL1) && testStatus;
- reportResults(testNumber++,"Mixed Loc Negative Constructor ",testStatus);
- testStatus = (FDR6[0] == FI1) && testStatus;
- reportResults(testNumber++,"Mixed Float/Double Constructor ",testStatus);
- }
-
- catch (const char *err)
- { uncaughtErrorReport(err,testNumber); }
- catch(const Pooma::Assertion &err)
- {uncaughtErrorReport(err.what(),testNumber); }
- catch(...)
- { cerr << "Unknown exception!" << endl; }
- cout << endl;
-
- Pooma::finalize();
- }
-
--- 0 ----
Index: Domain/Range/Constructors/makefile
===================================================================
RCS file: makefile
diff -N makefile
*** /tmp/cvsbALR67 Thu Oct 4 12:11:21 2001
--- /dev/null Fri Mar 23 21:37:44 2001
***************
*** 1,11 ****
- # Generated by mm.pl: Mon Mar 9 13:58:39 MST 1998
- # This file is user-editable
-
- PROJECT_ROOT = $(shell cd ../../../..; pwd)
- include $(PROJECT_ROOT)/config/head.mk
-
- default:: $(ODIR)/RangeConstructor
-
- $(ODIR)/RangeConstructor: $(ODIR)/RangeConstructor.o
- $(LinkToSuite)
- include $(SHARED_ROOT)/tail.mk
--- 0 ----
Index: Engine/BrickEngine/BrickEngine/BrickEngineTest.cpp
===================================================================
RCS file: BrickEngineTest.cpp
diff -N BrickEngineTest.cpp
*** /tmp/cvsVvudrj Thu Oct 4 12:11:21 2001
--- /dev/null Fri Mar 23 21:37:44 2001
***************
*** 1,3319 ****
- // ACL:license
- // ----------------------------------------------------------------------
- // This software and ancillary information (herein called "SOFTWARE")
- // called POOMA (Parallel Object-Oriented Methods and Applications) is
- // made available under the terms described here. The SOFTWARE has been
- // approved for release with associated LA-CC Number LA-CC-98-65.
- //
- // Unless otherwise indicated, this SOFTWARE has been authored by an
- // employee or employees of the University of California, operator of the
- // Los Alamos National Laboratory under Contract No. W-7405-ENG-36 with
- // the U.S. Department of Energy. The U.S. Government has rights to use,
- // reproduce, and distribute this SOFTWARE, and to allow others to do so.
- // The public may copy and use this SOFTWARE, FOR NONCOMMERCIAL USE ONLY,
- // without charge, provided that this Notice and any statement of
- // authorship are reproduced on all copies. Neither the Government nor
- // the University makes any warranty, express or implied, or assumes any
- // liability or responsibility for the use of this SOFTWARE.
- //
- // If SOFTWARE is modified to produce derivative works, such modified
- // SOFTWARE should be clearly marked, so as not to confuse it with the
- // version available from LANL.
- //
- // For more information about POOMA, send e-mail to pooma at acl.lanl.gov,
- // or visit the POOMA web page at http://www.acl.lanl.gov/pooma/.
- // ----------------------------------------------------------------------
- // ACL:license
-
- //-----------------------------------------------------------------------------
- // The POOMA Framework
- //
- // This program was prepared by the Regents of the University of California
- // at Los Alamos National Laboratory (the University) under Contract No.
- // W-7405-ENG-36 with the U.S. Department of Energy (DOE). The University has
- // certain rights in the program pursuant to the contract and the program
- // should not be copied or distributed outside your organization. All rights
- // in the program are reserved by the DOE and the University. Neither the U.S.
- // Government nor the University makes any warranty, express or implied, or
- // assumes any liability or responsibility for the use of this software
- //
- // Visit http://www.acl.lanl.gov/POOMA for more details
- //
- //-----------------------------------------------------------------------------
- // Engine Component Test Code
- //-----------------------------------------------------------------------------
- //
- // Classes:
- // Brick - Brick-Engine specialization tag.
- // BrickView<int,bool> - BrickView-Engine specialization tag.
- // Engine<Dim,T,Brick> - the "Brick-Engine" specialization.
- // Engine<Dim,T,BrickView> - the "BrickView-Engine" specialization.
- // NewEngine<Engine,SubDomain> - specializations for BrickView-Engine.
- // ElementProperties<Engine
- // <Dim, T, Brick> > - specialization for BrickEngine.
- //
- //-----------------------------------------------------------------------------
-
- #include "Pooma/Pooma.h"
- #include "Engine/BrickEngine.h"
- #include <iostream.h>
- #include <iomanip.h>
- #include <math.h>
- #include <stdio.h>
-
- //-----------------------------------------------------------------------------
- // Simple particle class providing non-standard type for testing
- // BrickEngine constructors. As specified in the Engine SRS, Atom
- // provides the minimal required copy constructor and assignment operator.
- //-----------------------------------------------------------------------------
-
- class Atom
- {
- public:
-
- //============================================================
- // Constructors, Destructor, Assignment...
- //============================================================
-
- // default construtor is required by RefCountedBlockPtr, which is
- // used by Engine, so we supply this...
-
- Atom()
- {
- N_m = 0;
- Z_m = 0;
- mass_m = 0.0;
- }
-
- Atom(int N, int Z, double mass)
- {
- N_m = N;
- Z_m = Z;
- mass_m = mass;
- }
-
- Atom(const Atom &model)
- {
- N_m = model.N_m;
- Z_m = model.Z_m;
- mass_m = model.mass_m;
- }
-
- Atom & operator=(const Atom &model)
- {
- if (&model == this) return *this;
- N_m = model.N_m;
- Z_m = model.Z_m;
- mass_m = model.mass_m;
- return *this;
- }
-
- ~Atom() { }
-
- //============================================================
- // Accessors and Mutators
- //============================================================
-
- int electron() { return N_m; }
- int nuclear() { return Z_m; }
- double amu() { return mass_m; }
-
- // Atom& makeOwnCopy() { return *this; }
-
- private:
-
- int N_m;
- int Z_m;
- double mass_m;
-
- };
-
-
- //-----------------------------------------------------------------------------
- // Two generic functions (reportResults and uncaughtErrorReport) and
- // two classes (TypeMatchTester and its partial specialization)
- // to facilitate testing...
- //-----------------------------------------------------------------------------
-
- int reportResults(int n, char *test, bool testStatus)
- {
- char* statusString = "passed";
- if(!testStatus) statusString = "failed";
- cout << " Test " << setw(3) << n << ", "
- << setw(46) << test << ": " << statusString << "\n";
- return 0;
- }
-
- void uncaughtErrorReport(const char *what, int n)
- {
- cerr << "\nAck! Caught assertion during test # " << n << ":" << endl;
- cerr << what << endl;
- }
-
- template <class T1, class T2> // template class to test typedefs
- struct TypeMatchTester
- {
- static const bool Result = false;
- };
-
- template <class T> // ... partial specialization
- struct TypeMatchTester<T,T>
- {
- static const bool Result = true;
- };
-
- //-----------------------------------------------------------------------------
- // Wrappers for high-resolution ACLTIMER library C timers
- //-----------------------------------------------------------------------------
-
- extern "C"
- {
- void dclock_init();
- double dclock();
- }
-
-
- //-----------------------------------------------------------------------------
- // Main test program
- //-----------------------------------------------------------------------------
-
- main(int argc, char* argv[]) {
-
- Pooma::initialize(argc,argv);
-
- int testNumber;
- bool testStatus;
- float percent;
- float trueData;
- float testData;
- double timeStart;
- double timeEnd;
- double fast;
- double slow;
- double diff;
- double c = 2.99792458e+8;
-
- float Ry = 13.605698;
- float zero = 0.0;
-
- cout << "\n"
- << " ============================================================="
- << "=====\n"
- << " Engine Capability; BrickEngine package; BrickEngine component "
- << "test\n"
- << " ============================================================="
- << "=====\n" << endl;
-
- testNumber = 0;
-
- try {
-
- // *************************** BrickEngine *****************************
-
- cout << "\n BrickEngine" << endl;
- cout << " -----------\n" << endl;
-
- typedef Engine<3,float,Brick> Engine3Df_t;
- typedef Engine<2,double,Brick> Engine2Dd_t;
- typedef Engine<4,double,Brick> Engine4Dd_t;
- typedef Engine<6,int,Brick> Engine6Di_t;
- typedef Engine<6,float,Brick> Engine6Df_t;
- typedef Engine<7,int,Brick> Engine7Di_t;
-
-
- //---------------------------------------------------------------
- // test 1: BrickEngine required POOMA typedefs properly exported?
- //---------------------------------------------------------------
-
- ++testNumber;
-
- // construct a 3D Cartesian domain [0...10] x [4...14] x [-5...+5]
- // and associated BrickEngine
-
- Interval<3> cube2(Interval<1>(0,10), Interval<1>(4,14), Interval<1>(-5,5));
- Engine3Df_t floatBrick(cube2);
-
- // assign floating-point elements to cube2 Domain
-
- for(int i = 0; i < 11; i++)
- for(int j = 4; j < 15; j++)
- for(int k = -5; k < 6; k++)
- floatBrick(Loc<3>(i,j,k)) = Ry*(i+j+k);
-
- {
- typedef Engine3Df_t::This_t Try_t;
- typedef Engine3Df_t Correct_t;
- testStatus = TypeMatchTester<Try_t,Correct_t>::Result;
- }
-
- {
- typedef Engine3Df_t::Engine_t Try_t;
- typedef Engine3Df_t::This_t Correct_t;
- testStatus = TypeMatchTester<Try_t,Correct_t>::Result && testStatus;
- }
-
- {
- typedef Engine3Df_t::Domain_t Try_t;
- typedef Interval<3> Correct_t;
- testStatus = TypeMatchTester<Try_t,Correct_t>::Result && testStatus;
- }
-
- reportResults(testNumber,"exported typedefs This_t, Engine_t, Domain_t",
- testStatus);
-
-
- //-----------------------------------------------------------
- // test 2: additional required POOMA typedefs for BrickEngine
- //-----------------------------------------------------------
-
- ++testNumber;
-
- {
- typedef Engine3Df_t::Base_t Try_t;
- typedef Range<3> Correct_t;
- testStatus = TypeMatchTester<Try_t,Correct_t>::Result;
- }
-
- {
- typedef Engine3Df_t::Element_t Try_t;
- typedef float Correct_t;
- testStatus = TypeMatchTester<Try_t,Correct_t>::Result && testStatus;
- }
-
- reportResults(testNumber,"exported typedefs BaseDomain_t, Element_t",
- testStatus);
-
-
- //-----------------------------------------------------------
- // test 3: still more required POOMA typedefs for BrickEngine
- //-----------------------------------------------------------
-
- ++testNumber;
-
- {
- typedef Engine3Df_t::ElementRef_t Try_t;
- typedef float& Correct_t;
- testStatus = TypeMatchTester<Try_t,Correct_t>::Result;
- }
-
- {
- typedef Engine3Df_t::Tag_t Try_t;
- typedef Brick Correct_t;
- testStatus = TypeMatchTester<Try_t,Correct_t>::Result && testStatus;
- }
-
- reportResults(testNumber,"exported typedefs ElementRef_t, Tag_t",
- testStatus);
-
-
- //-------------------------------------------------------
- // test 4: BrickEngine default constructor, standard type
- //-------------------------------------------------------
-
- ++testNumber;
-
- // use default constructor and BrickEngine assignment operator
-
- Engine3Df_t defaultBrick;
- defaultBrick = floatBrick;
-
- // check that defaultBrick now points to the same data as floatBrick
-
- for(int i = 0; i < 11; i++)
- for(int j = 4; j < 15; j++)
- for(int k = -5; k < 6; k++) {
- trueData = floatBrick.read(Loc<3>(i,j,k));
- testData = defaultBrick.read(Loc<3>(i,j,k));
- testStatus = (testData == trueData) && testStatus;
- testStatus = (trueData == Ry*(i+j+k)) && testStatus;
- trueData = floatBrick.read(i,j,k);
- testData = defaultBrick.read(i,j,k);
- testStatus = (testData == trueData) && testStatus;
- testStatus = (trueData == Ry*(i+j+k)) && testStatus;
- }
-
- reportResults(testNumber,"default constructor & assignment operator",
- testStatus);
-
-
- //-------------------------------------------------------------
- // test 5: BrickEngine Interval constructor, strides() accessor
- //-------------------------------------------------------------
-
- ++testNumber;
-
- Interval<1> x(-17,2);
- Interval<1> y(5,29);
- Interval<1> z(-36,-2);
- Interval<1> t(1);
- Interval<4> spaceTime(x,y,z,t);
-
- Engine4Dd_t lightCone(spaceTime);
- const int *STstrides = lightCone.strides();
- int nomStrides[7];
-
- // stride of the first dimension in the Interval should always be 1
- // (Interval stride() accessor)
-
- nomStrides[0] = spaceTime[0].stride();
- testStatus = (STstrides[0] == nomStrides[0]);
-
- // strides() array for a BrickEngine should return actual strides
- // of the full Interval (BrickEngine strides() accessor).
-
- for(int i = 1; i < 4; i++) {
- nomStrides[i] = spaceTime[i-1].last() - spaceTime[i-1].first() + 1;
- nomStrides[i] = nomStrides[i] * nomStrides[i-1];
- testStatus = (STstrides[i] == nomStrides[i]) && testStatus;
- }
-
- // set data values; incidentally test some Interval accessors
-
- int imin = x.first();
- int imax = x.last();
- int jmin = y.first();
- int jmax = y.last();
- int kmin = z.first();
- int kmax = z.last();
-
- for(int i = imin; i < imax+1; i++)
- for(int j = jmin; j < jmax+1; j++)
- for(int k = kmin; k < kmax+1; k++)
- lightCone(Loc<4>(i,j,k,0)) = c*((i-j)*3 +k);
-
- // verify data values
-
- for(int i = -17; i < 3; i++)
- for(int j = 5; j < 30; j++)
- for(int k = -36; k < -1; k++) {
- testData = lightCone.read(Loc<4>(i,j,k,0));
- trueData = c* ((i-j)*3 +k);
- testStatus = (testData == trueData) && testStatus;
- }
-
- reportResults(testNumber,"Interval constructor; strides accessor",
- testStatus);
-
-
- //----------------------------------------------------
- // test 6: BrickEngine copy constructor, standard type
- //----------------------------------------------------
-
- ++testNumber;
- Engine4Dd_t transporter(lightCone);
-
- diff = zero;
- for(int i = -17; i < 3; i++)
- for(int j = 5; j < 30; j++)
- for(int k = -36; k < -1; k++)
- diff += fabs(lightCone.read(Loc<4>(i,j,k,0)) - transporter.read(i,j,k,0));
-
- testStatus = (diff == zero);
- reportResults(testNumber,"copy constructor",
- testStatus);
-
-
- //------------------------------------------
- // test 7: BrickEngine constructor via model
- //------------------------------------------
-
- ++testNumber;
- Engine4Dd_t scotty(spaceTime,c);
-
- diff = zero;
- for(int i = -17; i < 3; i++)
- for(int j = 5; j < 30; j++)
- for(int k = -36; k < -1; k++)
- diff += fabs(scotty.read(Loc<4>(i,j,k,0)) - c);
-
- testStatus = (diff == zero);
- reportResults(testNumber,"constructor via model",testStatus);
-
-
- //------------------------------------------------------
- // test 8: BrickEngine constructor via foreign data (1D)
- //------------------------------------------------------
-
- ++testNumber;
-
- // 1D test
-
- double* B = new double[10];
- for (int i = 0; i<10; i++)
- B[i] = i*2.3;
-
- Interval<1> line(-2,7);
- Engine<1,double,Brick> french(B,line);
-
- diff = zero;
- for(int i = -2; i < 8; i++)
- diff += fabs(french.read(i) - (i+2)*2.3);
-
- testStatus = (diff == zero);
- reportResults(testNumber,"constructor via 1D foreign data",testStatus);
-
-
- //-----------------------------------------------------------
- // test 9: BrickEngine constructor via foreign data (2D & 3D)
- //-----------------------------------------------------------
-
- ++testNumber;
-
- // 2D test on 2 x 10 Interval
-
- float* C = new float[20];
- for (int i = 0; i<2; i++)
- for ( int j = 0; j < 10; j++)
- C[i*10+j] = (i*2.2+j*3.1);
-
- Interval<2> box(Interval<1>(0,1), Interval<1>(0,9));
- Engine<2,float,Brick> norwegian(C,box);
-
-
- // (i,j) loop order is reversed here to emphasize the fact that
- // POOMA II Engines index according to Fortran order (left-most index
- // varies fastest, etc.). Note C-style indexing of array C.
-
- diff = zero;
- for ( int j = 0; j < 10; j++)
- for( int i = 0; i < 2; i++)
- diff += fabs(norwegian.read(i,j) - C[i+2*j]);
-
- testStatus = (diff == zero);
-
-
- // 3D test on 4 x 3 x 2 Interval (zero-based)
-
- float* G = new float[24];
- Interval<3> cubic(Interval<1>(0,3), Interval<1>(0,2), Interval<1>(0,1));
- Engine<3,float,Brick> dutch(G,cubic);
-
- for (int i = 0; i<4; i++)
- for (int j = 0; j<3; j++)
- for (int k = 0; k<2; k++) {
- int ind = i*6 + j*2 + k;
- G[ind] = 2.2*i + 3.1*j + 1.4*k;
- }
-
- diff = zero;
- for(int k = 0; k < 2; k++)
- for(int j = 0; j < 3; j++)
- for(int i = 0; i < 4; i++) {
- int ind = k*12 + j*4 + i;
- diff += fabs(dutch.read(i,j,k) - G[ind]);
- }
-
- testStatus = (diff == zero) && testStatus;
-
-
- // 3D test on 11 x 11 x 11 Interval (non-zero-based)
-
- float* A = new float[1331];
- for (int i = 0; i<11; i++)
- for (int j = 0; j<11; j++)
- for (int k = 0; k<11; k++) {
- int ind = i*121 + j*11 + k;
- A[ind] = 2.2*i + 3.1*j + 1.4*k;
- }
-
- Engine3Df_t italian(A,cube2);
-
- diff = zero;
- for(int k = -5; k < 6; k++)
- for(int j = 4; j < 15; j++)
- for(int i = 0; i < 11; i++) {
- int ind = (k+5)*121 + (j-4)*11 + i;
- diff += fabs(italian.read(i,j,k) - A[ind]);
- }
-
- testStatus = (diff == zero) && testStatus;
-
- reportResults(testNumber,"constructor via 2D/3D foreign data",
- testStatus);
-
-
- //-------------------------------------------------
- // test 10: BrickEngine constructor via Node object
- //-------------------------------------------------
-
- ++testNumber;
-
- // Construct a simple Node with affinity = -1, Interval Domain,
- // context = local ID = global ID = 0.
-
- Interval<1> point(4,12);
- Interval<6> star(point,point,point,point,point,point);
- Node<Interval<6> > k(-1,star,0,0,0);
- Engine6Di_t BZone(k);
- Engine6Di_t BZone2(star,17);
- BZone = BZone2;
-
- diff = zero;
- for(int i = 4; i < 13; i++)
- for(int j = 4; j < 13; j++)
- for(int k = 4; k < 13; k++)
- for(int l = 4; l < 13; l++)
- for(int m = 4; m < 13; m++)
- for(int n = 4; n < 13; n++)
- diff += abs(BZone.read(i,j,k,l,m,n) - 17);
-
- testStatus = (diff == zero);
- reportResults(testNumber,"constructor via Node object", testStatus);
-
-
- //-----------------------------------------
- // test 11: BrickEngine assignment operator
- //-----------------------------------------
-
- ++testNumber;
-
- Engine4Dd_t geordi;
- geordi = scotty;
-
- diff = zero;
- for(int i = -17; i < 2; i++)
- for(int j = 5; j < 29; j++)
- for(int k = -36; k < -2; k++)
- diff += fabs(geordi.read(i,j,k,0) - c);
-
- testStatus = (diff == zero);
- reportResults(testNumber,"assignment operator",testStatus);
-
-
- //---------------------------------------------------
- // test 12: BrickEngine read(int) accessors, dims 1-7
- //---------------------------------------------------
-
- ++testNumber;
-
- // POOMA II supports Domains with dim <= 7
-
- Interval<1> I0(-3,3);
- Interval<1> J0(6,12);
- Interval<1> I1(I0);
- Engine<1,float,Brick> xxx1(I1,Ry);
-
- Interval<2> I2(I1,J0);
- Engine<2,float,Brick> xxx2(I2,Ry*2);
-
- Interval<3> I3(I2,I0);
- Engine<3,float,Brick> xxx3(I3,Ry*3);
-
- Interval<4> I4(I3,J0);
- Engine<4,float,Brick> xxx4(I4,Ry*4);
-
- Interval<5> I5(I4,I0);
- Engine<5,float,Brick> xxx5(I5,Ry*5);
-
- Interval<6> I6(I5,J0);
- Engine<6,float,Brick> xxx6(I6,Ry*6);
-
- Interval<7> I7(I6,I0);
- Engine<7,float,Brick> xxx7(I7,Ry*7);
-
- diff = zero;
- for(int i = -3; i < 3; i++) {
- diff += fabs(xxx1.read(i) - Ry);
- for(int j = 6; j < 12; j++) {
- diff += fabs(xxx2.read(i,j) - Ry*2);
- for(int k = -3; k < 3; k++) {
- diff += fabs(xxx3.read(i,j,k) - Ry*3);
- for(int l = 6; l < 12; l++) {
- diff += fabs(xxx4.read(i,j,k,l) - Ry*4);
- for(int m = -3; m < 3; m++) {
- diff += fabs(xxx5.read(i,j,k,l,m) - Ry*5);
- for(int n = 6; n < 12; n++) {
- diff += fabs(xxx6.read(i,j,k,l,m,n) - Ry*6);
- for(int p = -3; p < 3; p++) {
- diff += fabs(xxx7.read(i,j,k,l,m,n,p) - Ry*7);
- }
- }
- }
- }
- }
- }
- }
-
- testStatus = (diff == zero);
- reportResults(testNumber,"int read element accessors, dims 1-7",
- testStatus);
-
-
- //--------------------------------------------------------
- // test 13: BrickEngine read(Loc<Dim>) accessors, dims 1-7
- //--------------------------------------------------------
-
- ++testNumber;
-
- diff = zero;
- for(int i = -3; i < 3; i++) {
- diff += fabs(xxx1.read(Loc<1>(i)) - Ry);
- for(int j = 6; j < 12; j++) {
- diff += fabs(xxx2.read(Loc<2>(i,j)) - Ry*2);
- for(int k = -3; k < 3; k++) {
- diff += fabs(xxx3.read(Loc<3>(i,j,k)) - Ry*3);
- for(int l = 6; l < 12; l++) {
- diff += fabs(xxx4.read(Loc<4>(i,j,k,l)) - Ry*4);
- for(int m = -3; m < 3; m++) {
- diff += fabs(xxx5.read(Loc<5>(i,j,k,l,m)) - Ry*5);
- for(int n = 6; n < 12; n++) {
- diff += fabs(xxx6.read(Loc<6>(i,j,k,l,m,n)) - Ry*6);
- for(int p = -3; p < 3; p++) {
- diff += fabs(xxx7.read(Loc<7>(i,j,k,l,m,n,p)) - Ry*7);
- }
- }
- }
- }
- }
- }
- }
-
- testStatus = (diff == zero);
- reportResults(testNumber,"Loc<Dim> read element accessors, dims 1-7",
- testStatus);
-
-
- //------------------------------------------------------------
- // test 14: BrickEngine operator() element accessors, dims 1-7
- //------------------------------------------------------------
-
- ++testNumber;
-
- diff = zero;
- for(int i = -3; i < 3; i++) {
- diff += fabs(xxx1(i) - Ry);
- for(int j = 6; j < 12; j++) {
- diff += fabs(xxx2(i,j) - Ry*2);
- for(int k = -3; k < 3; k++) {
- diff += fabs(xxx3(i,j,k) - Ry*3);
- for(int l = 6; l < 12; l++) {
- diff += fabs(xxx4(i,j,k,l) - Ry*4);
- for(int m = -3; m < 3; m++) {
- diff += fabs(xxx5(i,j,k,l,m) - Ry*5);
- for(int n = 6; n < 12; n++) {
- diff += fabs(xxx6(i,j,k,l,m,n) - Ry*6);
- for(int p = -3; p < 3; p++) {
- diff += fabs(xxx7(i,j,k,l,m,n,p) - Ry*7);
- }
- }
- }
- }
- }
- }
- }
-
- testStatus = (diff == zero);
- reportResults(testNumber,"operator() element accessors, dims 1-7",
- testStatus);
-
- /*******************************************************************************
-
- // this test requires the implementation of an appropriate
- // PAssert to catch and report the dimension violation, at
- // which point it can be un-commented.
-
- // Upon un-commenting, remove the increment of testNumber immediately
- // following this test. The increment is needed to keep the test
- // numbers the same as the test labels.
-
- //-----------------------------------------------------------
- // test 15: BrickEngine underlying Domain dimension violation
- //-----------------------------------------------------------
-
- ++testNumber;
-
- try {
- Interval<8> I8(I7,I0);
- Engine<8,float,Brick> xxx8(I8,Ry*8);
- diff = xxx8.read(0,0,0,0,0,0,0,0) - pi*8;
- throw reportResults(testNumber,"underlying Domain dimension violation",false);
- }
- catch(const Pooma::Assertion &) {reportResults(testNumber,
- "underlying Domain dimension violation",true);}
-
- // the real work is done by 'throw' inside try block; this prevents
- // falling-through to outer 'try' block, and generation of
- // "unknown exception" message.
-
- catch(...) { }
-
- *******************************************************************************/
- ++testNumber; // remove upon activating test 15.
-
- //-------------------------------------------------------------
- // test 16: performance of element access via ints vs. Loc<Dim>
- //-------------------------------------------------------------
-
- ++testNumber;
-
- // initialize hi-resolution timer
-
- dclock_init();
-
- char* str1 = new char[43];
- int l = 0;
-
- for(int i = -17; i < 2; i++)
- for(int j = 5; j < 29; j++)
- for(int k = -36; k < -2; k++)
- lightCone(Loc<4>(i,j,k,l)) = Ry+i+j+k;
-
- timeStart = dclock();
- for(int i = -17; i < 2; i++)
- for(int j = 5; j < 29; j++)
- for(int k = -36; k < -2; k++)
- testData = lightCone.read(i,j,k,l);
-
- timeEnd = dclock();
- fast = timeEnd - timeStart;
-
- timeStart = dclock();
- for(int i = -17; i < 2; i++)
- for(int j = 5; j < 29; j++)
- for(int k = -36; k < -2; k++)
- testData = lightCone.read(Loc<4>(i,j,k,l));
-
- timeEnd = dclock();
- slow = timeEnd - timeStart;
-
- percent = (slow - fast) * 100.0/slow;
- sprintf(str1,"%34s%3.1f%1s",
- "int/Loc elt access; relative perf = ",percent,"%");
- testStatus = (fast < slow);
- reportResults(testNumber,str1,testStatus);
- delete str1;
-
-
- //---------------------------------------
- // test 17: BrickEngine domain() accessor
- //---------------------------------------
-
- ++testNumber;
- Interval<3> d1 = floatBrick.domain();
- testStatus = (d1[0].first() == cube2[0].first()) &&
- (d1[0].last() == cube2[0].last()) &&
- (d1[0].length() == cube2[0].length()) &&
- (d1[1].first() == cube2[1].first()) &&
- (d1[1].last() == cube2[1].last()) &&
- (d1[1].length() == cube2[1].length()) &&
- (d1[2].first() == cube2[2].first()) &&
- (d1[2].last() == cube2[2].last()) &&
- (d1[2].length() == cube2[2].length());
-
- Interval<4> d2 = lightCone.domain();
- testStatus = (d2[0].first() == spaceTime[0].first()) &&
- (d2[0].last() == spaceTime[0].last()) &&
- (d2[0].length() == spaceTime[0].length()) &&
- (d2[1].first() == spaceTime[1].first()) &&
- (d2[1].last() == spaceTime[1].last()) &&
- (d2[1].length() == spaceTime[1].length()) &&
- (d2[2].first() == spaceTime[2].first()) &&
- (d2[2].last() == spaceTime[2].last()) &&
- (d2[2].length() == spaceTime[2].length()) &&
- (d2[3].first() == spaceTime[3].first()) &&
- (d2[3].last() == spaceTime[3].last()) &&
- (d2[3].length() == spaceTime[3].length()) && testStatus;
-
- Interval<7> d3 = xxx7.domain();
- testStatus = (d3[0].first() == I7[0].first()) &&
- (d3[0].last() == I7[0].last()) &&
- (d3[0].length() == I7[0].length()) &&
- (d3[6].first() == I7[6].first()) &&
- (d3[6].last() == I7[6].last()) &&
- (d3[6].length() == I7[6].length()) && testStatus;
-
- reportResults(testNumber,"domain() accessor",testStatus);
-
-
- //-------------------------------------------
- // test 18: BrickEngine baseDomain() accessor
- //-------------------------------------------
-
- ++testNumber;
-
- // baseDomain should be identical to Domain for BrickEngine,
- // since no subsetting has occurred. That is, baseDomain
- // simply returns the Interval Domain of the Engine,
- // re-cast as a Range.
-
- Range<3> d4 = italian.baseDomain();
- testStatus = (d4[0].first() == cube2[0].first()) &&
- (d4[0].last() == cube2[0].last()) &&
- (d4[0].length() == cube2[0].length()) &&
- (d4[1].first() == cube2[1].first()) &&
- (d4[1].last() == cube2[1].last()) &&
- (d4[1].length() == cube2[1].length()) &&
- (d4[2].first() == cube2[2].first()) &&
- (d4[2].last() == cube2[2].last()) &&
- (d4[2].length() == cube2[2].length());
-
- Range<4> d5 = transporter.baseDomain();
- testStatus = (d5[0].first() == spaceTime[0].first()) &&
- (d5[0].last() == spaceTime[0].last()) &&
- (d5[0].length() == spaceTime[0].length()) &&
- (d5[1].first() == spaceTime[1].first()) &&
- (d5[1].last() == spaceTime[1].last()) &&
- (d5[1].length() == spaceTime[1].length()) &&
- (d5[2].first() == spaceTime[2].first()) &&
- (d5[2].last() == spaceTime[2].last()) &&
- (d5[2].length() == spaceTime[2].length()) &&
- (d5[3].first() == spaceTime[3].first()) &&
- (d5[3].last() == spaceTime[3].last()) &&
- (d5[3].length() == spaceTime[3].length()) && testStatus;
-
- Range<5> d6 = xxx5.baseDomain();
- testStatus = (d6[2].first() == I5[2].first()) &&
- (d6[2].last() == I5[2].last()) &&
- (d6[2].length() == I5[2].length()) &&
- (d6[4].first() == I5[4].first()) &&
- (d6[4].last() == I5[4].last()) &&
- (d6[4].length() == I5[4].length()) && testStatus;
-
- reportResults(testNumber,"baseDomain() accessor",testStatus);
-
-
- //--------------------------------------------
- // test 19: BrickEngine makeOwnCopy() function
- //--------------------------------------------
-
- ++testNumber;
- geordi(-12,0,32,0) = Ry;
- diff = (geordi(-12,0,32,0) - scotty(-12,0,32,0));
- testStatus = (diff == zero);
-
- diff = (geordi(1,28,-30,0) - c);
- testStatus = (diff == zero) && testStatus;
-
- geordi.makeOwnCopy();
- geordi(-12,0,32,0) = Ry*2;
- diff = (geordi(-12,0,32,0) - 2*scotty(-12,0,32,0));
- testStatus = (diff == zero) && testStatus;
-
- reportResults(testNumber,"makeOwnCopy() function",testStatus);
-
-
- //-------------------------------------------------------------------
- // test 20: BrickEngine Interval constructor, strides(); non-std type
- //-------------------------------------------------------------------
-
- ++testNumber;
-
- // construct a 6 x 7 Interval IJ, and put a different particle at each
- // location in the Range. Incidentally test some features of
- // Intervals. Note that BrickEngine requires a unit-stride Domain.
-
- Interval<2> IJ(Interval<1>(0,5), Interval<1>(-6,0));
- int IJsize = IJ.size();
- const int IJmax = 42;
- testStatus = (IJsize == IJmax);
-
- int Imin = IJ[0].first();
- int Imax = IJ[0].last();
- int Istr = IJ[0].stride();
- int Ilen = IJ[0].length();
- testStatus = (Imin == 0) && (Imax == 5) && testStatus;
- testStatus = (Istr == 1) && (Ilen == 6) && testStatus;
-
- int Jmin = IJ[1].first();
- int Jmax = IJ[1].last();
- int Jstr = IJ[1].stride();
- int Jlen = IJ[1].length();
- testStatus = (Jmin == -6) && (Jmax == 0) && testStatus;
- testStatus = (Jstr == 1) && (Jlen == 7) && testStatus;
-
- // construct 42 distinct Atoms and store them in the array Ar[IJsize]
-
- int NEl;
- int NChg;
- double Mass;
- int knt = 0;
-
- Atom* Ar[IJmax];
- for (int i=Imin; i<Imax+1; i=i+Istr)
- for (int j=Jmin; j<Jmax+1; j=j+Jstr) {
- NEl = abs(i+j)+5;
- NChg = NEl*2;
- Mass = NChg*2.22;
- Ar[knt] = new Atom(NEl,NChg,Mass);
- testStatus = (Ar[knt]->electron() == NEl) && testStatus;
- knt++;
- }
-
- testStatus = (knt == IJsize) && testStatus;
-
- // construct a 2D BrickEngine to manage the Ar Atoms over the IJ Range
-
- Engine<2,Atom,Brick> ArEngine(IJ);
-
- diff = zero;
- knt = 0;
-
- for (int i=Imin; i<Imax+1; i=i+Istr)
- for (int j=Jmin; j<Jmax+1; j=j+Jstr) {
- ArEngine(Loc<2>(i,j)) = *(Ar[knt]);
- diff += fabsf(ArEngine.read(i,j).amu() - (abs(i+j)+5)*4.44 );
- knt++;
- }
-
- testStatus = (diff == zero) && testStatus;
-
- // test BrickEngine strides() accessor. Should return
- // actual strides of underlying 2D Interval
-
- STstrides = ArEngine.strides();
- nomStrides[0] = 1;
- nomStrides[1] = Imax-Imin+1;
- testStatus = (STstrides[0] == nomStrides[0]) && testStatus;
- testStatus = (STstrides[1] == nomStrides[1]) && testStatus;
-
- reportResults(testNumber,"Interval constr/strides(); non-std type",
- testStatus);
-
-
- //------------------------------------------------------------
- // test 21: BrickEngine default constructor, non-standard type
- //------------------------------------------------------------
-
- ++testNumber;
- Engine<2,Atom,Brick> defaultAr;
- defaultAr = ArEngine;
-
- for (int i=Imin; i<Imax+1; i=i+Istr)
- for (int j=Jmin; j<Jmax+1; j=j+Jstr)
- diff += abs(defaultAr.read(i,j).nuclear() - (abs(i+j)+5)*2 );
-
- testStatus = (diff == zero);
- reportResults(testNumber,"default constructor/assign; non-std type",
- testStatus);
-
-
- //---------------------------------------------------------
- // test 22: BrickEngine copy constructor, non-standard type
- //---------------------------------------------------------
-
- ++testNumber;
- Engine<2,Atom,Brick> dupAr(ArEngine);
-
- diff = zero;
- for (int i=Imin; i<Imax+1; i=i+Istr)
- for (int j=Jmin; j<Jmax+1; j=j+Jstr) {
- diff += abs(dupAr.read(Loc<2>(i,j)).nuclear() - (abs(i+j)+5)*2 );
- knt++;
- }
-
- testStatus = (diff == zero);
- reportResults(testNumber,"copy constructor; non-std type",
- testStatus);
-
-
- //--------------------------------------------------------------
- // test 23: BrickEngine constructor via model, non-standard type
- //--------------------------------------------------------------
-
- ++testNumber;
- Interval<3> IJK(IJ,Interval<1>(2,14));
- Engine<3,Atom,Brick> ArToo(IJK,*(Ar[30]));
-
- Imin = IJK[0].first();
- Imax = IJK[0].last();
- Jmin = IJK[1].first();
- Jmax = IJK[1].last();
- int Kmin = IJK[2].first();
- int Kmax = IJK[2].last();
-
- diff = zero;
- for (int i=Imin; i<Imax+1; i++)
- for (int j=Jmin; j<Jmax+1; j++)
- for (int k=Kmin; k<Kmax+1; k++)
- diff += fabs(ArToo.read(i,j,k).amu() - (double)5*4.44);
-
- testStatus = (diff == zero);
- reportResults(testNumber,"constructor via model; non-std type",
- testStatus);
-
-
- //---------------------------------------------------------------------
- // test 24: BrickEngine constructor via foreign data (1D), non-std type
- //---------------------------------------------------------------------
-
- ++testNumber;
-
- Atom H[17];
- knt = 0;
- for (int i = 0; i<17; i++) {
- NEl = (int)Ry*i;
- NChg = NEl*2;
- Mass = NChg+4-i;
- Atom Htemp(NEl,NChg,Mass);
- H[knt] = Htemp;
- testStatus = (H[knt].amu() == Mass) && testStatus;
- knt++;
- }
-
- Interval<1> Balmer(3,19);
- Engine<1,Atom,Brick> jovian(H,Balmer);
-
- diff = zero;
- for(int i = 3; i < 20; i++) {
- diff += abs( jovian.read(Loc<1>(i)).electron() - (int)Ry*(i-3) );
- diff += fabs( jovian.read(i).amu() - ((int)Ry*(i-3)*2-i+7) );
- }
-
- testStatus = (diff == zero) && testStatus;
- reportResults(testNumber,"constructor via 1D foreign data; non-std type",
- testStatus);
-
-
- //---------------------------------------------------------------
- // test 25: BrickEngine constructor via Node object, non-std type
- //---------------------------------------------------------------
-
- ++testNumber;
-
- Engine<6,Atom,Brick> Energy(k);
- Engine<6,Atom,Brick> Energy2(star,H[16]);
- Energy = Energy2;
-
- diff = zero;
- for(int i = 4; i < 13; i++)
- for(int j = 4; j < 13; j++)
- for(int k = 4; k < 13; k++)
- for(int l = 4; l < 13; l++)
- for(int m = 4; m < 13; m++)
- for(int n = 4; n < 13; n++)
- diff += abs( Energy.read(i,j,k,l,m,n).nuclear() - ((int)Ry)*16*2 );
-
- testStatus = (diff == zero);
- reportResults(testNumber,"constructor via Node object; non-std type",
- testStatus);
-
-
- //-------------------------------------------------------
- // test 26: BrickEngine assignment operator, non-std type
- //-------------------------------------------------------
-
- ++testNumber;
- Engine<3,Atom,Brick> Ne;
- Ne = ArToo;
-
- diff = zero;
- for (int i=Imin; i<Imax+1; i++)
- for (int j=Jmin; j<Jmax+1; j++)
- for (int k=Kmin; k<Kmax+1; k++)
- diff += fabs(Ne.read(i,j,k).nuclear() - 10.0);
-
- testStatus = (diff == zero);
- reportResults(testNumber,"assignment operator; non-std type",
- testStatus);
-
-
- //-----------------------------------------------------
- // test 27: BrickEngine domain() accessor, non-std type
- //-----------------------------------------------------
-
- ++testNumber;
-
- Interval<1> d7 = jovian.domain();
- testStatus = (d7[0].first() == Balmer.first()) &&
- (d7[0].last() == Balmer.last()) &&
- (d7[0].length() == Balmer.length());
-
- Interval<2> d8 = ArEngine.domain();
- testStatus = (d8[0].first() == IJ[0].first()) &&
- (d8[0].last() == IJ[0].last()) &&
- (d8[0].length() == IJ[0].length()) &&
- (d8[1].first() == IJ[1].first()) &&
- (d8[1].last() == IJ[1].last()) &&
- (d8[1].length() == IJ[1].length()) && testStatus;
-
- Interval<6> d9 = Energy.domain();
- testStatus = (d9[3].first() == star[3].first()) &&
- (d9[3].last() == star[3].last()) &&
- (d9[3].length() == star[3].length()) &&
- (d9[5].first() == star[5].first()) &&
- (d9[5].last() == star[5].last()) &&
- (d9[5].length() == star[5].length()) && testStatus;
-
- reportResults(testNumber,"domain() accessor; non-std type",
- testStatus);
-
-
- //---------------------------------------------------------
- // test 28: BrickEngine baseDomain() accessor, non-std type
- //---------------------------------------------------------
-
- ++testNumber;
-
- // Again, baseDomain should be identical to Domain for BrickEngine,
- // since no subsetting has occurred.
-
- Range<2> d10 = dupAr.domain();
- testStatus = (d10[0].first() == IJ[0].first()) &&
- (d10[0].last() == IJ[0].last()) &&
- (d10[0].length() == IJ[0].length()) &&
- (d10[1].first() == IJ[1].first()) &&
- (d10[1].last() == IJ[1].last()) &&
- (d10[1].length() == IJ[1].length());
-
- Range<3> d11 = ArToo.domain();
- testStatus = (d11[0].first() == IJK[0].first()) &&
- (d11[0].last() == IJK[0].last()) &&
- (d11[0].length() == IJK[0].length()) &&
- (d11[1].first() == IJK[1].first()) &&
- (d11[1].last() == IJK[1].last()) &&
- (d11[1].length() == IJK[1].length()) && testStatus;
-
-
- Range<6> d12 = Energy.domain();
- testStatus = (d12[3].first() == star[3].first()) &&
- (d12[3].last() == star[3].last()) &&
- (d12[3].length() == star[3].length()) &&
- (d12[5].first() == star[5].first()) &&
- (d12[5].last() == star[5].last()) &&
- (d12[5].length() == star[5].length()) && testStatus;
-
- reportResults(testNumber,"baseDomain() accessor; non-std type",
- testStatus);
-
-
- //----------------------------------------------------------
- // test 29: BrickEngine makeOwnCopy() function, non-std type
- //----------------------------------------------------------
-
- ++testNumber;
- Ne.makeOwnCopy();
- Atom NeTemp(7.1,7.2,7.3);
- Ne(3,-4,9) = NeTemp;
-
- diff = zero;
- for (int i=Imin; i<Imax+1; i++)
- for (int j=Jmin; j<Jmax+1; j++)
- for (int k=Kmin; k<Kmax+1; k++) {
- if(i==3 && j==-4 && k==9)
- diff = fabs(Ne(3,-4,9).amu() - 7.3) + fabs(ArToo(3,-4,9).amu() - 5*4.44);
- else
- diff += fabs(Ne(Loc<3>(i,j,k)).amu() - ArToo.read(i,j,k).amu());
- }
-
- testStatus = (diff == zero);
- reportResults(testNumber,"makeOwnCopy() function; non-std type",
- testStatus);
-
-
-
- // ************************* BrickViewEngine ****************************
-
- cout << "\n\n BrickViewEngine" << endl;
- cout << " ---------------\n" << endl;
-
- typedef Engine<2,float,BrickView<6,false> > float2DV2_t;
- typedef Engine<3,float,BrickView<3,true> > float3DV1_t;
- typedef Engine<3,float,BrickView<3,false> > float3DV2_t;
- typedef Engine<4,float,BrickView<6,false> > float4DV3_t;
- typedef Engine<2,double,BrickView<2,true> > double2DV1_t;
- typedef Engine<2,double,BrickView<2,false> > double2DV2_t;
- typedef Engine<6,int,BrickView<6,true> > int6DV1_t;
- typedef Engine<7,int,BrickView<7,false> > int7DV2_t;
-
-
-
- //--------------------------------------------------------------------
- // test 30: BrickViewEngine required POOMA typedefs properly exported?
- //--------------------------------------------------------------------
-
- ++testNumber;
-
- // first construct stride-1 and non-stride-1 Views of 3D cube and
- // 2D square-based Engines
-
- Interval<1> line1(7,16);
- Interval<1> line2(-1,4);
- Interval<1> line3(11,16);
- Interval<1> line4(-4,5);
- Range<1> line5(0,6,2);
- Range<1> line6(-1,5,3);
- Range<1> line7(7,15,4);
-
- Interval<2> square(line,line1); // 10x10 Interval
- Interval<3> cube(line,line4,line1); // 10x10x10 Interval
-
- // square1 and rectangle2 are associated with Boolean 'true' in
- // BrickView, since both of these 2D Ranges have a (unit-stride)
- // Interval, line2, as their first Range component. Note that
- // this is true for rectangle2 even though its second Range component,
- // line7, has non-unit stride (4). By contrast, rectangle1 is
- // associated with Boolean 'false' in BrickView, since its first
- // Range component, line5, has stride 2.
-
- Interval<2> square1(line2,line3); // 6x6 "T" subset of square
- Range<2> rectangle1(line5,line3); // 4x6 "F" subset of square
- Range<2> rectangle2(line2,line7); // 6x3 "T" subset of square
-
- Interval<3> cube1(line2,line2,line3); // 6x6x6 "T" subset of cube
- Range<3> box1(line5,line6,line7); // 4x3x3 "F" subset of cube
- Range<3> box2(line2,line6,line7); // 6x3x3 "T" subset of cube
-
- Engine2Dd_t Q(square);
- Engine3Df_t R(cube);
-
- double2DV1_t BV1(Q,square1);
- double2DV2_t BV2(Q,rectangle1);
- double2DV2_t BV3(Q,rectangle2);
-
- float3DV1_t BV4(R,cube1);
- float3DV2_t BV5(R,box1);
- float3DV2_t BV6(R,box2);
-
- // populate Q with data
-
- Imin = line.first();
- Ilen = line.length();
- Imax = Imin + Ilen;
- Jmin = line1.first();
- Jmax = line1.last() + 1;
- Jlen = Jmax - Jmin;
-
- for (int i = Imin; i < Imax; i++)
- for (int j = Jmin; j < Jmax; j++)
- Q(i,j) = (i+Ry)*j + 1.1;
-
- // populate R with data
-
- int Klen;
-
- Imin = cube[0].first();
- Ilen = cube[0].length();
- Imax = Imin + Ilen;
- Jmin = cube[1].first();
- Jmax = cube[1].last() + 1;
- Jlen = Jmax - Jmin;
- Kmin = cube[2].first();
- Kmax = cube[2].last() + 1;
- Klen = Kmax - Kmin;
-
- for (int i = Imin; i < Imax; i++)
- for (int j = Jmin; j < Jmax; j++)
- for (int k = Kmin; k < Kmax; k++)
- R(i,j,k) = i*1.1 + j*2.2 + k*3.3;
-
-
- // now start testing various typedefs using the above BrickViewEngines
-
- // This_t
-
- {
- typedef float3DV1_t::This_t Try_t;
- typedef float3DV1_t Correct_t;
- testStatus = TypeMatchTester<Try_t,Correct_t>::Result;
- }
-
- {
- typedef float3DV2_t::This_t Try_t;
- typedef float3DV2_t Correct_t;
- testStatus = TypeMatchTester<Try_t,Correct_t>::Result && testStatus;
- }
-
- {
- typedef double2DV1_t::This_t Try_t;
- typedef double2DV1_t Correct_t;
- testStatus = TypeMatchTester<Try_t,Correct_t>::Result && testStatus;
- }
-
- {
- typedef double2DV2_t::This_t Try_t;
- typedef double2DV2_t Correct_t;
- testStatus = TypeMatchTester<Try_t,Correct_t>::Result && testStatus;
- }
-
-
- // Engine_t
-
- {
- typedef float3DV1_t::Engine_t Try_t;
- typedef float3DV1_t::This_t Correct_t;
- testStatus = TypeMatchTester<Try_t,Correct_t>::Result && testStatus;
- }
-
- {
- typedef float3DV2_t::Engine_t Try_t;
- typedef float3DV2_t::This_t Correct_t;
- testStatus = TypeMatchTester<Try_t,Correct_t>::Result && testStatus;
- }
-
- {
- typedef double2DV1_t::Engine_t Try_t;
- typedef double2DV1_t::This_t Correct_t;
- testStatus = TypeMatchTester<Try_t,Correct_t>::Result && testStatus;
- }
-
- {
- typedef double2DV2_t::Engine_t Try_t;
- typedef double2DV2_t::This_t Correct_t;
- testStatus = TypeMatchTester<Try_t,Correct_t>::Result && testStatus;
- }
-
-
- // Domain_t
-
- {
- typedef float3DV1_t::Domain_t Try_t;
- typedef Interval<3> Correct_t;
- testStatus = TypeMatchTester<Try_t,Correct_t>::Result && testStatus;
- }
-
- {
- typedef float3DV2_t::Domain_t Try_t;
- typedef Interval<3> Correct_t;
- testStatus = TypeMatchTester<Try_t,Correct_t>::Result && testStatus;
- }
-
- {
- typedef double2DV2_t::Domain_t Try_t;
- typedef Interval<2> Correct_t;
- testStatus = TypeMatchTester<Try_t,Correct_t>::Result && testStatus;
- }
-
- {
- typedef double2DV2_t::Domain_t Try_t;
- typedef Interval<2> Correct_t;
- testStatus = TypeMatchTester<Try_t,Correct_t>::Result && testStatus;
- }
-
- reportResults(testNumber,"exported typedefs This_t, Engine_t, Domain_t",
- testStatus);
-
-
- //----------------------------------------------------------------
- // test 31: additional required POOMA typedefs for BrickViewEngine
- //----------------------------------------------------------------
-
- ++testNumber;
-
- // BaseDomain_t
-
- {
- typedef float3DV1_t::BaseDomain_t Try_t;
- typedef Range<3> Correct_t;
- testStatus = TypeMatchTester<Try_t,Correct_t>::Result;
- }
-
- {
- typedef float3DV2_t::BaseDomain_t Try_t;
- typedef Range<3> Correct_t;
- testStatus = TypeMatchTester<Try_t,Correct_t>::Result && testStatus;
- }
-
- {
- typedef double2DV1_t::BaseDomain_t Try_t;
- typedef Range<2> Correct_t;
- testStatus = TypeMatchTester<Try_t,Correct_t>::Result && testStatus;
- }
-
- {
- typedef double2DV2_t::BaseDomain_t Try_t;
- typedef Range<2> Correct_t;
- testStatus = TypeMatchTester<Try_t,Correct_t>::Result && testStatus;
- }
-
- // Element_t
-
- {
- typedef float3DV1_t::Element_t Try_t;
- typedef float Correct_t;
- testStatus = TypeMatchTester<Try_t,Correct_t>::Result && testStatus;
- }
-
- {
- typedef float3DV2_t::Element_t Try_t;
- typedef float Correct_t;
- testStatus = TypeMatchTester<Try_t,Correct_t>::Result && testStatus;
- }
-
- {
- typedef double2DV1_t::Element_t Try_t;
- typedef double Correct_t;
- testStatus = TypeMatchTester<Try_t,Correct_t>::Result && testStatus;
- }
-
- {
- typedef double2DV2_t::Element_t Try_t;
- typedef double Correct_t;
- testStatus = TypeMatchTester<Try_t,Correct_t>::Result && testStatus;
- }
-
- reportResults(testNumber,"exported typedefs BaseDomain_t, Element_t",
- testStatus);
-
-
- //----------------------------------------------------------------
- // test 32: still more required POOMA typedefs for BrickViewEngine
- //----------------------------------------------------------------
-
- ++testNumber;
-
- // ElementRef_t
-
- {
- typedef float3DV1_t::ElementRef_t Try_t;
- typedef float& Correct_t;
- testStatus = TypeMatchTester<Try_t,Correct_t>::Result;
- }
-
- {
- typedef float3DV2_t::ElementRef_t Try_t;
- typedef float& Correct_t;
- testStatus = TypeMatchTester<Try_t,Correct_t>::Result && testStatus;
- }
-
- {
- typedef double2DV1_t::ElementRef_t Try_t;
- typedef double& Correct_t;
- testStatus = TypeMatchTester<Try_t,Correct_t>::Result && testStatus;
- }
-
- {
- typedef double2DV2_t::ElementRef_t Try_t;
- typedef double& Correct_t;
- testStatus = TypeMatchTester<Try_t,Correct_t>::Result && testStatus;
- }
-
- // Tag_t
-
- {
- typedef float3DV1_t::Tag_t Try_t;
- typedef BrickView<3,true> Correct_t;
- testStatus = TypeMatchTester<Try_t,Correct_t>::Result && testStatus;
- }
-
- {
- typedef float3DV2_t::Tag_t Try_t;
- typedef BrickView<3,false> Correct_t;
- testStatus = TypeMatchTester<Try_t,Correct_t>::Result && testStatus;
- }
-
- {
- typedef double2DV1_t::Tag_t Try_t;
- typedef BrickView<2,true> Correct_t;
- testStatus = TypeMatchTester<Try_t,Correct_t>::Result && testStatus;
- }
-
- {
- typedef double2DV2_t::Tag_t Try_t;
- typedef BrickView<2,false> Correct_t;
- testStatus = TypeMatchTester<Try_t,Correct_t>::Result && testStatus;
- }
-
- reportResults(testNumber,"exported typedefs ElementRef_t, Tag_t",
- testStatus);
-
-
- //----------------------------------------------------
- // test 33: BrickViewEngine Range/Interval constructor
- //----------------------------------------------------
-
- ++testNumber;
-
- //-------------
- // square tests
- //-------------
-
- // BV1...
-
- Imin = square1[0].first();
- Jmin = square1[1].first();
- Ilen = square1[0].length();
- Jlen = square1[1].length();
- Istr = square1[0].stride();
- Jstr = square1[1].stride();
-
- diff = zero;
- for (int i = 0; i < Ilen; i++)
- for (int j = 0; j < Jlen; j++) {
- int Iind = Imin + i*Istr;
- int Jind = Jmin + j*Jstr;
- diff += Q.read(Iind,Jind) - BV1(Loc<2>(i,j));
- }
- testStatus = (diff == zero);
-
- // BV2...
-
- Imin = rectangle1[0].first();
- Jmin = rectangle1[1].first();
- Ilen = rectangle1[0].length();
- Jlen = rectangle1[1].length();
- Istr = rectangle1[0].stride();
- Jstr = rectangle1[1].stride();
-
- diff = zero;
- for (int i = 0; i < Ilen; i++)
- for (int j = 0; j < Jlen; j++) {
- int Iind = Imin + i*Istr;
- int Jind = Jmin + j*Jstr;
- diff += Q.read(Iind,Jind) - BV2(Loc<2>(i,j));
- }
- testStatus = (diff == zero) && testStatus;
-
- // BV3...
-
- Imin = rectangle2[0].first();
- Jmin = rectangle2[1].first();
- Ilen = rectangle2[0].length();
- Jlen = rectangle2[1].length();
- Istr = rectangle2[0].stride();
- Jstr = rectangle2[1].stride();
-
- diff = zero;
- for (int i = 0; i < Ilen; i++)
- for (int j = 0; j < Jlen; j++) {
- int Iind = Imin + i*Istr;
- int Jind = Jmin + j*Jstr;
- diff += Q.read(Iind,Jind) - BV3(Loc<2>(i,j));
- }
- testStatus = (diff == zero) && testStatus;
-
-
- //-----------
- // cube tests
- //-----------
-
- // BV4...
-
- int Kstr;
-
- Imin = cube1[0].first();
- Jmin = cube1[1].first();
- Kmin = cube1[2].first();
- Ilen = cube1[0].length();
- Jlen = cube1[1].length();
- Klen = cube1[2].length();
- Istr = cube1[0].stride();
- Jstr = cube1[1].stride();
- Kstr = cube1[2].stride();
-
- diff = zero;
- for (int i = 0; i < Ilen; i++)
- for (int j = 0; j < Jlen; j++)
- for (int k = 0; k < Klen; k++) {
- int Iind = Imin + i*Istr;
- int Jind = Jmin + j*Jstr;
- int Kind = Kmin + k*Kstr;
- diff += R.read(Iind,Jind,Kind) - BV4(Loc<3>(i,j,k));
- }
- testStatus = (diff == zero) && testStatus;
-
- // BV5...
-
- Imin = box1[0].first();
- Jmin = box1[1].first();
- Kmin = box1[2].first();
- Ilen = box1[0].length();
- Jlen = box1[1].length();
- Klen = box1[2].length();
- Istr = box1[0].stride();
- Jstr = box1[1].stride();
- Kstr = box1[2].stride();
-
- diff = zero;
- for (int i = 0; i < Ilen; i++)
- for (int j = 0; j < Jlen; j++)
- for (int k = 0; k < Klen; k++) {
- int Iind = Imin + i*Istr;
- int Jind = Jmin + j*Jstr;
- int Kind = Kmin + k*Kstr;
- diff += R.read(Iind,Jind,Kind) - BV5(Loc<3>(i,j,k));
- }
-
- testStatus = (diff == zero) && testStatus;
-
- // BV6...
-
- Imin = box2[0].first();
- Jmin = box2[1].first();
- Kmin = box2[2].first();
- Ilen = box2[0].length();
- Jlen = box2[1].length();
- Klen = box2[2].length();
- Istr = box2[0].stride();
- Jstr = box2[1].stride();
- Kstr = box2[2].stride();
-
- diff = zero;
- for (int i = 0; i < Ilen; i++)
- for (int j = 0; j < Jlen; j++)
- for (int k = 0; k < Klen; k++) {
- int Iind = Imin + i*Istr;
- int Jind = Jmin + j*Jstr;
- int Kind = Kmin + k*Kstr;
- diff += R(Iind,Jind,Kind) - BV6(i,j,k);
- }
-
- testStatus = (diff == zero) && testStatus;
-
- reportResults(testNumber,"Range<Dim> constructor",testStatus);
-
-
- //-------------------------------------------------------
- // test 34: Range/Interval constructor, NewEngine struct
- //-------------------------------------------------------
-
- ++testNumber;
-
- {
- typedef NewEngine<Engine3Df_t,Range<3> >::Type_t Try_t;
- typedef Engine<3,float,BrickView<3,false> > Correct_t;
- testStatus = TypeMatchTester<Try_t,Correct_t>::Result;
- }
-
- reportResults(testNumber," NewEngine struct",testStatus);
-
-
- //-------------------------------------------------------
- // test 35: Range/Interval constructor, domain() accessor
- //-------------------------------------------------------
-
- ++testNumber;
-
- // 3D, UnitStride = F
-
- float3DV2_t BV7(BV5);
-
- // the Domain returned by this accessor is always an Interval, because
- // the View is, by definition, stride-1 in all dimensions, with first-index
- // = 0 in all dimensions. Thus, box4 should = box3, since these are stride-1
- // Intervals describing the identical View, but box3 is not = box1; box1 is the
- // not-necessarily-stride-1 Range corresponding to box3, and its indices are
- // expressed in terms of the parent Domain [cube]'s indices.
-
- Interval<3> box3 = BV5.domain();
- Interval<3> box4 = BV7.domain();
-
- testStatus = (box4[0].first() == box3[0].first()) &&
- (box4[0].last() == box3[0].last()) &&
- (box4[0].length() == box3[0].length()) &&
- (box4[1].first() == box3[1].first()) &&
- (box4[1].last() == box3[1].last()) &&
- (box4[1].length() == box3[1].length()) &&
- (box4[2].first() == box3[2].first()) &&
- (box4[2].last() == box3[2].last()) &&
- (box4[2].length() == box3[2].length());
-
- // 2D, UnitStride = T
-
- double2DV1_t BV8(BV1);
- Interval<2> square2 = BV8.domain();
-
- // even though BV1's Domain (square1) is already Interval<2>, still
- // need to compute its domain() which will be offset to start with index 0.
-
- Interval<2> square3 = BV1.domain();
-
- testStatus = (square2[0].first() == square3[0].first()) &&
- (square2[0].last() == square3[0].last()) &&
- (square2[0].length() == square3[0].length()) &&
- (square2[1].first() == square3[1].first()) &&
- (square2[1].last() == square3[1].last()) &&
- (square2[1].length() == square3[1].length()) && testStatus;
-
- reportResults(testNumber," domain() accessor",testStatus);
-
-
- //-----------------------------------------------------------
- // test 36: Range/Interval constructor, baseDomain() accessor
- //-----------------------------------------------------------
-
- ++testNumber;
-
- // 3D, UnitStride = F
-
- Range<3> cube3 = BV7.baseDomain();
-
- testStatus = (cube3[0].first() == box1[0].first()) &&
- (cube3[0].last() == box1[0].last()) &&
- (cube3[0].length() == box1[0].length()) &&
- (cube3[1].first() == box1[1].first()) &&
- (cube3[1].last() == box1[1].last()) &&
- (cube3[1].length() == box1[1].length()) &&
- (cube3[2].first() == box1[2].first()) &&
- (cube3[2].last() == box1[2].last()) &&
- (cube3[2].length() == box1[2].length());
-
- // 2D, UnitStride = T
-
- Range<2> box5 = BV8.baseDomain();
-
- testStatus = (box5[0].first() == square1[0].first()) &&
- (box5[0].last() == square1[0].last()) &&
- (box5[0].length() == square1[0].length()) &&
- (box5[1].first() == square1[1].first()) &&
- (box5[1].last() == square1[1].last()) &&
- (box5[1].length() == square1[1].length()) && testStatus;
-
- reportResults(testNumber," baseDomain() accessor",testStatus);
-
-
- //--------------------------------------------------------
- // test 37: Range/Interval constructor, strides() accessor
- //--------------------------------------------------------
-
- ++testNumber;
-
- // tests that second-guess the implementation, to illustrate
- // the meaning of the BrickViewEngine strides() accessor
- // (just this once)...
-
- // 3D, UnitStride = F
-
- const int *NT = BV7.strides();
-
- testStatus = true;
- for(int i = 0; i < 3; i++) {
- nomStrides[i] = R.strides()[i] * box1[i].stride();
- testStatus = (NT[i] == nomStrides[i]) && testStatus;
- }
-
- // 2D, UnitStride = T
-
- NT = BV8.strides();
-
- for(int i = 0; i < 2; i++) {
- nomStrides[i] = Q.strides()[i] * square1[i].stride();
- testStatus = (NT[i] == nomStrides[i]) && testStatus;
- }
-
-
- // the 'real' tests, illustrating how the BrickView strides()
- // accessor makes it possible to sequentially identify the subset
- // indices from the parent Domain.
-
- // 3D, UnitStride = F
-
- // create linear-indexing array RR
-
- Imin = R.domain()[0].first(); Imax = R.domain()[0].last();
- Jmin = R.domain()[1].first(); Jmax = R.domain()[1].last();
- Kmin = R.domain()[2].first(); Kmax = R.domain()[2].last();
-
- int sizeRR = R.domain()[0].length()*R.domain()[1].length()*R.domain()[2].length();
- float* RR = new float[sizeRR];
-
- for (int k = Kmin; k < Kmax+1; k++)
- for (int j = Jmin; j < Jmax+1; j++)
- for (int i = Imin; i < Imax+1; i++) {
- int in = (i-Imin); int jn = (j-Jmin); int kn = (k-Kmin);
- int ind = kn*R.domain()[1].length()*R.domain()[2].length() +
- jn*R.domain()[1].length() + in;
- RR[ind] = R(i,j,k);
- }
-
- // verify that using strides() to index into the linear version of
- // BrickEngine R gives the same result as BrickView BV7 with its
- // unit strides.
-
- NT = BV7.strides();
-
- Imax = BV7.domain()[0].last();
- Jmax = BV7.domain()[1].last();
- Kmax = BV7.domain()[2].last();
-
- // compute differences between parent and subdomain first-index
-
- int deltI = BV7.baseDomain()[0].first() - R.domain()[0].first();
- int deltJ = BV7.baseDomain()[1].first() - R.domain()[1].first();
- int deltK = BV7.baseDomain()[2].first() - R.domain()[2].first();
-
- // compute linear-indexing offset
-
- int off = deltK*R.domain()[1].length()*R.domain()[2].length() +
- deltJ*R.domain()[1].length() + deltI;
-
- diff = zero;
- for (int k = 0; k < Kmax+1; k++)
- for (int j = 0; j < Jmax+1; j++)
- for (int i = 0; i < Imax+1; i++) {
- int ind = i*NT[0] + j*NT[1] + k*NT[2] + off;
- diff += fabs(RR[ind] - BV7(i,j,k));
- }
-
- testStatus = (diff == zero) && testStatus;
-
-
- // 2D, UnitStride=T
-
- // create linear-indexing array QQ
-
- Imin = Q.domain()[0].first(); Imax = Q.domain()[0].last();
- Jmin = Q.domain()[1].first(); Jmax = Q.domain()[1].last();
-
- int sizeQQ = Q.domain()[0].length()*Q.domain()[1].length();
- float* QQ = new float[sizeQQ];
-
- for (int j = Jmin; j < Jmax+1; j++)
- for (int i = Imin; i < Imax+1; i++) {
- int in = (i-Imin); int jn = (j-Jmin);
- int ind = jn*Q.domain()[1].length() + in;
- QQ[ind] = Q(i,j);
- }
-
-
- // verify that using strides() to index into the linear version of
- // BrickEngine Q gives the same result as BrickView BV8 with its unit
- // strides (if the different starting points for the indexing underlying
- // the two Engines) is properly accounted for).
-
- NT = BV8.strides();
-
- Imax = BV8.domain()[0].last();
- Jmax = BV8.domain()[1].last();
-
- // compute differences between parent and subdomain first-index
-
- deltI = BV8.baseDomain()[0].first() - Q.domain()[0].first();
- deltJ = BV8.baseDomain()[1].first() - Q.domain()[1].first();
-
- // compute linear-indexing offset
-
- off = deltJ*Q.domain()[1].length() + deltI;
-
- diff = zero;
- for (int j = 0; j < Jmax+1; j++)
- for (int i = 0; i < Imax+1; i++) {
- int ind = i*NT[0] + j*NT[1] + off;
- diff += fabs(QQ[ind] - BV8(i,j));
- }
-
- testStatus = (diff == zero) && testStatus;
-
-
- // extra test for 3D, UnitStride = F (different Engine, just for fun)
-
- // parent domain
-
- Interval<1> U1(4,10); // length 7
- Interval<1> U2(0,4); // length 5
- Interval<1> U3(-2,0); // length 3
- Interval<3> D(U1,U2,U3);
- Engine3Df_t S(D);
-
- int sizeS2 = U1.length()*U2.length()*U3.length();
- float *S2 = new float[sizeS2];
-
- Imin = U1.first(); Imax = U1.last();
- Jmin = U2.first(); Jmax = U2.last();
- Kmin = U3.first(); Kmax = U3.last();
-
- // linearly-indexed version of BrickEngine to illustrate use of strides()
-
- for (int k = Kmin; k < Kmax+1; k++)
- for (int j = Jmin; j < Jmax+1; j++)
- for (int i = Imin; i < Imax+1; i++) {
- int in = (i-Imin); int jn = (j-Jmin); int kn = (k-Kmin);
- S(i,j,k) = in*1.1 + jn*2.2 + kn*3.3;
- int ind = kn*U1.length()*U2.length() + jn*U1.length() + in;
- S2[ind] = S(i,j,k);
- }
-
- // sub-domain
-
- Range<1> V1(4,10,2); // length 4
- Range<1> V2(0,4,2); // length 3
- Range<1> V3(-2,0,2); // length 2
-
- Range<3> F(V1,V2,V3);
- float3DV2_t BV9(S,F);
-
- NT = BV9.strides();
-
- // this 'check' once again second-guesses the implementation
- // (ok, this is _really_ the last time!)
-
- testStatus = true;
- for(int i = 0; i < 3; i++) {
- nomStrides[i] = S.strides()[i] * F[i].stride();
- testStatus = (NT[i] == nomStrides[i]) && testStatus;
- }
-
- // true check: verify that using strides() to index into the linear version
- // of BrickEngine S gives the same result as BrickView BV9 with unit strides.
-
- Imax = BV9.domain()[0].last();
- Jmax = BV9.domain()[1].last();
- Kmax = BV9.domain()[2].last();
-
- // compute differences between parent and subdomain first-index
-
- deltI = BV9.baseDomain()[0].first() - S.domain()[0].first();
- deltJ = BV9.baseDomain()[1].first() - S.domain()[1].first();
- deltK = BV9.baseDomain()[2].first() - S.domain()[2].first();
-
- // compute linear-indexing offset
-
- off = deltK*S.domain()[1].length()*S.domain()[2].length() +
- deltJ*S.domain()[1].length() + deltI;
-
- diff = zero;
- for (int k = 0; k < Kmax+1; k++)
- for (int j = 0; j < Jmax+1; j++)
- for (int i = 0; i < Imax+1; i++) {
- int ind = i*NT[0] + j*NT[1] + k*NT[2] + off;
- diff += fabs(S2[ind] - BV9(i,j,k));
- }
- testStatus = (diff == zero) && testStatus;
-
- reportResults(testNumber," strides() accessor",testStatus);
-
-
- //----------------------------------------------------------
- // test 38: BrickViewEngine SliceRange<Dim2,Dim> constructor
- //----------------------------------------------------------
-
- ++testNumber;
-
- // SliceRange<Dim2,Dim> is a Domain which stores a total
- // Domain (of dimension Dim2) and a slice Domain (of dimension
- // Dim < Dim2). Although in general both Domains in a SliceRange
- // can be Range objects, here the Dim2 Domain must be an Interval
- // since it corresponds to the Domain of a BrickEngine. The
- // Dim Range is the one actually used in the constructor; the
- // Dim2 Range is implicitly known through the BrickEngine.
-
- // construct the parent Interval/Engine for the SliceRange/View
-
- Interval<6> IA6(I0,IJK,J0,Balmer);
- Engine6Df_t B1(IA6);
-
- // get 6D Interval limits
-
- imin = I0.first();
- imax = I0.last();
- jmin = IJK[0].first();
- jmax = IJK[0].last();
- kmin = IJK[1].first();
- kmax = IJK[1].last();
- int lmin = IJK[2].first();
- int lmax = IJK[2].last();
- int mmin = J0.first();
- int mmax = J0.last();
- int nmin = Balmer.first();
- int nmax = Balmer.last();
-
- // assign BrickEngine values
-
- for(int i = imin; i < imax+1; i++)
- for(int j = jmin; j < jmax+1; j++)
- for(int k = kmin; k < kmax+1; k++)
- for(int l = lmin; l < lmax+1; l++)
- for(int m = mmin; m < mmax+1; m++)
- for(int n = nmin; n < nmax+1; n++)
- B1(i,j,k,l,m,n) = i*1.1 + j*2.2 + k*3.3 + l*4.4 + m*5.5 + n*6.6;
-
- // define typedefs for the SliceRange
-
- typedef NewDomain5<Loc<1>, int, AllDomain<2>, Interval<1>, Range<1> > ND1_t;
- typedef ND1_t::SliceType_t ST1_t;
-
- // construct the SliceRange, making sure that it is a true subset of
- // parent Interval IA6
-
- ST1_t SR6;
-
- int ll = -2;
- Loc<1> L1(ll); // subset of I0
- int ii = 5; // subset of I
- AllDomain<2> A2; // subset of JK part of IJK (wildcard)
- Interval<1> JJ0(7,10); // subset of J0
- Range<1> B0(3,15,3); // subset of Balmer
-
- ND1_t::fillSlice(SR6,IA6,L1,ii,A2,JJ0,B0);
-
- // finally, construct a BrickViewEngine based on SliceRange6
-
- testStatus = (SR6.sliceDimensions == 4);
- float4DV3_t BV10(B1,SR6);
-
- // check values
-
- int Lmin; int Llen; int Lstr;
- Range<6> d14 = BV10.baseDomain();
-
- Imin = d14[2].first();
- Jmin = d14[3].first();
- Kmin = d14[4].first();
- Lmin = d14[5].first();
- Ilen = d14[2].length();
- Jlen = d14[3].length();
- Klen = d14[4].length();
- Llen = d14[5].length();
- Istr = d14[2].stride();
- Jstr = d14[3].stride();
- Kstr = d14[4].stride();
- Lstr = d14[5].stride();
-
- diff = zero;
- for(int i = 0; i < Ilen; i++)
- for(int j = 0; j < Jlen; j++)
- for(int k = 0; k < Klen; k++)
- for(int l = 0; l < Llen; l++) {
- int Iind = Imin + i*Istr;
- int Jind = Jmin + j*Jstr;
- int Kind = Kmin + k*Kstr;
- int Lind = Lmin + l*Lstr;
- diff += fabs(B1(ll,ii,Iind,Jind,Kind,Lind) - BV10(i,j,k,l));
- }
- testStatus = (diff == zero) && testStatus;
-
- reportResults(testNumber,"SliceRange<Dim2,Dim> constructor",
- testStatus);
-
-
- //-------------------------------------------------------------
- // test 39: SliceRange<Dim2,Dim> constructor, NewEngine struct
- //-------------------------------------------------------------
-
- ++testNumber;
-
- {
- typedef NewEngine<Engine6Df_t,ST1_t>::Type_t Try_t;
- typedef Engine<4,float,BrickView<6,false> > Correct_t;
- testStatus = TypeMatchTester<Try_t,Correct_t>::Result;
- }
-
- reportResults(testNumber," NewEngine struct",testStatus);
-
-
- //--------------------------------------------------------------
- // test 40: SliceRange<Dim2,Dim> constructor, domain() accessor
- //--------------------------------------------------------------
-
- ++testNumber;
-
- Interval<4> d13 = BV10.domain();
-
- testStatus = (d13[0].first() == 0) &&
- (d13[0].last() == 6) &&
- (d13[0].length() == 7) &&
- (d13[1].first() == 0) &&
- (d13[1].last() == 12) &&
- (d13[1].length() == 13) &&
- (d13[2].first() == 0) &&
- (d13[2].last() == 3) &&
- (d13[2].length() == 4) &&
- (d13[3].first() == 0) &&
- (d13[3].last() == 4) &&
- (d13[3].length() == 5);
-
- reportResults(testNumber," domain() accessor",testStatus);
-
-
- //-----------------------------------------------------------------
- // test 41: SliceRange<Dim2,Dim> constructor, baseDomain() accessor
- //-----------------------------------------------------------------
-
- ++testNumber;
-
- testStatus = (d14[0].first() == -2) &&
- (d14[0].last() == -2) &&
- (d14[0].length() == 1) &&
- (d14[1].first() == 5) &&
- (d14[1].last() == 5) &&
- (d14[1].length() == 1) &&
- (d14[2].first() == -6) &&
- (d14[2].last() == 0) &&
- (d14[2].length() == 7) &&
- (d14[3].first() == 2) &&
- (d14[3].last() == 14) &&
- (d14[3].length() == 13) &&
- (d14[4].first() == 7) &&
- (d14[4].last() == 10) &&
- (d14[4].length() == 4) &&
- (d14[5].first() == 3) &&
- (d14[5].last() == 15) &&
- (d14[5].length() == 5);
-
-
- reportResults(testNumber," baseDomain() accessor",testStatus);
-
-
- //--------------------------------------------------------------
- // test 42: SliceRange<Dim2,Dim> constructor, strides() accessor
- //--------------------------------------------------------------
-
- ++testNumber;
-
- // create linear-indexing array BB1
-
- int Lmax; int Mmin; int Mmax; int Nmin; int Nmax;
- Imin = B1.domain()[0].first(); Imax = B1.domain()[0].last();
- Jmin = B1.domain()[1].first(); Jmax = B1.domain()[1].last();
- Kmin = B1.domain()[2].first(); Kmax = B1.domain()[2].last();
- Lmin = B1.domain()[3].first(); Lmax = B1.domain()[3].last();
- Mmin = B1.domain()[4].first(); Mmax = B1.domain()[4].last();
- Nmin = B1.domain()[5].first(); Nmax = B1.domain()[5].last();
-
- int sizeBB1 = B1.domain()[0].length()*B1.domain()[1].length()*B1.domain()[2].length() *
- B1.domain()[3].length()*B1.domain()[4].length()*B1.domain()[5].length();
- float* BB1 = new float[sizeBB1];
-
- int b10 = B1.domain()[0].length();
- int b11 = B1.domain()[1].length();
- int b12 = B1.domain()[2].length();
- int b13 = B1.domain()[3].length();
- int b14 = B1.domain()[4].length();
-
- for (int n = Nmin; n < Nmax+1; n++)
- for (int m = Mmin; m < Mmax+1; m++)
- for (int l = Lmin; l < Lmax+1; l++)
- for (int k = Kmin; k < Kmax+1; k++)
- for (int j = Jmin; j < Jmax+1; j++)
- for (int i = Imin; i < Imax+1; i++) {
- int in = (i-Imin); int jn = (j-Jmin); int kn = (k-Kmin);
- int ln = (l-Lmin); int mn = (m-Mmin); int nn = (n-Nmin);
- int ind = nn*b10*b11*b12*b13*b14 + mn*b10*b11*b12*b13 +
- ln*b10*b11*b12 + kn*b10*b11 + jn*b10 + in;
- BB1[ind] = B1(i,j,k,l,m,n);
- }
-
- NT = BV10.strides();
-
- Imax = BV10.domain()[0].last();
- Jmax = BV10.domain()[1].last();
- Kmax = BV10.domain()[2].last();
- Lmax = BV10.domain()[3].last();
-
- // compute differences between parent and subdomain first-index
-
- deltI = BV10.baseDomain()[0].first() - B1.domain()[0].first();
- deltJ = BV10.baseDomain()[1].first() - B1.domain()[1].first();
- deltK = BV10.baseDomain()[2].first() - B1.domain()[2].first();
- int deltL = BV10.baseDomain()[3].first() - B1.domain()[3].first();
- int deltM = BV10.baseDomain()[4].first() - B1.domain()[4].first();
- int deltN = BV10.baseDomain()[5].first() - B1.domain()[5].first();
-
- // compute linear-indexing offset
-
- off = deltN*b10*b11*b12*b13*b14 + deltM*b10*b11*b12*b13 +
- deltL*b10*b11*b12 + deltK*b10*b11 + deltJ*b10 + deltI;
-
- diff = zero;
- for (int l = 0; l < Lmax+1; l++)
- for (int k = 0; k < Kmax+1; k++)
- for (int j = 0; j < Jmax+1; j++)
- for (int i = 0; i < Imax+1; i++) {
- int ind = i*NT[0] + j*NT[1] + k*NT[2] + l*NT[3] + off;
- diff += fabs(BB1[ind] - BV10(i,j,k,l));
- }
-
- testStatus = (diff == zero) && testStatus;
-
- reportResults(testNumber," strides() accessor",testStatus);
-
-
- //-------------------------------------------------------------
- // test 43: BrickViewEngine SliceInterval<Dim2,Dim> constructor
- //-------------------------------------------------------------
-
- ++testNumber;
-
- // similar to SliceRange<Dim2,Dim> constructor, but now the 1D
- // subDomains comprising the Slice must all be Intervals.
- //
- // test using B1 again, but this time take 2D slice instead of 4D.
-
- typedef NewDomain4<AllDomain<1>, Loc<3>, Interval<1>, Loc<1> > ND2_t;
- typedef ND2_t::SliceType_t ST2_t;
-
- ST2_t SI6;
- AllDomain<1> A1; // subset of I0
- Loc<3> L3(2,-4,12); // subset of IJK
- L1 = 18; // subset of Balmer
-
- ND2_t::fillSlice(SI6,IA6,A1,L3,JJ0,L1);
- testStatus = (SI6.sliceDimensions == 2);
-
- float2DV2_t BV12(B1,SI6);
- Interval<6> d15 = BV12.baseDomain();
-
- Imin = d15[0].first();
- Jmin = d15[4].first();
- Ilen = d15[0].length();
- Jlen = d15[4].length();
- Istr = d15[0].stride();
- Jstr = d15[4].stride();
-
- diff = zero;
- for(int i = 0; i < Ilen; i++)
- for(int j = 0; j < Jlen; j++) {
- int Iind = Imin + i*Istr;
- int Jind = Jmin + j*Jstr;
- diff += fabs(B1(Iind,2,-4,12,Jind,18) - BV12(i,j));
- }
- testStatus = (diff == zero) && testStatus;
-
- reportResults(testNumber,"SliceInterval<Dim2,Dim> constructor",
- testStatus);
-
-
- //----------------------------------------------------------------
- // test 44: SliceInterval<Dim2,Dim> constructor, NewEngine struct
- //----------------------------------------------------------------
-
- ++testNumber;
-
- {
- typedef NewEngine<Engine6Df_t,ST2_t>::Type_t Try_t;
- typedef Engine<2,float,BrickView<6,false> > Correct_t;
- testStatus = TypeMatchTester<Try_t,Correct_t>::Result;
- }
-
- reportResults(testNumber," NewEngine struct",testStatus);
-
-
- //----------------------------------------------------------------
- // test 45: SliceInterval<Dim2,Dim> constructor, domain() accessor
- //----------------------------------------------------------------
-
- ++testNumber;
-
- Interval<2> d16 = BV12.domain();
- testStatus = (d16[0].first() == 0) &&
- (d16[0].last() == 6) &&
- (d16[0].length() == 7) &&
- (d16[1].first() == 0) &&
- (d16[1].last() == 3) &&
- (d16[1].length() == 4);
-
- reportResults(testNumber," domain() accessor",testStatus);
-
-
- //--------------------------------------------------------------------
- // test 46: SliceInterval<Dim2,Dim> constructor, baseDomain() accessor
- //--------------------------------------------------------------------
-
- ++testNumber;
-
- testStatus = (d15[0].first() == -3) &&
- (d15[0].last() == 3) &&
- (d15[0].length() == 7) &&
- (d15[1].first() == 2) &&
- (d15[1].last() == 2) &&
- (d15[1].length() == 1) &&
- (d15[2].first() == -4) &&
- (d15[2].last() == -4) &&
- (d15[2].length() == 1) &&
- (d15[3].first() == 12) &&
- (d15[3].last() == 12) &&
- (d15[3].length() == 1) &&
- (d15[4].first() == 7) &&
- (d15[4].last() == 10) &&
- (d15[4].length() == 4) &&
- (d15[5].first() == 18) &&
- (d15[5].last() == 18) &&
- (d15[5].length() == 1);
-
- reportResults(testNumber," baseDomain() accessor",testStatus);
-
-
- //-----------------------------------------------------------------
- // test 47: SliceInterval<Dim2,Dim> constructor, strides() accessor
- //-----------------------------------------------------------------
-
- ++testNumber;
-
- NT = BV12.strides();
-
- Imax = BV12.domain()[0].last();
- Jmax = BV12.domain()[1].last();
-
- deltI = BV12.baseDomain()[0].first() - B1.domain()[0].first();
- deltJ = BV12.baseDomain()[1].first() - B1.domain()[1].first();
- deltK = BV12.baseDomain()[2].first() - B1.domain()[2].first();
- deltL = BV12.baseDomain()[3].first() - B1.domain()[3].first();
- deltM = BV12.baseDomain()[4].first() - B1.domain()[4].first();
- deltN = BV12.baseDomain()[5].first() - B1.domain()[5].first();
-
- off = deltN*b10*b11*b12*b13*b14 + deltM*b10*b11*b12*b13 +
- deltL*b10*b11*b12 + deltK*b10*b11 + deltJ*b10 + deltI;
-
- diff = zero;
- for (int j = 0; j < Jmax+1; j++)
- for (int i = 0; i < Imax+1; i++) {
- int ind = i*NT[0] + j*NT[1] + off;
- diff += fabs(BB1[ind] - BV12(i,j));
- }
- testStatus = (diff == zero) && testStatus;
-
- reportResults(testNumber," strides() accessor",testStatus);
-
-
- //------------------------------------------
- // test 48: BrickViewEngine Node constructor
- //------------------------------------------
-
- ++testNumber;
-
- // use simple Node as in test #10, built on Interval<6>
- // subset of star.
-
- Loc<5> gamma(5,11,4,8,12);
- Interval<6> symm(gamma,Interval<1>(5,9));
- Node<Interval<6> > kpt(-1,symm,0,0,0);
-
- // assign more interesting data to BZone than simple constant
-
- for(int i = 4; i < 13; i++)
- for(int j = 4; j < 13; j++)
- for(int k = 4; k < 13; k++)
- for(int l = 4; l < 13; l++)
- for(int m = 4; m < 13; m++)
- for(int n = 4; n < 13; n++)
- BZone(i,j,k,l,m,n) = i*2 + j*3 + k*4 + (l+m)*5 - n;
-
- int6DV1_t BV14(BZone,kpt);
-
- Interval<6> d17 = BV14.baseDomain();
-
- Imin = d17[5].first();
- Ilen = d17[5].length();
- Istr = d17[5].stride();
-
- diff = zero;
- for(int i = 0; i < 5; i++) {
- int Iind = Imin + i*Istr;
- diff += abs(BZone(5,11,4,8,12,Iind) - BV14.read(0,0,0,0,0,i));
- }
-
- testStatus = (diff == zero);
-
- reportResults(testNumber,"Node constructor",testStatus);
-
-
- //---------------------------------------------
- // test 49: Node constructor, NewEngine struct
- //---------------------------------------------
-
- ++testNumber;
-
- {
- typedef NewEngine<Engine6Di_t, Node<Interval<6> > >::Type_t Try_t;
- typedef Engine<6,int,BrickView<6,true> > Correct_t;
- testStatus = TypeMatchTester<Try_t,Correct_t>::Result;
- }
-
- reportResults(testNumber," NewEngine struct",testStatus);
-
-
- //---------------------------------------------
- // test 50: Node constructor, domain() accessor
- //---------------------------------------------
-
- ++testNumber;
-
- Interval<6> d18 = BV14.domain();
- testStatus = (d18[0].first() == 0) &&
- (d18[0].last() == 0) &&
- (d18[0].length() == 1) &&
- (d18[1].first() == 0) &&
- (d18[1].last() == 0) &&
- (d18[1].length() == 1) &&
- (d18[2].first() == 0) &&
- (d18[2].last() == 0) &&
- (d18[2].length() == 1) &&
- (d18[3].first() == 0) &&
- (d18[3].last() == 0) &&
- (d18[3].length() == 1) &&
- (d18[4].first() == 0) &&
- (d18[4].last() == 0) &&
- (d18[4].length() == 1) &&
- (d18[5].first() == 0) &&
- (d18[5].last() == 4) &&
- (d18[5].length() == 5);
-
- reportResults(testNumber," domain() accessor",testStatus);
-
-
- //-------------------------------------------------
- // test 51: Node constructor, baseDomain() accessor
- //-------------------------------------------------
-
- ++testNumber;
- testStatus = (d17[0].first() == 5) &&
- (d17[0].last() == 5) &&
- (d17[0].length() == 1) &&
- (d17[1].first() == 11) &&
- (d17[1].last() == 11) &&
- (d17[1].length() == 1) &&
- (d17[2].first() == 4) &&
- (d17[2].last() == 4) &&
- (d17[2].length() == 1) &&
- (d17[3].first() == 8) &&
- (d17[3].last() == 8) &&
- (d17[3].length() == 1) &&
- (d17[4].first() == 12) &&
- (d17[4].last() == 12) &&
- (d17[4].length() == 1) &&
- (d17[5].first() == 5) &&
- (d17[5].last() == 9) &&
- (d17[5].length() == 5);
-
- reportResults(testNumber," baseDomain() accessor",testStatus);
-
-
- //----------------------------------------------
- // test 52: Node constructor, strides() accessor
- //----------------------------------------------
-
- ++testNumber;
-
- Imin = BZone.domain()[0].first(); Imax = BZone.domain()[0].last();
- Jmin = BZone.domain()[1].first(); Jmax = BZone.domain()[1].last();
- Kmin = BZone.domain()[2].first(); Kmax = BZone.domain()[2].last();
- Lmin = BZone.domain()[3].first(); Lmax = BZone.domain()[3].last();
- Mmin = BZone.domain()[4].first(); Mmax = BZone.domain()[4].last();
- Nmin = BZone.domain()[5].first(); Nmax = BZone.domain()[5].last();
-
- int sizeBZ2 = BZone.domain()[0].length()*BZone.domain()[1].length()*BZone.domain()[2].length() *
- BZone.domain()[3].length()*BZone.domain()[4].length()*BZone.domain()[5].length();
- float* BZ2 = new float[sizeBZ2];
-
- b10 = BZone.domain()[0].length();
- b11 = BZone.domain()[1].length();
- b12 = BZone.domain()[2].length();
- b13 = BZone.domain()[3].length();
- b14 = BZone.domain()[4].length();
-
- for (int n = Nmin; n < Nmax+1; n++)
- for (int m = Mmin; m < Mmax+1; m++)
- for (int l = Lmin; l < Lmax+1; l++)
- for (int k = Kmin; k < Kmax+1; k++)
- for (int j = Jmin; j < Jmax+1; j++)
- for (int i = Imin; i < Imax+1; i++) {
- int in = (i-Imin); int jn = (j-Jmin); int kn = (k-Kmin);
- int ln = (l-Lmin); int mn = (m-Mmin); int nn = (n-Nmin);
- int ind = nn*b10*b11*b12*b13*b14 + mn*b10*b11*b12*b13 +
- ln*b10*b11*b12 + kn*b10*b11 + jn*b10 + in;
- BZ2[ind] = BZone(i,j,k,l,m,n);
- }
-
- NT = BV14.strides();
- Imax = BV14.domain()[5].last();
-
- deltI = BV14.baseDomain()[0].first() - BZone.domain()[0].first();
- deltJ = BV14.baseDomain()[1].first() - BZone.domain()[1].first();
- deltK = BV14.baseDomain()[2].first() - BZone.domain()[2].first();
- deltL = BV14.baseDomain()[3].first() - BZone.domain()[3].first();
- deltM = BV14.baseDomain()[4].first() - BZone.domain()[4].first();
- deltN = BV14.baseDomain()[5].first() - BZone.domain()[5].first();
-
- off = deltN*b10*b11*b12*b13*b14 + deltM*b10*b11*b12*b13 +
- deltL*b10*b11*b12 + deltK*b10*b11 + deltJ*b10 + deltI;
-
- diff = zero;
- for (int i = 0; i < Imax+1; i++) {
- int ind = i*NT[5] + off;
- diff += fabs(BZ2[ind] - BV14(0,0,0,0,0,i));
- }
- testStatus = (diff == zero) && testStatus;
-
- reportResults(testNumber," strides() accessor",testStatus);
-
-
- //-------------------------------------------
- // test 53: BrickViewEngine INode constructor
- //-------------------------------------------
-
- ++testNumber;
-
- // construct an INode from a Node
-
- Loc<1> alpha(10);
- Loc<3> beta(12,5,7);
- Interval<6> symmer(alpha,Interval<1>(10,12),point,beta);
- Node<Interval<6> > gvec(-1,symmer,0,0,0);
- INode<6> IN1(gvec);
- int6DV1_t BV16(BZone,IN1);
-
- Interval<6> d19 = BV16.baseDomain();
-
- Imin = d19[1].first();
- Ilen = d19[1].length();
- Istr = d19[1].stride();
-
- Jmin = d19[2].first();
- Jlen = d19[2].length();
- Jstr = d19[2].stride();
-
- diff = zero;
- for(int i = 0; i < Ilen+1; i++)
- for(int j = 0; j < Jlen+1; j++) {
- int Iind = Imin + i*Istr;
- int Jind = Jmin + j*Jstr;
- diff += abs(BZone.read(10,Iind,Jind,12,5,7) - BV16(0,i,j,0,0,0));
- }
- testStatus = (diff == zero);
-
- reportResults(testNumber,"INode constructor",testStatus);
-
-
- //---------------------------------------------
- // test 54: INode constructor, NewEngine struct
- //---------------------------------------------
-
- ++testNumber;
-
- {
- typedef NewEngine<Engine6Di_t, INode<6> >::Type_t Try_t;
- typedef Engine<6,int,BrickView<6,true> > Correct_t;
- testStatus = TypeMatchTester<Try_t,Correct_t>::Result;
- }
-
- reportResults(testNumber," NewEngine struct",testStatus);
-
-
- //----------------------------------------------
- // test 55: INode constructor, domain() accessor
- //----------------------------------------------
-
- ++testNumber;
-
- Interval<6> d20 = BV16.domain();
- testStatus = (d20[0].first() == 0) &&
- (d20[0].last() == 0) &&
- (d20[0].length() == 1) &&
- (d20[1].first() == 0) &&
- (d20[1].last() == 2) &&
- (d20[1].length() == 3) &&
- (d20[2].first() == 0) &&
- (d20[2].last() == 8) &&
- (d20[2].length() == 9) &&
- (d20[3].first() == 0) &&
- (d20[3].last() == 0) &&
- (d20[3].length() == 1) &&
- (d20[4].first() == 0) &&
- (d20[4].last() == 0) &&
- (d20[4].length() == 1) &&
- (d20[5].first() == 0) &&
- (d20[5].last() == 0) &&
- (d20[5].length() == 1);
-
- reportResults(testNumber," domain() accessor",testStatus);
-
-
- //--------------------------------------------------
- // test 56: INode constructor, baseDomain() accessor
- //--------------------------------------------------
-
- ++testNumber;
-
- testStatus = (d19[0].first() == 10) &&
- (d19[0].last() == 10) &&
- (d19[0].length() == 1) &&
- (d19[1].first() == 10) &&
- (d19[1].last() == 12) &&
- (d19[1].length() == 3) &&
- (d19[2].first() == 4) &&
- (d19[2].last() == 12) &&
- (d19[2].length() == 9) &&
- (d19[3].first() == 12) &&
- (d19[3].last() == 12) &&
- (d19[3].length() == 1) &&
- (d19[4].first() == 5) &&
- (d19[4].last() == 5) &&
- (d19[4].length() == 1) &&
- (d19[5].first() == 7) &&
- (d19[5].last() == 7) &&
- (d19[5].length() == 1);
-
- reportResults(testNumber," baseDomain() accessor",testStatus);
-
-
- //-----------------------------------------------
- // test 57: INode constructor, strides() accessor
- //-----------------------------------------------
-
- ++testNumber;
-
- NT = BV16.strides();
- Imax = BV16.domain()[1].last();
- Jmax = BV16.domain()[2].last();
-
- deltI = BV16.baseDomain()[0].first() - BZone.domain()[0].first();
- deltJ = BV16.baseDomain()[1].first() - BZone.domain()[1].first();
- deltK = BV16.baseDomain()[2].first() - BZone.domain()[2].first();
- deltL = BV16.baseDomain()[3].first() - BZone.domain()[3].first();
- deltM = BV16.baseDomain()[4].first() - BZone.domain()[4].first();
- deltN = BV16.baseDomain()[5].first() - BZone.domain()[5].first();
-
- // b10...b14 are the same as for Node, since the underlying BZone
- // BrickEngine is the same
-
- off = deltN*b10*b11*b12*b13*b14 + deltM*b10*b11*b12*b13 +
- deltL*b10*b11*b12 + deltK*b10*b11 + deltJ*b10 + deltI;
-
- diff = zero;
- for (int j = 0; j < Jmax+1; j++)
- for (int i = 0; i < Imax+1; i++) {
- int ind = i*NT[1] + j*NT[2] + off;
- diff += fabs(BZ2[ind] - BV16(0,i,j,0,0,0));
- }
- testStatus = (diff == zero) && testStatus;
-
- reportResults(testNumber," strides() accessor",testStatus);
-
-
- //-----------------------------------------------------
- // test 58: BrickViewEngine BrickView/Range constructor
- //-----------------------------------------------------
-
- ++testNumber;
-
- // note: the nominally distinct case of BrickView/Interval
- // is not tested here.
-
- // Use the domain and subdomain of test #37 as the
- // starting point here. This is not the most general
- // test since the parent Engine Dim2 and subdomain Dim
- // happen to be equal here.
-
- Range<1> V4(4,6,2);
- Loc<1> L2(-2);
- Range<3> FF(V4,V2,L2);
-
- typedef NewEngine<float3DV2_t,Range<3> >::Type_t BVT1_t;
- BVT1_t BV21(BV9,FF);
-
- Range<3> d21 = BV21.baseDomain();
-
- Imin = d21[0].first();
- Jmin = d21[1].first();
- Kmin = d21[2].first();
- Ilen = d21[0].length();
- Jlen = d21[1].length();
- Klen = d21[2].length();
- Istr = d21[0].stride();
- Jstr = d21[1].stride();
- Kstr = d21[2].stride();
-
- diff = zero;
- for(int i = 0; i < Ilen; i++)
- for(int j = 0; j < Jlen; j++)
- for(int k = 0; k < Klen; k++) {
- int Iind = Imin + i*Istr;
- int Jind = Jmin + j*Jstr;
- int Kind = Kmin + k*Kstr;
- diff += fabs(S(Iind,Jind,Kind) - BV21(i,j,k));
- }
- testStatus = (diff == zero) && testStatus;
-
- reportResults(testNumber,"BrickView/Range constructor",
- testStatus);
-
-
- //-------------------------------------------------------
- // test 59: BrickView/Range constructor, NewEngine struct
- //-------------------------------------------------------
-
- ++testNumber;
-
- // test NewEngine for general case where Dim != Dim2
-
- {
- typedef NewEngine<float4DV3_t,Range<4> >::Type_t Try_t;
- typedef Engine<4,float,BrickView<6,false> > Correct_t;
- testStatus = TypeMatchTester<Try_t,Correct_t>::Result;
- }
-
- reportResults(testNumber," NewEngine struct",testStatus);
-
-
- //--------------------------------------------------------
- // test 60: BrickView/Range constructor, domain() accessor
- //--------------------------------------------------------
-
- /*
- =====================================================================
- gam 12/8/98
- tests 60 and 61 inactivated following swh's comments of 12/7/98:
-
- I've looked at the BrickEngineTest and it doesn't look correct.
-
- Susan makes an engine called S with the domain
-
- [4:10:1][0:4:1][-2:0:1]
-
- since this is a Brick, this is also the baseDomain. She then makes a view
- called BV9 using the range
-
- [4:10:2][0:4:2][-2:0:2].
-
- So far, so good. BV9 has the domain (remember that views are Zero-based and
- unit stride)
-
- [0:3:1][0:2:1][0:1:1]
-
- and the base domain is the same as the range that formed it. Then, she tries
- to take a view of BV9, called BV21, using the range
-
- [4:6:2][0:4:2][-2:-2:1]
-
- This is bad since this range is outside the domain of BV9. Any test using
- BC21 is suspect, though a few miraculously pass.
-
- =====================================================================
-
- ++testNumber;
-
- Range<3> d22 = BV21.domain();
- testStatus = (d22[0].first() == 0) &&
- (d22[0].last() == 1) &&
- (d22[0].length() == 2) &&
- (d22[1].first() == 0) &&
- (d22[1].last() == 2) &&
- (d22[1].length() == 3) &&
- (d22[2].first() == 0) &&
- (d22[2].last() == 0) &&
- (d22[2].length() == 1);
-
- reportResults(testNumber," domain() accessor",testStatus);
-
- //------------------------------------------------------------
- // test 61: BrickView/Range constructor, baseDomain() accessor
- //------------------------------------------------------------
-
- ++testNumber;
-
- // the baseDomain is the domain with respect to the original
- // Brick's Domain. Here, the original Brick is S (see
- // test #37) which has a Domain [4:10:1,0:4:1,-2:0:1].
- // The values returned by baseDomain should therefore lie
- // within these limits.
- //
- // The baseDomain is computed in BrickEngine.h as follows:
- //
- // baseDomain_m[dt] = Range<1>(
- // base[dt].first() + domain[d0].first() * base[dt].stride(),
- // base[dt].first() + domain[d0].last() * base[dt].stride(),
- // domain[d0].stride() * base[dt].stride());
- //
- // base <--> the BrickViewEngines's base, in this example,
- // BV9.baseDomain() = [4:10:2,0:4:2,-2:0:2].
- //
- // domain <--> the Domain of the Range constructor argument, in this
- // example, FF.domain() = = [4:6:2,0:4:2,-2:-2:1].
- //
- // The above code therefore computes the baseDomain() for
- // the new BrickView as follows:
- //
- // 1st Dim: 4 + 4*2, 4 + 6*2, 2*2
- // 2nd Dim: 0 + 0*2, 0 + 4*2, 2*2
- // 3rd Dim: -2 + -2*2, -2 + -2*2, 1*2
- //
- // i.e., d21 = [12:16:4,0:8:4,-6:-6:2].
- //
- // Note that this says that the baseDomain of the View of a BrickView of
- // a Brick lies outside the baseDomain of the original Brick.
- //
- // Thus, either the implementation is incorrect, or else the interpretation
- // of this constructor used here is wrong, and thus not apparent from
- // the .h file alone. In that case, it should be carefully explained,
- // with examples, in the user documentation. It is likely that this
- // issue will be duplicated in all BrickViews constructed from another
- // BrickView and a Domain (eg., BrickView/SliceRange below).
-
- testStatus = (d21[0].first() == 4) &&
- (d21[0].last() == 6) &&
- (d21[0].length() == 2) &&
- (d21[1].first() == 0) &&
- (d21[1].last() == 4) &&
- (d21[1].length() == 3) &&
- (d21[2].first() == -2) &&
- (d21[2].last() == -2) &&
- (d21[2].length() == 1);
-
- reportResults(testNumber," baseDomain() accessor",testStatus);
-
- =====================================================================
- gam: end of inactivated portion 12/8/98
- */
-
- /*---------- outlines for remaining constructor sub-tests -------------
-
- //---------------------------------------------------------
- // test 62: BrickView/Range constructor, strides() accessor
- //---------------------------------------------------------
-
- ++testNumber;
-
- // this test cannot be implemented until test #61 is resolved.
-
- reportResults(testNumber," strides() accessor",testStatus);
-
-
- //----------------------------------------------------------
- // test 63: BrickViewEngine BrickView/SliceRange constructor
- //----------------------------------------------------------
-
- ++testNumber;
-
- reportResults(testNumber,"BrickView/SliceRange constructor",
- testStatus);
-
-
- //------------------------------------------------------------
- // test 64: BrickView/SliceRange constructor, NewEngine struct
- //------------------------------------------------------------
-
- ++testNumber;
-
- reportResults(testNumber," NewEngine struct",testStatus);
-
-
- //-------------------------------------------------------------
- // test 65: BrickView/SliceRange constructor, domain() accessor
- //-------------------------------------------------------------
-
- ++testNumber;
-
- reportResults(testNumber," domain() accessor",testStatus);
-
-
- //-----------------------------------------------------------------
- // test 66: BrickView/SliceRange constructor, baseDomain() accessor
- //-----------------------------------------------------------------
-
- ++testNumber;
-
- reportResults(testNumber," baseDomain() accessor",testStatus);
-
-
- //--------------------------------------------------------------
- // test 67: BrickView/SliceRange constructor, strides() accessor
- //--------------------------------------------------------------
-
- ++testNumber;
-
- reportResults(testNumber," strides() accessor",testStatus);
-
-
- //-------------------------------------------------------------
- // test 68: BrickViewEngine BrickView/SliceInterval constructor
- //-------------------------------------------------------------
-
- ++testNumber;
-
- reportResults(testNumber,"BrickView/SliceInterval constructor",
- testStatus);
-
-
- //---------------------------------------------------------------
- // test 69: BrickView/SliceInterval constructor, NewEngine struct
- //---------------------------------------------------------------
-
- ++testNumber;
-
- reportResults(testNumber," NewEngine struct",testStatus);
-
-
- //----------------------------------------------------------------
- // test 70: BrickView/SliceInterval constructor, domain() accessor
- //----------------------------------------------------------------
-
- ++testNumber;
-
- reportResults(testNumber," domain() accessor",testStatus);
-
-
- //--------------------------------------------------------------------
- // test 71: BrickView/SliceInterval constructor, baseDomain() accessor
- //--------------------------------------------------------------------
-
- ++testNumber;
-
- reportResults(testNumber," baseDomain() accessor",testStatus);
-
-
- //-----------------------------------------------------------------
- // test 72: BrickView/SliceInterval constructor, strides() accessor
- //-----------------------------------------------------------------
-
- ++testNumber;
-
- reportResults(testNumber," strides() accessor",testStatus);
-
-
- //-----------------------------------------------------
- // test 73: BrickViewEngine BrickView/Inode constructor
- //-----------------------------------------------------
-
- ++testNumber;
-
- reportResults(testNumber,"BrickView/Inode constructor",
- testStatus);
-
-
- //-------------------------------------------------------
- // test 74: BrickView/Inode constructor, NewEngine struct
- //-------------------------------------------------------
-
- ++testNumber;
-
- reportResults(testNumber," NewEngine struct",testStatus);
-
-
- //--------------------------------------------------------
- // test 75: BrickView/INode constructor, domain() accessor
- //--------------------------------------------------------
-
- ++testNumber;
-
- reportResults(testNumber," domain() accessor",testStatus);
-
-
- //------------------------------------------------------------
- // test 76: BrickView/INode constructor, baseDomain() accessor
- //------------------------------------------------------------
-
- ++testNumber;
-
- reportResults(testNumber," baseDomain() accessor",testStatus);
-
-
- //---------------------------------------------------------
- // test 77: BrickView/Inode constructor, strides() accessor
- //---------------------------------------------------------
-
- ++testNumber;
-
- reportResults(testNumber," strides() accessor",testStatus);
-
-
- //-------------------------------------------------------------
- // test 78: BrickViewEngine MultiPatch/INode constructor
- //-------------------------------------------------------------
-
- ++testNumber;
-
- reportResults(testNumber,"MultiPatch/Inode constructor",
- testStatus);
-
-
- //---------------------------------------------------------------
- // test 79: MultiPatch/Inode constructor, NewEngine struct
- //---------------------------------------------------------------
-
- ++testNumber;
-
- reportResults(testNumber," NewEngine struct",testStatus);
-
-
- //----------------------------------------------------------------
- // test 80: MultiPatch/INode constructor, domain() accessor
- //----------------------------------------------------------------
-
- ++testNumber;
-
- reportResults(testNumber," domain() accessor",testStatus);
-
-
- //--------------------------------------------------------------------
- // test 81: MultiPatch/INode constructor, baseDomain() accessor
- //--------------------------------------------------------------------
-
- ++testNumber;
-
- reportResults(testNumber," baseDomain() accessor",testStatus);
-
-
- //-----------------------------------------------------------------
- // test 82: MultiPatch/Inode constructor, strides() accessor
- //-----------------------------------------------------------------
-
- ++testNumber;
-
- reportResults(testNumber," strides() accessor",testStatus);
-
-
- //------------------------------------------------------------
- // test 83: BrickViewEngine MultiPatch/Node constructor
- //------------------------------------------------------------
-
- ++testNumber;
-
- reportResults(testNumber,"MultiPatch/Node constructor",
- testStatus);
-
-
- //--------------------------------------------------------------
- // test 84: MultiPatch/Node constructor, NewEngine struct
- //--------------------------------------------------------------
-
- ++testNumber;
-
- reportResults(testNumber," NewEngine struct",testStatus);
-
-
- //---------------------------------------------------------------
- // test 85: MultiPatch/Node constructor, domain() accessor
- //---------------------------------------------------------------
-
- ++testNumber;
-
- reportResults(testNumber," domain() accessor",testStatus);
-
-
- //-------------------------------------------------------------------
- // test 86: MultiPatch/Node constructor, baseDomain() accessor
- //-------------------------------------------------------------------
-
- ++testNumber;
-
- reportResults(testNumber," baseDomain() accessor",testStatus);
-
-
- //----------------------------------------------------------------
- // test 87: MultiPatch/Node constructor, strides() accessor
- //----------------------------------------------------------------
-
- ++testNumber;
-
- reportResults(testNumber," strides() accessor",testStatus);
-
-
- //-----------------------------------------------------------------
- // test 88: BrickViewEngine MultiPatchView/INode constructor
- //-----------------------------------------------------------------
-
- ++testNumber;
-
- reportResults(testNumber,"MultiPatchView/Inode constructor",
- testStatus);
-
-
- //-------------------------------------------------------------------
- // test 89: MultiPatchVIew/Inode constructor, NewEngine struct
- //-------------------------------------------------------------------
-
- ++testNumber;
-
- reportResults(testNumber," NewEngine struct",testStatus);
-
-
- //--------------------------------------------------------------------
- // test 90: MultiPatchView/INode constructor, domain() accessor
- //--------------------------------------------------------------------
-
- ++testNumber;
-
- reportResults(testNumber," domain() accessor",testStatus);
-
-
- //------------------------------------------------------------------------
- // test 91: MultiPatchView/INode constructor, baseDomain() accessor
- //------------------------------------------------------------------------
-
- ++testNumber;
-
- reportResults(testNumber," baseDomain() accessor",testStatus);
-
-
- //---------------------------------------------------------------------
- // test 92: MultiPatchView/INode constructor, strides() accessor
- //---------------------------------------------------------------------
-
- ++testNumber;
-
- reportResults(testNumber," strides() accessor",testStatus);
-
-
- //----------------------------------------------------------------
- // test 93: BrickViewEngine MultiPatchView/Node constructor
- //----------------------------------------------------------------
-
- ++testNumber;
-
- reportResults(testNumber,"MultiPatchView/Node constructor",
- testStatus);
-
-
- //------------------------------------------------------------------
- // test 94: MultiPatchVIew/Node constructor, NewEngine struct
- //------------------------------------------------------------------
-
- ++testNumber;
-
- reportResults(testNumber," NewEngine struct",testStatus);
-
-
- //-------------------------------------------------------------------
- // test 95: MultiPatchView/Node constructor, domain() accessor
- //-------------------------------------------------------------------
-
- ++testNumber;
-
- reportResults(testNumber," domain() accessor",testStatus);
-
-
- //-----------------------------------------------------------------------
- // test 96: MultiPatchView/Node constructor, baseDomain() accessor
- //-----------------------------------------------------------------------
-
- ++testNumber;
-
- reportResults(testNumber," baseDomain() accessor",testStatus);
-
-
- //--------------------------------------------------------------------
- // test 97: MultiPatchView/Node constructor, strides() accessor
- //--------------------------------------------------------------------
-
- ++testNumber;
-
- reportResults(testNumber," strides() accessor",testStatus);
-
-
- //-------------------------------------------------------
- // test 98: BrickViewEngine CompressibleBrick constructor
- //-------------------------------------------------------
-
- ++testNumber;
-
- reportResults(testNumber,"CompressibleBrick constructor",
- testStatus);
-
-
- //---------------------------------------------------------
- // test 99: CompressibleBrick constructor, NewEngine struct
- //---------------------------------------------------------
-
- ++testNumber;
-
- reportResults(testNumber," NewEngine struct",testStatus);
-
-
- //-----------------------------------------------------------
- // test 100: CompressibleBrick constructor, domain() accessor
- //-----------------------------------------------------------
-
- ++testNumber;
-
- reportResults(testNumber," domain() accessor",testStatus);
-
-
- //---------------------------------------------------------------
- // test 101: CompressibleBrick constructor, baseDomain() accessor
- //---------------------------------------------------------------
-
- ++testNumber;
-
- reportResults(testNumber," baseDomain() accessor",testStatus);
-
-
- //------------------------------------------------------------
- // test 102: CompressibleBrick constructor, strides() accessor
- //------------------------------------------------------------
-
- ++testNumber;
-
- reportResults(testNumber," strides() accessor",testStatus);
-
-
- ---------------- end templates for remaining constructors -------------*/
-
-
- //------------------------------------------------------------------------
- // test 103: BrickViewEngine copy constructor (all BrickView constructors)
- //------------------------------------------------------------------------
-
- ++testNumber;
-
- // Range/Interval
-
- Ilen = box3[0].length();
- Jlen = box3[1].length();
- Klen = box3[2].length();
-
- for (int i = 0; i < Ilen; i++)
- for (int j = 0; j < Jlen; j++)
- for (int k = 0; k < Klen; k++)
- diff += fabs(BV5.read(i,j,k) - BV7(Loc<3>(i,j,k)));
- testStatus = (diff == zero);
-
- Ilen = square2[0].length();
- Jlen = square2[1].length();
-
- for (int i = 0; i < Ilen; i++)
- for (int j = 0; j < Jlen; j++)
- diff += fabs(BV8(i,j) - BV1(i,j));
- testStatus = (diff == zero) && testStatus;
-
-
- // SliceRange<Dim2,Dim>
-
- float4DV3_t BV11(BV10);
-
- Ilen = d13[0].length();
- Jlen = d13[1].length();
- Klen = d13[2].length();
- Llen = d13[3].length();
-
- diff = zero;
- for(int i = 0; i < Ilen; i++)
- for(int j = 0; j < Jlen; j++)
- for(int k = 0; k < Klen; k++)
- for(int l = 0; l < Llen; l++)
- diff += fabs(BV10(i,j,k,l) - BV11(i,j,k,l));
- testStatus = (diff == zero) && testStatus;
-
-
- // SliceInterval<Dim2,Dim>
-
- float2DV2_t BV13(BV12);
- Ilen = d15[0].length();
- Jlen = d15[1].length();
-
- diff = zero;
- for(int i = 0; i < Ilen; i++)
- for(int j = 0; j < Jlen; j++)
- diff += fabs(BV13(i,j) - BV12(i,j));
- testStatus = (diff == zero) && testStatus;
-
-
- // Node
-
- int6DV1_t BV15(BV14);
- Ilen = d18[5].length();
-
- diff = zero;
- for(int i = 0; i < Ilen; i++)
- diff += abs(BV15.read(0,0,0,0,0,i) - BV14(Loc<6>(0,0,0,0,0,i)));
- testStatus = (diff == zero) && testStatus;
-
-
- // INode
-
- int6DV1_t BV17(BV16);
- Ilen = d20[0].length();
- Jlen = d20[1].length();
-
- diff = zero;
- for(int i = 0; i < Ilen; i++)
- for(int j = 0; j < Jlen; j++)
- diff += abs(BV17.read(0,i,j,0,0,0) - BV16(Loc<6>(0,i,j,0,0,0)));
- testStatus = (diff == zero) && testStatus;
-
-
- // --- add tests for additional constructors (corresponding to
- // --- tests 62-102) here.
-
- reportResults(testNumber,"copy constructor (all BrickView constructors)",
- testStatus);
-
- }
- catch(const char *err)
- { uncaughtErrorReport(err,testNumber); }
- catch(const Pooma::Assertion &err)
- { uncaughtErrorReport(err.what(),testNumber); }
- catch(...)
- { cerr << "Unknown exception!" << endl; }
-
- cout << "\n" << endl;
- }
-
--- 0 ----
More information about the pooma-dev
mailing list