Exemple #1
0
std::string input_manager::get_keyname(long ch, input_event_t inp_type, bool portable) const
{
    if(inp_type == CATA_INPUT_KEYBOARD) {
        const t_key_to_name_map::const_iterator a = keycode_to_keyname.find(ch);
        if (a != keycode_to_keyname.end()) {
            return a->second;
        }
    } else if(inp_type == CATA_INPUT_MOUSE) {
        if(ch == MOUSE_BUTTON_LEFT) {
            return "MOUSE_LEFT";
        } else if(ch == MOUSE_BUTTON_RIGHT) {
            return "MOUSE_RIGHT";
        } else if(ch == SCROLLWHEEL_UP) {
            return "SCROLL_UP";
        } else if(ch == SCROLLWHEEL_DOWN) {
            return "SCROLL_DOWN";
        } else if(ch == MOUSE_MOVE) {
            return "MOUSE_MOVE";
        }
    } else if (inp_type == CATA_INPUT_GAMEPAD) {
        const t_key_to_name_map::const_iterator a = gamepad_keycode_to_keyname.find(ch);
        if (a != gamepad_keycode_to_keyname.end()) {
            return a->second;
        }
    } else {
        return "UNKNOWN";
    }
    if (portable) {
        return std::string("UNKNOWN_") + long_to_str(ch);
    }
    return string_format(_("unknown key %ld"), ch);
}
Exemple #2
0
void ctx_update(const char *job_name, size_t niter)
{
  if(niter % CTX_UPDATE_REPORT_RATE == 0)
  {
    char num_str[100];
    long_to_str(niter, num_str);
    status("[%s] Read %s entries (reads / read pairs)", job_name, num_str);
  }
}
Exemple #3
0
bool	test_nw_srt_from(long test_consec, long start_rnd, avg_stat& spd_avg, 
						 bool DEBUG_SRT_FROM = false, bool SPEED_TEST = false)
{
	std::ostream& os = std::cout;
	os << "TEST " << test_consec << "(seed=" << start_rnd << ")";
	os.flush();

	sort_glb glb1;
	//glb1.init_head_ss();
	glb1.stab_mutual_init();

	//os << "START_RND=" << start_rnd << std::endl;

	tak_mak rnd_gen(start_rnd);

	k_row<elem_sor> all_elem;

	row<op_sor> all_ops;
	if(SPEED_TEST){
		all_ops.set_cap(10000);
	}

	long num_elem = rnd_gen.gen_rand_int32_ie(1, 1000);
	all_elem.set_cap(num_elem);
	for(long aa = 0; aa <= num_elem; aa++){
		elem_sor& ele = all_elem.inc_sz();
		ele.es_id = "e=";
	}


	row<elem_sor*> tmp_rr1;
	row<elem_sor*> tmp_rr2;
	bool stop_all = false;

	std::stringstream ss_tmp;
	
	long num_lvs = rnd_gen.gen_rand_int32_ie(1, 10);
	for(long bb = 1; ((bb < num_lvs) && ! stop_all); bb++){
		glb1.sg_curr_stab_consec++;
		
		DBG_CK(glb1.sg_curr_stab_consec >= bb);
		DBG_CK(glb1.sg_curr_stab_consec >= glb1.sg_dbg_last_id);
		
		std::string bb_ss = long_to_str(bb);
		long num_reps_lv = rnd_gen.gen_rand_int32_ie(1, 10);
		for(long dd = 0; ((dd < num_reps_lv) && ! stop_all); dd++){
			DBG_CK(glb1.sg_curr_stab_consec >= glb1.sg_dbg_last_id);
			
			long num_elem_rep = rnd_gen.gen_rand_int32_ie(1, num_elem);
			for(long cc = 0; ((cc < num_elem_rep) && ! stop_all); cc++){
				DBG_CK(glb1.sg_curr_stab_consec >= glb1.sg_dbg_last_id);
				
				bool all_csecs = false;
				long elem_idx = rnd_gen.gen_rand_int32_ie(1, num_elem);
				SORTER_CK(all_elem.is_valid_idx(elem_idx));
				elem_sor& ele = all_elem[elem_idx];

				if(DEBUG_SRT_FROM){
					ss_tmp.clear();
					ss_tmp.seekg(0, std::ios::beg);
					ss_tmp.str("");
					ss_tmp.flush();

					glb1.sort_to_row_and_all_consec<elem_sor>(tmp_rr1, all_csecs);
					tmp_rr1.print_row_data(ss_tmp, true, "\n");

					if(! tmp_rr1.is_sorted(cmp_elem_sr)){
						//tmp_rr1.print_row_data(os, true, "\n");
						std::string out_ss = ss_tmp.str();
						os << out_ss;
						os << "FAILED starting" << std::endl << ele << std::endl;
						os << "START_RND=" << start_rnd << std::endl;
						stop_all = true;
						break;
					}
				}

				std::string dbg_id_start = ele.es_id;

				if(SPEED_TEST){
					op_sor& the_op = all_ops.inc_sz();
					the_op.op_elem = &ele;
					the_op.op_id = bb;
				} else {
					DBG_CK(glb1.sg_curr_stab_consec >= bb);
					DBG_CK(glb1.sg_curr_stab_consec >= glb1.sg_dbg_last_id);
					ele.es_srt_bdr.sort_from(glb1, bb);
					DBG_CK(glb1.sg_curr_stab_consec >= glb1.sg_dbg_last_id);
				}

				ele.es_id += "b" + bb_ss;
				ele.add(bb);

				std::string dbg_id_end = ele.es_id;

				if(DEBUG_SRT_FROM){
					glb1.sort_to_row_and_all_consec<elem_sor>(tmp_rr2, all_csecs);
					if(! tmp_rr2.is_sorted(cmp_elem_sr)){
						os << "STARTING" << std::endl;
						std::string out_ss = ss_tmp.str();
						os << out_ss;
						//tmp_rr1.print_row_data(os, true, "\n");
						os << std::endl << std::endl << "ENDING" << std::endl;
						tmp_rr2.print_row_data(os, true, "\n");
						os << "FAILED ending" << std::endl << ele << std::endl;
						os << "curr_id=" << bb << std::endl;
						os << "dbg_id_start=" << dbg_id_start << std::endl;
						os << "dbg_id_end=" << dbg_id_end << std::endl;
						os << "START_RND=" << start_rnd << std::endl;
						stop_all = true;
						ck_sorted_elems(tmp_rr2, cmp_elem_sr);
						break;
					}
				}
			}
		}
	}
	os << "::";
	os.flush();
	//DBG_CK(glb1.sg_curr_stab_consec >= glb1.sg_dbg_last_id);

	long num_srt_from = 0;
	double run_speed = 0;
	if(SPEED_TEST){
		double start_tm = cpu_time();

		for(long aa = 0; aa < all_ops.size(); aa++){
			op_sor& the_op = all_ops[aa];
			SORTER_CK(the_op.op_elem != NULL_PT);
			SORTER_CK(the_op.op_id > 0);
			the_op.op_elem->es_srt_bdr.sort_from(glb1, the_op.op_id);
			num_srt_from++;
		}
		double finish_tm = cpu_time();

		run_speed = num_srt_from / (finish_tm - start_tm);

		if(finite(run_speed)){
			spd_avg.add_val(run_speed);
		}
	}
	//DBG_CK(glb1.sg_curr_stab_consec >= glb1.sg_dbg_last_id);

	if(! stop_all){
		row<elem_sor*> s_rr;
		bool all_in_consec = false;
		glb1.sort_to_row_and_all_consec<elem_sor>(s_rr, all_in_consec);

		os << " #elem=" << num_elem << " #ops=" << num_srt_from << " speed=" << run_speed 
			<< " finite=" << finite(run_speed);

		//os << "SIZE=" << s_rr.size() << bj_eol;
		//s_rr.print_row_data(os, true, "\n");

		//os << "NUM_ELEM=" << num_elem << std::endl;
		//os << "START_RND=" << start_rnd << std::endl;
		//os << std::endl;

		bool finish_ok = true;

		if(! s_rr.is_sorted(cmp_elem_sr)){
			s_rr.print_row_data(os, true, "\n");
			os << " START_RND=" << start_rnd << std::endl;
			SORTER_CK(ck_sorted_elems(s_rr, cmp_elem_sr));
			finish_ok = false;
		}

		glb1.sort_to_tmp_srss();
		if(! glb1.sg_tmp_srss.is_sorted(cmp_sorsets)){
			s_rr.print_row_data(os, true, "\n");
			os << " START_RND=" << start_rnd << std::endl;
			ck_sorted_sorsets(glb1.sg_tmp_srss, cmp_sorsets);
			SORTER_CK(false);
			finish_ok = false;
		}
		//os << "FINISHED OK=" << start_rnd << std::endl;
		if(finish_ok){
			os << " finished ok";
		} else {
			os << " FAILED !!!!!!!!!!!!!!!!!!!!!!!!!!!!";
			os.flush();
			abort_func(0);
		}

		//os << std::endl;

		//glb1.release_all();
		//glb1.init_head_ss();
		glb1.stab_mutual_init();
	}
	//os << "START_RND=" << start_rnd << std::endl;
	
	return ! stop_all;
}
Exemple #4
0
void assemble_contigs_stats_print(const AssembleContigStats *s)
{
  ctx_assert(s->lengths.len == s->junctns.len);
  ctx_assert(s->lengths.len == s->num_contigs);

  size_t i, ncontigs = s->num_contigs;

  if(ncontigs == 0) {
    status("[asm] No contigs assembled");
    return;
  }

  qsort(s->lengths.b, ncontigs, sizeof(s->lengths.b[0]), cmp_size);
  qsort(s->junctns.b, ncontigs, sizeof(s->junctns.b[0]), cmp_size);

  size_t len_n50, jnc_n50;
  size_t len_median, jnc_median, len_mean, jnc_mean;
  size_t len_min, len_max, jnc_min, jnc_max;

  // Calculate N50s
  len_n50 = calc_N50(s->lengths.b, ncontigs, s->total_len);
  jnc_n50 = calc_N50(s->junctns.b, ncontigs, s->total_junc);

  // Calculate medians, means
  len_median = MEDIAN(s->lengths.b, ncontigs);
  jnc_median = MEDIAN(s->junctns.b, ncontigs);
  len_mean = (double)s->total_len / ncontigs;
  jnc_mean = (double)s->total_junc / ncontigs;

  // Calculate min, max
  len_min = s->lengths.b[0];
  jnc_min = s->junctns.b[0];
  len_max = s->lengths.b[ncontigs-1];
  jnc_max = s->junctns.b[ncontigs-1];

  // Print number of contigs
  char num_contigs_str[50], reseed_str[50], seed_not_fnd_str[50];
  char seed_kmers_str[50], seed_paths_str[50];
  long_to_str(ncontigs, num_contigs_str);
  long_to_str(s->num_reseed_abort, reseed_str);
  long_to_str(s->num_seeds_not_found, seed_not_fnd_str);
  long_to_str(s->num_contigs_from_seed_kmers, seed_kmers_str);
  long_to_str(s->num_contigs_from_seed_paths, seed_paths_str);
  status(PREFIX"pulled out %s contigs, %s from seed kmers, %s from seed paths",
         num_contigs_str, seed_kmers_str, seed_paths_str);
  status(PREFIX"no-reseed aborted %s times", reseed_str);
  status(PREFIX"seed kmer not found %s times", seed_not_fnd_str);

  char len_min_str[50], len_max_str[50], len_total_str[50];
  char len_mean_str[50], len_median_str[50], len_n50_str[50];

  char jnc_min_str[50], jnc_max_str[50], jnc_total_str[50];
  char jnc_mean_str[50], jnc_median_str[50], jnc_n50_str[50];

  // Use ulong_to_str instead of num_to_str to get better accuracy
  // e.g. 966 instead of 1K
  ulong_to_str(len_mean, len_mean_str);
  ulong_to_str(jnc_mean, jnc_mean_str);
  ulong_to_str(len_median, len_median_str);
  ulong_to_str(jnc_median, jnc_median_str);
  ulong_to_str(len_n50, len_n50_str);
  ulong_to_str(jnc_n50, jnc_n50_str);
  ulong_to_str(len_min, len_min_str);
  ulong_to_str(jnc_min, jnc_min_str);
  ulong_to_str(len_max, len_max_str);
  ulong_to_str(jnc_max, jnc_max_str);
  ulong_to_str(s->total_len, len_total_str);
  ulong_to_str(s->total_junc, jnc_total_str);

  status(PREFIX"Lengths: mean: %s  median: %s  N50: %s  min: %s  max: %s  total: %s [kmers]",
         len_mean_str, len_median_str, len_n50_str, len_min_str, len_max_str, len_total_str);
  status(PREFIX"Junctions: mean: %s  median: %s  N50: %s  min: %s  max: %s  total: %s [out >1]",
         jnc_mean_str, jnc_median_str, jnc_n50_str, jnc_min_str, jnc_max_str, jnc_total_str);
  status(PREFIX"Max junction density: %.2f\n", s->max_junc_density);

  timestamp();
  message(PREFIX" Outdegree: ");
  char nout_str[50];

  for(i = 0; i <= 4; i++) {
    message("\t%zu:%s [%zu%%]", i, ulong_to_str(s->contigs_outdegree[i], nout_str),
            (size_t)((100.0*s->contigs_outdegree[i])/(2.0*ncontigs)+0.5));
  }
  message("\n");

  _print_path_dist(s->paths_held, AC_MAX_PATHS, "Paths held",    ncontigs);
  _print_path_dist(s->paths_cntr, AC_MAX_PATHS, "Paths counter", ncontigs);

  const uint64_t *states = s->grphwlk_steps;
  size_t nsteps = s->total_len - s->num_contigs, ncontigends = 2*s->num_contigs;
  status(PREFIX"Traversal succeeded because:");
  _print_grphwlk_state("Pop straight ......... ", states[GRPHWLK_POPFWD],       nsteps);
  _print_grphwlk_state("Col straight ......... ", states[GRPHWLK_COLFWD],       nsteps);
  _print_grphwlk_state("PopFork use colour ... ", states[GRPHWLK_POPFRK_COLFWD],nsteps);
  _print_grphwlk_state("Go paths ............. ", states[GRPHWLK_USEPATH],      nsteps);

  const uint64_t *stops = s->stop_causes;
  status(PREFIX"Traversal halted because:");
  _print_grphwlk_state("No coverage .......... ", stops[ASSEM_STOP_NOCOVG],        ncontigends);
  _print_grphwlk_state("No colour covg ....... ", stops[ASSEM_STOP_NOCOLCOVG],     ncontigends);
  _print_grphwlk_state("No paths ............. ", stops[ASSEM_STOP_NOPATHS],       ncontigends);
  _print_grphwlk_state("Paths split .......... ", stops[ASSEM_STOP_SPLIT_PATHS],   ncontigends);
  _print_grphwlk_state("Missing paths ........ ", stops[ASSEM_STOP_MISSING_PATHS], ncontigends);
  _print_grphwlk_state("Graph cycles ......... ", stops[ASSEM_STOP_CYCLE],         ncontigends);
  _print_grphwlk_state("Low step confidence .. ", stops[ASSEM_STOP_LOW_STEP_CONF], ncontigends);
  _print_grphwlk_state("Low cumul. confidence  ", stops[ASSEM_STOP_LOW_CUMUL_CONF],ncontigends);

  size_t njunc = states[GRPHWLK_USEPATH] +
                 stops[ASSEM_STOP_NOPATHS] +
                 stops[ASSEM_STOP_SPLIT_PATHS] +
                 stops[ASSEM_STOP_MISSING_PATHS];

  ctx_assert2(s->total_junc == states[GRPHWLK_USEPATH], "%zu vs %zu",
              (size_t)s->total_junc, (size_t)states[GRPHWLK_USEPATH]);

  status(PREFIX"Junctions:");
  _print_grphwlk_state("Paths resolved", states[GRPHWLK_USEPATH], njunc);
}
void load_subhalo_catalogue(int num, struct halo_catalogue *cat)
{
  int i,iboyd, ngroups, nids, nFiles, nsubhalos, subcount, groupcount,offset;
  MyIDType idcount;
  char buf[1000];
  FILE *fd;
  unsigned int j, *tmp;

  nFiles = 1;
  subcount = 0;
  idcount = 0;
  groupcount = 0;

  for(i = 0; i < nFiles; i++)
    {
      sprintf(buf, "%s/groups_%03d/subhalo_tab_%03d.%d", OutputDir, num, num, i);
      printf( "%s/groups_%03d/subhalo_tab_%03d.%d\n", OutputDir, num, num, i);
      if(!(fd = fopen(buf, "r")))
	{
	  printf("can't open file `%s'\n", buf);
	  exit(1);
	}
      if(i == 0 || i == nFiles - 1)
	printf("reading '%s'\n", buf);
      if(i == 1)
	printf("...to...\n");


      my_fread(&ngroups, sizeof(int), 1, fd);
      printf("ngroup = %d\n",ngroups);
      my_fread(&cat->TotNgroups, sizeof(int), 1, fd);
      printf("TotNgroup = %d\n",cat->TotNgroups);
      my_fread(&nids, sizeof(int), 1, fd);
      printf("nids = %d\n",nids);
      my_fread(&cat->TotNids, sizeof(long long), 1, fd);
      printf("TotNids = %d\n",cat->TotNids);
      my_fread(&nFiles, sizeof(int), 1, fd);
      my_fread(&nsubhalos, sizeof(int), 1, fd);
      printf("nsubhalos = %d\n",nsubhalos);
      my_fread(&cat->TotNsubhalos, sizeof(int), 1, fd);
      printf("TotNsubhalos = %d\n",cat->TotNsubhalos);
  

      if(i == 0)
	{
	  cat->IdList = mymalloc(sizeof(MyIDType) * cat->TotNids);
	  cat->SubLen = mymalloc(sizeof(int) * cat->TotNsubhalos);
	  cat->SubOffset = mymalloc(sizeof(MyIDType) * cat->TotNsubhalos);

	  cat->SubParentHalo = mymalloc(sizeof(int) * cat->TotNsubhalos);
	  cat->SubhaloMass = mymalloc(sizeof(float) * cat->TotNsubhalos);

	  cat->SubhaloPos = mymalloc(3 * sizeof(float ) * cat->TotNsubhalos);
	  cat->SubhaloVel = mymalloc(3 * sizeof(float ) * cat->TotNsubhalos);
	  cat->SubhaloCM = mymalloc(3 * sizeof(float ) * cat->TotNsubhalos);
	  cat->SubhaloSpin = mymalloc(3 * sizeof(float ) * cat->TotNsubhalos);


	  cat->SubhaloVelDisp = mymalloc(sizeof(float) * cat->TotNsubhalos);
	  cat->SubhaloVmax = mymalloc(sizeof(float) * cat->TotNsubhalos);
	  cat->SubhaloVmaxRad = mymalloc(sizeof(float) * cat->TotNsubhalos);
	  cat->SubhaloHalfMass = mymalloc(sizeof(float) * cat->TotNsubhalos);

	  cat->SubhaloMostBoundID = mymalloc(sizeof(MyIDType) * cat->TotNsubhalos);
	  cat->SubhaloGrNr = mymalloc(sizeof(int) * cat->TotNsubhalos);

	  cat->GroupNsubs = mymalloc(sizeof(int) * cat->TotNgroups);
	  cat->GroupFirstSub = mymalloc(sizeof(int) * cat->TotNgroups);
	  cat->Descendant = mymalloc(sizeof(struct descendant_data) * cat->TotNsubhalos);
	  cat->CountProgenitors = mymalloc(sizeof(int) * cat->TotNsubhalos);
	}

      fseek(fd, sizeof(int) * ngroups, SEEK_CUR);	/* skip  GroupLen  */
      fseek(fd, sizeof(int) * ngroups, SEEK_CUR);	/* skip  GroupOffset  */
      fseek(fd, sizeof(float) * ngroups, SEEK_CUR);	/* skip  GroupMass  */
      fseek(fd, 3 * sizeof(float) * ngroups, SEEK_CUR);	/* skip  GroupPos */
      fseek(fd, sizeof(float) * ngroups, SEEK_CUR);	/* skip  Group_M_Mean200 */
      fseek(fd, sizeof(float) * ngroups, SEEK_CUR);	/* skip  Group_R_Mean200 */
      fseek(fd, sizeof(float) * ngroups, SEEK_CUR);	/* skip  Group_M_Crit200 */
      fseek(fd, sizeof(float) * ngroups, SEEK_CUR);	/* skip  Group_R_Crit200 */
      fseek(fd, sizeof(float) * ngroups, SEEK_CUR);	/* skip  Group_M_TopHat200 */
      fseek(fd, sizeof(float) * ngroups, SEEK_CUR);	/* skip  Group_R_TopHat200 */
#ifdef SO_VEL_DISPERSIONS
      fseek(fd, sizeof(float) * ngroups, SEEK_CUR);	/* skip  Group_VelDisp_Mean200 */
      fseek(fd, sizeof(float) * ngroups, SEEK_CUR);	/* skip  Group_VelDisp_Crit200 */
      fseek(fd, sizeof(float) * ngroups, SEEK_CUR);	/* skip  Group_VelDisp_TopHat200 */
#endif
      fseek(fd, sizeof(int) * ngroups, SEEK_CUR);	/* skip  GroupContaminationCount */
      fseek(fd, sizeof(float) * ngroups, SEEK_CUR);	/* skip  GroupContaminationMass */
      //fseek(fd, sizeof(int) * ngroups, SEEK_CUR);	/* skip  GroupNsubs */
      my_fread(&cat->GroupNsubs[groupcount], sizeof(int), ngroups, fd);
      //fseek(fd, sizeof(int) * ngroups, SEEK_CUR);	/* skip  GroupFirstsub */
      my_fread(&cat->GroupFirstSub[groupcount], sizeof(int), ngroups, fd);
      
      my_fread(&cat->SubLen[subcount], sizeof(int), nsubhalos, fd);

      tmp = mymalloc(sizeof(int) * nsubhalos);
      my_fread(tmp, sizeof(int), nsubhalos, fd);
      for(j = 0; j < nsubhalos; j++)
	cat->SubOffset[subcount + j] = tmp[j];	/* copy it to 64 bit if needed */

      myfree(tmp);
      //myfree(buf);


      my_fread(&cat->SubParentHalo[subcount], sizeof(int), nsubhalos, fd);
      my_fread(&cat->SubhaloMass[subcount], sizeof(float), nsubhalos, fd);
      //fseek(fd, sizeof(float) * nsubhalos, SEEK_CUR);	/* skip  SubhaloMass */

      my_fread(&cat->SubhaloPos[3 * subcount], 3 * sizeof(float), nsubhalos, fd);
      my_fread(&cat->SubhaloVel[3 * subcount], 3 * sizeof(float), nsubhalos, fd);

      //fseek(fd, 3 * sizeof(float) * nsubhalos, SEEK_CUR);	/* skip  SubhaloCM */
      my_fread(&cat->SubhaloCM[3 * subcount], 3 * sizeof(float), nsubhalos, fd);

      my_fread(&cat->SubhaloVelDisp[subcount], sizeof(float), nsubhalos, fd);
      my_fread(&cat->SubhaloVmax[subcount], sizeof(float), nsubhalos, fd);

      my_fread(&cat->SubhaloVmaxRad[subcount], sizeof(float), nsubhalos, fd);

      //fseek(fd, sizeof(float) * nsubhalos, SEEK_CUR);	/* skip  SubhaloVmaxRad */

      my_fread(&cat->SubhaloHalfMass[subcount], sizeof(float), nsubhalos, fd);

      
      my_fread(&cat->SubhaloMostBoundID[subcount], sizeof(MyIDType), nsubhalos, fd);

      //fseek(fd, sizeof(int) * nsubhalos, SEEK_CUR);	/* skip  GrNr */
      my_fread(&cat->SubhaloGrNr[subcount], sizeof(int), nsubhalos, fd);
      
      fclose(fd);

      subcount += nsubhalos;
      groupcount += ngroups;
    }

  /* now check whether we had a 32-bit overflow in subhalo offset, and fix it if needed */

  if(sizeof(MyIDType) > 4)
    {
      MyIDType previous_offset = 0, add = 0;

      for(i = 0; i < cat->TotNsubhalos; i++)
	{
	  if(cat->SubOffset[i] < previous_offset)
	    {
	      printf("deteced 32-bit overflow, correcting it\n");
	      add += (((long long) 1) << 32);
	    }
	  previous_offset = cat->SubOffset[i];

	  cat->SubOffset[i] += add;
	}
    }


  long_to_str(buf, cat->TotNids);

  printf("cat->TotNsubhalos = %d\n", cat->TotNsubhalos);
  printf("cat->TotNids = %s\n", buf);


  for(i = 0; i < nFiles; i++)
    {
      sprintf(buf, "%s/groups_%03d/subhalo_ids_%03d.%d", OutputDir, num, num, i);
      printf("%s/groups_%03d/subhalo_ids_%03d.%d\n", OutputDir, num, num, i);
      if(!(fd = fopen(buf, "r")))
	{
	  printf("can't open file `%s'\n", buf);
	  exit(1);
	}
      if(i == 0 || i == nFiles - 1)
	printf("reading '%s'\n", buf);
      if(i == 1)
	printf("...to...\n");

      my_fread(&ngroups, sizeof(int), 1, fd);
      my_fread(&cat->TotNgroups, sizeof(int), 1, fd);
      my_fread(&nids, sizeof(int), 1, fd);
      my_fread(&cat->TotNids, sizeof(long long), 1, fd);
      my_fread(&nFiles, sizeof(int), 1, fd);
      my_fread(&offset, sizeof(int), 1, fd);

      printf("read all\n");
      my_fread(&cat->IdList[idcount], sizeof(MyIDType), nids, fd);
      fclose(fd);

      idcount += nids;
    }


  //reassign_ids(cat->TotNids, cat->IdList);
}