Index: trunk/psLib/src/mathtypes/psImage.c
===================================================================
--- trunk/psLib/src/mathtypes/psImage.c	(revision 12380)
+++ trunk/psLib/src/mathtypes/psImage.c	(revision 12381)
@@ -9,6 +9,6 @@
  *  @author Ross Harman, MHPCC
  *
- *  @version $Revision: 1.123 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2007-02-08 03:10:33 $
+ *  @version $Revision: 1.124 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2007-03-09 20:16:40 $
  *
  *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
@@ -121,22 +121,10 @@
 }
 
-bool psImageInit (psImage *image,...)
-{
-    PS_ASSERT_PTR(image, false);
-    PS_ASSERT_IMAGE_NON_NULL(image, false);
-
-    va_list argp;
-    va_start (argp, image);
-
-    switch (image->type.type) {
-        #define IMAGEINIT_INTCASE(TYPE,NATIVETYPE) \
+
+
+// Image initialisation for integer types
+#define IMAGEINIT_INTCASE(TYPE) \
     case PS_TYPE_##TYPE: { \
-            NATIVETYPE temp = va_arg(argp, NATIVETYPE); \
-            if ( temp < PS_MIN_##TYPE || temp > PS_MAX_##TYPE ) { \
-                psError(PS_ERR_BAD_PARAMETER_VALUE, true, "Error: Value %d out of Range.\n", temp); \
-                return false; \
-            } \
-            ps##TYPE value = temp; \
-            if (value == 0) { \
+            if (value == 0.0) { \
                 size_t numBytes = image->numCols * sizeof(ps##TYPE); \
                 for (int y = 0; y < image->numRows; y++) { \
@@ -144,8 +132,14 @@
                 } \
             } else { \
+                if (value < (double)PS_MIN_##TYPE || value > (double)PS_MAX_##TYPE) { \
+                    psError(PS_ERR_BAD_PARAMETER_VALUE, true, "Error: Value %f out of range for type %s.\n", \
+                            value, #TYPE); \
+                    return false; \
+                } \
+                ps##TYPE castValue = (ps##TYPE)value; \
                 for (int iy = 0; iy < image->numRows; iy++) { \
                     ps##TYPE *row = image->data.TYPE[iy]; \
                     for (int ix = 0; ix < image->numCols; ix++) { \
-                        row[ix] = value; \
+                        row[ix] = castValue; \
                     } \
                 } \
@@ -154,15 +148,23 @@
         }
 
-        IMAGEINIT_INTCASE(U8,unsigned int)
-        IMAGEINIT_INTCASE(U16,unsigned int)
-        IMAGEINIT_INTCASE(U32,unsigned int)
-        IMAGEINIT_INTCASE(S8,int)
-        IMAGEINIT_INTCASE(S16,int)
-        IMAGEINIT_INTCASE(S32,int)
-
-        #define IMAGEINIT_LONGCASE(TYPE,NATIVETYPE) \
+// Image initialisation for char-size integer types
+#define IMAGEINIT_CHARCASE(TYPE) \
     case PS_TYPE_##TYPE: { \
-            ps##TYPE value = va_arg(argp, NATIVETYPE); \
-            if (value == 0) { \
+            if (value < (double)PS_MIN_##TYPE || value > (double)PS_MAX_##TYPE) { \
+                psError(PS_ERR_BAD_PARAMETER_VALUE, true, "Error: Value %f out of range for type %s.\n", \
+                        value, #TYPE); \
+                return false; \
+            } \
+            size_t numBytes = image->numCols * sizeof(ps##TYPE); \
+            ps##TYPE castValue = (ps##TYPE)value; \
+            for (int y = 0; y < image->numRows; y++) { \
+                memset(image->data.TYPE[y], castValue, numBytes); \
+            } \
+            return true; \
+        }
+// Image initialisation for floating point types
+#define IMAGEINIT_FLOATCASE(TYPE) \
+    case PS_TYPE_##TYPE: { \
+            if (value == 0.0) { \
                 size_t numBytes = image->numCols * sizeof(ps##TYPE); \
                 for (int y = 0; y < image->numRows; y++) { \
@@ -170,8 +172,9 @@
                 } \
             } else { \
+                ps##TYPE castValue = (ps##TYPE)value; \
                 for (int iy = 0; iy < image->numRows; iy++) { \
                     ps##TYPE *row = image->data.TYPE[iy]; \
                     for (int ix = 0; ix < image->numCols; ix++) { \
-                        row[ix] = value; \
+                        row[ix] = castValue; \
                     } \
                 } \
@@ -180,31 +183,23 @@
         }
 
-        IMAGEINIT_LONGCASE(U64,unsigned long)
-        IMAGEINIT_LONGCASE(S64,long)
-
-        #define IMAGEINIT_FLOATCASE(TYPE) \
-    case PS_TYPE_##TYPE: { \
-            ps##TYPE value = va_arg(argp, psF64); \
-            if (value == 0) { \
-                size_t numBytes = image->numCols * sizeof(ps##TYPE); \
-                for (int y = 0; y < image->numRows; y++) { \
-                    memset(image->data.TYPE[y], 0, numBytes); \
-                } \
-            } else { \
-                for (int iy = 0; iy < image->numRows; iy++) { \
-                    ps##TYPE *row = image->data.TYPE[iy]; \
-                    for (int ix = 0; ix < image->numCols; ix++) { \
-                        row[ix] = value; \
-                    } \
-                } \
-            } \
-            return true; \
-        }
-
+
+bool psImageInit (psImage *image, double value)
+{
+    PS_ASSERT_PTR(image, false);
+    PS_ASSERT_IMAGE_NON_NULL(image, false);
+
+    switch (image->type.type) {
+        IMAGEINIT_CHARCASE(U8)
+        IMAGEINIT_INTCASE(U16)
+        IMAGEINIT_INTCASE(U32)
+        IMAGEINIT_CHARCASE(S8)
+        IMAGEINIT_INTCASE(S16)
+        IMAGEINIT_INTCASE(S32)
+        IMAGEINIT_INTCASE(U64)
+        IMAGEINIT_INTCASE(S64)
         IMAGEINIT_FLOATCASE(F32)
         IMAGEINIT_FLOATCASE(F64)
-
     default:
-        psError(PS_ERR_BAD_PARAMETER_TYPE, true, "datatype not defined in psImageInit\n");
+        psError(PS_ERR_BAD_PARAMETER_TYPE, true, "Type %x not supported", image->type.type);
     }
     return (false);
Index: trunk/psLib/src/mathtypes/psImage.h
===================================================================
--- trunk/psLib/src/mathtypes/psImage.h	(revision 12380)
+++ trunk/psLib/src/mathtypes/psImage.h	(revision 12381)
@@ -9,6 +9,6 @@
  * @author Joshua Hoblitt, University of Hawaii
  *
- * @version $Revision: 1.88 $ $Name: not supported by cvs2svn $
- * @date $Date: 2007-02-08 03:26:15 $
+ * @version $Revision: 1.89 $ $Name: not supported by cvs2svn $
+ * @date $Date: 2007-03-09 20:16:40 $
  * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
  */
@@ -116,5 +116,5 @@
 /** Checks the type of a particular pointer.
  *
- *  Uses the appropriate deallocation function in psMemBlock to check the ptr * datatype. 
+ *  Uses the appropriate deallocation function in psMemBlock to check the ptr * datatype.
  *  @return bool:       True if the pointer matches a psImage structure, false otherwise.
  */
@@ -131,5 +131,5 @@
 bool psImageInit(
     psImage *image,                    ///< the image to be initialized
-    ...                                ///< Variable argument list for initialization
+    double value                        ///< Value to which to initialise
 );
 
Index: trunk/psLib/src/mathtypes/psVector.c
===================================================================
--- trunk/psLib/src/mathtypes/psVector.c	(revision 12380)
+++ trunk/psLib/src/mathtypes/psVector.c	(revision 12381)
@@ -10,6 +10,6 @@
 *  @author Joshua Hoblitt, University of Hawaii
 *
-*  @version $Revision: 1.94 $ $Name: not supported by cvs2svn $
-*  @date $Date: 2007-02-08 02:59:36 $
+*  @version $Revision: 1.95 $ $Name: not supported by cvs2svn $
+*  @date $Date: 2007-03-09 20:16:40 $
 *
 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
@@ -678,181 +678,70 @@
 }
 
-
-bool psVectorInit(psVector *vector,
-                  ...)
-{
-    va_list argp;
-    psU8  vU8;
-    psU16 vU16;
-    psU32 vU32;
-    psU64 vU64;
-    psS8 vS8;
-    psS16 vS16;
-    psS32 vS32;
-    psS64 vS64;
-    psF32 vF32;
-    psF64 vF64;
-    psC32 vC32;
-    psC64 vC64;
-
-    unsigned int temp;
-    int temp2;
-
-    if (vector == NULL)
-        return (false);
-
-    va_start (argp, vector);
+// Image initialisation for integer types
+#define VECTORINIT_INTCASE(TYPE) \
+    case PS_TYPE_##TYPE: { \
+            if (value == 0.0) { \
+                memset(vector->data.TYPE, 0, vector->n * sizeof(ps##TYPE)); \
+            } else { \
+                if (value < (double)PS_MIN_##TYPE || value > (double)PS_MAX_##TYPE) { \
+                    psError(PS_ERR_BAD_PARAMETER_VALUE, true, "Error: Value %f out of range for type %s.\n", \
+                            value, #TYPE); \
+                    return false; \
+                } \
+                ps##TYPE castValue = (ps##TYPE)value; \
+                ps##TYPE *vectorData = vector->data.TYPE; \
+                for (int i = 0; i < vector->n; i++) { \
+                    vectorData[i] = castValue; \
+                } \
+            } \
+            return true; \
+        }
+
+// Image initialisation for char-size integer types
+#define VECTORINIT_CHARCASE(TYPE) \
+    case PS_TYPE_##TYPE: { \
+            if (value < (double)PS_MIN_##TYPE || value > (double)PS_MAX_##TYPE) { \
+                psError(PS_ERR_BAD_PARAMETER_VALUE, true, "Error: Value %f out of range for type %s.\n", \
+                        value, #TYPE); \
+                return false; \
+            } \
+            memset(vector->data.TYPE, (ps##TYPE)value, vector->n * sizeof(ps##TYPE)); \
+            return true; \
+        }
+
+// Image initialisation for floating point types
+#define VECTORINIT_FLOATCASE(TYPE) \
+    case PS_TYPE_##TYPE: { \
+            if (value == 0.0) { \
+                memset(vector->data.TYPE, 0, vector->n * sizeof(ps##TYPE)); \
+            } else { \
+                ps##TYPE castValue = (ps##TYPE)value; \
+                ps##TYPE *vectorData = vector->data.TYPE; \
+                for (int i = 0; i < vector->n; i++) { \
+                    vectorData[i] = castValue; \
+                } \
+            } \
+            return true; \
+        }
+
+
+
+bool psVectorInit(psVector *vector, double value)
+{
+    PS_ASSERT_VECTOR_NON_NULL(vector, false);
 
     switch (vector->type.type) {
-    case PS_TYPE_BOOL: {
-            // This is a little ugly, because psVector doesn't have a boolean type yet.
-            int temp = va_arg(argp, int);
-            bool value = temp;
-            if (!value) {
-                memset(vector->data.U8, 0, vector->n * sizeof(bool));
-            } else {
-                for (long i = 0; i < vector->n; i++) {
-                    vector->data.U8[i] = value;
-                }
-            }
-            return true;
-        }
-    case PS_TYPE_U8:
-        temp = va_arg (argp, psU32);
-        if ( temp >= PS_MIN_U8 && temp <= PS_MAX_U8 ) {
-            vU8 = temp;
-        } else {
-            psError(PS_ERR_BAD_PARAMETER_VALUE, true, "Error:  U8 Value out of Range.\n");
-            return false;
-        }
-        // Can use memset for char-size values
-        memset(vector->data.U8, vU8, vector->n * sizeof(psU8));
-        return (true);
-    case PS_TYPE_F32:
-        vF32 = (psF32)va_arg (argp, psF64);
-        if (vF32 == 0.0) {
-            memset(vector->data.F32, 0, vector->n * sizeof(psF32));
-        } else {
-            for (long iy = 0; iy < vector->n; iy++) {
-                vector->data.F32[iy] = vF32;
-            }
-        }
-        return (true);
-    case PS_TYPE_F64:
-        vF64 = va_arg (argp, psF64);
-        if (vF64 == 0.0) {
-            memset(vector->data.F64, 0, vector->n * sizeof(psF64));
-        } else {
-            for (long iy = 0; iy < vector->n; iy++) {
-                vector->data.F64[iy] = vF64;
-            }
-        }
-        return (true);
-    case PS_TYPE_U16:
-        temp = va_arg (argp, psU32);
-        if ( temp >= PS_MIN_U16 && temp <= PS_MAX_U16 )
-            vU16 = temp;
-        else {
-            psError(PS_ERR_BAD_PARAMETER_VALUE, true, "Error:  U16 Value out of Range.\n");
-            return false;
-        }
-        if (vU16 == 0) {
-            memset(vector->data.U16, 0, vector->n * sizeof(psU16));
-        } else {
-            for (long iy = 0; iy < vector->n; iy++) {
-                vector->data.U16[iy] = vU16;
-            }
-        }
-        return (true);
-    case PS_TYPE_U32:
-        vU32 = va_arg (argp, psU32);
-        if (vU32 == 0) {
-            memset(vector->data.U32, 0, vector->n * sizeof(psU32));
-        } else {
-            for (long iy = 0; iy < vector->n; iy++) {
-                vector->data.U32[iy] = vU32;
-            }
-        }
-        return (true);
-    case PS_TYPE_U64:
-        vU64 = va_arg (argp, psU64);
-        if (vU64 == 0) {
-            memset(vector->data.U64, 0, vector->n * sizeof(psU64));
-        } else {
-            for (long iy = 0; iy < vector->n; iy++) {
-                vector->data.U64[iy] = vU64;
-            }
-        }
-        return (true);
-    case PS_TYPE_S8:
-        temp2 = va_arg (argp, psS32);
-        if ( temp2 >= PS_MIN_S8 && temp2 <= PS_MAX_S8 )
-            vS8 = temp2;
-        else {
-            psError(PS_ERR_BAD_PARAMETER_VALUE, true, "Error:  S8 Value out of Range.\n");
-            return false;
-        }
-        // Can use memset for char-size values
-        memset(vector->data.S8, vS8, vector->n * sizeof(psS8));
-        return (true);
-    case PS_TYPE_S16:
-        temp2 = va_arg (argp, psS32);
-        if ( temp2 >= PS_MIN_S16 && temp2 <= PS_MAX_S16 )
-            vS16 = temp2;
-        else {
-            psError(PS_ERR_BAD_PARAMETER_VALUE, true, "Error:  S16 Value out of Range.\n");
-            return false;
-        }
-        if (vS16 == 0) {
-            memset(vector->data.S16, 0, vector->n * sizeof(psS16));
-        } else {
-            for (long iy = 0; iy < vector->n; iy++) {
-                vector->data.S16[iy] = vS16;
-            }
-        }
-        return (true);
-    case PS_TYPE_S32:
-        vS32 = va_arg (argp, psS32);
-        if (vS32 == 0) {
-            memset(vector->data.S32, 0, vector->n * sizeof(psS32));
-        } else {
-            for (long iy = 0; iy < vector->n; iy++) {
-                vector->data.S32[iy] = vS32;
-            }
-        }
-        return (true);
-    case PS_TYPE_S64:
-        vS64 = va_arg (argp, psS64);
-        if (vS64 == 0) {
-            memset(vector->data.S64, 0, vector->n * sizeof(psS64));
-        } else {
-            for (long iy = 0; iy < vector->n; iy++) {
-                vector->data.S64[iy] = vS64;
-            }
-        }
-        return (true);
-    case PS_TYPE_C32:
-        vC32 = va_arg (argp, psC32);
-        if (vC32 == 0) {
-            memset(vector->data.C32, 0, vector->n * sizeof(psC32));
-        } else {
-            for (long iy = 0; iy < vector->n; iy++) {
-                vector->data.C32[iy] = vC32;
-            }
-        }
-        return (true);
-    case PS_TYPE_C64:
-        vC64 = va_arg (argp, psC64);
-        if (vC64 == 0) {
-            memset(vector->data.C64, 0, vector->n * sizeof(psC64));
-        } else {
-            for (long iy = 0; iy < vector->n; iy++) {
-                vector->data.C64[iy] = vC64;
-            }
-        }
-        return (true);
+        VECTORINIT_CHARCASE(U8)
+        VECTORINIT_INTCASE(U16)
+        VECTORINIT_INTCASE(U32)
+        VECTORINIT_CHARCASE(S8)
+        VECTORINIT_INTCASE(S16)
+        VECTORINIT_INTCASE(S32)
+        VECTORINIT_INTCASE(U64)
+        VECTORINIT_INTCASE(S64)
+        VECTORINIT_FLOATCASE(F32)
+        VECTORINIT_FLOATCASE(F64)
     default:
-        psError (PS_ERR_BAD_PARAMETER_TYPE, true, "datatype not defined in psImageInit\n");
-        return (false);
+        psError(PS_ERR_BAD_PARAMETER_TYPE, true, "Type %x not supported", vector->type.type);
     }
     return (false);
Index: trunk/psLib/src/mathtypes/psVector.h
===================================================================
--- trunk/psLib/src/mathtypes/psVector.h	(revision 12380)
+++ trunk/psLib/src/mathtypes/psVector.h	(revision 12381)
@@ -10,6 +10,6 @@
  * @author Joshua Hoblitt, University of Hawaii
  *
- * @version $Revision: 1.65 $ $Name: not supported by cvs2svn $
- * @date $Date: 2007-02-08 02:59:36 $
+ * @version $Revision: 1.66 $ $Name: not supported by cvs2svn $
+ * @date $Date: 2007-03-09 20:16:40 $
  * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
  */
@@ -89,5 +89,5 @@
     const char *file,                   ///< File of caller
     unsigned int lineno,                ///< Line number of caller
-    const char *func,                   ///< Function name of caller 
+    const char *func,                   ///< Function name of caller
     long nalloc,                        ///< Total number of elements to make available.
     psElemType type                    ///< Type of data to be held by vector.
@@ -98,5 +98,5 @@
 //#endif // ifdef __GNUC__
 #define psVectorAlloc(nalloc, type) \
-      p_psVectorAlloc(__FILE__, __LINE__, __func__, nalloc, type) 
+      p_psVectorAlloc(__FILE__, __LINE__, __func__, nalloc, type)
 #endif // ifdef DOXYGEN
 
@@ -118,5 +118,5 @@
     const char *file,                   ///< File of caller
     unsigned int lineno,                ///< Line number of caller
-    const char *func,                   ///< Function name of caller 
+    const char *func,                   ///< Function name of caller
     long nalloc,                       ///< Total number of elements to make available.
     psElemType type                    ///< Type of data to be held by vector.
@@ -127,5 +127,5 @@
 //#endif // ifdef __GNUC__
 #define psVectorAllocEmpty(nalloc, type) \
-      p_psVectorAllocEmpty(__FILE__, __LINE__, __func__, nalloc, type) 
+      p_psVectorAllocEmpty(__FILE__, __LINE__, __func__, nalloc, type)
 #endif // ifdef DOXYGEN
 
@@ -184,5 +184,5 @@
     const char *file,                   ///< File of caller
     unsigned int lineno,                ///< Line number of caller
-    const char *func,                   ///< Function name of caller 
+    const char *func,                   ///< Function name of caller
     psVector* vector,
     ///< Vector to recycle.  If NULL, a new vector is created.  No effort
@@ -215,5 +215,5 @@
     const char *file,                   ///< File of caller
     unsigned int lineno,                ///< Line number of caller
-    const char *func,                   ///< Function name of caller 
+    const char *func,                   ///< Function name of caller
     psVector* output,                  ///< if non-NULL, a psVector to recycle
     const psVector* input,             ///< the vector to copy.
@@ -221,5 +221,5 @@
 );
 #define psVectorCopy(output, input, type) \
-      p_psVectorCopy(__FILE__, __LINE__, __func__, output, input, type) 
+      p_psVectorCopy(__FILE__, __LINE__, __func__, output, input, type)
 #endif // ifdef DOXYGEN
 
@@ -291,5 +291,5 @@
 bool psVectorInit(
     psVector *vector,                  ///< the vector to be initialized
-    ...                                ///< Variable argument list for initialization
+    double value                        ///< Value to which to initialise
 );
 
@@ -315,5 +315,5 @@
     const char *file,                   ///< File of caller
     unsigned int lineno,                ///< Line number of caller
-    const char *func,                   ///< Function name of caller 
+    const char *func,                   ///< Function name of caller
     psVector *input,                   ///< Input vector
     double lower,                      ///< lower bound
