Remove src/mandelbrot/legacy_codes/
authorW. Trevor King <wking@drexel.edu>
Tue, 14 Sep 2010 22:40:48 +0000 (18:40 -0400)
committerW. Trevor King <wking@drexel.edu>
Tue, 14 Sep 2010 22:40:48 +0000 (18:40 -0400)
I'm not sure how these relate to the current codes in MS-codes/, but
they claim to be legacy code, so I'm removing them.  If you want them,
they'll still be there in the history.

src/mandelbrot/legacy_codes/m1.c [deleted file]
src/mandelbrot/legacy_codes/m2.c [deleted file]
src/mandelbrot/legacy_codes/m3.c [deleted file]
src/mandelbrot/legacy_codes/m4.c [deleted file]
src/mandelbrot/legacy_codes/mandelbrot.c [deleted file]
src/mandelbrot/legacy_codes/mandelbrot_1.c [deleted file]
src/mandelbrot/legacy_codes/mandelbrot_2.c [deleted file]
src/mandelbrot/legacy_codes/mandelbrot_3.c [deleted file]
src/mandelbrot/legacy_codes/mandelbrot_blocked.c [deleted file]
src/mandelbrot/legacy_codes/mandelbrot_parallel.c [deleted file]
src/mandelbrot/legacy_codes/mandelbrot_sliced.c [deleted file]

diff --git a/src/mandelbrot/legacy_codes/m1.c b/src/mandelbrot/legacy_codes/m1.c
deleted file mode 100644 (file)
index b138d6e..0000000
+++ /dev/null
@@ -1,189 +0,0 @@
-
-                /**********************************/
-                /*                                */
-                /*     The Mandelbrot Set         */
-                /*                                */
-                /*      z = z*z + c               */
-                /*                                */
-                /*     parallel version           */
-                /*                                */
-                /**********************************/                              /*  m1.c  */
-
-
-                                        /* Michel Vallieres */
-
-#include <stdio.h>
-#include <time.h>
-#include "mpi.h"
-                                        /* large distance; if |z| reaches */
-                                        /* it, point C is not a member    */
-                                        /* of the set                     */
-#define LARGE_RADIUS 2.0
-                                        /* Maximum number of iterations */
-                                        /* before declaring a point in  */
-                                        /* the Mandelbrot set           */
-#define MAX_ITERATIONS 80
-#define NX 600                          /* image size */
-#define NY 500
-#define N_STRIPE 37                     /* number of stripes */
-#define MAX_PROC 100                    /* max # of processes */
-
-                                       /* prototypes   */
-void compute_stripe( double crmin, double crmax, double cimin, double cimax,
-                    int i_min, int i_max, double store_iter[],
-                    int *store_n);
-void grid_stripes( double *crmin, double *crmax, double *cimin, double *cimax,
-                      int begin_stripe[], int last_stripe[] );
-
-
-int main( int argc, char *argv[] )
-{
-  double crmin, crmax, cimin, cimax;
-  double store_iter[NY*(NX/N_STRIPE+1)];
-  int begin_stripe[N_STRIPE], last_stripe[N_STRIPE];
-  int stripe;
-  int store_n, i_point;
-  int count;
-  int myid, numprocs;
-  MPI_Status mesgStatus;
-  int stripe_in_proc[MAX_PROC], sent_stripe, recv_stripe, ip;
-
-                                         /* start the MPI virtual machine */
-  MPI_Init(&argc,&argv);
-  MPI_Comm_size(MPI_COMM_WORLD,&numprocs);
-  MPI_Comm_rank(MPI_COMM_WORLD,&myid);
-                                        /* initialize grid & stripes */
-  grid_stripes ( &crmin, &crmax, &cimin, &cimax, begin_stripe, last_stripe );
-
-                                        /*****************/
-                                       /* Master code   */
-                                        /*****************/
-  if ( myid == 0 )
-    {
-                                        /* initilalize send & recv counters */
-       sent_stripe = 0;
-       recv_stripe = 0;
-                                        /* send a stripe to each slave   */
-                                        /* to start local calculation    */
-       for ( ip=1 ; ip<numprocs ; ip++ )
-        {
-            MPI_Send( &sent_stripe, 1, MPI_INT, ip, 5, MPI_COMM_WORLD );
-            stripe_in_proc[ip] = sent_stripe;
-            sent_stripe++;
-        }
-
-    }
-                                        /*****************/
-                                       /* Slave code    */
-                                        /*****************/
-  else
-    {
-                                        /* receive a stripe to do */
-      MPI_Recv( &stripe, 1, MPI_INT, 0, 5, MPI_COMM_WORLD, 
-                         &mesgStatus );
-
-      fprintf( stderr, " Node: %d -- Stripe: %d \n", myid, stripe );
-
-                                       /* find the points in the set */
-      compute_stripe( crmin, crmax, cimin, cimax, begin_stripe[stripe],
-                     last_stripe[stripe], store_iter, &store_n);
-    }
-
-                                        /* end MPI virtual machine */
-  MPI_Finalize();
-}
-
-
-
-
-void grid_stripes( double *crmin, double *crmax, double *cimin, double *cimax,
-                      int begin_stripe[], int last_stripe[] )
-{
-  int  w_stripe, stripe, left_over;
-                                        /* define grid spanning   */
-                                        /* the complex plane for  */
-                                        /* the C variable         */
-  *crmin=-1.7;
-  *crmax = 0.8;
-  *cimin = -1.0;
-  *cimax = 1.0;
-                                       /* stripe definition            */
-                                        /* stripe # does not have to be */
-                                        /* commensurate with grid size  */
-                                        /* in which case add 1 to some  */
-                                        /* stripes */
-  w_stripe= NX/N_STRIPE;
-  left_over = NX % N_STRIPE;
-                                        /* fist stripe */
-  begin_stripe[0] = 0;
-  last_stripe[0] = begin_stripe[0] + w_stripe - 1;
-  if ( left_over > 0 )
-    {
-      last_stripe[0] = last_stripe[0] + 1;
-      left_over--;
-    }
-                                        /* other stripes */
-  for ( stripe = 1; stripe < N_STRIPE ; stripe++ )
-    {
-      begin_stripe[stripe] = last_stripe[stripe-1] + 1 ;
-      last_stripe[stripe] = begin_stripe[stripe] + w_stripe - 1;
-      if ( left_over > 0 )
-       {
-      last_stripe[stripe] = last_stripe[stripe] + 1;
-      left_over--;
-       }
-    }
-}
-
-
-
-
-void compute_stripe( double crmin, double crmax, double cimin, double cimax,
-                    int i_min, int i_max, double store_iter[],
-                    int *store_n)
-{
-   double z_real, z_img, z_magnitude;
-   double c_real, c_img, z_current_real;
-   double dcr, dci;
-   int    i, j;
-   int    counter;
-
-                                        /* scan C values on complex plane */
-   dcr = (crmax - crmin)/(double)(NX-1);
-   dci = (cimax - cimin)/(double)(NY-1);
-                                        /* scan stripe */
-   *store_n=0;
-   for ( i=i_min ; i<=i_max; i++ )
-   {
-      for ( j=0 ; j<NY; j++ )
-      {
-           c_real = crmin + i*dcr;
-           c_img = cimin + j*dci;
-                                        /* z starts a origin */
-           z_real = 0.0;
-           z_img  = 0.0;
-                                        /* set counter to zero */
-           counter = 0;
-                                        /* iterate map for             */
-                                        /*  MAX_ITERATIONS times or ...*/
-           while ( counter < MAX_ITERATIONS ) 
-           {
-             z_current_real = z_real;
-             z_real = z_real*z_real - z_img*z_img + c_real;
-             z_img  = 2.0*z_current_real*z_img + c_img;
-             counter = counter + 1;
-                                        /* ... until magnitude of z */
-                                        /* is larger than some      */
-                                        /* large radius             */
-             z_magnitude = z_real*z_real+z_img*z_img;
-             if ( z_magnitude > LARGE_RADIUS ) break;
-           }
-                                        /* store iteration numbers */
-                                        /* to plot the set         */
-          store_iter[*store_n] =
-                    (double)(255*counter) / (double)MAX_ITERATIONS ;
-          (*store_n)++;
-       }
-    }
-}
-
diff --git a/src/mandelbrot/legacy_codes/m2.c b/src/mandelbrot/legacy_codes/m2.c
deleted file mode 100644 (file)
index 8a4dc51..0000000
+++ /dev/null
@@ -1,219 +0,0 @@
-
-                /**********************************/
-                /*                                */
-                /*     The Mandelbrot Set         */
-                /*                                */
-                /*      z = z*z + c               */
-                /*                                */
-                /*     parallel version           */
-                /*                                */
-                /**********************************/                           /*  m2.c  */
-
-
-                                        /* Michel Vallieres */
-
-#include <stdio.h>
-#include <time.h>
-#include "mpi.h"
-                                        /* large distance; if |z| reaches */
-                                        /* it, point C is not a member    */
-                                        /* of the set                     */
-#define LARGE_RADIUS 2.0
-                                        /* Maximum number of iterations */
-                                        /* before declaring a point in  */
-                                        /* the Mandelbrot set           */
-#define MAX_ITERATIONS 80
-#define NX 600                          /* image size */
-#define NY 500
-#define N_STRIPE 37                     /* number of stripes */
-#define MAX_PROC 100                    /* max # of processes */
-
-                                       /* prototypes   */
-void compute_stripe( double crmin, double crmax, double cimin, double cimax,
-                    int i_min, int i_max, double store_iter[],
-                    int *store_n);
-void grid_stripes( double *crmin, double *crmax, double *cimin, double *cimax,
-                      int begin_stripe[], int last_stripe[] );
-
-
-int main( int argc, char *argv[] )
-{
-  double crmin, crmax, cimin, cimax;
-  double store_iter[NY*(NX/N_STRIPE+1)];
-  int begin_stripe[N_STRIPE], last_stripe[N_STRIPE];
-  int stripe;
-  int store_n, i_point;
-  int count;
-  int myid, numprocs;
-  MPI_Status mesgStatus;
-  int stripe_in_proc[MAX_PROC], sent_stripe, recv_stripe, from_node, 
-      number_from_node, ip;
-  int end_signal;
-
-                                         /* start the MPI virtual machine */
-  MPI_Init(&argc,&argv);
-  MPI_Comm_size(MPI_COMM_WORLD,&numprocs);
-  MPI_Comm_rank(MPI_COMM_WORLD,&myid);
-
-                                        /* initialize grid & stripes */
-  grid_stripes ( &crmin, &crmax, &cimin, &cimax, begin_stripe, last_stripe );
-
-                                        /*****************/
-                                       /* Master code   */
-                                        /*****************/
-  if ( myid == 0 )
-    {
-
-        fprintf( stderr, " size of array = %d \n", NY*(NX/N_STRIPE+1) );
-
-                                        /* initilalize send counter */
-       sent_stripe = 0;
-                                        /* send a stripe to each slave   */
-                                        /* to start local calculation    */
-       for ( ip=1 ; ip<numprocs ; ip++ )
-        {
-            MPI_Send( &sent_stripe, 1, MPI_INT, ip, 5, MPI_COMM_WORLD );
-            stripe_in_proc[ip] = sent_stripe;
-            sent_stripe++;
-        }
-                                        /* receive results back from nodes */
-       for ( recv_stripe = 0 ; recv_stripe < N_STRIPE ; recv_stripe++ )
-        {
-           MPI_Recv( store_iter, NY*(NX/N_STRIPE+1), MPI_DOUBLE, 
-                        MPI_ANY_SOURCE, 7, MPI_COMM_WORLD,  &mesgStatus );
-           from_node = mesgStatus.MPI_SOURCE;
-           MPI_Get_count( &mesgStatus, MPI_DOUBLE, &number_from_node );
-
-           fprintf ( stderr, " From node: %d -- stripe & # %d %d \n",
-                         from_node, stripe_in_proc[from_node], 
-                                            number_from_node );
-
-        }
-
-    }
-                                        /*****************/
-                                       /* Slave code    */
-                                        /*****************/
-  else
-    {
-                                        /* loop for more stripes until */
-      for ( ; ;  )                      /* negative signal received */
-       {
-                                        /* receive a stripe to do */
-          MPI_Recv( &stripe, 1, MPI_INT, 0, 5, MPI_COMM_WORLD, 
-                         &mesgStatus );
-
-          fprintf( stderr, "From within node: %d -- Stripe: %d \n", myid, stripe );
-
-          if ( stripe < 0 )
-           {
-               fprintf( stderr,"Node %d exiting \n", myid);
-               MPI_Finalize();
-               exit(0);
-           }
-                                       /* find the points in the set */
-          compute_stripe( crmin, crmax, cimin, cimax, begin_stripe[stripe],
-                     last_stripe[stripe], store_iter, &store_n);
-                                       /* send results  to master */
-          MPI_Send( store_iter, store_n, MPI_DOUBLE, 0, 7, MPI_COMM_WORLD );
-       }
-    }
-
-                                        /* end MPI virtual machine */
-  MPI_Finalize();
-}
-
-
-
-
-void grid_stripes( double *crmin, double *crmax, double *cimin, double *cimax,
-                      int begin_stripe[], int last_stripe[] )
-{
-  int  w_stripe, stripe, left_over;
-                                        /* define grid spanning   */
-                                        /* the complex plane for  */
-                                        /* the C variable         */
-  *crmin=-1.7;
-  *crmax = 0.8;
-  *cimin = -1.0;
-  *cimax = 1.0;
-                                       /* stripe definition            */
-                                        /* stripe # does not have to be */
-                                        /* commensurate with grid size  */
-                                        /* in which case add 1 to some  */
-                                        /* stripes */
-  w_stripe= NX/N_STRIPE;
-  left_over = NX % N_STRIPE;
-                                        /* fist stripe */
-  begin_stripe[0] = 0;
-  last_stripe[0] = begin_stripe[0] + w_stripe - 1;
-  if ( left_over > 0 )
-    {
-      last_stripe[0] = last_stripe[0] + 1;
-      left_over--;
-    }
-                                        /* other stripes */
-  for ( stripe = 1; stripe < N_STRIPE ; stripe++ )
-    {
-      begin_stripe[stripe] = last_stripe[stripe-1] + 1 ;
-      last_stripe[stripe] = begin_stripe[stripe] + w_stripe - 1;
-      if ( left_over > 0 )
-       {
-      last_stripe[stripe] = last_stripe[stripe] + 1;
-      left_over--;
-       }
-    }
-}
-
-
-
-
-void compute_stripe( double crmin, double crmax, double cimin, double cimax,
-                    int i_min, int i_max, double store_iter[],
-                    int *store_n)
-{
-   double z_real, z_img, z_magnitude;
-   double c_real, c_img, z_current_real;
-   double dcr, dci;
-   int    i, j;
-   int    counter;
-
-                                        /* scan C values on complex plane */
-   dcr = (crmax - crmin)/(double)(NX-1);
-   dci = (cimax - cimin)/(double)(NY-1);
-                                        /* scan stripe */
-   *store_n=0;
-   for ( i=i_min ; i<=i_max; i++ )
-   {
-      for ( j=0 ; j<NY; j++ )
-      {
-           c_real = crmin + i*dcr;
-           c_img = cimin + j*dci;
-                                        /* z starts a origin */
-           z_real = 0.0;
-           z_img  = 0.0;
-                                        /* set counter to zero */
-           counter = 0;
-                                        /* iterate map for             */
-                                        /*  MAX_ITERATIONS times or ...*/
-           while ( counter < MAX_ITERATIONS ) 
-           {
-             z_current_real = z_real;
-             z_real = z_real*z_real - z_img*z_img + c_real;
-             z_img  = 2.0*z_current_real*z_img + c_img;
-             counter = counter + 1;
-                                        /* ... until magnitude of z */
-                                        /* is larger than some      */
-                                        /* large radius             */
-             z_magnitude = z_real*z_real+z_img*z_img;
-             if ( z_magnitude > LARGE_RADIUS ) break;
-           }
-                                        /* store iteration numbers */
-                                        /* to plot the set         */
-          store_iter[*store_n] =
-                    (double)(255*counter) / (double)MAX_ITERATIONS ;
-          (*store_n)++;
-       }
-    }
-}
-
diff --git a/src/mandelbrot/legacy_codes/m3.c b/src/mandelbrot/legacy_codes/m3.c
deleted file mode 100644 (file)
index 82c8d7e..0000000
+++ /dev/null
@@ -1,226 +0,0 @@
-
-                /**********************************/
-                /*                                */
-                /*     The Mandelbrot Set         */
-                /*                                */
-                /*      z = z*z + c               */
-                /*                                */
-                /*     parallel version           */
-                /*                                */
-                /**********************************/                       /*   m3.c   */
-
-                                        /* Michel Vallieres */
-
-#include <stdio.h>
-#include <time.h>
-#include "mpi.h"
-                                        /* large distance; if |z| reaches */
-                                        /* it, point C is not a member    */
-                                        /* of the set                     */
-#define LARGE_RADIUS 2.0
-                                        /* Maximum number of iterations */
-                                        /* before declaring a point in  */
-                                        /* the Mandelbrot set           */
-#define MAX_ITERATIONS 80
-#define NX 600                          /* image size */
-#define NY 500
-#define N_STRIPE 37                     /* number of stripes */
-#define MAX_PROC 100                    /* max # of processes */
-
-                                       /* prototypes   */
-void compute_stripe( double crmin, double crmax, double cimin, double cimax,
-                    int i_min, int i_max, double store_iter[],
-                    int *store_n);
-void grid_stripes( double *crmin, double *crmax, double *cimin, double *cimax,
-                      int begin_stripe[], int last_stripe[] );
-
-
-int main( int argc, char *argv[] )
-{
-  double crmin, crmax, cimin, cimax;
-  double store_iter[NY*(NX/N_STRIPE+1)];
-  int begin_stripe[N_STRIPE], last_stripe[N_STRIPE];
-  int stripe;
-  int store_n, i_point;
-  int count;
-  int myid, numprocs;
-  MPI_Status mesgStatus;
-  int stripe_in_proc[MAX_PROC], sent_stripe, recv_stripe, from_node, 
-      number_from_node, ip;
-  int end_signal;
-
-                                         /* start the MPI virtual machine */
-  MPI_Init(&argc,&argv);
-  MPI_Comm_size(MPI_COMM_WORLD,&numprocs);
-  MPI_Comm_rank(MPI_COMM_WORLD,&myid);
-
-                                        /* initialize grid & stripes */
-  grid_stripes ( &crmin, &crmax, &cimin, &cimax, begin_stripe, last_stripe );
-
-                                        /*****************/
-                                       /* Master code   */
-                                        /*****************/
-  if ( myid == 0 )
-    {
-
-        fprintf( stderr, " size of array = %d \n", NY*(NX/N_STRIPE+1) );
-
-                                        /* initilalize send counter */
-       sent_stripe = 0;
-                                        /* send a stripe to each slave   */
-                                        /* to start local calculation    */
-       for ( ip=1 ; ip<numprocs ; ip++ )
-        {
-            MPI_Ssend( &sent_stripe, 1, MPI_INT, ip, 5, MPI_COMM_WORLD );
-            stripe_in_proc[ip] = sent_stripe;
-            sent_stripe++;
-        }
-                                        /* receive results back from nodes */
-       for ( recv_stripe = 0 ; recv_stripe < N_STRIPE ; recv_stripe++ )
-        {
-           MPI_Recv( store_iter, NY*(NX/N_STRIPE+1), MPI_DOUBLE, 
-                        MPI_ANY_SOURCE, 7, MPI_COMM_WORLD,  &mesgStatus );
-           from_node = mesgStatus.MPI_SOURCE;
-           MPI_Get_count( &mesgStatus, MPI_DOUBLE, &number_from_node );
-
-           fprintf ( stderr, " From node: %d -- stripe & # %d %d \n",
-                         from_node, stripe_in_proc[from_node], 
-                                            number_from_node );
-
-                end_signal = -1;
-       
-                MPI_Ssend( &end_signal, 1, MPI_INT, from_node, 5, MPI_COMM_WORLD );
-
-                fprintf( stderr, "Node %d has sent end_signal = %d to node %d\n",
-                                 myid, end_signal, from_node );
-        }
-
-    }
-                                        /*****************/
-                                       /* Slave code    */
-                                        /*****************/
-  else
-    {
-                                        /* loop for more stripes until */
-      for ( ; ;  )                      /* negative signal received */
-       {
-                                        /* receive a stripe to do */
-          MPI_Recv( &stripe, 1, MPI_INT, 0, 5, MPI_COMM_WORLD, 
-                         &mesgStatus );
-
-          fprintf( stderr, "From within node: %d -- Stripe: %d \n", myid, stripe );
-
-          if ( stripe < 0 )
-           {
-               fprintf( stderr,"Node %d exiting \n", myid);
-               MPI_Finalize();
-               exit(0);
-           }
-                                       /* find the points in the set */
-          compute_stripe( crmin, crmax, cimin, cimax, begin_stripe[stripe],
-                     last_stripe[stripe], store_iter, &store_n);
-
-                                       /* send results  to master */
-          MPI_Ssend( store_iter, store_n, MPI_DOUBLE, 0, 7, MPI_COMM_WORLD );
-       }
-    }
-
-                                        /* end MPI virtual machine */
-  MPI_Finalize();
-  exit(0);
-}
-
-
-
-
-void grid_stripes( double *crmin, double *crmax, double *cimin, double *cimax,
-                      int begin_stripe[], int last_stripe[] )
-{
-  int  w_stripe, stripe, left_over;
-                                        /* define grid spanning   */
-                                        /* the complex plane for  */
-                                        /* the C variable         */
-  *crmin=-1.7;
-  *crmax = 0.8;
-  *cimin = -1.0;
-  *cimax = 1.0;
-                                       /* stripe definition            */
-                                        /* stripe # does not have to be */
-                                        /* commensurate with grid size  */
-                                        /* in which case add 1 to some  */
-                                        /* stripes */
-  w_stripe= NX/N_STRIPE;
-  left_over = NX % N_STRIPE;
-                                        /* fist stripe */
-  begin_stripe[0] = 0;
-  last_stripe[0] = begin_stripe[0] + w_stripe - 1;
-  if ( left_over > 0 )
-    {
-      last_stripe[0] = last_stripe[0] + 1;
-      left_over--;
-    }
-                                        /* other stripes */
-  for ( stripe = 1; stripe < N_STRIPE ; stripe++ )
-    {
-      begin_stripe[stripe] = last_stripe[stripe-1] + 1 ;
-      last_stripe[stripe] = begin_stripe[stripe] + w_stripe - 1;
-      if ( left_over > 0 )
-       {
-      last_stripe[stripe] = last_stripe[stripe] + 1;
-      left_over--;
-       }
-    }
-}
-
-
-
-
-void compute_stripe( double crmin, double crmax, double cimin, double cimax,
-                    int i_min, int i_max, double store_iter[],
-                    int *store_n)
-{
-   double z_real, z_img, z_magnitude;
-   double c_real, c_img, z_current_real;
-   double dcr, dci;
-   int    i, j;
-   int    counter;
-
-                                        /* scan C values on complex plane */
-   dcr = (crmax - crmin)/(double)(NX-1);
-   dci = (cimax - cimin)/(double)(NY-1);
-                                        /* scan stripe */
-   *store_n=0;
-   for ( i=i_min ; i<=i_max; i++ )
-   {
-      for ( j=0 ; j<NY; j++ )
-      {
-           c_real = crmin + i*dcr;
-           c_img = cimin + j*dci;
-                                        /* z starts a origin */
-           z_real = 0.0;
-           z_img  = 0.0;
-                                        /* set counter to zero */
-           counter = 0;
-                                        /* iterate map for             */
-                                        /*  MAX_ITERATIONS times or ...*/
-           while ( counter < MAX_ITERATIONS ) 
-           {
-             z_current_real = z_real;
-             z_real = z_real*z_real - z_img*z_img + c_real;
-             z_img  = 2.0*z_current_real*z_img + c_img;
-             counter = counter + 1;
-                                        /* ... until magnitude of z */
-                                        /* is larger than some      */
-                                        /* large radius             */
-             z_magnitude = z_real*z_real+z_img*z_img;
-             if ( z_magnitude > LARGE_RADIUS ) break;
-           }
-                                        /* store iteration numbers */
-                                        /* to plot the set         */
-          store_iter[*store_n] =
-                    (double)(255*counter) / (double)MAX_ITERATIONS ;
-          (*store_n)++;
-       }
-    }
-}
-
diff --git a/src/mandelbrot/legacy_codes/m4.c b/src/mandelbrot/legacy_codes/m4.c
deleted file mode 100644 (file)
index b42d236..0000000
+++ /dev/null
@@ -1,241 +0,0 @@
-
-                /**********************************/
-                /*                                */
-                /*     The Mandelbrot Set         */
-                /*                                */
-                /*      z = z*z + c               */
-                /*                                */
-                /*     parallel version           */
-                /*                                */
-                /**********************************/                 /*  m4  */
-
-
-                                        /* Michel Vallieres */
-
-#include <stdio.h>
-#include <time.h>
-#include "mpi.h"
-                                        /* large distance; if |z| reaches */
-                                        /* it, point C is not a member    */
-                                        /* of the set                     */
-#define LARGE_RADIUS 2.0
-                                        /* Maximum number of iterations */
-                                        /* before declaring a point in  */
-                                        /* the Mandelbrot set           */
-#define MAX_ITERATIONS 80
-#define NX 600                          /* image size */
-#define NY 500
-#define N_STRIPE 37                     /* number of stripes */
-#define MAX_PROC 100                    /* max # of processes */
-
-                                       /* prototypes   */
-void compute_stripe( double crmin, double crmax, double cimin, double cimax,
-                    int i_min, int i_max, double store_iter[],
-                    int *store_n);
-void grid_stripes( double *crmin, double *crmax, double *cimin, double *cimax,
-                      int begin_stripe[], int last_stripe[] );
-
-
-int main( int argc, char *argv[] )
-{
-  double crmin, crmax, cimin, cimax;
-  double store_iter[NY*(NX/N_STRIPE+1)];
-  int begin_stripe[N_STRIPE], last_stripe[N_STRIPE];
-  int stripe;
-  int store_n, i_point;
-  int count;
-  int myid, numprocs;
-  MPI_Status mesgStatus;
-  int stripe_in_proc[MAX_PROC], sent_stripe, recv_stripe, from_node, 
-      number_from_node, ip;
-  int end_signal;
-
-                                         /* start the MPI virtual machine */
-  MPI_Init(&argc,&argv);
-  MPI_Comm_size(MPI_COMM_WORLD,&numprocs);
-  MPI_Comm_rank(MPI_COMM_WORLD,&myid);
-
-                                        /* initialize grid & stripes */
-  grid_stripes ( &crmin, &crmax, &cimin, &cimax, begin_stripe, last_stripe );
-
-                                        /*****************/
-                                       /* Master code   */
-                                        /*****************/
-  if ( myid == 0 )
-    {
-
-        fprintf( stderr, " size of array = %d \n", NY*(NX/N_STRIPE+1) );
-
-                                        /* initilalize send counter */
-       sent_stripe = 0;
-                                        /* send a stripe to each slave   */
-                                        /* to start local calculation    */
-       for ( ip=1 ; ip<numprocs ; ip++ )
-        {
-            MPI_Ssend( &sent_stripe, 1, MPI_INT, ip, 5, MPI_COMM_WORLD );
-            stripe_in_proc[ip] = sent_stripe;
-            sent_stripe++;
-        }
-                                        /* receive results back from nodes */
-       for ( recv_stripe = 0 ; recv_stripe < N_STRIPE ; recv_stripe++ )
-        {
-           MPI_Recv( store_iter, NY*(NX/N_STRIPE+1), MPI_DOUBLE, 
-                        MPI_ANY_SOURCE, 7, MPI_COMM_WORLD,  &mesgStatus );
-           from_node = mesgStatus.MPI_SOURCE;
-           MPI_Get_count( &mesgStatus, MPI_DOUBLE, &number_from_node );
-
-           fprintf ( stderr, " From node: %d -- stripe & # %d %d \n",
-                         from_node, stripe_in_proc[from_node], 
-                                            number_from_node );
-
-                                       /* new stripe for this slave */
-           if ( sent_stripe < N_STRIPE )
-            {
-
-                fprintf( stderr, "Node %d will send stripe = %d to node %d\n",
-                                 myid, sent_stripe, from_node );
-
-                MPI_Ssend( &sent_stripe, 1, MPI_INT, from_node, 5, MPI_COMM_WORLD );
-                stripe_in_proc[from_node] = sent_stripe;
-                sent_stripe++;
-            }
-           else
-            {
-                end_signal = -1;
-       
-                MPI_Ssend( &end_signal, 1, MPI_INT, from_node, 5, MPI_COMM_WORLD );
-
-                fprintf( stderr, "Node %d has sent end_signal = %d to node %d\n",
-                                 myid, end_signal, from_node );
-            }
-        }
-
-    }
-                                        /*****************/
-                                       /* Slave code    */
-                                        /*****************/
-  else
-    {
-                                        /* loop for more stripes until */
-      for ( ; ;  )                      /* negative signal received */
-       {
-                                        /* receive a stripe to do */
-          MPI_Recv( &stripe, 1, MPI_INT, 0, 5, MPI_COMM_WORLD, 
-                         &mesgStatus );
-
-          fprintf( stderr, "From within node: %d -- Stripe: %d \n", myid, stripe );
-
-          if ( stripe < 0 )
-           {
-               fprintf( stderr,"Node %d exiting \n", myid);
-               MPI_Finalize();
-               exit(0);
-           }
-                                       /* find the points in the set */
-          compute_stripe( crmin, crmax, cimin, cimax, begin_stripe[stripe],
-                     last_stripe[stripe], store_iter, &store_n);
-
-                                       /* send results  to master */
-          MPI_Ssend( store_iter, store_n, MPI_DOUBLE, 0, 7, MPI_COMM_WORLD );
-       }
-    }
-
-                                        /* end MPI virtual machine */
-  MPI_Finalize();
-  exit(0);
-}
-
-
-
-
-void grid_stripes( double *crmin, double *crmax, double *cimin, double *cimax,
-                      int begin_stripe[], int last_stripe[] )
-{
-  int  w_stripe, stripe, left_over;
-                                        /* define grid spanning   */
-                                        /* the complex plane for  */
-                                        /* the C variable         */
-  *crmin=-1.7;
-  *crmax = 0.8;
-  *cimin = -1.0;
-  *cimax = 1.0;
-                                       /* stripe definition            */
-                                        /* stripe # does not have to be */
-                                        /* commensurate with grid size  */
-                                        /* in which case add 1 to some  */
-                                        /* stripes */
-  w_stripe= NX/N_STRIPE;
-  left_over = NX % N_STRIPE;
-                                        /* fist stripe */
-  begin_stripe[0] = 0;
-  last_stripe[0] = begin_stripe[0] + w_stripe - 1;
-  if ( left_over > 0 )
-    {
-      last_stripe[0] = last_stripe[0] + 1;
-      left_over--;
-    }
-                                        /* other stripes */
-  for ( stripe = 1; stripe < N_STRIPE ; stripe++ )
-    {
-      begin_stripe[stripe] = last_stripe[stripe-1] + 1 ;
-      last_stripe[stripe] = begin_stripe[stripe] + w_stripe - 1;
-      if ( left_over > 0 )
-       {
-      last_stripe[stripe] = last_stripe[stripe] + 1;
-      left_over--;
-       }
-    }
-}
-
-
-
-
-void compute_stripe( double crmin, double crmax, double cimin, double cimax,
-                    int i_min, int i_max, double store_iter[],
-                    int *store_n)
-{
-   double z_real, z_img, z_magnitude;
-   double c_real, c_img, z_current_real;
-   double dcr, dci;
-   int    i, j;
-   int    counter;
-
-                                        /* scan C values on complex plane */
-   dcr = (crmax - crmin)/(double)(NX-1);
-   dci = (cimax - cimin)/(double)(NY-1);
-                                        /* scan stripe */
-   *store_n=0;
-   for ( i=i_min ; i<=i_max; i++ )
-   {
-      for ( j=0 ; j<NY; j++ )
-      {
-           c_real = crmin + i*dcr;
-           c_img = cimin + j*dci;
-                                        /* z starts a origin */
-           z_real = 0.0;
-           z_img  = 0.0;
-                                        /* set counter to zero */
-           counter = 0;
-                                        /* iterate map for             */
-                                        /*  MAX_ITERATIONS times or ...*/
-           while ( counter < MAX_ITERATIONS ) 
-           {
-             z_current_real = z_real;
-             z_real = z_real*z_real - z_img*z_img + c_real;
-             z_img  = 2.0*z_current_real*z_img + c_img;
-             counter = counter + 1;
-                                        /* ... until magnitude of z */
-                                        /* is larger than some      */
-                                        /* large radius             */
-             z_magnitude = z_real*z_real+z_img*z_img;
-             if ( z_magnitude > LARGE_RADIUS ) break;
-           }
-                                        /* store iteration numbers */
-                                        /* to plot the set         */
-          store_iter[*store_n] =
-                    (double)(255*counter) / (double)MAX_ITERATIONS ;
-          (*store_n)++;
-       }
-    }
-}
-
diff --git a/src/mandelbrot/legacy_codes/mandelbrot.c b/src/mandelbrot/legacy_codes/mandelbrot.c
deleted file mode 100644 (file)
index 1d3e062..0000000
+++ /dev/null
@@ -1,97 +0,0 @@
-
-#include <math.h>
-#include <stdio.h>
-
-                /********************************/
-                /*                              */
-                /*     The Mandelbrot Set       */
-                /*                              */
-                /*      z = z*z + c             */
-                /*                              */
-                /********************************/
-
-/* use:           */
-/*                */
-/* mandelbrot     */
-
-
-                                        /* Summer School 1995 */
-
-
-                                        /* large distance; if |z| goes  */
-                                        /* beyond it, point C is not a  */
-                                        /* member of the set            */
-#define LARGE_RADIUS 2.0
-                                        /* Maximum number of iterations */
-                                        /* before declaring a point in  */
-                                        /* the Mandelbrot set           */
-#define MAX_ITERATIONS 80
-                                        /* image size */
-#define NX 600
-#define NY 500
-
-
-int main( int argc, char * argv[] )
-{
-   double z_real, z_img, z_magnitude;
-   double c_real, c_img, crmin, crmax, cimin, cimax, 
-          dcr, dci, z_current_real;
-   int    i, j, NX, NY;
-   int    counter;
-   int    count;
-
-                                        /* define grid spanning   */
-                                        /* the complex plane for  */
-                                        /* the C variable         */
-    crmin=-1.7;
-    crmax = 0.8;
-    cimin = -1.0;
-    cimax = 1.0;
-                                        /* scan C values on complex plane */
-    dcr = (crmax - crmin)/(NX-1);
-    dci = (cimax - cimin)/(NY-1);
-
-    count = 0;
-
-    for ( i=0 ; i<NX; i++ )
-    {
-      for ( j=0 ; j<NY; j++ )
-      {
-         c_real = crmin + i*dcr;
-         c_img = cimin + j*dci;
-                                        /* z starts a origin */
-         z_real = 0.0;
-         z_img  = 0.0;
-                                        /* set counter to zero */
-         counter = 0;
-                                        /* iterate map for             */
-                                        /*  MAX_ITERATIONS times or ...*/
-         while ( counter < MAX_ITERATIONS ) 
-         {
-             z_current_real = z_real;
-             z_real = z_real*z_real - z_img*z_img + c_real;
-             z_img  = 2.0*z_current_real*z_img + c_img;
-             counter = counter + 1;
-                                        /* ... until magnitude of z */
-                                        /* is larger than some      */
-                                        /* large radius             */
-             z_magnitude = z_real*z_real+z_img*z_img;
-             if ( z_magnitude > LARGE_RADIUS ) break;
-         }
-                                        /* write C real and       */
-                                        /* imaginary parts if     */
-                                        /* C belongs to the set   */
-         /*
-           if ( z_magnitude < LARGE_RADIUS ) 
-           printf ( " %f %f  \n ", c_real, c_img );
-        */
-                                       /* or iteration number      */
-                                       /* for all scanned C values */
-                                       /* for color picture        */
-           count++;
-           printf ( " %f ", (double)(255*counter) / (double)MAX_ITERATIONS );
-       }
-
-   }
-
-}
diff --git a/src/mandelbrot/legacy_codes/mandelbrot_1.c b/src/mandelbrot/legacy_codes/mandelbrot_1.c
deleted file mode 100644 (file)
index d213d4e..0000000
+++ /dev/null
@@ -1,191 +0,0 @@
-
-                /**********************************/
-                /*                                */
-                /*     The Mandelbrot Set         */
-                /*                                */
-                /*      z = z*z + c               */
-                /*                                */
-                /* Adapted to calculate the Set   */
-                /* in stripes parallel to Img axis*/
-                /*                                */
-                /* Improved routines structure    */
-                /* to facilitate parallel         */
-                /*     implementation             */
-               /**********************************/
-
-                                        /* Michel Vallieres */
-
-#include <stdio.h>
-#include <time.h>
-#include <mpi.h>
-                                        /* large distance; if |z| reaches */
-                                        /* it, point C is not a member    */
-                                        /* of the set                     */
-#define LARGE_RADIUS 2.0
-                                        /* Maximum number of iterations */
-                                        /* before declaring a point in  */
-                                        /* the Mandelbrot set           */
-#define MAX_ITERATIONS 80
-#define NX 600                          /* image size */
-#define NY 500
-#define N_STRIPE 37                     /* number of stripes */
-#define MAX_PROCS 100
-
-                                       /* prototypes   */
-void compute_stripe( double crmin, double crmax, double cimin, double cimax,
-                    int i_min, int i_max, double store_iter[],
-                    int *store_n);
-void grid_stripes( double *crmin, double *crmax, double *cimin, double *cimax,
-                      int begin_stripe[], int last_stripe[] );
-
-
-int main( int argc, char *argv[] )
-{
-  double crmin, crmax, cimin, cimax;
-  double store_iter[NY*(NX/N_STRIPE+1)];
-  int begin_stripe[N_STRIPE], last_stripe[N_STRIPE];
-  int stripe;
-  int store_n, i_point;
-  int count;
-  int my_id, numprocs, ip;
-  int sent_stripe, recv_stripe, stripe_in_proc[MAX_PROCS];
-
-  MPI_Status  mesgStatus;
-
-  MPI_Init(&argc, &argv);               /* start MPI virtual machine */
-
-  MPI_Comm_rank(MPI_COMM_WORLD, &my_id);
-  MPI_Comm_size(MPI_COMM_WORLD, &numprocs);
-
-
-                                        /* initialize grid & stripes */
-  grid_stripes ( &crmin, &crmax, &cimin, &cimax, begin_stripe, last_stripe );
-
-  count = 0;
-                                        /**********/
-                                        /* master */
-                                        /**********/
-  if(my_id == 0)                      
-  {
-     sent_stripe = 0;
-     recv_stripe = 0;                   /* logic of stripes */
-                                        /* send original stripe to slaves */
-     for( ip = 1; ip < numprocs; ip++)
-     {
-        MPI_Ssend(&sent_stripe, 1, MPI_INT, ip, 5, MPI_COMM_WORLD);
-        stripe_in_proc[ip] = sent_stripe;
-        sent_stripe++;
-     }
-  }  
-                                        /**********/
-                                        /* slave  */
-                                        /**********/
-  else
-  {
-                                        /* I'm getting a stripe to do, YAHOO! */
-     MPI_Recv(&stripe, 1, MPI_INT, 0, 5, MPI_COMM_WORLD, &mesgStatus);
-     fprintf(stderr, "my ID: %d -- recieved stripe: %d \n", my_id, stripe);
-
-                                       /* find the points in the set */
-     compute_stripe( crmin, crmax, cimin, cimax, begin_stripe[stripe],
-                     last_stripe[stripe], store_iter, &store_n);
-  }
-
-  MPI_Finalize();
-}
-
-
-
-
-void grid_stripes( double *crmin, double *crmax, double *cimin, double *cimax,
-                      int begin_stripe[], int last_stripe[] )
-{
-  int  w_stripe, stripe, left_over;
-                                        /* define grid spanning   */
-                                        /* the complex plane for  */
-                                        /* the C variable         */
-  *crmin=-1.7;
-  *crmax = 0.8;
-  *cimin = -1.0;
-  *cimax = 1.0;
-                                       /* stripe definition            */
-                                        /* stripe # does not have to be */
-                                        /* commensurate with grid size  */
-                                        /* in which case add 1 to some  */
-                                        /* stripes */
-  w_stripe= NX/N_STRIPE;
-  left_over = NX % N_STRIPE;
-                                        /* fist stripe */
-  begin_stripe[0] = 0;
-  last_stripe[0] = begin_stripe[0] + w_stripe - 1;
-  if ( left_over > 0 )
-    {
-      last_stripe[0] = last_stripe[0] + 1;
-      left_over--;
-    }
-                                        /* other stripes */
-  for ( stripe = 1; stripe < N_STRIPE ; stripe++ )
-    {
-      begin_stripe[stripe] = last_stripe[stripe-1] + 1 ;
-      last_stripe[stripe] = begin_stripe[stripe] + w_stripe - 1;
-      if ( left_over > 0 )
-       {
-      last_stripe[stripe] = last_stripe[stripe] + 1;
-      left_over--;
-       }
-    }
-}
-
-
-
-
-void compute_stripe( double crmin, double crmax, double cimin, double cimax,
-                    int i_min, int i_max, double store_iter[],
-                    int *store_n)
-{
-   double z_real, z_img, z_magnitude;
-   double c_real, c_img, z_current_real;
-   double dcr, dci;
-   int    i, j;
-   int    counter;
-
-                                        /* scan C values on complex plane */
-   dcr = (crmax - crmin)/(double)(NX-1);
-   dci = (cimax - cimin)/(double)(NY-1);
-                                        /* scan stripe */
-   *store_n=0;
-   for ( i=i_min ; i<=i_max; i++ )
-   {
-      for ( j=0 ; j<NY; j++ )
-      {
-           c_real = crmin + i*dcr;
-           c_img = cimin + j*dci;
-                                        /* z starts a origin */
-           z_real = 0.0;
-           z_img  = 0.0;
-                                        /* set counter to zero */
-           counter = 0;
-                                        /* iterate map for             */
-                                        /*  MAX_ITERATIONS times or ...*/
-           while ( counter < MAX_ITERATIONS ) 
-           {
-             z_current_real = z_real;
-             z_real = z_real*z_real - z_img*z_img + c_real;
-             z_img  = 2.0*z_current_real*z_img + c_img;
-             counter = counter + 1;
-                                        /* ... until magnitude of z */
-                                        /* is larger than some      */
-                                        /* large radius             */
-             z_magnitude = z_real*z_real+z_img*z_img;
-             if ( z_magnitude > LARGE_RADIUS ) break;
-           }
-                                        /* store iteration numbers */
-                                        /* to plot the set         */
-          store_iter[*store_n] =
-                    (double)(255*counter) / (double)MAX_ITERATIONS ;
-          (*store_n)++;
-       }
-    }
-}
-
diff --git a/src/mandelbrot/legacy_codes/mandelbrot_2.c b/src/mandelbrot/legacy_codes/mandelbrot_2.c
deleted file mode 100644 (file)
index 874c491..0000000
+++ /dev/null
@@ -1,206 +0,0 @@
-
-                /**********************************/
-                /*                                */
-                /*     The Mandelbrot Set         */
-                /*                                */
-                /*      z = z*z + c               */
-                /*                                */
-                /* Adapted to calculate the Set   */
-                /* in stripes parallel to Img axis*/
-                /*                                */
-                /* Improved routines structure    */
-                /* to facilitate parallel         */
-                /*     implementation             */
-               /**********************************/
-
-                                        /* Michel Vallieres */
-
-#include <stdio.h>
-#include <time.h>
-#include <mpi.h>
-                                        /* large distance; if |z| reaches */
-                                        /* it, point C is not a member    */
-                                        /* of the set                     */
-#define LARGE_RADIUS 2.0
-                                        /* Maximum number of iterations */
-                                        /* before declaring a point in  */
-                                        /* the Mandelbrot set           */
-#define MAX_ITERATIONS 80
-#define NX 600                          /* image size */
-#define NY 500
-#define N_STRIPE 37                     /* number of stripes */
-#define MAX_PROCS 100
-
-                                       /* prototypes   */
-void compute_stripe( double crmin, double crmax, double cimin, double cimax,
-                    int i_min, int i_max, double store_iter[],
-                    int *store_n);
-void grid_stripes( double *crmin, double *crmax, double *cimin, double *cimax,
-                      int begin_stripe[], int last_stripe[] );
-
-
-int main( int argc, char *argv[] )
-{
-  double crmin, crmax, cimin, cimax;
-  double store_iter[NY*(NX/N_STRIPE+1)];
-  int begin_stripe[N_STRIPE], last_stripe[N_STRIPE];
-  int stripe;
-  int store_n, i_point;
-  int count;
-  int my_id, numprocs, ip;
-  int sent_stripe, recv_stripe, stripe_in_proc[MAX_PROCS];
-  int from_node, number_from_node;
-
-  MPI_Status  mesgStatus;
-
-  MPI_Init(&argc, &argv);               /* start MPI virtual machine */
-
-  MPI_Comm_rank(MPI_COMM_WORLD, &my_id);
-  MPI_Comm_size(MPI_COMM_WORLD, &numprocs);
-
-
-                                        /* initialize grid & stripes */
-  grid_stripes ( &crmin, &crmax, &cimin, &cimax, begin_stripe, last_stripe );
-
-  count = 0;
-                                        /**********/
-                                        /* master */
-                                        /**********/
-  if(my_id == 0)                      
-  {
-     sent_stripe = 0;
-     recv_stripe = 0;                   /* logic of stripes */
-                                        /* send original stripe to slaves */
-     for( ip = 1; ip < numprocs; ip++)
-     {
-        MPI_Ssend(&sent_stripe, 1, MPI_INT, ip, 5, MPI_COMM_WORLD);
-        stripe_in_proc[ip] = sent_stripe;
-        sent_stripe++;
-     }
-
-     for( recv_stripe = 0; recv_stripe < N_STRIPE; recv_stripe++)
-     {
-                                        /* Recieve result back from a node */
-       MPI_Recv(store_iter, NY*(NX/N_STRIPE+1), MPI_DOUBLE, MPI_ANY_SOURCE, 7, 
-                                         MPI_COMM_WORLD, &mesgStatus);
-       from_node = mesgStatus.MPI_SOURCE;
-       MPI_Get_count( &mesgStatus, MPI_DOUBLE, &number_from_node );
-       fprintf( stderr, "From node %d -- stripe & # %d %d \n", from_node, 
-                             stripe_in_proc[from_node], number_from_node );
-     }
-  }  
-                                        /**********/
-                                        /* slave  */
-                                        /**********/
-  else
-  {
-                                        /* I'm getting a stripe to do, YAHOO! */
-     MPI_Recv(&stripe, 1, MPI_INT, 0, 5, MPI_COMM_WORLD, &mesgStatus);
-     fprintf(stderr, "my ID: %d -- recieved stripe: %d \n", my_id, stripe);
-
-                                       /* find the points in the set */
-     compute_stripe( crmin, crmax, cimin, cimax, begin_stripe[stripe],
-                     last_stripe[stripe], store_iter, &store_n);
-
-                                        /* send stripe results back to master */
-     MPI_Ssend(store_iter, store_n, MPI_DOUBLE, 0, 7, MPI_COMM_WORLD);
- }
-
-  MPI_Finalize();
-}
-
-
-
-
-void grid_stripes( double *crmin, double *crmax, double *cimin, double *cimax,
-                      int begin_stripe[], int last_stripe[] )
-{
-  int  w_stripe, stripe, left_over;
-                                        /* define grid spanning   */
-                                        /* the complex plane for  */
-                                        /* the C variable         */
-  *crmin=-1.7;
-  *crmax = 0.8;
-  *cimin = -1.0;
-  *cimax = 1.0;
-                                       /* stripe definition            */
-                                        /* stripe # does not have to be */
-                                        /* commensurate with grid size  */
-                                        /* in which case add 1 to some  */
-                                        /* stripes */
-  w_stripe= NX/N_STRIPE;
-  left_over = NX % N_STRIPE;
-                                        /* fist stripe */
-  begin_stripe[0] = 0;
-  last_stripe[0] = begin_stripe[0] + w_stripe - 1;
-  if ( left_over > 0 )
-    {
-      last_stripe[0] = last_stripe[0] + 1;
-      left_over--;
-    }
-                                        /* other stripes */
-  for ( stripe = 1; stripe < N_STRIPE ; stripe++ )
-    {
-      begin_stripe[stripe] = last_stripe[stripe-1] + 1 ;
-      last_stripe[stripe] = begin_stripe[stripe] + w_stripe - 1;
-      if ( left_over > 0 )
-       {
-      last_stripe[stripe] = last_stripe[stripe] + 1;
-      left_over--;
-       }
-    }
-}
-
-
-
-
-void compute_stripe( double crmin, double crmax, double cimin, double cimax,
-                    int i_min, int i_max, double store_iter[],
-                    int *store_n)
-{
-   double z_real, z_img, z_magnitude;
-   double c_real, c_img, z_current_real;
-   double dcr, dci;
-   int    i, j;
-   int    counter;
-
-                                        /* scan C values on complex plane */
-   dcr = (crmax - crmin)/(double)(NX-1);
-   dci = (cimax - cimin)/(double)(NY-1);
-                                        /* scan stripe */
-   *store_n=0;
-   for ( i=i_min ; i<=i_max; i++ )
-   {
-      for ( j=0 ; j<NY; j++ )
-      {
-           c_real = crmin + i*dcr;
-           c_img = cimin + j*dci;
-                                        /* z starts a origin */
-           z_real = 0.0;
-           z_img  = 0.0;
-                                        /* set counter to zero */
-           counter = 0;
-                                        /* iterate map for             */
-                                        /*  MAX_ITERATIONS times or ...*/
-           while ( counter < MAX_ITERATIONS ) 
-           {
-             z_current_real = z_real;
-             z_real = z_real*z_real - z_img*z_img + c_real;
-             z_img  = 2.0*z_current_real*z_img + c_img;
-             counter = counter + 1;
-                                        /* ... until magnitude of z */
-                                        /* is larger than some      */
-                                        /* large radius             */
-             z_magnitude = z_real*z_real+z_img*z_img;
-             if ( z_magnitude > LARGE_RADIUS ) break;
-           }
-                                        /* store iteration numbers */
-                                        /* to plot the set         */
-          store_iter[*store_n] =
-                    (double)(255*counter) / (double)MAX_ITERATIONS ;
-          (*store_n)++;
-       }
-    }
-}
-
diff --git a/src/mandelbrot/legacy_codes/mandelbrot_3.c b/src/mandelbrot/legacy_codes/mandelbrot_3.c
deleted file mode 100644 (file)
index 7988869..0000000
+++ /dev/null
@@ -1,224 +0,0 @@
-
-                /**********************************/
-                /*                                */
-                /*     The Mandelbrot Set         */
-                /*                                */
-                /*      z = z*z + c               */
-                /*                                */
-                /* Adapted to calculate the Set   */
-                /* in stripes parallel to Img axis*/
-                /*                                */
-                /* Improved routines structure    */
-                /* to facilitate parallel         */
-                /*     implementation             */
-               /**********************************/
-
-                                        /* Michel Vallieres */
-
-#include <stdio.h>
-#include <time.h>
-#include <mpi.h>
-                                        /* large distance; if |z| reaches */
-                                        /* it, point C is not a member    */
-                                        /* of the set                     */
-#define LARGE_RADIUS 2.0
-                                        /* Maximum number of iterations */
-                                        /* before declaring a point in  */
-                                        /* the Mandelbrot set           */
-#define MAX_ITERATIONS 80
-#define NX 600                          /* image size */
-#define NY 500
-#define N_STRIPE 37                     /* number of stripes */
-#define MAX_PROCS 100
-
-                                       /* prototypes   */
-void compute_stripe( double crmin, double crmax, double cimin, double cimax,
-                    int i_min, int i_max, double store_iter[],
-                    int *store_n);
-void grid_stripes( double *crmin, double *crmax, double *cimin, double *cimax,
-                      int begin_stripe[], int last_stripe[] );
-
-
-int main( int argc, char *argv[] )
-{
-  double crmin, crmax, cimin, cimax;
-  double store_iter[NY*(NX/N_STRIPE+1)];
-  int begin_stripe[N_STRIPE], last_stripe[N_STRIPE];
-  int stripe;
-  int store_n, i_point;
-  int count;
-  int my_id, numprocs, ip;
-  int sent_stripe, recv_stripe, stripe_in_proc[MAX_PROCS];
-  int from_node, number_from_node;
-  int end_signal;
-
-  MPI_Status  mesgStatus;
-
-  MPI_Init(&argc, &argv);               /* start MPI virtual machine */
-
-  MPI_Comm_rank(MPI_COMM_WORLD, &my_id);
-  MPI_Comm_size(MPI_COMM_WORLD, &numprocs);
-
-
-                                        /* initialize grid & stripes */
-  grid_stripes ( &crmin, &crmax, &cimin, &cimax, begin_stripe, last_stripe );
-
-  count = 0;
-                                        /**********/
-                                        /* master */
-                                        /**********/
-  if(my_id == 0)                      
-  {
-     sent_stripe = 0;
-     recv_stripe = 0;                   /* logic of stripes */
-                                        /* send original stripe to slaves */
-     for( ip = 1; ip < numprocs; ip++)
-     {
-        MPI_Ssend(&sent_stripe, 1, MPI_INT, ip, 5, MPI_COMM_WORLD);
-        stripe_in_proc[ip] = sent_stripe;
-        sent_stripe++;
-     }
-
-     for( recv_stripe = 0; recv_stripe < N_STRIPE; recv_stripe++)
-     {
-                                        /* Recieve result back from a node */
-        MPI_Recv(store_iter, NY*(NX/N_STRIPE+1), MPI_DOUBLE, MPI_ANY_SOURCE, 7, 
-                                         MPI_COMM_WORLD, &mesgStatus);
-        from_node = mesgStatus.MPI_SOURCE;
-        MPI_Get_count( &mesgStatus, MPI_DOUBLE, &number_from_node );
-        fprintf( stderr, "From node %d -- stripe & # %d %d \n", from_node, 
-                             stripe_in_proc[from_node], number_from_node );
-                                        /* Termination logic. */
-        end_signal = -1;
-        fprintf( stderr, "I'm sending a termination signal to %d \n", from_node);
-        fflush(stderr);
-        MPI_Ssend( &end_signal, 1, MPI_INT, from_node, 5, MPI_COMM_WORLD);
-        fprintf( stderr, "I have sent a termination signal to %d \n", from_node);
-        fflush(stderr);
-     }
-  }  
-                                        /**********/
-                                        /* slave  */
-                                        /**********/
-  else
-  {
-     for ( ; ; )
-       {
-                                        /* I'm getting a stripe to do, YAHOO! */
-        MPI_Recv(&stripe, 1, MPI_INT, 0, 5, MPI_COMM_WORLD, &mesgStatus);
-        fprintf(stderr, "my ID: %d -- recieved stripe: %d \n", my_id, stripe);
-
-        if( stripe < 0)
-        {
-          fprintf(stderr, "Node %d is quitting. \n", my_id);
-          MPI_Finalize();
-          exit(0);
-        } 
-
-                                       /* find the points in the set */
-        compute_stripe( crmin, crmax, cimin, cimax, begin_stripe[stripe],
-                     last_stripe[stripe], store_iter, &store_n);
-
-                                        /* send stripe results back to master */
-       MPI_Ssend(store_iter, store_n, MPI_DOUBLE, 0, 7, MPI_COMM_WORLD);
-       }
- }
-
-  MPI_Finalize();
-}
-
-
-
-
-void grid_stripes( double *crmin, double *crmax, double *cimin, double *cimax,
-                      int begin_stripe[], int last_stripe[] )
-{
-  int  w_stripe, stripe, left_over;
-                                        /* define grid spanning   */
-                                        /* the complex plane for  */
-                                        /* the C variable         */
-  *crmin=-1.7;
-  *crmax = 0.8;
-  *cimin = -1.0;
-  *cimax = 1.0;
-                                       /* stripe definition            */
-                                        /* stripe # does not have to be */
-                                        /* commensurate with grid size  */
-                                        /* in which case add 1 to some  */
-                                        /* stripes */
-  w_stripe= NX/N_STRIPE;
-  left_over = NX % N_STRIPE;
-                                        /* fist stripe */
-  begin_stripe[0] = 0;
-  last_stripe[0] = begin_stripe[0] + w_stripe - 1;
-  if ( left_over > 0 )
-    {
-      last_stripe[0] = last_stripe[0] + 1;
-      left_over--;
-    }
-                                        /* other stripes */
-  for ( stripe = 1; stripe < N_STRIPE ; stripe++ )
-    {
-      begin_stripe[stripe] = last_stripe[stripe-1] + 1 ;
-      last_stripe[stripe] = begin_stripe[stripe] + w_stripe - 1;
-      if ( left_over > 0 )
-       {
-      last_stripe[stripe] = last_stripe[stripe] + 1;
-      left_over--;
-       }
-    }
-}
-
-
-
-
-void compute_stripe( double crmin, double crmax, double cimin, double cimax,
-                    int i_min, int i_max, double store_iter[],
-                    int *store_n)
-{
-   double z_real, z_img, z_magnitude;
-   double c_real, c_img, z_current_real;
-   double dcr, dci;
-   int    i, j;
-   int    counter;
-
-                                        /* scan C values on complex plane */
-   dcr = (crmax - crmin)/(double)(NX-1);
-   dci = (cimax - cimin)/(double)(NY-1);
-                                        /* scan stripe */
-   *store_n=0;
-   for ( i=i_min ; i<=i_max; i++ )
-   {
-      for ( j=0 ; j<NY; j++ )
-      {
-           c_real = crmin + i*dcr;
-           c_img = cimin + j*dci;
-                                        /* z starts a origin */
-           z_real = 0.0;
-           z_img  = 0.0;
-                                        /* set counter to zero */
-           counter = 0;
-                                        /* iterate map for             */
-                                        /*  MAX_ITERATIONS times or ...*/
-           while ( counter < MAX_ITERATIONS ) 
-           {
-             z_current_real = z_real;
-             z_real = z_real*z_real - z_img*z_img + c_real;
-             z_img  = 2.0*z_current_real*z_img + c_img;
-             counter = counter + 1;
-                                        /* ... until magnitude of z */
-                                        /* is larger than some      */
-                                        /* large radius             */
-             z_magnitude = z_real*z_real+z_img*z_img;
-             if ( z_magnitude > LARGE_RADIUS ) break;
-           }
-                                        /* store iteration numbers */
-                                        /* to plot the set         */
-          store_iter[*store_n] =
-                    (double)(255*counter) / (double)MAX_ITERATIONS ;
-          (*store_n)++;
-       }
-    }
-}
-
diff --git a/src/mandelbrot/legacy_codes/mandelbrot_blocked.c b/src/mandelbrot/legacy_codes/mandelbrot_blocked.c
deleted file mode 100644 (file)
index 9d87eb3..0000000
+++ /dev/null
@@ -1,161 +0,0 @@
-
-                /**********************************/
-                /*                                */
-                /*     The Mandelbrot Set         */
-                /*                                */
-                /*      z = z*z + c               */
-                /*                                */
-                /* Adapted to calculate the Set   */
-                /* in stripes parallel to Img axis*/
-                /*                                */
-                /* Improved routines structure    */
-                /* to facilitate parallel         */
-                /*     implementation             */
-               /**********************************/
-
-                                        /* Michel Vallieres */
-
-#include <stdio.h>
-#include <time.h>
-                                        /* large distance; if |z| reaches */
-                                        /* it, point C is not a member    */
-                                        /* of the set                     */
-#define LARGE_RADIUS 2.0
-                                        /* Maximum number of iterations */
-                                        /* before declaring a point in  */
-                                        /* the Mandelbrot set           */
-#define MAX_ITERATIONS 80
-#define NX 600                          /* image size */
-#define NY 500
-#define N_STRIPE 37                     /* number of stripes */
-
-                                       /* prototypes   */
-void compute_stripe( double crmin, double crmax, double cimin, double cimax,
-                    int i_min, int i_max, double store_iter[],
-                    int *store_n);
-void grid_stripes( double *crmin, double *crmax, double *cimin, double *cimax,
-                      int begin_stripe[], int last_stripe[] );
-
-
-int main( int argc, char *argv[] )
-{
-  double crmin, crmax, cimin, cimax;
-  double store_iter[NY*(NX/N_STRIPE+1)];
-  int begin_stripe[N_STRIPE], last_stripe[N_STRIPE];
-  int stripe;
-  int store_n, i_point;
-  int count;
-                                        /* initialize grid & stripes */
-  grid_stripes ( &crmin, &crmax, &cimin, &cimax, begin_stripe, last_stripe );
-
-  count = 0;
-                                       /* scan over stripes       */
-  for( stripe = 0; stripe < N_STRIPE; stripe++ )
-  {
-                                       /* find the points in the set */
-     compute_stripe( crmin, crmax, cimin, cimax, begin_stripe[stripe],
-                     last_stripe[stripe], store_iter, &store_n);
-
-                                        /* output iteration # for plot */
-     for ( i_point = 0 ; i_point < store_n ; i_point++ )
-       {
-           count ++;
-          printf( " %f ", store_iter[i_point] );
-       }
-  }
-}
-
-
-
-
-void grid_stripes( double *crmin, double *crmax, double *cimin, double *cimax,
-                      int begin_stripe[], int last_stripe[] )
-{
-  int  w_stripe, stripe, left_over;
-                                        /* define grid spanning   */
-                                        /* the complex plane for  */
-                                        /* the C variable         */
-  *crmin=-1.7;
-  *crmax = 0.8;
-  *cimin = -1.0;
-  *cimax = 1.0;
-                                       /* stripe definition            */
-                                        /* stripe # does not have to be */
-                                        /* commensurate with grid size  */
-                                        /* in which case add 1 to some  */
-                                        /* stripes */
-  w_stripe= NX/N_STRIPE;
-  left_over = NX % N_STRIPE;
-                                        /* fist stripe */
-  begin_stripe[0] = 0;
-  last_stripe[0] = begin_stripe[0] + w_stripe - 1;
-  if ( left_over > 0 )
-    {
-      last_stripe[0] = last_stripe[0] + 1;
-      left_over--;
-    }
-                                        /* other stripes */
-  for ( stripe = 1; stripe < N_STRIPE ; stripe++ )
-    {
-      begin_stripe[stripe] = last_stripe[stripe-1] + 1 ;
-      last_stripe[stripe] = begin_stripe[stripe] + w_stripe - 1;
-      if ( left_over > 0 )
-       {
-      last_stripe[stripe] = last_stripe[stripe] + 1;
-      left_over--;
-       }
-    }
-}
-
-
-
-
-void compute_stripe( double crmin, double crmax, double cimin, double cimax,
-                    int i_min, int i_max, double store_iter[],
-                    int *store_n)
-{
-   double z_real, z_img, z_magnitude;
-   double c_real, c_img, z_current_real;
-   double dcr, dci;
-   int    i, j;
-   int    counter;
-
-                                        /* scan C values on complex plane */
-   dcr = (crmax - crmin)/(double)(NX-1);
-   dci = (cimax - cimin)/(double)(NY-1);
-                                        /* scan stripe */
-   *store_n=0;
-   for ( i=i_min ; i<=i_max; i++ )
-   {
-      for ( j=0 ; j<NY; j++ )
-      {
-           c_real = crmin + i*dcr;
-           c_img = cimin + j*dci;
-                                        /* z starts a origin */
-           z_real = 0.0;
-           z_img  = 0.0;
-                                        /* set counter to zero */
-           counter = 0;
-                                        /* iterate map for             */
-                                        /*  MAX_ITERATIONS times or ...*/
-           while ( counter < MAX_ITERATIONS ) 
-           {
-             z_current_real = z_real;
-             z_real = z_real*z_real - z_img*z_img + c_real;
-             z_img  = 2.0*z_current_real*z_img + c_img;
-             counter = counter + 1;
-                                        /* ... until magnitude of z */
-                                        /* is larger than some      */
-                                        /* large radius             */
-             z_magnitude = z_real*z_real+z_img*z_img;
-             if ( z_magnitude > LARGE_RADIUS ) break;
-           }
-                                        /* store iteration numbers */
-                                        /* to plot the set         */
-          store_iter[*store_n] =
-                    (double)(255*counter) / (double)MAX_ITERATIONS ;
-          (*store_n)++;
-       }
-    }
-}
-
diff --git a/src/mandelbrot/legacy_codes/mandelbrot_parallel.c b/src/mandelbrot/legacy_codes/mandelbrot_parallel.c
deleted file mode 100644 (file)
index df95d10..0000000
+++ /dev/null
@@ -1,256 +0,0 @@
-
-                /**********************************/
-                /*                                */
-                /*     The Mandelbrot Set         */
-                /*                                */
-                /*      z = z*z + c               */
-                /*                                */
-                /*     parallel version           */
-                /*                                */
-               /**********************************/
-
-                                        /* Michel Vallieres */
-
-#include <stdio.h>
-#include <time.h>
-#include "mpi.h"
-                                        /* large distance; if |z| reaches */
-                                        /* it, point C is not a member    */
-                                        /* of the set                     */
-#define LARGE_RADIUS 2.0
-                                        /* Maximum number of iterations */
-                                        /* before declaring a point in  */
-                                        /* the Mandelbrot set           */
-#define MAX_ITERATIONS 80
-#define NX 600                          /* image size */
-#define NY 500
-#define N_STRIPE 37                     /* number of stripes */
-#define MAX_PROC 100                    /* max # of processes */
-
-                                       /* prototypes   */
-void compute_stripe( double crmin, double crmax, double cimin, double cimax,
-                    int i_min, int i_max, double store_iter[],
-                    int *store_n);
-void grid_stripes( double *crmin, double *crmax, double *cimin, double *cimax,
-                      int begin_stripe[], int last_stripe[] );
-
-
-int main( int argc, char *argv[] )
-{
-  double crmin, crmax, cimin, cimax;
-  double store_iter[NY*(NX/N_STRIPE+1)];
-  double global_store_iter[NY*NX];
-  int begin_stripe[N_STRIPE], last_stripe[N_STRIPE];
-  int stripe;
-  int store_n, i_point, offset;
-  int count;
-  int myid, numprocs;
-  MPI_Status mesgStatus;
-  int stripe_in_proc[MAX_PROC], sent_stripe, recv_stripe, from_node, 
-      from_stripe, number_from_node, ip;
-  int end_signal;
-
-                                         /* start the MPI virtual machine */
-  MPI_Init(&argc,&argv);
-  MPI_Comm_size(MPI_COMM_WORLD,&numprocs);
-  MPI_Comm_rank(MPI_COMM_WORLD,&myid);
-
-                                        /* initialize grid & stripes */
-  grid_stripes ( &crmin, &crmax, &cimin, &cimax, begin_stripe, last_stripe );
-
-                                        /*****************/
-                                       /* Master code   */
-                                        /*****************/
-  if ( myid == 0 )
-    {
-
-       count = 0;
-
-                                        /* initilalize send counter */
-       sent_stripe = 0;
-                                        /* send a stripe to each slave   */
-                                        /* to start local calculation    */
-       for ( ip=1 ; ip<numprocs ; ip++ )
-        {
-            MPI_Ssend( &sent_stripe, 1, MPI_INT, ip, 5, MPI_COMM_WORLD );
-            stripe_in_proc[ip] = sent_stripe;
-            sent_stripe++;
-        }
-                                        /* receive results back from nodes */
-       for ( recv_stripe = 0 ; recv_stripe < N_STRIPE ; recv_stripe++ )
-        {
-           MPI_Recv( store_iter, NY*(NX/N_STRIPE+1), MPI_DOUBLE, 
-                        MPI_ANY_SOURCE, 7, MPI_COMM_WORLD,  &mesgStatus );
-           from_node = mesgStatus.MPI_SOURCE;
-           MPI_Get_count( &mesgStatus, MPI_DOUBLE, &number_from_node );
-           from_stripe = stripe_in_proc[from_node];
-
-           fprintf ( stderr, " From node: %d -- stripe & # %d %d \n",
-                         from_node, stripe_in_proc[from_node], 
-                                            number_from_node );
-
-                                       /* new stripe for this slave */
-           if ( sent_stripe < N_STRIPE )
-            {
-
-                fprintf( stderr, "Node %d will send stripe = %d to node %d\n",
-                                 myid, sent_stripe, from_node );
-
-                MPI_Ssend( &sent_stripe, 1, MPI_INT, from_node, 5, MPI_COMM_WORLD );
-                stripe_in_proc[from_node] = sent_stripe;
-                sent_stripe++;
-            }
-           else
-            {
-                end_signal = -1;
-       
-                MPI_Ssend( &end_signal, 1, MPI_INT, from_node, 5, MPI_COMM_WORLD );
-
-                fprintf( stderr, "Node %d has sent end_signal = %d to node %d\n",
-                                 myid, end_signal, from_node );
-            }
-
-                                       /* accumulate iterations */
-           offset = NY * begin_stripe[from_stripe];
-           for ( i_point=0 ; i_point<number_from_node ; i_point++ )
-            {
-                global_store_iter[offset+i_point] = store_iter[i_point];
-            }
-        }
-
-                                        /* all stripes done */
-                                        /* print out results */
-      for ( i_point=0; i_point<NX*NY ; i_point++ )
-       {
-         count++;
-         printf( " %f \n ", global_store_iter[i_point] );
-       }
-                                        /* end MPI virtual machine */
-      MPI_Finalize();
-      exit(0);
-    }
-                                        /*****************/
-                                       /* Slave code    */
-                                        /*****************/
-  else
-    {
-                                        /* loop for more stripes until */
-      for ( ; ;  )                      /* negative signal received */
-       {
-                                        /* receive a stripe to do */
-          MPI_Recv( &stripe, 1, MPI_INT, 0, 5, MPI_COMM_WORLD, 
-                         &mesgStatus );
-
-          fprintf( stderr, "From within node: %d -- Stripe: %d \n", myid, stripe );
-
-          if ( stripe < 0 )
-           {
-               fprintf( stderr,"Node %d exiting \n", myid);
-               MPI_Finalize();
-               exit(0);
-           }
-                                       /* find the points in the set */
-          compute_stripe( crmin, crmax, cimin, cimax, begin_stripe[stripe],
-                     last_stripe[stripe], store_iter, &store_n);
-
-                                       /* send results  to master */
-          MPI_Ssend( store_iter, store_n, MPI_DOUBLE, 0, 7, MPI_COMM_WORLD );
-       }
-    }
-
-}
-
-
-
-
-void grid_stripes( double *crmin, double *crmax, double *cimin, double *cimax,
-                      int begin_stripe[], int last_stripe[] )
-{
-  int  w_stripe, stripe, left_over;
-                                        /* define grid spanning   */
-                                        /* the complex plane for  */
-                                        /* the C variable         */
-  *crmin=-1.7;
-  *crmax = 0.8;
-  *cimin = -1.0;
-  *cimax = 1.0;
-                                       /* stripe definition            */
-                                        /* stripe # does not have to be */
-                                        /* commensurate with grid size  */
-                                        /* in which case add 1 to some  */
-                                        /* stripes */
-  w_stripe= NX/N_STRIPE;
-  left_over = NX % N_STRIPE;
-                                        /* fist stripe */
-  begin_stripe[0] = 0;
-  last_stripe[0] = begin_stripe[0] + w_stripe - 1;
-  if ( left_over > 0 )
-    {
-      last_stripe[0] = last_stripe[0] + 1;
-      left_over--;
-    }
-                                        /* other stripes */
-  for ( stripe = 1; stripe < N_STRIPE ; stripe++ )
-    {
-      begin_stripe[stripe] = last_stripe[stripe-1] + 1 ;
-      last_stripe[stripe] = begin_stripe[stripe] + w_stripe - 1;
-      if ( left_over > 0 )
-       {
-      last_stripe[stripe] = last_stripe[stripe] + 1;
-      left_over--;
-       }
-    }
-}
-
-
-
-
-void compute_stripe( double crmin, double crmax, double cimin, double cimax,
-                    int i_min, int i_max, double store_iter[],
-                    int *store_n)
-{
-   double z_real, z_img, z_magnitude;
-   double c_real, c_img, z_current_real;
-   double dcr, dci;
-   int    i, j;
-   int    counter;
-
-                                        /* scan C values on complex plane */
-   dcr = (crmax - crmin)/(double)(NX-1);
-   dci = (cimax - cimin)/(double)(NY-1);
-                                        /* scan stripe */
-   *store_n=0;
-   for ( i=i_min ; i<=i_max; i++ )
-   {
-      for ( j=0 ; j<NY; j++ )
-      {
-           c_real = crmin + i*dcr;
-           c_img = cimin + j*dci;
-                                        /* z starts a origin */
-           z_real = 0.0;
-           z_img  = 0.0;
-                                        /* set counter to zero */
-           counter = 0;
-                                        /* iterate map for             */
-                                        /*  MAX_ITERATIONS times or ...*/
-           while ( counter < MAX_ITERATIONS ) 
-           {
-             z_current_real = z_real;
-             z_real = z_real*z_real - z_img*z_img + c_real;
-             z_img  = 2.0*z_current_real*z_img + c_img;
-             counter = counter + 1;
-                                        /* ... until magnitude of z */
-                                        /* is larger than some      */
-                                        /* large radius             */
-             z_magnitude = z_real*z_real+z_img*z_img;
-             if ( z_magnitude > LARGE_RADIUS ) break;
-           }
-                                        /* store iteration numbers */
-                                        /* to plot the set         */
-          store_iter[*store_n] =
-                    (double)(255*counter) / (double)MAX_ITERATIONS ;
-          (*store_n)++;
-       }
-    }
-}
-
diff --git a/src/mandelbrot/legacy_codes/mandelbrot_sliced.c b/src/mandelbrot/legacy_codes/mandelbrot_sliced.c
deleted file mode 100644 (file)
index 7b12aa2..0000000
+++ /dev/null
@@ -1,132 +0,0 @@
-
-                /**********************************/
-                /*                                */
-                /*     The Mandelbrot Set         */
-                /*                                */
-                /*      z = z*z + c               */
-                /*                                */
-                /* Adapted to calculate the Set   */
-                /* in stripes parallel to Img axis*/
-                /*                                */
-               /**********************************/
-
-                                        /* Summer School 1995 */
-
-
-#include <stdio.h>
-#include <time.h>
-                                        /* large distance; if |z| reaches */
-                                        /* it, point C is not a member    */
-                                        /* of the set                     */
-#define LARGE_RADIUS 2.0
-                                        /* Maximum number of iterations */
-                                        /* before declaring a point in  */
-                                        /* the Mandelbrot set           */
-#define MAX_ITERATIONS 80
-#define NX 500
-#define NY 500
-#define N_STRIPE 25
-
-                                       /* prototype                    */
-void compute_stripe( double crmin, double crmax,
-                    double cimin, double cimax, double dcr, double dci,
-                    int i_min, int i_max, double store_r[], double store_i[],
-                    int *store_n);
-
-main()
-{
-  double crmin, crmax, cimin, cimax;
-  double dcr, dci;
-  double store_r[NY*NX/N_STRIPE], store_i[NY*NX/N_STRIPE];
-  int  w_stripe, stripe;
-  int i_min, i_max;
-  int store_n;
-  int i;
-
-                                        /* define grid spanning   */
-                                        /* the complex plane for  */
-                                        /* the C variable         */
-  crmin=-1.7;
-  crmax = 0.8;
-  cimin = -1.0;
-  cimax = 1.0;
-                                       /* stripe definition      */
-  w_stripe= NX/N_STRIPE;
-    
-                                        /* scan C values on complex plane */
-  dcr = (crmax - crmin)/(double)(NX-1);
-  dci = (cimax - cimin)/(double)(NY-1);
-
-                                       /* scan over stripes       */
-  for( stripe = 0; stripe < N_STRIPE; stripe++ )
-  {
-      i_min= stripe*w_stripe;
-      i_max= (stripe+1)*w_stripe - 1;
-      if( stripe == N_STRIPE-1 )  i_max = NX;
-
-                                       /* find the points in the set */
-      compute_stripe( crmin, crmax, cimin, cimax, dcr, dci, i_min, i_max,
-                    store_r, store_i, &store_n);
-                                       /* output coordinates in set */
-      /*
-      for( i=0; i< store_n; i++ )
-       printf("%f %f\n", store_r[i], store_i[i]);
-      */
-    }
-
-}
-
-
-void compute_stripe( double crmin, double crmax,
-                    double cimin, double cimax, double dcr, double dci,
-                    int i_min, int i_max, double store_r[], double store_i[],
-                    int *store_n)
-{
-   double z_real, z_img, z_magnitude;
-   double c_real, c_img, z_current_real;
-   int    i, j;
-   int    counter;
-
-   *store_n=0;
-   for ( i=i_min ; i<=i_max; i++ )
-   {
-      for ( j=0 ; j<NY; j++ )
-      {
-           c_real = crmin + i*dcr;
-           c_img = cimin + j*dci;
-                                        /* z starts a origin */
-           z_real = 0.0;
-           z_img  = 0.0;
-                                        /* set counter to zero */
-           counter = 0;
-                                        /* iterate map for             */
-                                        /*  MAX_ITERATIONS times or ...*/
-           while ( counter < MAX_ITERATIONS ) 
-           {
-             z_current_real = z_real;
-             z_real = z_real*z_real - z_img*z_img + c_real;
-             z_img  = 2.0*z_current_real*z_img + c_img;
-             counter = counter + 1;
-                                        /* ... until magnitude of z */
-                                        /* is larger than some      */
-                                        /* large radius             */
-             z_magnitude = z_real*z_real+z_img*z_img;
-             if ( z_magnitude > LARGE_RADIUS ) break;
-           }
-                                        /* store C real and       */
-                                        /* imaginary parts if     */
-                                        /* C belongs to the set   */
-           if ( z_magnitude < LARGE_RADIUS )
-           {
-             store_r[*store_n]=c_real;
-             store_i[*store_n]=c_img;
-             (*store_n)++;
-          }
-
-           printf ( " %f ", (double)(255*counter) / (double)MAX_ITERATIONS );
-       }
-
-    }
-
-}
-