/* Utility for printing the record info */
void QIO_print_record_info(QIO_RecordInfo *record_info){

  printf("Record header: datatype %s recordtype %d \n",
	 QIO_get_datatype(record_info),
	 QIO_get_recordtype(record_info));
  printf("precision %s colors %d spins %d count %d\n",
	 QIO_get_precision(record_info),
	 QIO_get_colors(record_info),
	 QIO_get_spins(record_info),
	 QIO_get_datacount(record_info));
  
  if(QIO_get_recordtype(record_info) == QIO_HYPER){
    int i;
    int n = QIO_get_hyper_spacetime(record_info);
    int *lower = QIO_get_hyperlower(record_info);
    int *upper = QIO_get_hyperupper(record_info);
    printf("Hypercube lower");
    for(i = 0; i < n; i++){
      printf(" %d",lower[i]);
    }
    printf("\n");
    printf("Hypercube upper");
    for(i = 0; i < n; i++){
      printf(" %d",upper[i]);
    }
    printf("\n");
  }
}
Example #2
0
/* Compare only fields that occur in the expected record info */
int QIO_compare_record_info(QIO_RecordInfo *found, QIO_RecordInfo *expect){
  char myname[] = "QIO_compare_record_info";

  if(QIO_defined_recordtype(expect))
    if(!QIO_defined_recordtype(found) &&
       QIO_get_recordtype(found)  != QIO_get_recordtype(expect))
      {
	printf("%s:Recordtype flag mismatch expected %d found %d \n",myname,
	       QIO_get_recordtype(expect),QIO_get_recordtype(found));
	return QIO_ERR_REC_INFO;
      }

  if(QIO_defined_datatype(expect))
    if(!QIO_defined_datatype(found) && 
       strncmp(QIO_get_datatype(found),QIO_get_datatype(expect),
	       QIO_MAXVALUESTRING))
      {
	printf("%s:Datatype mismatch expected %s found %s \n",myname,
	       QIO_get_datatype(expect),QIO_get_datatype(found));
	return QIO_ERR_REC_INFO;
      }

  if(QIO_defined_precision(expect))
    if(!QIO_defined_precision(found) &&
       strncmp(QIO_get_precision(found),QIO_get_precision(expect),
	       QIO_MAXVALUESTRING))
      {
	printf("%s:Precision mismatch expected %s found %s \n",myname,
	       QIO_get_precision(expect),QIO_get_precision(found));
	return QIO_ERR_REC_INFO;
      }

  if(QIO_defined_colors(expect))
    if(!QIO_defined_colors(found) &&
       QIO_get_colors(found) != QIO_get_colors(expect))
      {
	printf("%s:Colors mismatch expected %d found %d \n",myname,
	       QIO_get_colors(expect),QIO_get_colors(found));
	return QIO_ERR_REC_INFO;
      }

  if(QIO_defined_spins(expect))
    if(!QIO_defined_spins(found) &&
       QIO_get_spins(found)  != QIO_get_spins(expect))
      {
	printf("%s:Spins mismatch expected %d found %d \n",myname,
	       QIO_get_spins(expect),QIO_get_spins(found));
	return QIO_ERR_REC_INFO;
      }

  if(QIO_defined_typesize(expect))
    if(!QIO_defined_typesize(found) &&
       QIO_get_typesize(found) != QIO_get_typesize(expect))
      {
	printf("%s:Typesize mismatch expected %d found %d \n",myname,
	       QIO_get_typesize(expect),QIO_get_typesize(found));
	return QIO_ERR_REC_INFO;
      }

  if(QIO_defined_datacount(expect))
    if(!QIO_defined_datacount(found) &&
       QIO_get_datacount(found) != QIO_get_datacount(expect))
      {
	printf("%s:Datacount mismatch expected %d found %d \n",myname,
	       QIO_get_datacount(expect),QIO_get_datacount(found));
	return QIO_ERR_REC_INFO;
      }

  return QIO_SUCCESS;
}