// file: $USFS/eval/exp_13/code/sbe_init.cc
//

// isip include files
//
#include "sbe_eval.h"
#include <string.h>

#include "sbe_eval_constants.h"
#include <integral_constants.h>

// program to find the mean value
//
logical_1 Sbe_eval::init_cc(int_4 n, int_4 option) {
  
  // check for the memory before allocating
  //
  if (name_d != (char_1**)NULL) {
    delete [] name_d;
  }
  
  name_d = new char_1*[n];
  for (int_4 i=0; i < n; i++) {
    name_d[i] = new char_1[ISIP_MAX_STRING_LENGTH];
  }

  if (sbe_value_d != (float_4*)NULL) {
    delete sbe_value_d;
  }

  sbe_value_d = new float_4[n];
  memset((void*)sbe_value_d, (int)0, n);

  // initialize the counters
  //
  no_of_images_d = n;
  sbe_mean_d = 0;
  
  if (option == SBE_PARTITION) {
    no_of_input = 1;
    no_of_output = 3;
  }

  if (option == SBE_ASSIGN) {
    no_of_input = 3;
    no_of_output = 1;
  }
  
  if (option == SBE_ERROR) {
    no_of_input = 2;
    no_of_output = 0;
  }
  
  if (option == SBE_INDEX) {
    no_of_input = 1;
    no_of_output = 1;
  }
  
  // exit gracefully
  //
  return ISIP_TRUE;
}




