#include #include using namespace std; #include "MandelbrotSimple.class.h" #include "MandelbrotOMP.class.h" #include "MandelbrotPOSIX.class.h" #include "Painter.class.cpp" //#include // POSIX-threads static const int ASCII_WIDTH = 50; static const int ASCII_HEIGHT = 35; static const int PIXEL_WIDTH = 1024; static const int PIXEL_HEIGHT = 768; /* * check arguments, create all necessary objects */ int main(int argc, char *argv[]) { if (argc<6) { printf("wrong number of arguments:\n1. number of iterations\n2. output mode [0 = disabled; 1 = ASCII; 2 = Graphic]\n3. OpenMP -> Number of threads\n4. Multithreading [0 = POSIX-Threads; 1 = OpenMP]\n5. SSE [0 = No SSE; 1 = SSE]\n"); return -1; } int i_iterations = atoi(argv[1]); //how many iterations int i_outtype = atoi(argv[2]); //how 2 print int i_threads = atoi(argv[3]); int i_posix = atoi(argv[4]); int i__sse = atoi(argv[5]); bool i_sse = false; if(i__sse == 1){ i_sse = true; } //Define size int x_width = 0; int y_height = 0; switch(i_outtype){ case 1: x_width = ASCII_WIDTH; y_height = ASCII_HEIGHT; break; case 2: x_width = PIXEL_WIDTH; y_height = PIXEL_HEIGHT; break; default: break; } //create Mandelbrot Obj. IMandelbrot* mandelbrot; if(i_threads <= 1){ mandelbrot = new CMandelbrotSimple(x_width, y_height, i_iterations, i_threads, i_sse); } else { if(i_posix == 1) { mandelbrot = new CMandelbrotOMP(x_width, y_height, i_iterations, i_threads, i_sse); } else { mandelbrot = new CMandelbrotPOSIX(x_width, y_height, i_iterations, i_threads, i_sse); } } //Calculate stuff mandelbrot->calculateMandelbrot(); //Printstuff CPainter::print(i_outtype, mandelbrot->getOutArray(), x_width, y_height); delete mandelbrot; return 0; }