Index: trunk/pswarp/src/pswarp.h
===================================================================
--- trunk/pswarp/src/pswarp.h	(revision 18558)
+++ trunk/pswarp/src/pswarp.h	(revision 18839)
@@ -10,4 +10,6 @@
 #include <psmodules.h>
 #include <psphot.h>
+
+#define THREADED 1
 
 #include "pswarpErrorCodes.h"
@@ -33,6 +35,25 @@
     int nXpts, nYpts;                   // number of x,y samples in the grid
     int nXpix, nYpix;                   // x,y spacing in src image pixels of grid samples
-    int xMin,  yMin;                    // coordinate of first grid sample
+    double xMin,  yMin;			// coordinate of first grid sample
 } pswarpMapGrid;
+
+typedef struct {
+    // values which are common to all tiles
+    pmReadout *input;
+    pmReadout *output;
+    pswarpMapGrid *grid;
+    psImageInterpolateOptions *interp;
+    psImage *region;
+
+    // input values for this tile
+    int gridX;
+    int gridY;
+
+    // output values for this tile
+    long goodPixels;
+} pswarpTransformTileArgs;
+
+pswarpTransformTileArgs *pswarpTransformTileArgsAlloc();
+bool pswarpTransformTile (pswarpTransformTileArgs *args);
 
 pmConfig *pswarpArguments (int argc, char **argv);
@@ -44,5 +65,5 @@
 void pswarpCleanup (pmConfig *config);
 bool pswarpTransformReadout (pmReadout *output, pmReadout *input, pmConfig *config);
-bool pswarpTransformReadout_Opt (pmReadout *output, pmReadout *input, pmConfig *config);
+bool pswarpTransformSources(pmReadout *output, pmReadout *input, pmConfig *config);
 
 bool pswarpMatchRange (int *minX, int *minY, int *maxX, int *maxY, pmReadout *dest, pmReadout *src);
@@ -53,4 +74,5 @@
 pswarpMapGrid *pswarpMapGridFromImage (pmReadout *dest, pmReadout *src, int nXpix, int nYpix);
 bool pswarpMapGridSetGrid (pswarpMapGrid *grid, int ix, int iy, int *gridX, int *gridY);
+bool pswarpMapGridCoordRange (pswarpMapGrid *grid, int gridX, int gridY, psPlane *min, psPlane *max);
 int pswarpMapGridNextGrid_X (pswarpMapGrid *grid, int gridX);
 int pswarpMapGridNextGrid_Y (pswarpMapGrid *grid, int gridY);
@@ -68,2 +90,4 @@
     );
 
+// define threads for this program
+bool pswarpSetThreads ();
