Changeset 29797
- Timestamp:
- Nov 18, 2010, 2:28:52 PM (15 years ago)
- Location:
- branches/eam_branches/ipp-20101103/Ohana/src/dvomerge
- Files:
-
- 2 added
- 6 edited
-
Makefile (modified) (1 diff)
-
include/dvomerge.h (modified) (1 diff)
-
src/dvomerge.c (modified) (2 diffs)
-
src/dvomergeContinue.c (modified) (3 diffs)
-
src/dvomergeContinue_threaded.c (modified) (6 diffs)
-
src/dvomergeImageIDs.c (added)
-
src/dvomergeUpdate.c (modified) (6 diffs)
-
src/dvomergeUpdate_threaded.c (added)
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/ipp-20101103/Ohana/src/dvomerge/Makefile
r29794 r29797 22 22 all: dvomerge dvoconvert dvosecfilt 23 23 24 # $(SRC)/dvomergeContinue.$(ARCH).o 25 24 26 DVOMERGE = \ 25 27 $(SRC)/dvomerge.$(ARCH).o \ 26 28 $(SRC)/dvomergeUpdate.$(ARCH).o \ 27 29 $(SRC)/dvomergeCreate.$(ARCH).o \ 28 $(SRC)/dvomergeContinue.$(ARCH).o \ 29 $(SRC)/dvomergeContinue_threaded.$(ARCH).o \ 30 $(SRC)/dvomergeUpdate_threaded.$(ARCH).o \ 30 31 $(SRC)/dvomergeFromList.$(ARCH).o \ 32 $(SRC)/dvomergeImageIDs.$(ARCH).o \ 31 33 $(SRC)/dvo_image_merge_dbs.$(ARCH).o \ 32 34 $(SRC)/SetSignals.$(ARCH).o \ -
branches/eam_branches/ipp-20101103/Ohana/src/dvomerge/include/dvomerge.h
r29794 r29797 111 111 int dvo_image_match_dbs PROTO((IDmapType *IDmap, FITS_DB *tgt, FITS_DB *src)); 112 112 int dvomergeImagesGetMap PROTO((IDmapType *IDmap, char *input, char *output)); 113 int dvomergeContinue PROTO((int argc, char **argv));114 113 int dvomergeFromList PROTO((int argc, char **argv)); 115 int dvomerge Continue_threaded PROTO((int argc, char **argv));114 int dvomergeUpdate_threaded PROTO((int argc, char **argv)); -
branches/eam_branches/ipp-20101103/Ohana/src/dvomerge/src/dvomerge.c
r29794 r29797 8 8 dvomerge_args (&argc, argv); 9 9 10 // XXX require both inputs to be sorted?11 12 10 if (argc == 6) { 13 11 if (!strcasecmp (argv[2], "and")) { … … 17 15 } 18 16 } 19 if (argc == 4) dvomergeUpdate (argc, argv); 20 if (argc == 5) { 17 if ((argc == 4) || (argc == 5)) { 21 18 if (NTHREADS) { 22 dvomerge Continue_threaded (argc, argv);19 dvomergeUpdate_threaded (argc, argv); 23 20 } else { 24 dvomerge Continue (argc, argv);21 dvomergeUpdate (argc, argv); 25 22 } 26 23 } -
branches/eam_branches/ipp-20101103/Ohana/src/dvomerge/src/dvomergeContinue.c
r29794 r29797 71 71 } 72 72 73 // XXXneed to determine the mapping from the input to the output images73 // need to determine the mapping from the input to the output images 74 74 dvomergeImagesGetMap (&IDmap, input, output); 75 75 … … 96 96 depth = inlist[0].regions[Ns][0].depth; 97 97 98 // XXX test: are we using the table (if so, if it is NULL, we should get errors)99 98 SetPhotcodeTable(NULL); 100 99 … … 164 163 exit (0); 165 164 } 166 167 /*** update the image table ***/168 int dvomergeImagesGetMap (IDmapType *IDmap, char *input, char *output) {169 170 FITS_DB inDB;171 FITS_DB outDB;172 int status;173 174 /*** load input1/Images.dat ***/175 sprintf (ImageCat, "%s/Images.dat", input);176 inDB.mode = dvo_catalog_catmode (CATMODE);177 inDB.format = dvo_catalog_catformat (CATFORMAT);178 status = dvo_image_lock (&inDB, ImageCat, 3600.0, LCK_XCLD); // shorter timeout?179 if (!status) Shutdown ("ERROR: failure to lock image catalog %s", inDB.filename);180 181 // load the image table182 if (inDB.dbstate == LCK_EMPTY) {183 Shutdown ("only use -continue for an existing, partially merged database");184 }185 if (!dvo_image_load (&inDB, VERBOSE, TRUE)) {186 Shutdown ("can't read input image catalog %s", inDB.filename);187 }188 189 /*** load output/Images.dat ***/190 sprintf (ImageCat, "%s/Images.dat", output);191 outDB.mode = dvo_catalog_catmode (CATMODE);192 outDB.format = dvo_catalog_catformat (CATFORMAT);193 status = dvo_image_lock (&outDB, ImageCat, 3600.0, LCK_XCLD); // shorter timeout?194 if (!status) Shutdown ("ERROR: failure to lock image catalog %s", outDB.filename);195 196 /* load the image table */197 if (outDB.dbstate == LCK_EMPTY) {198 Shutdown ("only use -continue for an existing, partially merged database");199 }200 if (!dvo_image_load (&outDB, VERBOSE, TRUE)) {201 Shutdown ("can't read output image catalog %s", outDB.filename);202 }203 204 // convert database table to internal structure & add to output image db205 dvo_image_match_dbs(IDmap, &outDB, &inDB);206 dvo_image_unlock (&inDB); // unlock input207 dvo_image_unlock (&outDB); // unlock output208 209 return TRUE;210 } -
branches/eam_branches/ipp-20101103/Ohana/src/dvomerge/src/dvomergeContinue_threaded.c
r29795 r29797 25 25 } ThreadData; 26 26 27 void *dvomerge Continue_threadjob (void *inputData) {27 void *dvomergeUpdate_threadjob (void *inputData) { 28 28 29 29 off_t j; … … 96 96 } 97 97 98 int dvomerge Continue_threaded (int argc, char **argv) {98 int dvomergeUpdate_threaded (int argc, char **argv) { 99 99 100 100 int j, launched, done, Nwait, Nrun; … … 118 118 gettimeofday (&start, NULL); 119 119 120 CONTINUE = FALSE; 120 121 if (strcasecmp (argv[2], "into")) dvomerge_usage(); 121 if (strcasecmp (argv[4], "continue")) dvomerge_usage(); 122 if (argc == 5) { 123 if (strcasecmp (argv[4], "continue")) dvomerge_usage(); 124 CONTINUE = TRUE; 125 } 122 126 123 127 input = argv[1]; … … 170 174 } 171 175 172 // XXX need to determine the mapping from the input to the output images 173 dvomergeImagesGetMap (&IDmap, input, output); 176 if (CONTINUE) { 177 // need to determine the mapping from the input to the output images 178 dvomergeImagesGetMap (&IDmap, input, output); 179 } else { 180 dvomergeImagesUpdate (&IDmap, input, output); 181 } 174 182 175 183 // load the sky table for the existing database … … 192 200 // loop over the populatable output tables; check for data in input in the corresponding regions 193 201 194 // XXX test: are we using the table (if so, if it is NULL, we should get errors)195 SetPhotcodeTable(NULL);196 197 202 SkyListPopulatedRange (&Ns, &Ne, inlist, 0); 198 203 depth = inlist[0].regions[Ns][0].depth; 199 204 205 SetPhotcodeTable(NULL); 206 200 207 ALLOCATE(threads, pthread_t, NTHREADS); 201 208 ALLOCATE(threadData, ThreadData, NTHREADS); … … 205 212 } 206 213 for (i = 0; i < NTHREADS; i++) { 207 pthread_create (&threads[i], NULL, &dvomerge Continue_threadjob, (void *) &threadData[i]);214 pthread_create (&threads[i], NULL, &dvomergeUpdate_threadjob, (void *) &threadData[i]); 208 215 } 209 216 -
branches/eam_branches/ipp-20101103/Ohana/src/dvomerge/src/dvomergeUpdate.c
r29794 r29797 3 3 int dvomergeUpdate (int argc, char **argv) { 4 4 5 int depth ;5 int depth, CONTINUE; 6 6 off_t i, j, Ns, Ne; 7 7 SkyTable *outsky, *insky; … … 15 15 int NsecfiltInput, NsecfiltOutput; 16 16 17 double dtime; 18 struct timeval start, stop; 19 gettimeofday (&start, NULL); 20 21 CONTINUE = FALSE; 17 22 if (strcasecmp (argv[2], "into")) dvomerge_usage(); 23 if (argc == 5) { 24 if (strcasecmp (argv[4], "continue")) dvomerge_usage(); 25 CONTINUE = TRUE; 26 } 18 27 19 28 input = argv[1]; … … 66 75 } 67 76 68 dvomergeImagesUpdate (&IDmap, input, output); 77 if (CONTINUE) { 78 // need to determine the mapping from the input to the output images 79 dvomergeImagesGetMap (&IDmap, input, output); 80 } else { 81 dvomergeImagesUpdate (&IDmap, input, output); 82 } 69 83 70 84 // load the sky table for the existing database … … 97 111 if (VERBOSE) fprintf (stderr, "input: %s\n", inlist[0].regions[i][0].name); 98 112 99 // SetPhotcodeTable(inputPhotcodes);100 113 // load / create output catalog (if catalog does not exist, it will be created) 101 114 LoadCatalog (&incatalog, &inlist[0].regions[i][0], inlist[0].filename[i], "r", NsecfiltInput); … … 118 131 119 132 // load input catalog 120 // SetPhotcodeTable(outputPhotcodes);121 133 LoadCatalog (&outcatalog, outlist[0].regions[j], outlist[0].filename[j], "w", NsecfiltOutput); 122 134 … … 153 165 } 154 166 167 gettimeofday (&stop, NULL); 168 dtime = DTIME (stop, start); 169 fprintf (stderr, "SUCCESS: elapsed time %9.4f sec\n", dtime); 170 155 171 exit (0); 156 172 } 157 158 /*** update the image table ***/159 int dvomergeImagesUpdate (IDmapType *IDmap, char *input, char *output) {160 161 FITS_DB inDB;162 FITS_DB outDB;163 int status;164 165 /*** load input1/Images.dat ***/166 sprintf (ImageCat, "%s/Images.dat", input);167 inDB.mode = dvo_catalog_catmode (CATMODE);168 inDB.format = dvo_catalog_catformat (CATFORMAT);169 status = dvo_image_lock (&inDB, ImageCat, 3600.0, LCK_XCLD); // shorter timeout?170 if (!status) Shutdown ("ERROR: failure to lock image catalog %s", inDB.filename);171 172 // load the image table173 if (inDB.dbstate == LCK_EMPTY) {174 // Shutdown ("can't find input image catalog %s", inDB.filename);175 IDmap->Nmap = 0;176 return TRUE;177 }178 if (!dvo_image_load (&inDB, VERBOSE, TRUE)) {179 Shutdown ("can't read input image catalog %s", inDB.filename);180 }181 182 /*** load output/Images.dat ***/183 sprintf (ImageCat, "%s/Images.dat", output);184 outDB.mode = dvo_catalog_catmode (CATMODE);185 outDB.format = dvo_catalog_catformat (CATFORMAT);186 status = dvo_image_lock (&outDB, ImageCat, 3600.0, LCK_XCLD); // shorter timeout?187 if (!status) Shutdown ("ERROR: failure to lock image catalog %s", outDB.filename);188 189 /* load the image table */190 if (outDB.dbstate == LCK_EMPTY) {191 dvo_image_create (&outDB, GetZeroPoint());192 } else {193 if (!dvo_image_load (&outDB, VERBOSE, TRUE)) {194 Shutdown ("can't read output image catalog %s", outDB.filename);195 }196 }197 198 // convert database table to internal structure & add to output image db199 dvo_image_merge_dbs(IDmap, &outDB, &inDB);200 dvo_image_unlock (&inDB); // unlock input201 202 SetProtect (TRUE);203 dvo_image_save (&outDB, VERBOSE);204 SetProtect (FALSE);205 dvo_image_unlock (&outDB); // unlock output206 207 return TRUE;208 }
Note:
See TracChangeset
for help on using the changeset viewer.
