IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jan 11, 2015, 1:12:08 PM (12 years ago)
Author:
eugene
Message:

add option to load a full table (needed to manage some measure/average links)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ipp-20140904/Ohana/src/dvosplit/src/split_averages.c

    r37043 r37796  
    2727  incatalog[0].catflags = LOAD_AVES | LOAD_SECF;
    2828
    29   if (incatalog[0].catmode == DVO_MODE_SPLIT) {
     29  if ((incatalog[0].catmode == DVO_MODE_SPLIT) && !FULL_TABLE) {
    3030    Nblocks = incatalog[0].Naves_disk / NROWS;
    3131    if (incatalog[0].Naves_disk % NROWS) Nblocks ++;
     
    3636  for (block = 0; block < Nblocks; block++) {
    3737
    38     if (incatalog[0].catmode == DVO_MODE_SPLIT) {
     38    if ((incatalog[0].catmode == DVO_MODE_SPLIT) && !FULL_TABLE) {
    3939      // read up to NROWS at a time
    4040      dvo_catalog_load_segment (incatalog, VERBOSE, block*NROWS, NROWS);
    4141      fprintf (stderr, "splitting %s (averages) .. %d of %d\n", incatalog[0].filename, block, Nblocks);
     42      assert (block*NROWS == incatalog[0].Naves_off);
    4243    } else {
    4344      dvo_catalog_load (incatalog, VERBOSE);
    4445      fprintf (stderr, "splitting %s (averages)\n", incatalog[0].filename);
    4546    }
    46 
    47     assert (block*NROWS == incatalog[0].Naves_off);
    4847
    4948    // distribute data to the output catalogs
     
    5453      inD = incatalog[0].average[ave].D;
    5554
     55      if (incatalog[0].average[ave].Nmeasure == 0) {
     56        fprintf (stderr, "WARNING: object with no measurements, skipping %d (%f, %f)\n", averef, inR, inD);
     57        continue;
     58      }
    5659      // which of the outcatalogs contains this coordinate?
    5760
     
    98101
    99102    // write out the new values
    100     for (cat = 0; cat < outlist[0].Nregions; cat++) {
    101       outcatalogs[cat].catflags = LOAD_AVES | LOAD_SECF;
     103    if (!FULL_TABLE) {
     104      for (cat = 0; cat < outlist[0].Nregions; cat++) {
     105        outcatalogs[cat].catflags = LOAD_AVES | LOAD_SECF;
    102106
    103       dvo_catalog_save (&outcatalogs[cat], VERBOSE);
    104       // fprintf (stderr, "secfilt: %d %d %d %d\n", outcatalogs[cat].Nsecf_mem, outcatalogs[cat].Nsecf_disk, outcatalogs[cat].Nsecf_off, outcatalogs[cat].Naverage, outcatalogs[cat].Nsecfilt);
     107        dvo_catalog_save (&outcatalogs[cat], VERBOSE);
     108        // fprintf (stderr, "secfilt: %d %d %d %d\n", outcatalogs[cat].Nsecf_mem, outcatalogs[cat].Nsecf_disk, outcatalogs[cat].Nsecf_off, outcatalogs[cat].Naverage, outcatalogs[cat].Nsecfilt);
    105109
    106       // advance the pointers and free the current data
    107       // XXX these should be done within save segment:
    108       outcatalogs[cat].Naves_disk += outcatalogs[cat].Naverage;
    109       outcatalogs[cat].Naves_off  += outcatalogs[cat].Naverage;
    110       outcatalogs[cat].Nsecf_disk += outcatalogs[cat].Nsecfilt * outcatalogs[cat].Naverage;
    111       outcatalogs[cat].Nsecf_off  += outcatalogs[cat].Nsecfilt * outcatalogs[cat].Naverage;
    112       outcatalogs[cat].Nsecfilt    = Nsecfilt;
     110        // advance the pointers and free the current data
     111        // XXX these should be done within save segment:
     112        outcatalogs[cat].Naves_disk += outcatalogs[cat].Naverage;
     113        outcatalogs[cat].Naves_off  += outcatalogs[cat].Naverage;
     114        outcatalogs[cat].Nsecf_disk += outcatalogs[cat].Nsecfilt * outcatalogs[cat].Naverage;
     115        outcatalogs[cat].Nsecf_off  += outcatalogs[cat].Nsecfilt * outcatalogs[cat].Naverage;
     116        outcatalogs[cat].Nsecfilt    = Nsecfilt;
    113117
    114       outcatalogs[cat].Naverage    = 0;
    115       outcatalogs[cat].Nsecf_mem   = 0;
     118        outcatalogs[cat].Naverage    = 0;
     119        outcatalogs[cat].Nsecf_mem   = 0;
     120      }
    116121    }
    117122  }
    118123
    119   for (cat = 0; cat < outlist[0].Nregions; cat++) {
    120     dvo_catalog_free_data (&outcatalogs[cat]);
     124  if (!FULL_TABLE) {
     125    for (cat = 0; cat < outlist[0].Nregions; cat++) {
     126      dvo_catalog_free_data (&outcatalogs[cat]);
     127    }
    121128  }
    122129
Note: See TracChangeset for help on using the changeset viewer.