Changeset 15746
- Timestamp:
- Dec 6, 2007, 3:39:40 PM (18 years ago)
- Location:
- trunk/Ohana/src/dvosplit/src
- Files:
-
- 3 edited
-
dvosplit.c (modified) (2 diffs)
-
split_averages.c (modified) (7 diffs)
-
split_measures.c (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Ohana/src/dvosplit/src/dvosplit.c
r15743 r15746 61 61 // split_missings (&incatalog, outlist, outcatalogs, avelinks); 62 62 63 free (avelinks[0].outref); 64 free (avelinks[0].outcat); 65 63 66 dvo_catalog_unlock (&incatalog); 64 67 … … 72 75 outlist[0].regions[j][0].table = TRUE; 73 76 } 74 75 77 } 76 78 77 79 // save sky table copy 78 80 sprintf (filename, "%s/SkyTable.fits", CATDIR); 79 check_file_access (filename, FALSE, VERBOSE);81 check_file_access (filename, TRUE, VERBOSE); 80 82 if (!SkyTableSave (sky, filename)) { 81 83 fprintf (stderr, "ERROR: failed to save sky table for %s\n", CATDIR); -
trunk/Ohana/src/dvosplit/src/split_averages.c
r15743 r15746 1 1 # include "dvosplit.h" 2 2 # define NROWS 100000 /* ~10MB per block for measures */ 3 # define DNOUT 1000 3 4 4 5 AveLinks *split_averages (Catalog *incatalog, SkyList *outlist, Catalog *outcatalogs) { … … 6 7 double inR, inD; 7 8 int n, block, ave, cat, averef, Nblocks, Ncat, Nout, Nsecfilt; 8 int *outref, *outcat ;9 int *outref, *outcat, *outmem; 9 10 AveLinks *avelinks; 10 11 11 12 ALLOCATE (outref, int, incatalog[0].Naves_disk); 12 13 ALLOCATE (outcat, int, incatalog[0].Naves_disk); 14 ALLOCATE (outmem, int, outlist[0].Nregions); 13 15 14 16 Nsecfilt = GetPhotcodeNsecfilt (); … … 17 19 // contains primary photcodes, which will increase Nsecfilt by one. 18 20 for (cat = 0; cat < outlist[0].Nregions; cat++) { 19 REALLOCATE (outcatalogs[cat].average, Average, NROWS); 20 REALLOCATE (outcatalogs[cat].secfilt, SecFilt, NROWS*(Nsecfilt + 1)); 21 outmem[cat] = DNOUT; 22 REALLOCATE (outcatalogs[cat].average, Average, outmem[cat]); 23 REALLOCATE (outcatalogs[cat].secfilt, SecFilt, outmem[cat]*(Nsecfilt + 1)); 21 24 } 22 25 … … 29 32 // read up to NROWS at a time 30 33 dvo_catalog_load_segment (incatalog, VERBOSE, block*NROWS, NROWS); 34 fprintf (stderr, "splitting %s (averages) .. %d of %d\n", incatalog[0].filename, block, Nblocks); 35 31 36 assert (block*NROWS == incatalog[0].Naves_off); 32 37 38 // distribute data to the output catalogs 33 39 for (ave = 0; ave < incatalog[0].Naverage; ave++) { 34 40 averef = ave + incatalog[0].Naves_off; … … 67 73 outcatalogs[Ncat].Nsecf_mem++; 68 74 } 75 76 if (outcatalogs[Ncat].Naverage >= outmem[Ncat]) { 77 outmem[Ncat] += DNOUT; 78 REALLOCATE (outcatalogs[Ncat].average, Average, outmem[Ncat]); 79 REALLOCATE (outcatalogs[Ncat].secfilt, SecFilt, outmem[Ncat]*(Nsecfilt + 1)); 80 } 69 81 } 82 dvo_catalog_free_data (incatalog); 70 83 71 84 // double check the values of Naverage, Nsecf_mem? … … 75 88 outcatalogs[cat].catflags = LOAD_AVES | LOAD_SECF; 76 89 77 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);78 90 dvo_catalog_save (&outcatalogs[cat], VERBOSE); 79 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);91 // 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); 80 92 81 // XXX I need toadvance the pointers and free the current data93 // advance the pointers and free the current data 82 94 // XXX these should be done within save segment: 83 95 outcatalogs[cat].Naves_disk += outcatalogs[cat].Naverage; … … 92 104 } 93 105 106 for (cat = 0; cat < outlist[0].Nregions; cat++) { 107 dvo_catalog_free_data (&outcatalogs[cat]); 108 } 109 110 free (outmem); 111 94 112 ALLOCATE (avelinks, AveLinks, 1); 95 113 avelinks[0].outref = outref; 96 114 avelinks[0].outcat = outcat; 97 115 116 98 117 return (avelinks); 99 118 } -
trunk/Ohana/src/dvosplit/src/split_measures.c
r15743 r15746 1 1 # include "dvosplit.h" 2 2 # define NROWS 100000 /* ~10MB per row for measures */ 3 # define DNOUT 1000 3 4 4 5 int split_measures (Catalog *incatalog, SkyList *outlist, Catalog *outcatalogs, AveLinks *avelinks) { 5 6 6 7 int block, meas, cat, Nblocks, Ncat, Nout, averef; 7 int *outref, *outcat ;8 int *outref, *outcat, *outmem; 8 9 9 10 outref = avelinks->outref; 10 11 outcat = avelinks->outcat; 12 ALLOCATE (outmem, int, outlist[0].Nregions); 11 13 12 14 // allocate enough space for the output buffer 13 15 for (cat = 0; cat < outlist[0].Nregions; cat++) { 14 REALLOCATE (outcatalogs[cat].measure, Measure, NROWS); 16 outmem[cat] = DNOUT; 17 REALLOCATE (outcatalogs[cat].measure, Measure, outmem[cat]); 15 18 } 16 19 … … 23 26 // read up to NROWS at a time 24 27 dvo_catalog_load_segment (incatalog, VERBOSE, block*NROWS, NROWS); 28 fprintf (stderr, "splitting %s (measures) .. %d of %d\n", incatalog[0].filename, block, Nblocks); 29 30 assert (block*NROWS == incatalog[0].Nmeas_off); 25 31 26 32 for (meas = 0; meas < incatalog[0].Nmeasure; meas++) { … … 33 39 outcatalogs[Ncat].measure[Nout].averef = outref[averef]; 34 40 outcatalogs[Ncat].Nmeasure++; 41 42 if (outcatalogs[Ncat].Nmeasure >= outmem[Ncat]) { 43 outmem[Ncat] += DNOUT; 44 REALLOCATE (outcatalogs[Ncat].measure, Measure, outmem[Ncat]); 45 } 35 46 } 47 dvo_catalog_free_data (incatalog); 36 48 37 49 for (cat = 0; cat < outlist[0].Nregions; cat++) { … … 45 57 } 46 58 } 59 60 for (cat = 0; cat < outlist[0].Nregions; cat++) { 61 dvo_catalog_free_data (&outcatalogs[cat]); 62 } 63 64 free (outmem); 65 47 66 return (TRUE); 48 67 }
Note:
See TracChangeset
for help on using the changeset viewer.
