From 56563700df68816e8329b99f66ede5459cbbb23a Mon Sep 17 00:00:00 2001 From: tomsmeding Date: Wed, 5 Apr 2017 15:47:10 +0200 Subject: Initial --- attract.c | 158 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 158 insertions(+) create mode 100644 attract.c (limited to 'attract.c') diff --git a/attract.c b/attract.c new file mode 100644 index 0000000..f4cb7b0 --- /dev/null +++ b/attract.c @@ -0,0 +1,158 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include "lodepng.h" + +const int MAXITER=200; +const double EPS=1e-1; + +static double complex att_func(double complex x){ + static const int N=9; + + double complex r=1,y=x; + for(int i=1;iystart; + int yend=th_info->yend; + unsigned char *img=th_info->img; + bool do_basins=th_info->do_basins; + struct config cfg=th_info->cfg; + + int nbasins=0,bsz=0; + double complex *basins=NULL; + if(do_basins){ + bsz=16; + basins=malloc(bsz*sizeof(double complex)); + assert(basins); + } + + printf("Thread: y in [%d,%d)\n",ystart,yend); + + for(int iy=ystart;iy=999||nthreads<1)nthreads=1; + fprintf(stderr,"Using %d thread%s\n",nthreads,nthreads==1?"":"s"); + + + pthread_attr_t attr; + if(pthread_attr_init(&attr)!=0){ + perror("pthread_attr_init"); + return 1; + } + + struct thread_info ths[nthreads]; + for(int i=0;i