Index: trunk/psModules/src/objects/pmModelClass.c
===================================================================
--- trunk/psModules/src/objects/pmModelClass.c	(revision 14938)
+++ trunk/psModules/src/objects/pmModelClass.c	(revision 15562)
@@ -6,6 +6,6 @@
  *  @author EAM, IfA
  *
- *  @version $Revision: 1.3 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2007-09-21 00:09:05 $
+ *  @version $Revision: 1.4 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2007-11-10 01:09:20 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -57,5 +57,4 @@
 static void ModelClassFree (pmModelClass *modelClass)
 {
-
     if (modelClass == NULL)
         return;
@@ -70,8 +69,14 @@
 }
 
+bool psMemCheckModelClass(psPtr ptr)
+{
+    PS_ASSERT_PTR(ptr, false);
+    return ( psMemGetDeallocator(ptr) == (psFreeFunc) ModelClassFree);
+}
+
 void pmModelClassAdd (pmModelClass *model)
 {
     if (models == NULL) {
-        pmModelClassInit ();
+        pmModelClassInit();
     }
 
@@ -85,6 +90,7 @@
 {
     // if we do not need to init, return false;
-    if (models != NULL)
+    if (models != NULL) {
         return false;
+    }
 
     int Nnew = sizeof (defaultModels) / sizeof (pmModelClass);
@@ -100,4 +106,8 @@
 pmModelClass *pmModelClassSelect (pmModelType type)
 {
+    if (models == NULL) {
+        pmModelClassInit();
+    }
+
     if ((type < 0) || (type >= Nmodels)) {
         psError(PS_ERR_UNKNOWN, true, "Undefined pmModelType");
@@ -111,4 +121,5 @@
     psFree (models);
     models = NULL;
+    Nmodels = 0;
     return;
 }
@@ -116,4 +127,8 @@
 psS32 pmModelClassParameterCount (pmModelType type)
 {
+    if (models == NULL) {
+        pmModelClassInit();
+    }
+
     if ((type < 0) || (type >= Nmodels)) {
         psError(PS_ERR_UNKNOWN, true, "Undefined pmModelType");
@@ -125,4 +140,8 @@
 psS32 pmModelClassGetType (char *name)
 {
+    if (models == NULL) {
+        pmModelClassInit();
+    }
+
     for (int i = 0; i < Nmodels; i++) {
         if (!strcmp(models[i].name, name)) {
@@ -135,4 +154,8 @@
 char *pmModelClassGetName (pmModelType type)
 {
+    if (models == NULL) {
+        pmModelClassInit();
+    }
+
     if ((type < 0) || (type >= Nmodels)) {
         psError(PS_ERR_UNKNOWN, true, "Undefined pmModelType");
