Changeset 28484 for branches/pap/psphot/src/psphotTest.c
- Timestamp:
- Jun 24, 2010, 2:59:09 PM (16 years ago)
- Location:
- branches/pap
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/pap
- Property svn:mergeinfo changed
-
branches/pap/psphot
- Property svn:mergeinfo changed
/branches/czw_branch/20100519/psphot (added) merged: 28164,28304
- Property svn:mergeinfo changed
-
branches/pap/psphot/src/psphotTest.c
r24187 r28484 25 25 26 26 bool FillImage_Threaded (psThreadJob *job) { 27 27 28 28 psImage *image = job->args->data[0]; 29 29 int xs = PS_SCALAR_VALUE(job->args->data[1],S32); … … 36 36 psRegion region = psRegionSet (xs, xs + dx, ys, ys + dy); 37 37 for (int i = 0; i < 100; i++) { 38 psImage *subset = psImageSubset (image, region);39 psImageInit (subset, value + i);40 psFree (subset);38 psImage *subset = psImageSubset (image, region); 39 psImageInit (subset, value + i); 40 psFree (subset); 41 41 } 42 42 return true; … … 46 46 47 47 if (argc != 3) { 48 fprintf (stderr, "USAGE: psphotTest (output.fits) (nThreads)\n");49 exit (2);48 fprintf (stderr, "USAGE: psphotTest (output.fits) (nThreads)\n"); 49 exit (2); 50 50 } 51 51 … … 62 62 63 63 for (int ix = 0; ix < 1000; ix += 100) { 64 for (int iy = 0; iy < 1000; iy += 100) {64 for (int iy = 0; iy < 1000; iy += 100) { 65 65 66 // allocate a job -- if threads are not defined, this just runs the job67 psThreadJob *job = psThreadJobAlloc ("FILL_IMAGE");66 // allocate a job -- if threads are not defined, this just runs the job 67 psThreadJob *job = psThreadJobAlloc ("FILL_IMAGE"); 68 68 69 psArrayAdd(job->args, 1, image);70 PS_ARRAY_ADD_SCALAR(job->args, ix, PS_TYPE_S32);71 PS_ARRAY_ADD_SCALAR(job->args, iy, PS_TYPE_S32);72 PS_ARRAY_ADD_SCALAR(job->args, 100, PS_TYPE_S32);73 PS_ARRAY_ADD_SCALAR(job->args, 100, PS_TYPE_S32);74 PS_ARRAY_ADD_SCALAR(job->args, ix + iy, PS_TYPE_S32);69 psArrayAdd(job->args, 1, image); 70 PS_ARRAY_ADD_SCALAR(job->args, ix, PS_TYPE_S32); 71 PS_ARRAY_ADD_SCALAR(job->args, iy, PS_TYPE_S32); 72 PS_ARRAY_ADD_SCALAR(job->args, 100, PS_TYPE_S32); 73 PS_ARRAY_ADD_SCALAR(job->args, 100, PS_TYPE_S32); 74 PS_ARRAY_ADD_SCALAR(job->args, ix + iy, PS_TYPE_S32); 75 75 76 // FillImage (image, ix, iy, 100, 100, ix + iy);76 // FillImage (image, ix, iy, 100, 100, ix + iy); 77 77 78 if (!psThreadJobAddPending(job)) { 79 fprintf (stderr, "failure to run FillImage(1)"); 80 psFree (job); 81 exit (1); 82 } 83 psFree(job); 84 } 78 if (!psThreadJobAddPending(job)) { 79 fprintf (stderr, "failure to run FillImage(1)"); 80 exit (1); 81 } 82 } 85 83 } 86 84 … … 88 86 // wait for the threads to finish and manage results 89 87 if (!psThreadPoolWait (true)) { 90 fprintf (stderr, "failure to run FillImage (2)");91 exit (1);88 fprintf (stderr, "failure to run FillImage (2)"); 89 exit (1); 92 90 } 93 91
Note:
See TracChangeset
for help on using the changeset viewer.
