Index: /trunk/psLib/src/math/psConstants.h
===================================================================
--- /trunk/psLib/src/math/psConstants.h	(revision 5516)
+++ /trunk/psLib/src/math/psConstants.h	(revision 5517)
@@ -6,6 +6,6 @@
  *  @author GLG, MHPCC
  *
- *  @version $Revision: 1.78 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2005-10-12 21:02:20 $
+ *  @version $Revision: 1.79 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2005-11-15 20:10:32 $
  *
  *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
@@ -222,4 +222,9 @@
 the wrong type.
 *****************************************************************************/
+#define PS_WARN_PTR_NON_NULL(NAME) \
+if ((NAME) == NULL) { \
+    psLogMsg(__func__, PS_LOG_WARN, "WARNING: %s is NULL.", #NAME); \
+} \
+
 #define PS_ASSERT_PTR_NON_NULL(NAME, RVAL) PS_ASSERT_GENERAL_PTR_NON_NULL(NAME, return RVAL)
 #define PS_ASSERT_GENERAL_PTR_NON_NULL(NAME, CLEANUP) \
@@ -501,4 +506,12 @@
     PS_POLY macros:
 *****************************************************************************/
+#define PS_ASSERT_POLY1D(NAME, RVAL) \
+if (false == psMemCheckPolynomial1D(NAME)) { \
+    psError(PS_ERR_BAD_PARAMETER_NULL, true, \
+            "Unallowable operation: argument %s is not a psPolynomial1D struct.\n",\
+            #NAME); \
+    return(RVAL); \
+} \
+
 #define PS_ASSERT_POLY_NON_NULL(NAME, RVAL) \
 if ((NAME) == NULL || (NAME)->coeff == NULL) { \
@@ -582,4 +595,23 @@
     printf("%s->coeff[%d] is %f\n", #NAME, i, NAME->coeff[i]); \
 }\
+
+/*****************************************************************************
+    PS_SPLINE macros:
+*****************************************************************************/
+#define PS_ASSERT_SPLINE(NAME, RVAL) \
+if (false == psMemCheckSpline1D(NAME)) { \
+    psError(PS_ERR_BAD_PARAMETER_NULL, true, \
+            "Unallowable operation: argument %s is not a psSpline1D struct.\n",\
+            #NAME); \
+    return(RVAL); \
+} \
+
+#define PS_ASSERT_SPLINE_NON_NULL(NAME, RVAL) \
+if ((NAME) == NULL) { \
+    psError(PS_ERR_BAD_PARAMETER_NULL, true, \
+            "Unallowable operation: psSpline1D %s is NULL.", \
+            #NAME); \
+    return(RVAL); \
+} \
 
 /*****************************************************************************
@@ -755,3 +787,8 @@
 ((A) * (A))
 
+#define PRINT_MEMLEAKS(NUM) \
+printf("A: ---------------------------------------- (ID: %d)\n", NUM); \
+memLeaks = psMemCheckLeaks(currentId,NULL,stderr,false); \
+printf("B: ---------------------------------------- (%d)\n", memLeaks); \
+
 # define PS_SWAP(X,Y) {double tmp=(X); (X) = (Y); (Y) = tmp;}
Index: /trunk/psLib/src/math/psSpline.c
===================================================================
--- /trunk/psLib/src/math/psSpline.c	(revision 5516)
+++ /trunk/psLib/src/math/psSpline.c	(revision 5517)
@@ -7,6 +7,6 @@
 *  splines.
 *
-*  @version $Revision: 1.131 $ $Name: not supported by cvs2svn $
-*  @date $Date: 2005-09-29 20:06:58 $
+*  @version $Revision: 1.132 $ $Name: not supported by cvs2svn $
+*  @date $Date: 2005-11-15 20:10:32 $
 *
 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
@@ -496,24 +496,44 @@
     PS_ASSERT_VECTOR_NON_NULL(y, NULL);
     PS_ASSERT_VECTOR_TYPE_F32_OR_F64(y, NULL);
+    PS_ASSERT_INT_LARGER_THAN_OR_EQUAL(y->n, 2, NULL);
     psS32 numSplines = (y->n)-1;
     psTrace(__func__, 5, "numSplines is %d\n", numSplines);
+
+    //
+    // Create the psSpline1D struct.
+    //
+    psSpline1D *spline = psSpline1DAlloc();
+    spline->n = numSplines;
+    spline->spline = (psPolynomial1D **) psAlloc(numSplines * sizeof(psPolynomial1D *));
+    for (psS32 i=0;i<numSplines;i++) {
+        spline->spline[i] = psPolynomial1DAlloc(3, PS_POLYNOMIAL_ORD);
+    }
+
     //
     // The following code ensures that xPtr and yPtr points to a psF32 psVector.
     //
-    psVector *xPtr = NULL;
+    // XXX: When you debug, use the vector copy and create routines here:
+    //
+
+    spline->knots = psVectorAlloc(y->n, PS_TYPE_F32);
     if (x != NULL) {
         PS_ASSERT_VECTOR_NON_NULL(x, NULL);
+        PS_ASSERT_VECTORS_SIZE_EQUAL(x, y, NULL);
         PS_ASSERT_VECTOR_TYPE_F32_OR_F64(x, NULL);
-        PS_ASSERT_VECTORS_SIZE_EQUAL(x, y, NULL);
-        // Convert x to F32 if necessary.
-        if (PS_TYPE_F64 == x->type.type) {
-            xPtr = psVectorCopy(NULL, x, PS_TYPE_F32);
-        } else if (PS_TYPE_F32 == x->type.type) {
-            xPtr = (psVector *) x;
+        if (x->type.type == PS_TYPE_F32) {
+            for (psS32 i = 0 ; i < x->n ; i++) {
+                spline->knots->data.F32[i] = x->data.F32[i];
+            }
+        } else if (x->type.type == PS_TYPE_F64) {
+            for (psS32 i = 0 ; i < x->n ; i++) {
+                spline->knots->data.F32[i] = (psF32) x->data.F64[i];
+            }
         }
     } else {
-        // Allocate an index vector for x
-        xPtr = psVectorCreate(NULL, 0.0, (psF64) y->n, 1.0, PS_TYPE_F32);
-    }
+        for (psS32 i = 0 ; i < y->n ; i++) {
+            spline->knots->data.F32[i] = (psF32) i;
+        }
+    }
+    psVector *xPtr = spline->knots;
 
     psVector *yPtr = NULL;
@@ -526,14 +546,4 @@
 
     //
-    // Create the psSpline1D struct.
-    //
-    psSpline1D *spline = psSpline1DAlloc();
-    spline->n = numSplines;
-    spline->spline = (psPolynomial1D **) psAlloc(numSplines * sizeof(psPolynomial1D *));
-    for (psS32 i=0;i<numSplines;i++) {
-        spline->spline[i] = psPolynomial1DAlloc(3, PS_POLYNOMIAL_ORD);
-    }
-    spline->knots = psVectorCopy(NULL, xPtr, PS_TYPE_F32);
-    //
     // Generate the second derivatives at each data point.
     //
@@ -548,5 +558,6 @@
         psF32 H = xPtr->data.F32[i+1] - xPtr->data.F32[i];
         if (fabs(H) <= FLT_EPSILON) {
-            psError(PS_ERR_UNKNOWN, false, "x data points are not distinct (%d %d).\n", i, i+1);
+            psError(PS_ERR_UNKNOWN, false, "x data points are not distinct (%d %d) (%f %f).\n",
+                    i, i+1, xPtr->data.F32[i], xPtr->data.F32[i+1]);
         }
         psTrace(__func__, 6, "x data (%f - %f) (%f)\n", xPtr->data.F32[i], xPtr->data.F32[i+1], H);
@@ -609,7 +620,4 @@
     }
 
-    if ((x == NULL) || (PS_TYPE_F64 == x->type.type)) {
-        psFree(xPtr);
-    }
     if (PS_TYPE_F64 == y->type.type) {
         psFree(yPtr);
@@ -618,4 +626,59 @@
     return(spline);
 }
+
+void PS_POLY1D_PRINT(
+    psPolynomial1D *poly)
+{
+    printf("-------------- PS_POLY1D_PRINT() --------------\n");
+    printf("poly->nX is %d\n", poly->nX);
+    for (psS32 i = 0 ; i < (1 + poly->nX) ; i++) {
+        printf("poly->coeff[%d] is %f\n", i, poly->coeff[i]);
+    }
+}
+
+void PS_PRINT_SPLINE2(psSpline1D *mySpline)
+{
+    printf("-------------- PS_PRINT_SPLINE2() --------------\n");
+    printf("mySpline->n is %d\n", mySpline->n);
+    for (psS32 i = 0 ; i < mySpline->n ; i++) {
+        PS_POLY1D_PRINT(mySpline->spline[i]);
+    }
+    PS_VECTOR_PRINT_F32(mySpline->knots);
+}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
 
 
@@ -650,7 +713,6 @@
         //
         psLogMsg(__func__, PS_LOG_WARN,
-                 "psSpline1DEval(): x ordinate (%f) is outside the spline range (%f - %f).",
-                 x, spline->knots->data.F32[0],
-                 spline->knots->data.F32[n-1]);
+                 "psSpline1DEval(): x ordinate (%f) is outside the spline range (%f - %f) (%d).",
+                 x, spline->knots->data.F32[0], spline->knots->data.F32[n-1], n);
 
         if (x < spline->knots->data.F32[0]) {
Index: /trunk/psLib/src/math/psSpline.h
===================================================================
--- /trunk/psLib/src/math/psSpline.h	(revision 5516)
+++ /trunk/psLib/src/math/psSpline.h	(revision 5517)
@@ -6,10 +6,12 @@
  *  and evaluate splines.
  *
+ *  XXX: What is the purpose of the SplineAlloc() function?
+ *
  *  @ingroup GROUP00
  *
  *  @author GLG, MHPCC
  *
- *  @version $Revision: 1.57 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2005-09-27 23:16:59 $
+ *  @version $Revision: 1.58 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2005-11-15 20:10:32 $
  *
  *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
Index: /trunk/psLib/src/math/psStats.c
===================================================================
--- /trunk/psLib/src/math/psStats.c	(revision 5516)
+++ /trunk/psLib/src/math/psStats.c	(revision 5517)
@@ -1,5 +1,5 @@
 /** @file  psStats.c
  *  \brief basic statistical operations
- *  @ingroup Stats
+ *  @ingroup Stat
  *
  *  This file will hold the definition of the histogram and stats data
@@ -17,6 +17,6 @@
 *
 *
-*  @version $Revision: 1.149 $ $Name: not supported by cvs2svn $
-*  @date $Date: 2005-09-24 00:46:45 $
+*  @version $Revision: 1.150 $ $Name: not supported by cvs2svn $
+*  @date $Date: 2005-11-15 20:10:32 $
 *
 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -1676,7 +1676,7 @@
     memLeaks = psMemCheckLeaks(currentId,NULL,stderr,false); \
     printf("B: ---------------------------------------- (%d)\n", memLeaks); \
-*/
 #define PRINT_MEMLEAKS(NUM) \
 memLeaks = currentId;
+*/
 
 
Index: /trunk/psLib/src/sys/psAbort.c
===================================================================
--- /trunk/psLib/src/sys/psAbort.c	(revision 5516)
+++ /trunk/psLib/src/sys/psAbort.c	(revision 5517)
@@ -10,6 +10,6 @@
  *  @author Eric Van Alst, MHPCC
  *   
- *  @version $Revision: 1.11 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2005-06-17 23:39:51 $
+ *  @version $Revision: 1.12 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2005-11-15 20:10:32 $
  *
  *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
@@ -24,5 +24,4 @@
 {
     va_list argPtr;             // variable list arguement pointer
-
     // Get the variable list parameters to pass to logging function
     va_start(argPtr, format);
Index: /trunk/psLib/src/types/psMetadata.c
===================================================================
--- /trunk/psLib/src/types/psMetadata.c	(revision 5516)
+++ /trunk/psLib/src/types/psMetadata.c	(revision 5517)
@@ -12,6 +12,6 @@
  *  @author Ross Harman, MHPCC
  *
- *  @version $Revision: 1.88 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2005-10-29 00:05:53 $
+ *  @version $Revision: 1.89 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2005-11-15 20:10:32 $
  *
  *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
@@ -966,5 +966,5 @@
         logLevel = 5;
     }
-    psLogSetLevel (logLevel);  // XXX: This function should return an error if the log level is invalid
+    psLogSetLevel(logLevel);  // XXX: This function should return an error if the log level is invalid
 
     if ( (argnum = psArgumentGet(*argc, argv, "-logfmt")) ) {
