//
// PURPOSE: Test shell sort of array of structs.  This code is in Math.cc & MathP.h.
// DATE:
// CHANGELOG:  28 Jan 2016:  Initial code rsm.
//
#include <stdio.h>
#include "MathP.h"
//
// For shell short:
//struct beams {
//   float *range;
//   short num;
//};
//
// Function prototype:
//static void shellSort(struct beams b[], int array_size);
//
//
float value1 = 1.;
float value2 = 2.;
float value3 = 3.;

void main()
{
   struct beams idtBeams[] =
      {
	 { &value3, 3 },
	 { &value2, 4 },
	 { &value1, 7 },
      };

   int size = 3;
   int i;

   printf("\n\n");

   for( i=0; i< size; i++ )
   {
      printf(" range[%d] = %.1f\n",idtBeams[i].num, *idtBeams[i].range);
   }

   Math::shellSort( idtBeams, size );

   printf("\n\n");

   for( i=0; i< size; i++ )
   {
      printf(" range[%d] = %.1f\n",idtBeams[i].num, *idtBeams[i].range);
   }

   printf("\n\n");

   printf(" value1 = %.1f\n", value1);
   printf(" value2 = %.1f\n", value2);
   printf(" value3 = %.1f\n", value3);

   
   printf("\n\n");
   
}
