/* * This file is part of rasdaman community. * * Rasdaman community is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Rasdaman community is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with rasdaman community. If not, see . * * Copyright 2003, 2004, 2005, 2006, 2007, 2008, 2009 Peter Baumann / rasdaman GmbH. * * For more information please see * or contact Peter Baumann via . */ /************************************************************* * * SOURCE: test_miter.cc * * MODULE: raslib * ************************************************************/ #include #include #include #include "raslib/miter.hh" #include "raslib/minterval.hh" #include "raslib/rminit.hh" #include "raslib/rmdebug.hh" RMINITGLOBALS('C') // structure storing information on iteration for each dimension // (perhaps add dimension for reordering later) typedef struct { int repeat; // total number of repeats int inc; // increment per repeat int curr; // current repeat } incArrElem; // for repeating inside the test functions const int numRepeat = 100; r_Minterval createCube(int size, int dim) { int i; long c = pow((double)size, 1.0/(double)dim); r_Minterval res(dim); for(i=0; i size) res[i-1].set_high(res[i-1].high() - 1); return res; } void test_Miter( r_Minterval& m1, r_Minterval& m2, char* data ) { char* currCell; // just to do something inside the loop unsigned long sum = 0; cout <<"Iteration r_Miter: "; // for performance measurement RMTimer mIterTimer("Iterator","r_Miter" ); mIterTimer.start( ); r_Miter iter(&m2, &m1, 4, (char*)data); for(int i=0; i m2[i].high() ) { pOp[i] = m2[i].low(); i--; if(i < 0) { done = 1; break; } ++pOp[i]; } } } oldIterTimer.stop(); cout << sum << endl; } void test_CppIter( unsigned long cells, char* data ) { unsigned long sum = 0; RMTimer cppIterTimer("Iterator", "cppIter"); cppIterTimer.start(); for(int r=0; r