// file: $USFS/class/image_analysis/v3.1/imaga_dbg_0.cc
//

// isip include files
//
#include "image_analysis.h"

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

// method: debug_cc
//
// arguments:
//  FILE* fp: (input) an open file pointer
//  char_1* message: (input) identification message
//
// return: a logical_1 value indicating the status
//
logical_1 Image_analysis::debug_cc(FILE* fp_a, char_1* message_a) {

  // dump internal data
  //
  if (param_version_d == (char_1*)NULL) {
    fprintf(fp_a, "<%s::%s> param_version_d = NULL\n",
	    IMAGE_ANALYSIS_CLASS_NAME, (char*)message_a);
  }
  else {
    fprintf(fp_a, "<%s::%s> param_version_d = %s\n",
	    IMAGE_ANALYSIS_CLASS_NAME, (char*)message_a,
	    param_version_d);
  }
  
  if (param_fname_d == (char_1*)NULL) {
    fprintf(fp_a, "<%s::%s> param_fname_d = NULL\n",
	    IMAGE_ANALYSIS_CLASS_NAME, (char*)message_a);
  }
  else {
    fprintf(fp_a, "<%s::%s> param_version_d = %s\n",
	    IMAGE_ANALYSIS_CLASS_NAME, (char*)message_a,
	    param_fname_d);
  }
  
  if (model_version_d == (char_1*)NULL) {
    fprintf(fp_a, "<%s::%s> model_version_d = %s\n",
	    IMAGE_ANALYSIS_CLASS_NAME, (char*)message_a,
	    model_version_d);
  }
  else {
    fprintf(fp_a, "<%s::%s> param_version_d = %s\n",
	    IMAGE_ANALYSIS_CLASS_NAME, (char*)message_a,
	    model_version_d);
  }
  
  if (model_fname_d == (char_1*)NULL) {
    fprintf(fp_a, "<%s::%s> model_fname_d = NULL\n",
	    IMAGE_ANALYSIS_CLASS_NAME, (char*)message_a);
  }
  else {
    fprintf(fp_a, "%s::%s> param_version_d = %s\n",
	    IMAGE_ANALYSIS_CLASS_NAME, (char*)message_a,
	    model_fname_d);
  }

  fprintf(fp_a, "<%s::%s> algorithm_d = %ld\n",
	  IMAGE_ANALYSIS_CLASS_NAME, (char*)message_a, algorithm_d);

  fprintf(fp_a, "<%s::%s> mode_d = %ld\n",
	  IMAGE_ANALYSIS_CLASS_NAME, (char*)message_a, mode_d);

  fprintf(fp_a, "<%s::%s> hist_r_min_d = %f\n",
	  IMAGE_ANALYSIS_CLASS_NAME, (char*)message_a, hist_r_min_d);

  fprintf(fp_a, "<%s::%s> hist_r_max_d = %f\n",
	  IMAGE_ANALYSIS_CLASS_NAME, (char*)message_a, hist_r_max_d);

  fprintf(fp_a, "<%s::%s> hist_r_nbins_d = %ld\n",
	  IMAGE_ANALYSIS_CLASS_NAME, (char*)message_a, hist_r_nbins_d);
  
  fprintf(fp_a, "<%s::%s> hist_r_redp_d = %ld\n",
	  IMAGE_ANALYSIS_CLASS_NAME, (char*)message_a, hist_r_redp_d);

  fprintf(fp_a, "<%s::%s> hist_r_grnp_d = %ld\n",
	  IMAGE_ANALYSIS_CLASS_NAME, (char*)message_a, hist_r_grnp_d);

  fprintf(fp_a, "<%s::%s> hist_r_blup_d = %ld\n",
	  IMAGE_ANALYSIS_CLASS_NAME, (char*)message_a, hist_r_blup_d);
  
  fprintf(fp_a, "<%s::%s> hist_r_npxls_d = %ld\n",
	  IMAGE_ANALYSIS_CLASS_NAME, (char*)message_a, hist_r_npxls_d);
  
  fprintf(fp_a, "<%s::%s> hist_r_nimages_d = %ld\n",
	  IMAGE_ANALYSIS_CLASS_NAME, (char*)message_a,
	  hist_r_nimages_d);

  for (int_4 i=0; i < hist_r_nbins_d; i++) {
    
    if (hist_r_rpdf_d[i] == (float_8)NULL) {
      fprintf(fp_a, "<%s::%s> hist_r_rpdf_d[%ld] = NULL\n",
	      IMAGE_ANALYSIS_CLASS_NAME, (char*)message_a, i);
    }
    else {
      fprintf(fp_a, "<%s::%s> hist_r_rpdf_d[%ld] = %f\n",
	      IMAGE_ANALYSIS_CLASS_NAME, (char*)message_a, i,
	      hist_r_rpdf_d[i]);
    }
  }
  
  for (int_4 i=0; i < hist_r_nbins_d; i++) {

    if (hist_r_gpdf_d[i] == (float_8)NULL) {
      fprintf(fp_a, "<%s::%s> hist_r_gpdf_d[%ld] = NULL\n",
	      IMAGE_ANALYSIS_CLASS_NAME, (char*)message_a, i);
    }
    else {
      fprintf(fp_a, "<%s::%s> hist_r_gpdf_d[%ld] = %f\n",
	      IMAGE_ANALYSIS_CLASS_NAME, (char*)message_a, i,
	      hist_r_gpdf_d[i]);
    }
  }
  
  for (int_4 i=0; i < hist_r_nbins_d; i++) {
    
    if (hist_r_bpdf_d[i] == (float_8)NULL) {
      fprintf(fp_a, "<%s::%s> hist_r_bpdf_d[%ld] = NULL\n",
	      IMAGE_ANALYSIS_CLASS_NAME, (char*)message_a, i);
    }
    else {
      fprintf(fp_a, "<%s::%s> hist_r_bpdf_d[%ld] = %f\n",
	      IMAGE_ANALYSIS_CLASS_NAME, (char*)message_a, i,
	      hist_r_bpdf_d[i]);
    }
  }
  
  for (int_4 i=0; i < hist_r_nbins_d; i++) {
    
    if (hist_r_ylwpdf_d[i] == (float_8)NULL) {
      fprintf(fp_a, "<%s::%s> hist_r_ylwpdf_d[%ld] = NULL\n",
	      IMAGE_ANALYSIS_CLASS_NAME, (char*)message_a, i);
    }
    else {
      fprintf(fp_a, "<%s::%s> hist_r_ylwpdf_d[%ld] = %f\n",
	      IMAGE_ANALYSIS_CLASS_NAME, (char*)message_a, i,
	      hist_r_ylwpdf_d[i]);
    }
  }
  
  for (int_4 i=0; i < hist_r_nbins_d; i++) {
    
    if (hist_r_brnpdf_d[i] == (float_8)NULL) {
      fprintf(fp_a, "<%s::%s> hist_r_brnpdf_d[%ld] = NULL\n",
	      IMAGE_ANALYSIS_CLASS_NAME, (char*)message_a, i);
    }
    else {
      fprintf(fp_a, "<%s::%s> hist_r_brnpdf_d[%ld] = %f\n",
	      IMAGE_ANALYSIS_CLASS_NAME, (char*)message_a, i,
	      hist_r_brnpdf_d[i]);
    }
  }
  
  for (int_4 i=0; i < hist_r_nbins_d; i++) {

    if (hist_r_rcval_d[i] == (float_8)NULL) {
      fprintf(fp_a, "<%s::%s> hist_r_rcval_d[%ld] = NULL\n",
	      IMAGE_ANALYSIS_CLASS_NAME, (char*)message_a, i);
    }
    else {
      fprintf(fp_a, "<%s::%s> hist_r_rcval_d[%ld] = %f\n",
	      IMAGE_ANALYSIS_CLASS_NAME, (char*)message_a, i,
	      hist_r_rcval_d[i]);
    }
  }
  
  for (int_4 i=0; i < hist_r_nbins_d; i++) {

    if (hist_r_gcval_d[i] == (float_8)NULL) {
      fprintf(fp_a, "<%s::%s> hist_r_gcval_d[%ld] = NULL\n",
	      IMAGE_ANALYSIS_CLASS_NAME, (char*)message_a, i);
    }
    else {
      fprintf(fp_a, "<%s::%s> hist_r_gcval_d[%ld] = %f\n",
	      IMAGE_ANALYSIS_CLASS_NAME, (char*)message_a, i,
	      hist_r_gcval_d[i]);
    }
  }
  
  for (int_4 i=0; i < hist_r_nbins_d; i++) {
    
    if (hist_r_bcval_d[i] == (float_8)NULL) {
      fprintf(fp_a, "<%s::%s> hist_r_bcval_d[%ld] = NULL\n",
	      IMAGE_ANALYSIS_CLASS_NAME, (char*)message_a, i);
    }
    else {
      fprintf(fp_a, "<%s::%s> hist_r_bcval_d[%ld] = %f\n",
	      IMAGE_ANALYSIS_CLASS_NAME, (char*)message_a, i,
	      hist_r_bcval_d[i]);
    }
  }
  
  for (int_4 i=0; i < hist_r_nbins_d; i++) {
    
    if (hist_r_ylwcval_d[i] == (float_8)NULL) {
      fprintf(fp_a, "<%s::%s> hist_r_ylwcval_d[%ld] = NULL\n",
	      IMAGE_ANALYSIS_CLASS_NAME, (char*)message_a, i);
    }
    else {
      fprintf(fp_a, "<%s::%s> hist_r_ylwcval_d[%ld] = %f\n",
	      IMAGE_ANALYSIS_CLASS_NAME, (char*)message_a, i,
	      hist_r_ylwcval_d[i]);
    }
  }
  
  for (int_4 i=0; i < hist_r_nbins_d; i++) {
    
    if (hist_r_brncval_d[i] == (float_8)NULL) {
      fprintf(fp_a, "<%s::%s> hist_r_brncval_d[%ld] = NULL\n",
	      IMAGE_ANALYSIS_CLASS_NAME, (char*)message_a, i);
    }
    else {
      fprintf(fp_a, "<%s::%s> hist_r_brncval_d[%ld] = %f\n",
	      IMAGE_ANALYSIS_CLASS_NAME, (char*)message_a, i,
	      hist_r_brncval_d[i]);
    }
  }

  fprintf(fp_a, "<%s::%s> hist_rwgt_d = %f\n",
	  IMAGE_ANALYSIS_CLASS_NAME, (char*)message_a, hist_rwgt_d);
  
  fprintf(fp_a, "<%s::%s> hist_gwgt_d = %f\n",
	  IMAGE_ANALYSIS_CLASS_NAME, (char*)message_a, hist_gwgt_d);
  
  fprintf(fp_a, "<%s::%s> hist_bwgt_d = %f\n",
	  IMAGE_ANALYSIS_CLASS_NAME, (char*)message_a, hist_bwgt_d);
  
  fprintf(fp_a, "<%s::%s> hist_ascale_d = %f\n",
	  IMAGE_ANALYSIS_CLASS_NAME, (char*)message_a, hist_ascale_d);
  
  fprintf(fp_a, "<%s::%s> hist_bscale_d = %f\n",
	  IMAGE_ANALYSIS_CLASS_NAME, (char*)message_a, hist_bscale_d);
  
  fprintf(fp_a, "<%s::%s> hist_t_npxls_d = %ld\n",
	  IMAGE_ANALYSIS_CLASS_NAME, (char*)message_a, hist_t_npxls_d);
  
  fprintf(fp_a, "<%s::%s> hist_t_nimages_d = %ld\n",
	  IMAGE_ANALYSIS_CLASS_NAME, (char*)message_a,
	  hist_t_nimages_d);
  
  for (int_4 i=0; i < hist_r_nbins_d; i++) {
    
    if (hist_t_rpdf_d[i] == (float_8)NULL) {
      fprintf(fp_a, "<%s::%s> hist_t_rpdf_d[%ld] = NULL\n",
	      IMAGE_ANALYSIS_CLASS_NAME, (char*)message_a, i);
    }
    else {
      fprintf(fp_a, "<%s::%s> hist_t_rpdf_d[%ld] = %f\n",
	      IMAGE_ANALYSIS_CLASS_NAME, (char*)message_a, i,
	      hist_t_rpdf_d[i]);
    }
  }

  for (int_4 i=0; i < hist_r_nbins_d; i++) {

    if (hist_t_gpdf_d[i] == (float_8)NULL) {
      fprintf(fp_a, "<%s::%s> hist_t_gpdf_d[%ld] = NULL\n",
	      IMAGE_ANALYSIS_CLASS_NAME, (char*)message_a, i);
    }
    else {
      fprintf(fp_a, "<%s::%s> hist_t_rgpdf_d[%ld] = %f\n",
	      IMAGE_ANALYSIS_CLASS_NAME, (char*)message_a, i,
	      hist_t_gpdf_d[i]);
    }
  }
  
  for (int_4 i=0; i < hist_r_nbins_d; i++) {
    
    if (hist_t_bpdf_d[i] == (float_8)NULL) {
      fprintf(fp_a, "<%s::%s> hist_t_bpdf_d[%ld] = NULL\n",
	      IMAGE_ANALYSIS_CLASS_NAME, (char*)message_a, i);
    }
    else {
      fprintf(fp_a, "<%s::%s> hist_t_bpdf_d[%ld] = %f\n",
	      IMAGE_ANALYSIS_CLASS_NAME, (char*)message_a, i,
	      hist_t_bpdf_d[i]);
    }
  }
  
  for (int_4 i=0; i < hist_r_nbins_d; i++) {
    
    if (hist_t_ylwpdf_d[i] == (float_8)NULL) {
      fprintf(fp_a, "<%s::%s> hist_t_ylwpdf_d[%ld] = NULL\n",
	      IMAGE_ANALYSIS_CLASS_NAME, (char*)message_a, i);
    }
    else {
      fprintf(fp_a, "<%s::%s> hist_t_ylwpdf_d[%ld] = %f\n",
	      IMAGE_ANALYSIS_CLASS_NAME, (char*)message_a, i,
	      hist_t_ylwpdf_d[i]);
    }
  }
  
  for (int_4 i=0; i < hist_r_nbins_d; i++) {
    
    if (hist_t_brnpdf_d[i] == (float_8)NULL) {
      fprintf(fp_a, "<%s::%s> hist_t_brnpdf_d[%ld] = NULL\n",
	      IMAGE_ANALYSIS_CLASS_NAME, (char*)message_a, i);
    }
    else {
      fprintf(fp_a, "<%s::%s> hist_t_brnpdf_d[%ld] = %f\n",
	      IMAGE_ANALYSIS_CLASS_NAME, (char*)message_a, i,
	      hist_t_brnpdf_d[i]);
    }
  }
  
  for (int_4 i=0; i < hist_r_nbins_d; i++) {
    
    if (hist_t_rcval_d[i] == (float_8)NULL) {
      fprintf(fp_a, "<%s::%s> hist_t_rcval_d[%ld] = %f\n",
	      IMAGE_ANALYSIS_CLASS_NAME, (char*)message_a, i,
	      hist_t_rcval_d[i]);
    }
    else {
      fprintf(fp_a, "<%s::%s> hist_t_rcval_d[%ld] = %f\n",
	      IMAGE_ANALYSIS_CLASS_NAME, (char*)message_a, i,
	      hist_t_rcval_d[i]);
    }
  }
  
  for (int_4 i=0; i < hist_r_nbins_d; i++) {

    if (hist_t_gcval_d[i] == (float_8)NULL) {
      fprintf(fp_a, "<%s::%s> hist_t_gcval_d[%ld] = NULL\n",
	      IMAGE_ANALYSIS_CLASS_NAME, (char*)message_a, i);
    }
    else {
      fprintf(fp_a, "<%s::%s> hist_t_gcval_d[%ld] = %f\n",
	      IMAGE_ANALYSIS_CLASS_NAME, (char*)message_a, i,
	      hist_t_gcval_d[i]);
    }
  }
  
  for (int_4 i=0; i < hist_r_nbins_d; i++) {
    
    if (hist_t_bcval_d[i] == (float_8)NULL) {
      fprintf(fp_a, "<%s::%s> hist_t_bcval_d[%ld] = NULL\n",
	      IMAGE_ANALYSIS_CLASS_NAME, (char*)message_a, i);
    }
    else {
      fprintf(fp_a, "<%s::%s> hist_t_bcval_d[%ld] = %f\n",
	      IMAGE_ANALYSIS_CLASS_NAME, (char*)message_a, i,
	      hist_t_bcval_d[i]);
    }
  }
  
  for (int_4 i=0; i < hist_r_nbins_d; i++) {
    
    if (hist_t_ylwcval_d[i] == (float_8)NULL) {
      fprintf(fp_a, "<%s::%s> hist_t_ylwcval_d[%ld] = NULL\n",
	      IMAGE_ANALYSIS_CLASS_NAME, (char*)message_a, i);
    }
    else {
      fprintf(fp_a, "<%s::%s> hist_t_ylwcval_d[%ld] = %f\n",
	      IMAGE_ANALYSIS_CLASS_NAME, (char*)message_a, i,
	      hist_t_ylwcval_d[i]);
    }
  }
  
  for (int_4 i=0; i < hist_r_nbins_d; i++) {
    
    if (hist_t_brncval_d[i] == (float_8)NULL) {
      fprintf(fp_a, "<%s::%s> hist_t_brncval_d[%ld] = NULL\n",
	      IMAGE_ANALYSIS_CLASS_NAME, (char*)message_a, i);
    }
    else {
      fprintf(fp_a, "<%s::%s> hist_t_brncval_d[%ld] = %f\n",
	      IMAGE_ANALYSIS_CLASS_NAME, (char*)message_a, i,
	      hist_t_brncval_d[i]);
    }
  }
  
  // exit gracefully
  //
  return ISIP_TRUE;
}


