mandelbrot/mandelbrot.h
2022-07-06 19:20:48 +02:00

48 lines
1.2 KiB
C++

/*
The GPLv3 License (GPLv3)
Copyright (c) 2022 Akos Horvath
This program 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.
This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#include <cmath>
#include "utils.h"
#include <cstdint>
#include <omp.h>
#include <thread>
#include <vector>
using namespace Util;
class Mandelbrotc {
public:
Vec2mp f, t;
uint8_t thread_count;
std::vector<std::thread> threads;
Vec2i s;
//std::vector<std::vector<uint8_t>> screen;
uint8_t **screen;
bool done;
uint32_t max_iter;
Mandelbrotc(Vec2mp const &f, Vec2mp const &t, Vec2i const &s, uint32_t mi);
void start_threads(bool first);
void stop_threads();
uint32_t mandelbrot(const Vec2mp &n);
void calc(const uint8_t tid);
};