Index: trunk/psModules/src/objects/pmModel.h
===================================================================
--- trunk/psModules/src/objects/pmModel.h	(revision 13898)
+++ trunk/psModules/src/objects/pmModel.h	(revision 14652)
@@ -1,3 +1,3 @@
-/* @file  pmObjects.h
+/* @file  pmModel.h
  * @brief Functions to define and manipulate object models
  *
@@ -5,6 +5,6 @@
  * @author EAM, IfA
  *
- * @version $Revision: 1.11 $ $Name: not supported by cvs2svn $
- * @date $Date: 2007-06-20 02:22:26 $
+ * @version $Revision: 1.12 $ $Name: not supported by cvs2svn $
+ * @date $Date: 2007-08-24 00:11:02 $
  *
  * Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -17,6 +17,6 @@
 /// @{
 
-// type of model carried by the pmModel structure
-typedef int pmModelType;
+/* pointers for the functions types below are supplied to each pmModel, and can be used by
+   the programmer without needing to know the model class */
 
 typedef enum {
@@ -41,4 +41,35 @@
 } pmModelOpMode;
 
+typedef struct pmModel pmModel;
+typedef struct pmSource pmSource;
+
+//  This function is the model chi-square minimization function for this model.
+typedef psMinimizeLMChi2Func pmModelFunc;
+
+//  This function sets the parameter limits for this model.
+typedef psMinimizeLMLimitFunc pmModelLimits;
+
+// This function returns the integrated flux for the given model parameters.
+typedef psF64 (*pmModelFlux)(const psVector *params);
+
+// This function returns the radius at which the given model and parameters
+// achieves the given flux.
+typedef psF64 (*pmModelRadius)(const psVector *params, double flux);
+
+//  This function provides the model guess parameters based on the details of
+//  the given source.
+typedef bool (*pmModelGuessFunc)(pmModel *model, pmSource *source);
+
+//  This function constructs the PSF model for the given source based on the
+//  supplied psf and the EXT model for the object.
+typedef bool (*pmModelFromPSFFunc)(pmModel *modelPSF, pmModel *modelEXT, pmPSF *psf);
+
+//  This function sets the model parameters based on the PSF for a given coordinate and central
+//  intensity
+typedef bool (*pmModelParamsFromPSF)(pmModel *model, pmPSF *psf, float Xo, float Yo, float Io);
+
+//  This function returns the success / failure status of the given model fit
+typedef bool (*pmModelFitStatusFunc)(pmModel *model);
+
 /** pmModel data structure
  *
@@ -50,6 +81,5 @@
  *
  */
-typedef struct
-{
+struct pmModel {
     pmModelType type;                   ///< Model to be used.
     psVector *params;                   ///< Paramater values.
@@ -62,11 +92,15 @@
     float radiusFit;                    ///< fit radius actually used
     pmResiduals *residuals;             ///< normalized PSF residuals
-}
-pmModel;
 
-/* XXX we are currently saving the residuals with the pmModel.  It might be better to save this
- * in the pmSource.  we may want an API to Add/Sub a pmModel (analytical model only) or a
- * pmSource (analytical + residuals).
- */
+    // functions for this model which depend on the model class
+    pmModelFunc          modelFunc;
+    pmModelFlux          modelFlux;
+    pmModelRadius        modelRadius;
+    pmModelLimits        modelLimits;
+    pmModelGuessFunc     modelGuess;
+    pmModelFromPSFFunc   modelFromPSF;
+    pmModelParamsFromPSF modelParamsFromPSF;
+    pmModelFitStatusFunc modelFitStatus;
+};
 
 /** Symbolic names for the elements of [d]params
@@ -130,4 +164,20 @@
 );
 
+bool pmModelAddWithOffset(psImage *image,
+			  psImage *mask,
+			  pmModel *model,
+			  pmModelOpMode mode,
+			  psMaskType maskVal,
+			  int dx,
+			  int dy);
+
+bool pmModelSubWithOffset(psImage *image,
+			  psImage *mask,
+			  pmModel *model,
+			  pmModelOpMode mode,
+			  psMaskType maskVal,
+			  int dx,
+			  int dy);
+
 /** pmModelFitStatus()
  *
