college/ws2010/gdi3/p5/MandelbrotOMP.class.h
2011-10-18 10:28:57 +02:00

48 lines
818 B
C++

#pragma once
#include <omp.h>
#include "Mandelbrot.interface.h"
class CMandelbrotOMP: public IMandelbrot {
void calc(CParams& params){
double startR = params.m_minRe;
int x_pos;
int y_pos;
double startI;
omp_set_num_threads(params.m_threads);
#pragma omp parallel for private(y_pos) schedule(dynamic, params.m_x_width)
for(x_pos = 0; x_pos < params.m_x_width; x_pos++){
startI = params.m_minIm;
for(y_pos = params.m_y_height -1; y_pos >= 0; y_pos--){
checkNumber(params, startR, startI, x_pos, y_pos);
startI += params.m_step;
}
startR += params.m_step;
}
}
public:
CMandelbrotOMP(int x_width, int y_height, int iterations, unsigned int threads, bool sse){
Init(x_width,y_height,iterations,threads,sse);
}
~CMandelbrotOMP(){
Exit();
}
};