Index: /trunk/psLib/src/collections/Makefile
===================================================================
--- /trunk/psLib/src/collections/Makefile	(revision 1227)
+++ /trunk/psLib/src/collections/Makefile	(revision 1228)
@@ -3,6 +3,6 @@
 ##  Makefile:   collections
 ##
-##  $Revision: 1.23 $  $Name: not supported by cvs2svn $
-##  $Date: 2004-07-09 21:48:07 $
+##  $Revision: 1.24 $  $Name: not supported by cvs2svn $
+##  $Date: 2004-07-15 22:18:02 $
 ##
 ##  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -36,5 +36,6 @@
            psList.o \
            psScalar.o \
-           psCompare.o
+           psCompare.o \
+           psArray.o
 
 # Define PHONY target "all" which will make all the necessary items
Index: /trunk/psLib/src/collections/psArray.c
===================================================================
--- /trunk/psLib/src/collections/psArray.c	(revision 1228)
+++ /trunk/psLib/src/collections/psArray.c	(revision 1228)
@@ -0,0 +1,120 @@
+/** @file  psArray.c
+ *
+ *  @brief Contains support for basic vector types
+ *
+ *  This file defines the basic type for a vector struct and functions useful
+ *  in manupulating vectors.
+ *
+ *  @author Ross Harman, MHPCC
+ *
+ *  @version $Revision: 1.9 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-07-15 22:18:02 $
+ *
+ *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
+ */
+
+/******************************************************************************/
+/*  INCLUDE FILES                                                             */
+/******************************************************************************/
+#include<stdlib.h>            // for qsort, etc.
+
+#include "psMemory.h"
+#include "psError.h"
+#include "psArray.h"
+#include "psLogMsg.h"
+
+
+/*****************************************************************************/
+/*  FUNCTION IMPLEMENTATION - LOCAL                                          */
+/*****************************************************************************/
+static void arrayFree(psArray *restrict psArr);
+
+/*****************************************************************************/
+/* FUNCTION IMPLEMENTATION - PUBLIC                                          */
+/*****************************************************************************/
+psArray* psArrayAlloc(unsigned int nalloc)
+{
+    psArray *psArr = NULL;
+
+    // Invalid nalloc
+    if(nalloc < 1) {
+        psError(__func__, "Invalid value for nalloc. nalloc: %d\n", nalloc);
+        return NULL;
+    }
+
+    // Create vector struct
+    psArr = (psArray *)psAlloc(sizeof(psArray));
+    p_psMemSetDeallocator(psArr,(psFreeFcn)arrayFree);
+
+    psArr->nalloc = nalloc;
+    psArr->n = nalloc;
+
+    // Create vector data array
+    psArr->data = psAlloc(nalloc*sizeof(psPTR));
+
+    return psArr;
+}
+
+psArray *psArrayRealloc(unsigned int nalloc, psArray *restrict in)
+{
+    // Invalid nalloc
+    if(nalloc < 1) {
+        psError(__func__, "Invalid value for realloc (%d)\n", nalloc);
+        return NULL;
+    }
+
+    if(in == NULL) {
+        psError(__func__, "Null input vector\n");
+        return NULL;
+    } else if(in->nalloc != nalloc) {                    // No need to realloc to same size
+        if(nalloc < in->n) {
+            for (int i = nalloc; i < in->n; i++) {   // For reduction in vector size
+                psFree(in->data[i]);
+            }
+            in->n = nalloc;
+        }
+
+        // Realloc after decrementation to avoid accessing freed array elements
+        in->data = psRealloc(in->data,nalloc*sizeof(psPTR));
+        in->nalloc = nalloc;
+    }
+
+    return in;
+}
+
+static void arrayFree(psArray *restrict psArr)
+{
+    if (psArr == NULL) {
+        return;
+    }
+
+    psArrayElementFree(psArr);
+
+    psFree(psArr->data);
+}
+
+void psArrayElementFree(psArray *restrict psArr)
+{
+
+    if(psArr == NULL) {
+        return;
+    }
+
+    for(int i = 0; i < psArr->n; i++) {
+        psFree(psArr->data[i]);
+        psArr->data[i] = NULL;
+    }
+}
+
+psArray* psArraySort(psArray* in, psComparePtrFcn compare)
+{
+    if (in == NULL) {
+        return NULL;
+    }
+
+    qsort(in->data, in->n, sizeof(psPTR),
+          (int(*)(const void *, const void *))compare);
+
+
+    return in;
+}
Index: /trunk/psLib/src/collections/psArray.h
===================================================================
--- /trunk/psLib/src/collections/psArray.h	(revision 1228)
+++ /trunk/psLib/src/collections/psArray.h	(revision 1228)
@@ -0,0 +1,92 @@
+/** @file  psArray.h
+ *
+ *  @brief Contains basic array definitions and operations
+ *
+ *  This file defines the basic type for a array struct and functions useful
+ *  in manupulating arrays.
+ *
+ *  @ingroup Array
+ *
+ *  @author Robert DeSonia, MHPCC
+ *  @author Ross Harman, MHPCC
+ *
+ *  @version $Revision: 1.11 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-07-15 22:18:02 $
+ *
+ *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
+ */
+
+#ifndef PS_ARRAY_H
+#define PS_ARRAY_H
+
+#include "psType.h"
+#include "psCompare.h"
+
+/// @addtogroup Array
+/// @{
+
+/** An array to support primitive types.
+ *
+ * Struct for maintaining an array of frequently used primitive types.
+ *
+ */
+typedef struct
+{
+    unsigned int nalloc;                ///< Total number of elements available.
+    unsigned int n;                     ///< Number of elements in use.
+    psPTR* data;                        ///< An Array of pointer elements
+}
+psArray;
+
+/*****************************************************************************/
+/* FUNCTION PROTOTYPES                                                       */
+/*****************************************************************************/
+
+/** Allocate an array.
+ *
+ * Uses psLib memory allocation functions to create an array collection of 
+ * data
+ *
+ * @return psArray*: Pointer to psArray.
+ *
+ */
+psArray *psArrayAlloc(
+    unsigned int nalloc                 ///< Total number of elements to make available.
+);
+
+/** Reallocate an array.
+ *
+ * Uses psLib memory allocation functions to reallocate an array collection 
+ * of data. 
+ *
+ * @return psArray*: Pointer to psArray.
+ *
+ */
+psArray *psArrayRealloc(
+    unsigned int nalloc,                ///< Total number of elements to make available.
+    psArray *restrict psArr            ///< array to reallocate.
+);
+
+/** Deallocate/Dereference elements of an array.
+ *
+ * Uses psLib memory allocation functions to deallocate/dereference elements 
+ * of a array of void pointers.  The array psArr is not freed, and its elements
+ * will all be set to NULL.
+ *
+ */
+void psArrayElementFree(
+    psArray *restrict psArr    ///< Void pointer array to destroy.
+);
+
+/** Sort the array according to an external compare function.
+ *
+ *  Sorts an array via the specification of a comparison function
+ *  to specify how the objects on the array should be sorted.
+ *
+ *  @return psArray*       The sorted array.
+ */
+psArray* psArraySort(psArray* in, psComparePtrFcn compare);
+
+/// @}
+
+#endif
Index: /trunk/psLib/src/collections/psList.c
===================================================================
--- /trunk/psLib/src/collections/psList.c	(revision 1227)
+++ /trunk/psLib/src/collections/psList.c	(revision 1228)
@@ -6,6 +6,6 @@
  *  @author Robert Daniel DeSonia, MHPCC
  *
- *  @version $Revision: 1.10 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-07-08 01:05:00 $
+ *  @version $Revision: 1.11 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-07-15 22:18:02 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -401,9 +401,9 @@
  * Convert a psList to/from a psVoidPtrArray
  */
-psVector* psListToVector(psList* restrict list)
+psArray* psListToArray(psList* restrict list)
 {
     psListElem* ptr;
     unsigned int n;
-    psVector* restrict arr;
+    psArray* restrict arr;
 
     if (list == NULL) {
@@ -412,7 +412,7 @@
 
     if (list->size > 0) {
-        arr = psVectorAlloc(list->size, PS_TYPE_PTR);
-    } else {
-        arr = psVectorAlloc(1, PS_TYPE_PTR);
+        arr = psArrayAlloc(list->size);
+    } else {
+        arr = psArrayAlloc(1);
     }
 
@@ -422,5 +422,5 @@
     n = list->size;
     for (int i = 0; i < n; i++) {
-        arr->data.PTR[i] = psMemIncrRefCounter(ptr->data);
+        arr->data[i] = psMemIncrRefCounter(ptr->data);
         ptr = ptr->next;
     }
@@ -429,5 +429,5 @@
 }
 
-psList* psVectorToList(psVector* arr)
+psList* psArrayToList(psArray* arr)
 {
     unsigned int n;
@@ -435,9 +435,4 @@
 
     if (arr == NULL) {
-        return NULL;
-    }
-
-    if (arr->type.type != PS_TYPE_PTR) {
-        psError(__func__,"Can not convert a non pointer-vector to a linked list.");
         return NULL;
     }
@@ -446,5 +441,5 @@
     n = arr->n;
     for (int i = 0; i < n; i++) {
-        psListAdd(list,arr->data.PTR[i],PS_LIST_TAIL);
+        psListAdd(list,arr->data[i],PS_LIST_TAIL);
     }
 
@@ -455,5 +450,5 @@
 psList* psListSort(psList* list, psComparePtrFcn compare)
 {
-    psVector* vector;
+    psArray* arr;
     if (list == NULL) {
         return NULL;
@@ -461,13 +456,12 @@
 
     // convert to indexable vector for use by qsort.
-    vector = psListToVector(list);
+    arr = psListToArray(list);
     psFree(list);
 
-    qsort(vector->data.V, vector->n, sizeof(void*),
-          (int(*)(const void *, const void *))compare);
+    arr = psArraySort(arr,compare);
 
     // convert back to linked list
-    list = psVectorToList(vector);
-    psFree(vector);
+    list = psArrayToList(arr);
+    psFree(arr);
 
     return list;
Index: /trunk/psLib/src/collections/psList.d
===================================================================
--- /trunk/psLib/src/collections/psList.d	(revision 1227)
+++ /trunk/psLib/src/collections/psList.d	(revision 1228)
@@ -1,3 +1,3 @@
 psList.o psList.d : psList.c ../sysUtils/psError.h ../sysUtils/psAbort.h \
-  ../sysUtils/psMemory.h psList.h psCompare.h psVector.h psType.h \
+  ../sysUtils/psMemory.h psList.h psCompare.h psArray.h psType.h \
   ../sysUtils/psTrace.h ../sysUtils/psLogMsg.h
Index: /trunk/psLib/src/collections/psList.h
===================================================================
--- /trunk/psLib/src/collections/psList.h	(revision 1227)
+++ /trunk/psLib/src/collections/psList.h	(revision 1228)
@@ -10,6 +10,6 @@
  *  @ingroup LinkedList
  *
- *  @version $Revision: 1.8 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-07-08 01:05:00 $
+ *  @version $Revision: 1.9 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-07-15 22:18:02 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -20,5 +20,5 @@
 
 #include "psCompare.h"
-#include "psVector.h"
+#include "psArray.h"
 
 /** @addtogroup LinkedList
@@ -156,8 +156,8 @@
 /** Convert a linked list to an array
  *
- *  @return psVector*   A new psVector populated with elements from the list,
+ *  @return psArray*   A new psArray populated with elements from the list,
  *                      or NULL if the given dlist parameter is NULL.
  */
-psVector* psListToVector(
+psArray* psListToArray(
     psList *dlist                      ///< List to convert
 );
@@ -165,9 +165,9 @@
 /** Convert array to a doubly-linked list
  *
- *  @return psList*     A new psList populated with elements formt the psVector,
+ *  @return psList*     A new psList populated with elements formt the psArray,
  *                      or NULL is the given arr parameter is NULL.
  */
-psList* psVectorToList(
-    psVector* arr                      ///< vector to convert
+psList* psArrayToList(
+    psArray* arr                      ///< vector to convert
 );
 
Index: /trunk/psLib/src/collections/psVector.c
===================================================================
--- /trunk/psLib/src/collections/psVector.c	(revision 1227)
+++ /trunk/psLib/src/collections/psVector.c	(revision 1228)
@@ -8,6 +8,6 @@
  *  @author Ross Harman, MHPCC
  *
- *  @version $Revision: 1.12 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-06-26 00:24:30 $
+ *  @version $Revision: 1.13 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-07-15 22:18:02 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -100,9 +100,4 @@
         elementSize = PSELEMTYPE_SIZEOF(elemType);
         if(nalloc < in->n) {
-            if (elemType == PS_TYPE_PTR) {
-                for (int i = nalloc; i < in->n; i++) {   // For reduction in vector size
-                    psMemDecrRefCounter(in->data.PTR[i]);
-                }
-            }
             in->n = nalloc;
         }
@@ -139,12 +134,4 @@
 
 
-    // if vector of pointers, dereference old values.
-    if (elemType == PS_TYPE_PTR) {
-        for (int i = 0; i < in->n; i++) {   // For reduction in vector size
-            psMemDecrRefCounter(in->data.PTR[i]);
-            in->data.PTR[i] = NULL;
-        }
-    }
-
     in->data.V = psRealloc(in->data.V,nalloc*PSELEMTYPE_SIZEOF(type));
 
@@ -162,30 +149,4 @@
     }
 
-    if (psVec->type.type == PS_TYPE_PTR) {
-        for(int i = 0; i < psVec->n; i++) {
-            psFree(psVec->data.PTR[i]);
-            psVec->data.PTR[i] = NULL;
-        }
-    }
-
     psFree(psVec->data.V);
 }
-
-void psVectorElementFree(psVector *restrict psVec)
-{
-
-    if(psVec == NULL) {
-        return;
-    }
-
-    if (psVec->type.type != PS_TYPE_PTR) {
-        psLogMsg(__func__,PS_LOG_WARN,"psVectorElementFree only operates on void* vectors");
-        return;
-    }
-
-    for(int i = 0; i < psVec->n; i++) {
-        psFree(psVec->data.PTR[i]);
-        psVec->data.PTR[i] = NULL;
-    }
-}
-
Index: /trunk/psLib/src/collections/psVector.h
===================================================================
--- /trunk/psLib/src/collections/psVector.h	(revision 1227)
+++ /trunk/psLib/src/collections/psVector.h	(revision 1228)
@@ -11,6 +11,6 @@
  *  @author Ross Harman, MHPCC
  *
- *  @version $Revision: 1.11 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-06-23 23:00:15 $
+ *  @version $Revision: 1.12 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-07-15 22:18:02 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -49,5 +49,4 @@
         psC32   *C32;                   ///< Single-precision complex data.
         psC64   *C64;                   ///< Double-precision complex data.
-        psPTR   *PTR;                   ///< Void pointers.
         psPTR    V;                     ///< Pointer to data.
     } data;                             ///< Union for data types.
@@ -100,16 +99,4 @@
 );
 
-/** Deallocate/Dereference elements of a void pointer vector.
- *
- * Uses psLib memory allocation functions to deallocate/dereference elements of a vector of void pointers.
- * This function does not free the vector elements unless the user provides a elemFree function
- * pointer. If the elemFree function pointer is NULL, the reference cound of the elements are decremented
- * without being freed.  The vector psVec is not freed, and its elements will all be set to NULL.
- *
- */
-void psVectorElementFree(
-    psVector *restrict psVec    ///< Void pointer vector to destroy.
-);
-
 /// @}
 
Index: /trunk/psLib/src/mathtypes/psVector.c
===================================================================
--- /trunk/psLib/src/mathtypes/psVector.c	(revision 1227)
+++ /trunk/psLib/src/mathtypes/psVector.c	(revision 1228)
@@ -8,6 +8,6 @@
  *  @author Ross Harman, MHPCC
  *
- *  @version $Revision: 1.12 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-06-26 00:24:30 $
+ *  @version $Revision: 1.13 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-07-15 22:18:02 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -100,9 +100,4 @@
         elementSize = PSELEMTYPE_SIZEOF(elemType);
         if(nalloc < in->n) {
-            if (elemType == PS_TYPE_PTR) {
-                for (int i = nalloc; i < in->n; i++) {   // For reduction in vector size
-                    psMemDecrRefCounter(in->data.PTR[i]);
-                }
-            }
             in->n = nalloc;
         }
@@ -139,12 +134,4 @@
 
 
-    // if vector of pointers, dereference old values.
-    if (elemType == PS_TYPE_PTR) {
-        for (int i = 0; i < in->n; i++) {   // For reduction in vector size
-            psMemDecrRefCounter(in->data.PTR[i]);
-            in->data.PTR[i] = NULL;
-        }
-    }
-
     in->data.V = psRealloc(in->data.V,nalloc*PSELEMTYPE_SIZEOF(type));
 
@@ -162,30 +149,4 @@
     }
 
-    if (psVec->type.type == PS_TYPE_PTR) {
-        for(int i = 0; i < psVec->n; i++) {
-            psFree(psVec->data.PTR[i]);
-            psVec->data.PTR[i] = NULL;
-        }
-    }
-
     psFree(psVec->data.V);
 }
-
-void psVectorElementFree(psVector *restrict psVec)
-{
-
-    if(psVec == NULL) {
-        return;
-    }
-
-    if (psVec->type.type != PS_TYPE_PTR) {
-        psLogMsg(__func__,PS_LOG_WARN,"psVectorElementFree only operates on void* vectors");
-        return;
-    }
-
-    for(int i = 0; i < psVec->n; i++) {
-        psFree(psVec->data.PTR[i]);
-        psVec->data.PTR[i] = NULL;
-    }
-}
-
Index: /trunk/psLib/src/mathtypes/psVector.h
===================================================================
--- /trunk/psLib/src/mathtypes/psVector.h	(revision 1227)
+++ /trunk/psLib/src/mathtypes/psVector.h	(revision 1228)
@@ -11,6 +11,6 @@
  *  @author Ross Harman, MHPCC
  *
- *  @version $Revision: 1.11 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-06-23 23:00:15 $
+ *  @version $Revision: 1.12 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-07-15 22:18:02 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -49,5 +49,4 @@
         psC32   *C32;                   ///< Single-precision complex data.
         psC64   *C64;                   ///< Double-precision complex data.
-        psPTR   *PTR;                   ///< Void pointers.
         psPTR    V;                     ///< Pointer to data.
     } data;                             ///< Union for data types.
@@ -100,16 +99,4 @@
 );
 
-/** Deallocate/Dereference elements of a void pointer vector.
- *
- * Uses psLib memory allocation functions to deallocate/dereference elements of a vector of void pointers.
- * This function does not free the vector elements unless the user provides a elemFree function
- * pointer. If the elemFree function pointer is NULL, the reference cound of the elements are decremented
- * without being freed.  The vector psVec is not freed, and its elements will all be set to NULL.
- *
- */
-void psVectorElementFree(
-    psVector *restrict psVec    ///< Void pointer vector to destroy.
-);
-
 /// @}
 
Index: /trunk/psLib/src/pslib.h
===================================================================
--- /trunk/psLib/src/pslib.h	(revision 1227)
+++ /trunk/psLib/src/pslib.h	(revision 1228)
@@ -8,6 +8,6 @@
  *  @author Eric Van Alst, MHPCC
  *   
- *  @version $Revision: 1.11 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-07-15 19:01:28 $
+ *  @version $Revision: 1.12 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-07-15 22:18:02 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -73,4 +73,6 @@
 #include "psVector.h"
 
+#include "psArray.h"
+
 /// @defgroup Image Image Container
 /// @ingroup DataContainer
Index: /trunk/psLib/src/sysUtils/psHash.d
===================================================================
--- /trunk/psLib/src/sysUtils/psHash.d	(revision 1227)
+++ /trunk/psLib/src/sysUtils/psHash.d	(revision 1228)
@@ -1,3 +1,3 @@
 psHash.o psHash.d : psHash.c psHash.h ../collections/psList.h \
-  ../collections/psCompare.h ../collections/psVector.h \
+  ../collections/psCompare.h ../collections/psArray.h \
   ../collections/psType.h psMemory.h psString.h psTrace.h psAbort.h
Index: /trunk/psLib/src/types/psArray.c
===================================================================
--- /trunk/psLib/src/types/psArray.c	(revision 1228)
+++ /trunk/psLib/src/types/psArray.c	(revision 1228)
@@ -0,0 +1,120 @@
+/** @file  psArray.c
+ *
+ *  @brief Contains support for basic vector types
+ *
+ *  This file defines the basic type for a vector struct and functions useful
+ *  in manupulating vectors.
+ *
+ *  @author Ross Harman, MHPCC
+ *
+ *  @version $Revision: 1.9 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-07-15 22:18:02 $
+ *
+ *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
+ */
+
+/******************************************************************************/
+/*  INCLUDE FILES                                                             */
+/******************************************************************************/
+#include<stdlib.h>            // for qsort, etc.
+
+#include "psMemory.h"
+#include "psError.h"
+#include "psArray.h"
+#include "psLogMsg.h"
+
+
+/*****************************************************************************/
+/*  FUNCTION IMPLEMENTATION - LOCAL                                          */
+/*****************************************************************************/
+static void arrayFree(psArray *restrict psArr);
+
+/*****************************************************************************/
+/* FUNCTION IMPLEMENTATION - PUBLIC                                          */
+/*****************************************************************************/
+psArray* psArrayAlloc(unsigned int nalloc)
+{
+    psArray *psArr = NULL;
+
+    // Invalid nalloc
+    if(nalloc < 1) {
+        psError(__func__, "Invalid value for nalloc. nalloc: %d\n", nalloc);
+        return NULL;
+    }
+
+    // Create vector struct
+    psArr = (psArray *)psAlloc(sizeof(psArray));
+    p_psMemSetDeallocator(psArr,(psFreeFcn)arrayFree);
+
+    psArr->nalloc = nalloc;
+    psArr->n = nalloc;
+
+    // Create vector data array
+    psArr->data = psAlloc(nalloc*sizeof(psPTR));
+
+    return psArr;
+}
+
+psArray *psArrayRealloc(unsigned int nalloc, psArray *restrict in)
+{
+    // Invalid nalloc
+    if(nalloc < 1) {
+        psError(__func__, "Invalid value for realloc (%d)\n", nalloc);
+        return NULL;
+    }
+
+    if(in == NULL) {
+        psError(__func__, "Null input vector\n");
+        return NULL;
+    } else if(in->nalloc != nalloc) {                    // No need to realloc to same size
+        if(nalloc < in->n) {
+            for (int i = nalloc; i < in->n; i++) {   // For reduction in vector size
+                psFree(in->data[i]);
+            }
+            in->n = nalloc;
+        }
+
+        // Realloc after decrementation to avoid accessing freed array elements
+        in->data = psRealloc(in->data,nalloc*sizeof(psPTR));
+        in->nalloc = nalloc;
+    }
+
+    return in;
+}
+
+static void arrayFree(psArray *restrict psArr)
+{
+    if (psArr == NULL) {
+        return;
+    }
+
+    psArrayElementFree(psArr);
+
+    psFree(psArr->data);
+}
+
+void psArrayElementFree(psArray *restrict psArr)
+{
+
+    if(psArr == NULL) {
+        return;
+    }
+
+    for(int i = 0; i < psArr->n; i++) {
+        psFree(psArr->data[i]);
+        psArr->data[i] = NULL;
+    }
+}
+
+psArray* psArraySort(psArray* in, psComparePtrFcn compare)
+{
+    if (in == NULL) {
+        return NULL;
+    }
+
+    qsort(in->data, in->n, sizeof(psPTR),
+          (int(*)(const void *, const void *))compare);
+
+
+    return in;
+}
Index: /trunk/psLib/src/types/psArray.h
===================================================================
--- /trunk/psLib/src/types/psArray.h	(revision 1228)
+++ /trunk/psLib/src/types/psArray.h	(revision 1228)
@@ -0,0 +1,92 @@
+/** @file  psArray.h
+ *
+ *  @brief Contains basic array definitions and operations
+ *
+ *  This file defines the basic type for a array struct and functions useful
+ *  in manupulating arrays.
+ *
+ *  @ingroup Array
+ *
+ *  @author Robert DeSonia, MHPCC
+ *  @author Ross Harman, MHPCC
+ *
+ *  @version $Revision: 1.11 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-07-15 22:18:02 $
+ *
+ *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
+ */
+
+#ifndef PS_ARRAY_H
+#define PS_ARRAY_H
+
+#include "psType.h"
+#include "psCompare.h"
+
+/// @addtogroup Array
+/// @{
+
+/** An array to support primitive types.
+ *
+ * Struct for maintaining an array of frequently used primitive types.
+ *
+ */
+typedef struct
+{
+    unsigned int nalloc;                ///< Total number of elements available.
+    unsigned int n;                     ///< Number of elements in use.
+    psPTR* data;                        ///< An Array of pointer elements
+}
+psArray;
+
+/*****************************************************************************/
+/* FUNCTION PROTOTYPES                                                       */
+/*****************************************************************************/
+
+/** Allocate an array.
+ *
+ * Uses psLib memory allocation functions to create an array collection of 
+ * data
+ *
+ * @return psArray*: Pointer to psArray.
+ *
+ */
+psArray *psArrayAlloc(
+    unsigned int nalloc                 ///< Total number of elements to make available.
+);
+
+/** Reallocate an array.
+ *
+ * Uses psLib memory allocation functions to reallocate an array collection 
+ * of data. 
+ *
+ * @return psArray*: Pointer to psArray.
+ *
+ */
+psArray *psArrayRealloc(
+    unsigned int nalloc,                ///< Total number of elements to make available.
+    psArray *restrict psArr            ///< array to reallocate.
+);
+
+/** Deallocate/Dereference elements of an array.
+ *
+ * Uses psLib memory allocation functions to deallocate/dereference elements 
+ * of a array of void pointers.  The array psArr is not freed, and its elements
+ * will all be set to NULL.
+ *
+ */
+void psArrayElementFree(
+    psArray *restrict psArr    ///< Void pointer array to destroy.
+);
+
+/** Sort the array according to an external compare function.
+ *
+ *  Sorts an array via the specification of a comparison function
+ *  to specify how the objects on the array should be sorted.
+ *
+ *  @return psArray*       The sorted array.
+ */
+psArray* psArraySort(psArray* in, psComparePtrFcn compare);
+
+/// @}
+
+#endif
Index: /trunk/psLib/src/types/psList.c
===================================================================
--- /trunk/psLib/src/types/psList.c	(revision 1227)
+++ /trunk/psLib/src/types/psList.c	(revision 1228)
@@ -6,6 +6,6 @@
  *  @author Robert Daniel DeSonia, MHPCC
  *
- *  @version $Revision: 1.10 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-07-08 01:05:00 $
+ *  @version $Revision: 1.11 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-07-15 22:18:02 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -401,9 +401,9 @@
  * Convert a psList to/from a psVoidPtrArray
  */
-psVector* psListToVector(psList* restrict list)
+psArray* psListToArray(psList* restrict list)
 {
     psListElem* ptr;
     unsigned int n;
-    psVector* restrict arr;
+    psArray* restrict arr;
 
     if (list == NULL) {
@@ -412,7 +412,7 @@
 
     if (list->size > 0) {
-        arr = psVectorAlloc(list->size, PS_TYPE_PTR);
-    } else {
-        arr = psVectorAlloc(1, PS_TYPE_PTR);
+        arr = psArrayAlloc(list->size);
+    } else {
+        arr = psArrayAlloc(1);
     }
 
@@ -422,5 +422,5 @@
     n = list->size;
     for (int i = 0; i < n; i++) {
-        arr->data.PTR[i] = psMemIncrRefCounter(ptr->data);
+        arr->data[i] = psMemIncrRefCounter(ptr->data);
         ptr = ptr->next;
     }
@@ -429,5 +429,5 @@
 }
 
-psList* psVectorToList(psVector* arr)
+psList* psArrayToList(psArray* arr)
 {
     unsigned int n;
@@ -435,9 +435,4 @@
 
     if (arr == NULL) {
-        return NULL;
-    }
-
-    if (arr->type.type != PS_TYPE_PTR) {
-        psError(__func__,"Can not convert a non pointer-vector to a linked list.");
         return NULL;
     }
@@ -446,5 +441,5 @@
     n = arr->n;
     for (int i = 0; i < n; i++) {
-        psListAdd(list,arr->data.PTR[i],PS_LIST_TAIL);
+        psListAdd(list,arr->data[i],PS_LIST_TAIL);
     }
 
@@ -455,5 +450,5 @@
 psList* psListSort(psList* list, psComparePtrFcn compare)
 {
-    psVector* vector;
+    psArray* arr;
     if (list == NULL) {
         return NULL;
@@ -461,13 +456,12 @@
 
     // convert to indexable vector for use by qsort.
-    vector = psListToVector(list);
+    arr = psListToArray(list);
     psFree(list);
 
-    qsort(vector->data.V, vector->n, sizeof(void*),
-          (int(*)(const void *, const void *))compare);
+    arr = psArraySort(arr,compare);
 
     // convert back to linked list
-    list = psVectorToList(vector);
-    psFree(vector);
+    list = psArrayToList(arr);
+    psFree(arr);
 
     return list;
Index: /trunk/psLib/src/types/psList.h
===================================================================
--- /trunk/psLib/src/types/psList.h	(revision 1227)
+++ /trunk/psLib/src/types/psList.h	(revision 1228)
@@ -10,6 +10,6 @@
  *  @ingroup LinkedList
  *
- *  @version $Revision: 1.8 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-07-08 01:05:00 $
+ *  @version $Revision: 1.9 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-07-15 22:18:02 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -20,5 +20,5 @@
 
 #include "psCompare.h"
-#include "psVector.h"
+#include "psArray.h"
 
 /** @addtogroup LinkedList
@@ -156,8 +156,8 @@
 /** Convert a linked list to an array
  *
- *  @return psVector*   A new psVector populated with elements from the list,
+ *  @return psArray*   A new psArray populated with elements from the list,
  *                      or NULL if the given dlist parameter is NULL.
  */
-psVector* psListToVector(
+psArray* psListToArray(
     psList *dlist                      ///< List to convert
 );
@@ -165,9 +165,9 @@
 /** Convert array to a doubly-linked list
  *
- *  @return psList*     A new psList populated with elements formt the psVector,
+ *  @return psList*     A new psList populated with elements formt the psArray,
  *                      or NULL is the given arr parameter is NULL.
  */
-psList* psVectorToList(
-    psVector* arr                      ///< vector to convert
+psList* psArrayToList(
+    psArray* arr                      ///< vector to convert
 );
 
