#include #include using namespace std; #include "Attractor.hpp" #include "Canvas.hpp" #include "Projector.hpp" int main(int argc, char *argv[]) { clock_t start, end; double totalTime, totalIterations; // initialising stuff Attractor myAttractor("attractors/testLorenz.stf"); Projector projection; Canvas canvas(800, 800, 3); projection.canvas = &canvas; myAttractor.projectors.push_back(&projection); myAttractor.init_range(); projection.output(); // iterating 4 evah unsigned int iterations = 200000; // twintig duizend start = clock(); for ( unsigned int j = 1; j <= 100; j++ ) { for ( unsigned int i = 0; i <= iterations; i++ ) { myAttractor.iterate(); myAttractor.plot(); } system("clear"); myAttractor.output(); cout << j << "% done" << endl; } end = clock(); totalIterations = 100.0*iterations; totalTime = ((double)(end-start)/(double)(CLOCKS_PER_SEC)); printf("\ntotal clock time: %f\n", totalTime ); printf("average iterations per second: %f\n", totalIterations/((double)(end-start)/(double)(CLOCKS_PER_SEC)) ); // saving output start = clock(); canvas.output_file(); end = clock(); totalTime = ((double)(end-start)/(double)(CLOCKS_PER_SEC)); printf("\ntotal clock time for writing png: %f\n", totalTime ); /*if ( argc <= 2 ) { cout << endl << "nothing to do..." << endl; cout << "usage:" << endl; cout << " rendering to canvas: -a my_attractor.attr 500000000 my_attractor.canv 800 600 3" << endl; cout << " canvas to png: -c my_attractor.canv 800 600 3 my_atttractor.png" << endl << endl; exit(0); } int mode; string argv1 = argv[1]; if ( argv1 == "-a" ) { cout << "rendermode" << endl; mode = 1; } else if ( argv1 == "-c" ) { cout << "canvasmode" << endl; mode = 2; } else { cout << "i do.. i do... i do not understand... \"" << argv1 << "\""<< endl; exit(0); } switch ( mode ) { case 1: { if ( argc != 8 ) { cout << "all parameters must be set..." << endl; exit(0); } string attractorFile = argv[2]; unsigned int iterations = atoi(argv[3]); string canvasFile = argv[4]; unsigned int width = atoi(argv[5]); unsigned int height = atoi(argv[6]); unsigned int numColors = atoi(argv[7]); Attractor attract(attractorFile.c_str()); cout << attractorFile << " is read" << endl; Projector projection; Canvas canvas(width, height, numColors); projection.canvas = &canvas; attract.projectors.push_back(&projection); attract.init_range(); projection.output(); for ( unsigned int j = 1; j <= 100; j++ ) { for ( unsigned int i = 0; 100*i <= iterations; i++ ) { attract.iterate(); attract.plot(); } cout << j << "% done" << endl; } canvas.output_raw(canvasFile.c_str()); cout << canvasFile << " is outputted" << endl; break; } case 2: { if ( argc != 7 ) { cout << "all parameters must be set..." << endl; exit(0); } string canvasFile = argv[2]; unsigned int width = atoi(argv[3]); unsigned int height = atoi(argv[4]); unsigned int numColors = atoi(argv[5]); string pngFile = argv[6]; Canvas canvas(width, height, numColors); canvas.input_raw(canvasFile.c_str()); cout << canvasFile << " is read" << endl; for ( double v = -1.5; v < 1.6; v += 1.5 ) { canvas.v = v; canvas.output_file(); } cout << pngFile << " was exported" << endl; break; } default: { cout << "WTF" << endl; break; } }*/ return 0; }