Index: /issm/trunk/src/c/shared/String/DescriptorIndex.cpp
===================================================================
--- /issm/trunk/src/c/shared/String/DescriptorIndex.cpp	(revision 5469)
+++ /issm/trunk/src/c/shared/String/DescriptorIndex.cpp	(revision 5469)
@@ -0,0 +1,66 @@
+/*!\file:  DescriptorIndex: return type of qmu variable: indexed, scaled, nodal or regular
+ * + figure out the descriptor root. 
+ * Ex: scaled_Thickness_1 should return SCALEDENUM, fill root with Thickness, and initialize index 
+ * to 1.
+ */ 
+
+#ifdef HAVE_CONFIG_H
+	#include "config.h"
+#else
+#error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!"
+#endif
+
+#include "stdio.h"
+#include <string.h>
+#include <ctype.h>
+#include "../shared.h"
+#include "../../EnumDefinitions/EnumDefinitions.h"
+
+int  DescriptorIndex(char* root, int* pindex,char* descriptor){ //We assume root has already been allocated, and we just have to copy into it.
+	
+	char * pch=NULL;
+	
+	/*retrieve first token, separated by underscore: */
+	pch = strtok (descriptor,"_");
+	if(!pch)ISSMERROR("%s%s%s"," descriptor ",descriptor," is not correctly formatted!");
+
+	if (strncmp(pch,"scaled",6)==0){
+		/*we have a scaled variable. recover the root: */
+		pch = strtok (NULL, "_");
+		if(!pch)ISSMERROR("%s%s%s"," scaled descriptor ",descriptor," is not correctly formatted!");
+		strcpy(root,pch);
+		/*now recover  the index: */
+		pch = strtok (NULL, "_");
+		sscanf(pch,"%i",pindex);
+		if(!pch)ISSMERROR("%s%s%s"," scaled descriptor ",descriptor," is not correctly formatted!");
+		return ScaledEnum;
+	}
+	else if (strncmp(pch,"indexed",7)==0){
+		/*we have an indexed variable. recover the root: */
+		pch = strtok (NULL, "_");
+		if(!pch)ISSMERROR("%s%s%s"," indexed descriptor ",descriptor," is not correctly formatted!");
+		strcpy(root,pch);
+		/*now recover  the index: */
+		pch = strtok (NULL, "_");
+		if(!pch)ISSMERROR("%s%s%s"," indexed descriptor ",descriptor," is not correctly formatted!");
+		sscanf(pch,"%i",pindex);
+		return IndexedEnum;
+	}
+	else if (strncmp(pch,"nodal",5)==0){
+		/*we have an indexed variable. recover the root: */
+		pch = strtok (NULL, "_");
+		if(!pch)ISSMERROR("%s%s%s"," nodal descriptor ",descriptor," is not correctly formatted!");
+		strcpy(root,pch);
+		/*now recover  the index: */
+		pch = strtok (NULL, "_");
+		if(!pch)ISSMERROR("%s%s%s"," nodal descriptor ",descriptor," is not correctly formatted!");
+		sscanf(pch,"%i",pindex);
+		return NodalEnum;
+	}
+	else{
+		/*We don't have _ in the name, this is a regular variable: */
+		strcpy(root,pch);
+		*pindex=-1;
+		return RegularEnum;
+	}
+}
Index: sm/trunk/src/c/shared/String/isdistributed.cpp
===================================================================
--- /issm/trunk/src/c/shared/String/isdistributed.cpp	(revision 5468)
+++ 	(revision )
@@ -1,48 +1,0 @@
-/*!\file:  isdistributed.cpp
- * \brief: figure out if a dakota variable descriptor indicates presence of a distributed 
- * variable. For example: "rho_ice" is not distributed, but "thickness1" is. 
- * If variable is distributed, return root of the variable name (here, if would be "thickness" 
- * for variable descriptor "thickness1").
- */ 
-
-#ifdef HAVE_CONFIG_H
-	#include "config.h"
-#else
-#error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!"
-#endif
-
-#include "stdio.h"
-#include <string.h>
-#include <ctype.h>
-#include "../Alloc/alloc.h"
-
-int isdistributed(char** proot,char* name){
-
-	int i;
-
-	/*output: */
-	int   distributed=0;
-	char* root=NULL;
-
-	/*Look at the end of the string, whether it's numeric or not: */
-	if (isdigit(name[strlen(name)-1]))distributed=1;
-
-	if(distributed){
-		
-		root=(char*)xmalloc((strlen(name)+1)*sizeof(char));
-		strcpy(root,name);
-	
-		/*Start from the end, until we find a letter, which we will, otherwise error out: */
-		for(i=strlen(name)-1;i>=0;i--){
-			if (isdigit(name[i])){
-				root[i]='\0'; //finish the string here and keep looking for a letter
-			}
-			else break;
-		}
-	}
-
-	/*Assign output pointers:*/
-	*proot=root;
-	return distributed;
-}
-
Index: /issm/trunk/src/c/shared/String/sharedstring.h
===================================================================
--- /issm/trunk/src/c/shared/String/sharedstring.h	(revision 5468)
+++ /issm/trunk/src/c/shared/String/sharedstring.h	(revision 5469)
@@ -6,5 +6,5 @@
 #define  _SHAREDSTRING_H_
 
-int isdistributed(char** proot,char* name);
+int  DescriptorIndex(char* root, int* pindex,char* descriptor);
 
 #endif //ifndef _SHAREDSTRING_H_
