Index: /trunk/psModules/test/tst_pmObjects01.c
===================================================================
--- /trunk/psModules/test/tst_pmObjects01.c	(revision 4095)
+++ /trunk/psModules/test/tst_pmObjects01.c	(revision 4096)
@@ -19,6 +19,6 @@
  * abd never deallocate, no error is generated.
  *
- *  @version $Revision: 1.6 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2005-04-19 23:44:54 $
+ *  @version $Revision: 1.7 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2005-06-03 20:34:47 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -126,11 +126,12 @@
         testStatus = false;
     } else {
-        if (tmpModel->Nparams != 7) {
-            printf("TEST ERROR: pmModelAlloc(PS_MODEL_GAUSS) allocated an incorrect number of params (%d)\n", tmpModel->Nparams);
+        if ((tmpModel->params->n != 7) || (tmpModel->dparams->n != 7)) {
+            printf("TEST ERROR: pmModelAlloc(PS_MODEL_GAUSS) allocated an incorrect number of params (%d, %d)\n",
+                   tmpModel->params->n, tmpModel->dparams->n);
             testStatus = false;
         } else {
             for (psS32 i = 0 ; i < 7 ; i++) {
-                if ((tmpModel->params[i] != 0.0) ||
-                        (tmpModel->dparams[i] != 0.0)) {
+                if ((tmpModel->params->data.F32[i] != 0.0) ||
+                        (tmpModel->dparams->data.F32[i] != 0.0)) {
                     printf("TEST ERROR: pmModelAlloc(PS_MODEL_GAUSS) did not ininitialize the params/dparams array to 0.0.\n");
                     testStatus = false;
@@ -147,11 +148,12 @@
         testStatus = false;
     } else {
-        if (tmpModel->Nparams != 7) {
-            printf("TEST ERROR: pmModelAlloc(PS_MODEL_PGAUSS) allocated an incorrect number of params (%d)\n", tmpModel->Nparams);
+        if ((tmpModel->params->n != 7) || (tmpModel->dparams->n != 7)) {
+            printf("TEST ERROR: pmModelAlloc(PS_MODEL_PGAUSS) allocated an incorrect number of params (%d, %d)\n",
+                   tmpModel->params->n, tmpModel->dparams->n);
             testStatus = false;
         } else {
             for (psS32 i = 0 ; i < 7 ; i++) {
-                if ((tmpModel->params[i] != 0.0) ||
-                        (tmpModel->dparams[i] != 0.0)) {
+                if ((tmpModel->params->data.F32[i] != 0.0) ||
+                        (tmpModel->dparams->data.F32[i] != 0.0)) {
                     printf("TEST ERROR: pmModelAlloc(PS_MODEL_PGAUSS) did not ininitialize the params/dparams array to 0.0.\n");
                     testStatus = false;
@@ -168,11 +170,12 @@
         testStatus = false;
     } else {
-        if (tmpModel->Nparams != 11) {
-            printf("TEST ERROR: pmModelAlloc(PS_MODEL_TWIST_GAUSS) allocated an incorrect number of params (%d)\n", tmpModel->Nparams);
+        if ((tmpModel->params->n != 11) || (tmpModel->dparams->n != 11)) {
+            printf("TEST ERROR: pmModelAlloc(PS_MODEL_TWIST_GAUSS) allocated an incorrect number of params (%d, %d)\n",
+                   tmpModel->params->n, tmpModel->dparams->n);
             testStatus = false;
         } else {
             for (psS32 i = 0 ; i < 11 ; i++) {
-                if ((tmpModel->params[i] != 0.0) ||
-                        (tmpModel->dparams[i] != 0.0)) {
+                if ((tmpModel->params->data.F32[i] != 0.0) ||
+                        (tmpModel->dparams->data.F32[i] != 0.0)) {
                     printf("TEST ERROR: pmModelAlloc(PS_MODEL_TWIST_GAUSS) did not ininitialize the params/dparams array to 0.0.\n");
                     testStatus = false;
@@ -189,11 +192,12 @@
         testStatus = false;
     } else {
-        if (tmpModel->Nparams != 9) {
-            printf("TEST ERROR: pmModelAlloc(PS_MODEL_WAUSS) allocated an incorrect number of params (%d)\n", tmpModel->Nparams);
+        if ((tmpModel->params->n != 9) || (tmpModel->dparams->n != 9)) {
+            printf("TEST ERROR: pmModelAlloc(PS_MODEL_WAUSS) allocated an incorrect number of params (%d, %d)\n",
+                   tmpModel->params->n, tmpModel->dparams->n);
             testStatus = false;
         } else {
             for (psS32 i = 0 ; i < 9 ; i++) {
-                if ((tmpModel->params[i] != 0.0) ||
-                        (tmpModel->dparams[i] != 0.0)) {
+                if ((tmpModel->params->data.F32[i] != 0.0) ||
+                        (tmpModel->dparams->data.F32[i] != 0.0)) {
                     printf("TEST ERROR: pmModelAlloc(PS_MODEL_WAUSS) did not ininitialize the params/dparams array to 0.0.\n");
                     testStatus = false;
@@ -210,11 +214,12 @@
         testStatus = false;
     } else {
-        if (tmpModel->Nparams != 8) {
-            printf("TEST ERROR: pmModelAlloc(PS_MODEL_SERSIC) allocated an incorrect number of params (%d)\n", tmpModel->Nparams);
+        if ((tmpModel->params->n != 8) || (tmpModel->dparams->n != 8)) {
+            printf("TEST ERROR: pmModelAlloc(PS_MODEL_SERSIC) allocated an incorrect number of params (%d, %d)\n",
+                   tmpModel->params->n, tmpModel->dparams->n);
             testStatus = false;
         } else {
             for (psS32 i = 0 ; i < 8 ; i++) {
-                if ((tmpModel->params[i] != 0.0) ||
-                        (tmpModel->dparams[i] != 0.0)) {
+                if ((tmpModel->params->data.F32[i] != 0.0) ||
+                        (tmpModel->dparams->data.F32[i] != 0.0)) {
                     printf("TEST ERROR: pmModelAlloc(PS_MODEL_SERSIC) did not ininitialize the params/dparams array to 0.0.\n");
                     testStatus = false;
@@ -231,11 +236,12 @@
         testStatus = false;
     } else {
-        if (tmpModel->Nparams != 12) {
-            printf("TEST ERROR: pmModelAlloc(PS_MODEL_SERSIC_CORE) allocated an incorrect number of params (%d)\n", tmpModel->Nparams);
+        if ((tmpModel->params->n != 12) || (tmpModel->dparams->n != 12)) {
+            printf("TEST ERROR: pmModelAlloc(PS_MODEL_SERSIC_CORE) allocated an incorrect number of params (%d, %d)\n",
+                   tmpModel->params->n, tmpModel->dparams->n);
             testStatus = false;
         } else {
             for (psS32 i = 0 ; i < 12 ; i++) {
-                if ((tmpModel->params[i] != 0.0) ||
-                        (tmpModel->dparams[i] != 0.0)) {
+                if ((tmpModel->params->data.F32[i] != 0.0) ||
+                        (tmpModel->dparams->data.F32[i] != 0.0)) {
                     printf("TEST ERROR: pmModelAlloc(PS_MODEL_SERSIC_CORE) did not ininitialize the params/dparams array to 0.0.\n");
                     testStatus = false;
@@ -485,5 +491,5 @@
     bool testStatus = true;
     psImage *inData = psImageAlloc(numCols, numRows, PS_TYPE_F32);
-    psList *outData = NULL;
+    psArray *outData = NULL;
 
     //
@@ -531,13 +537,12 @@
             expectedNumPeaks = 5;
         }
-        if (outData->size != expectedNumPeaks) {
-            printf("TEST ERROR: pmFindImagePeaks found %d peaks (should be %d)\n", outData->size, expectedNumPeaks);
-            testStatus = false;
-        }
-
-        // HEY
-        psListElem *tmpPeakLE = (psListElem *) outData->head;
-        while (tmpPeakLE != NULL) {
-            psPeak *tmpPeak = (psPeak *) tmpPeakLE->data;
+        if (outData->n != expectedNumPeaks) {
+            printf("TEST ERROR: pmFindImagePeaks found %d peaks (should be %d)\n", outData->n, expectedNumPeaks);
+            testStatus = false;
+        }
+
+        // HEY: verify
+        for (psS32 i = 0 ; i < outData->n ; i++) {
+            psPeak *tmpPeak = (psPeak *) outData->data[i];
             if (((tmpPeak->x == 0) && (tmpPeak->y == 0)) ||
                     ((tmpPeak->x == 0) && (tmpPeak->y == numRows-1)) ||
@@ -558,6 +563,4 @@
                 testStatus = false;
             }
-
-            tmpPeakLE = tmpPeakLE->next;
         }
     }
@@ -571,5 +574,5 @@
 {
     bool testStatus = true;
-    psList *tmpList = NULL;
+    psArray *tmpArray = NULL;
     psImage *tmpImageF64 = psImageAlloc(TST02_NUM_ROWS, TST02_NUM_COLS, PS_TYPE_F64);
     psImage *tmpImageEmpty = psImageAlloc(0, 0, PS_TYPE_F32);
@@ -579,27 +582,27 @@
     printf("----------------------------------------------------------------------------------\n");
     printf("Calling pmFindImagePeaks with NULL psImage.  Should generate error and return NULL.\n");
-    tmpList = pmFindImagePeaks(NULL, 0.0);
-    if (tmpList != NULL) {
+    tmpArray = pmFindImagePeaks(NULL, 0.0);
+    if (tmpArray != NULL) {
         printf("TEST ERROR: pmFindImagePeaks() returned a non-NULL psImage.\n");
         testStatus = false;
-        psFree(tmpList);
+        psFree(tmpArray);
     }
 
     printf("----------------------------------------------------------------------------------\n");
     printf("Calling pmFindImagePeaks with empty psImage.  Should generate error and return NULL.\n");
-    tmpList = pmFindImagePeaks(tmpImageEmpty, 0.0);
-    if (tmpList != NULL) {
+    tmpArray = pmFindImagePeaks(tmpImageEmpty, 0.0);
+    if (tmpArray != NULL) {
         printf("TEST ERROR: pmFindImagePeaks() returned a non-NULL psImage.\n");
         testStatus = false;
-        psFree(tmpList);
+        psFree(tmpArray);
     }
 
     printf("----------------------------------------------------------------------------------\n");
     printf("Calling pmFindImagePeaks with PS_TYPE_F64 psImage.  Should generate error and return NULL.\n");
-    tmpList = pmFindImagePeaks(tmpImageF64, 0.0);
-    if (tmpList != NULL) {
+    tmpArray = pmFindImagePeaks(tmpImageF64, 0.0);
+    if (tmpArray != NULL) {
         printf("TEST ERROR: pmFindImagePeaks() returned a non-NULL psImage.\n");
         testStatus = false;
-        psFree(tmpList);
+        psFree(tmpArray);
     }
     printf("----------------------------------------------------------------------------------\n");
@@ -630,13 +633,15 @@
     bool testStatus = true;
     psImage *imgData = psImageAlloc(NUM_COLS, NUM_ROWS, PS_TYPE_F32);
-    psList *outData = NULL;
-
-    printf("----------------------------------------------------------------------------------\n");
-    printf("Calling pmCullPeaks with NULL psList.  Should generate error and return NULL.\n");
-    outData = pmCullPeaks(NULL, 0.0, NULL);
-    if (outData != NULL) {
-        printf("TEST ERROR: pmCulPeaks() returned a non-NULL psList.\n");
-        testStatus = false;
-    }
+    psArray *outData = NULL;
+
+    /* XXX: Modify for new pmCullPeaks()
+            printf("----------------------------------------------------------------------------------\n");
+            printf("Calling pmCullPeaks with NULL psList.  Should generate error and return NULL.\n");
+            outData = pmCullPeaks(NULL, 0.0, NULL);
+            if (outData != NULL) {
+                printf("TEST ERROR: pmCulPeaks() returned a non-NULL psList.\n");
+                testStatus = false;
+        }
+    */
 
     //
@@ -670,16 +675,18 @@
     printf("Calling pmCullPeaks with large maxValue and NULL psRegion.\n");
     outData = pmFindImagePeaks(imgData, 0.0);
-    outData = pmCullPeaks(outData, PS_MAX_F32, NULL);
-
-    if (outData == NULL) {
-        printf("TEST ERROR: pmCullPeaks() returned a non-NULL psList.\n");
-        testStatus = false;
-        return(testStatus);
-    }
-    if (outData->size != numPeaksOrig) {
-        printf("TEST ERROR (0): pmCullPeaks incorrectly removed peaks\n");
-        printf("The pmCullPeaks() output had %d peaks, should have had %d peaks.\n", outData->size, numPeaksOrig);
-        testStatus = false;
-    }
+    /* XXX: Modify for new pmCullPeaks
+        outData = pmCullPeaks(outData, PS_MAX_F32, NULL);
+     
+        if (outData == NULL) {
+            printf("TEST ERROR: pmCullPeaks() returned a non-NULL psList.\n");
+            testStatus = false;
+            return(testStatus);
+        }
+        if (outData->n != numPeaksOrig) {
+            printf("TEST ERROR (0): pmCullPeaks incorrectly removed peaks\n");
+            printf("The pmCullPeaks() output had %d peaks, should have had %d peaks.\n", outData->n, numPeaksOrig);
+            testStatus = false;
+        }
+    */
     psFree(outData);
 
@@ -691,18 +698,20 @@
     printf("Calling pmCullPeaks with tiny maxValue and NULL psRegion.\n");
     outData = pmFindImagePeaks(imgData, 0.0);
-    printf("pmFindImagePeaks found %d peaks\n", outData->size);
-    outData = pmCullPeaks(outData, 0.0, NULL);
-
-    if (outData == NULL) {
-        printf("TEST ERROR: pmCullPeaks() returned a non-NULL psList.\n");
-        testStatus = false;
-        return(testStatus);
-    }
-    if (outData->size != 0) {
-        printf("TEST ERROR (1): pmCullPeaks incorrectly removed peaks\n");
-        printf("The pmCullPeaks() output had %d peaks, should have had %d peaks.\n", outData->size, 0);
-        testStatus = false;
-    }
-    psFree(outData);
+    printf("pmFindImagePeaks found %d peaks\n", outData->n);
+    /* XXX: Modify for new pmCullPeaks
+        outData = pmCullPeaks(outData, 0.0, NULL);
+     
+        if (outData == NULL) {
+            printf("TEST ERROR: pmCullPeaks() returned a non-NULL psList.\n");
+            testStatus = false;
+            return(testStatus);
+        }
+        if (outData->n != 0) {
+            printf("TEST ERROR (1): pmCullPeaks incorrectly removed peaks\n");
+            printf("The pmCullPeaks() output had %d peaks, should have had %d peaks.\n", outData->n, 0);
+            testStatus = false;
+        }
+        psFree(outData);
+    */
 
     //
@@ -713,20 +722,22 @@
     printf("Calling pmCullPeaks with large maxValue and disjoint psRegion.\n");
     outData = pmFindImagePeaks(imgData, 0.0);
-    printf("pmFindImagePeaks found %d peaks\n", outData->size);
-    psRegion *tmpRegion = psRegionAlloc(10000.0, 20000.0, 10000.0, 20000.0);
-    outData = pmCullPeaks(outData, PS_MAX_F32, tmpRegion);
-
-    if (outData == NULL) {
-        printf("TEST ERROR: pmCullPeaks() returned a non-NULL psList.\n");
-        testStatus = false;
-        return(testStatus);
-    }
-    if (outData->size != numPeaksOrig) {
-        printf("TEST ERROR (2): pmCullPeaks incorrectly removed peaks\n");
-        printf("The pmCullPeaks() output had %d peaks, should have had %d peaks.\n", outData->size, numPeaksOrig);
-        testStatus = false;
-    }
+    printf("pmFindImagePeaks found %d peaks\n", outData->n);
+    psRegion tmpRegion = psRegionSet(10000.0, 20000.0, 10000.0, 20000.0);
+
+    /* XXX: Modify for new pmCullPeaks
+        outData = pmCullPeaks(outData, PS_MAX_F32, tmpRegion);
+     
+        if (outData == NULL) {
+            printf("TEST ERROR: pmCullPeaks() returned a non-NULL psList.\n");
+            testStatus = false;
+            return(testStatus);
+        }
+        if (outData->n != numPeaksOrig) {
+            printf("TEST ERROR (2): pmCullPeaks incorrectly removed peaks\n");
+            printf("The pmCullPeaks() output had %d peaks, should have had %d peaks.\n", outData->n, numPeaksOrig);
+            testStatus = false;
+        }
+    */
     psFree(outData);
-    psFree(tmpRegion);
 
     //
@@ -737,20 +748,21 @@
     printf("Calling pmCullPeaks with large maxValue and non-disjoint psRegion.\n");
     outData = pmFindImagePeaks(imgData, 0.0);
-    printf("pmFindImagePeaks found %d peaks\n", outData->size);
-    tmpRegion = psRegionAlloc(-PS_MAX_F32, PS_MAX_F32, -PS_MAX_F32, PS_MAX_F32);
-    outData = pmCullPeaks(outData, PS_MAX_F32, tmpRegion);
-
-    if (outData == NULL) {
-        printf("TEST ERROR: pmCullPeaks() returned a non-NULL psList.\n");
-        testStatus = false;
-        return(testStatus);
-    }
-    if (outData->size != 0) {
-        printf("TEST ERROR (3): pmCullPeaks incorrectly removed peaks\n");
-        printf("The pmCullPeaks() output had %d peaks, should have had %d peaks.\n", outData->size, 0);
-        testStatus = false;
-    }
+    printf("pmFindImagePeaks found %d peaks\n", outData->n);
+    tmpRegion = psRegionSet(-PS_MAX_F32, PS_MAX_F32, -PS_MAX_F32, PS_MAX_F32);
+    /* XXX: Modify for new pmCullPeaks
+        outData = pmCullPeaks(outData, PS_MAX_F32, tmpRegion);
+     
+        if (outData == NULL) {
+            printf("TEST ERROR: pmCullPeaks() returned a non-NULL psList.\n");
+            testStatus = false;
+            return(testStatus);
+        }
+        if (outData->n != 0) {
+            printf("TEST ERROR (3): pmCullPeaks incorrectly removed peaks\n");
+            printf("The pmCullPeaks() output had %d peaks, should have had %d peaks.\n", outData->n, 0);
+            testStatus = false;
+        }
+    */
     psFree(outData);
-    psFree(tmpRegion);
 
     printf("----------------------------------------------------------------------------------\n");
@@ -1637,11 +1649,11 @@
     printf("Calling pmSourceContour with acceptable data.\n");
     printf("NOTE: must figure out the parameters for this test to be meaningful.\n");
-    mySrc->models->params[0] = TST09_SKY;
-    mySrc->models->params[1] = 15.0;
-    mySrc->models->params[2] = (psF32) (TST09_NUM_ROWS / 2);
-    mySrc->models->params[3] = (psF32) (TST09_NUM_COLS / 2);
-    mySrc->models->params[4] = 2.0;
-    mySrc->models->params[5] = 2.0;
-    mySrc->models->params[6] = 2.0;
+    mySrc->models->params->data.F32[0] = TST09_SKY;
+    mySrc->models->params->data.F32[1] = 15.0;
+    mySrc->models->params->data.F32[2] = (psF32) (TST09_NUM_ROWS / 2);
+    mySrc->models->params->data.F32[3] = (psF32) (TST09_NUM_COLS / 2);
+    mySrc->models->params->data.F32[4] = 2.0;
+    mySrc->models->params->data.F32[5] = 2.0;
+    mySrc->models->params->data.F32[6] = 2.0;
     rc = pmSourceContour(mySrc, imgData, LEVEL, PS_CONTOUR_CRUDE);
     if (rc != NULL) {
@@ -1700,11 +1712,11 @@
 
     mySrc->models = pmModelAlloc(PS_MODEL_GAUSS);
-    mySrc->models->params[0] = 5.0;
-    mySrc->models->params[1] = 70.0;
-    mySrc->models->params[2] = (psF32) (TST15_NUM_ROWS / 2);
-    mySrc->models->params[3] = (psF32) (TST15_NUM_COLS / 2);
-    mySrc->models->params[4] = 1.0;
-    mySrc->models->params[5] = 1.0;
-    mySrc->models->params[6] = 2.0;
+    mySrc->models->params->data.F32[0] = 5.0;
+    mySrc->models->params->data.F32[1] = 70.0;
+    mySrc->models->params->data.F32[2] = (psF32) (TST15_NUM_ROWS / 2);
+    mySrc->models->params->data.F32[3] = (psF32) (TST15_NUM_COLS / 2);
+    mySrc->models->params->data.F32[4] = 1.0;
+    mySrc->models->params->data.F32[5] = 1.0;
+    mySrc->models->params->data.F32[6] = 2.0;
 
     printf("----------------------------------------------------------------------------------\n");
@@ -1780,11 +1792,11 @@
 
     mySrc->models = pmModelAlloc(PS_MODEL_GAUSS);
-    mySrc->models->params[0] = 5.0;
-    mySrc->models->params[1] = 70.0;
-    mySrc->models->params[2] = (psF32) (TST16_NUM_ROWS / 2);
-    mySrc->models->params[3] = (psF32) (TST16_NUM_COLS / 2);
-    mySrc->models->params[4] = 1.0;
-    mySrc->models->params[5] = 1.0;
-    mySrc->models->params[6] = 2.0;
+    mySrc->models->params->data.F32[0] = 5.0;
+    mySrc->models->params->data.F32[1] = 70.0;
+    mySrc->models->params->data.F32[2] = (psF32) (TST16_NUM_ROWS / 2);
+    mySrc->models->params->data.F32[3] = (psF32) (TST16_NUM_COLS / 2);
+    mySrc->models->params->data.F32[4] = 1.0;
+    mySrc->models->params->data.F32[5] = 1.0;
+    mySrc->models->params->data.F32[6] = 2.0;
 
     printf("----------------------------------------------------------------------------------\n");
@@ -1862,11 +1874,11 @@
 
 
-    mySrc->models->params[0] = 5.0;
-    mySrc->models->params[1] = 70.0;
-    mySrc->models->params[2] = (psF32) (TST20_NUM_ROWS / 2);
-    mySrc->models->params[3] = (psF32) (TST20_NUM_COLS / 2);
-    mySrc->models->params[4] = 1.0;
-    mySrc->models->params[5] = 1.0;
-    mySrc->models->params[6] = 2.0;
+    mySrc->models->params->data.F32[0] = 5.0;
+    mySrc->models->params->data.F32[1] = 70.0;
+    mySrc->models->params->data.F32[2] = (psF32) (TST20_NUM_ROWS / 2);
+    mySrc->models->params->data.F32[3] = (psF32) (TST20_NUM_COLS / 2);
+    mySrc->models->params->data.F32[4] = 1.0;
+    mySrc->models->params->data.F32[5] = 1.0;
+    mySrc->models->params->data.F32[6] = 2.0;
 
     printf("----------------------------------------------------------------------------------\n");
