Index: /issm/trunk-jpl/src/c/Makefile.am
===================================================================
--- /issm/trunk-jpl/src/c/Makefile.am	(revision 14632)
+++ /issm/trunk-jpl/src/c/Makefile.am	(revision 14633)
@@ -61,4 +61,6 @@
 					./classes/IssmComm.h\
 					./classes/IssmComm.cpp\
+					./classes/ToolkitOptions.h\
+					./classes/ToolkitOptions.cpp\
 					./classes/Hook.h\
 					./classes/Hook.cpp\
Index: /issm/trunk-jpl/src/c/classes/ToolkitOptions.cpp
===================================================================
--- /issm/trunk-jpl/src/c/classes/ToolkitOptions.cpp	(revision 14633)
+++ /issm/trunk-jpl/src/c/classes/ToolkitOptions.cpp	(revision 14633)
@@ -0,0 +1,89 @@
+/*! \file ToolkitOptions.cpp
+ * \brief  file containing the methods for ToolkitOptions.h
+ */
+
+#ifdef HAVE_CONFIG_H
+	#include <config.h>
+#else
+#error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!"
+#endif
+
+#include "./ToolkitOptions.h"
+#include "../include/types.h"
+#include "../include/macros.h"
+#include "../shared/Exceptions/exceptions.h"
+#include "../shared/Alloc/alloc.h"
+
+void ToolkitOptions::Init(char* options){ /*{{{*/
+
+	/*First, avoid a leak: */
+	xDelete<char>(toolkitoptions);
+
+	/*copy options into toolkitoptions:*/
+	toolkitoptions= xNew<char>(strlen(options)+1); 
+	sprintf(toolkitoptions,   "%s",options);
+
+
+}/*}}}*/
+char* ToolkitOptions::GetToolkitType(){  /*{{{*/
+
+	/*Look for token: -toolkit, and return value:*/
+
+	return TokenValue(toolkitoptions,"toolkit");
+
+}/*}}}*/
+char* TokenValue(char* tokenlist,char* target){ /*{{{*/
+
+	/*output:*/
+	char* value=NULL;
+
+	/*intermediary: */
+	char *token = NULL;
+	char* tokenlistcopy=NULL;
+
+	/*First, because tokenizing destroys a string, copy what we have: */
+	tokenlistcopy= xNew<char>(strlen(tokenlist)+1); 
+	sprintf(tokenlistcopy,   "%s",tokenlist);
+
+	/*Now go through list of tokens, and look for  target, return value: */
+	token=strtok(tokenlistcopy, " ");
+	while(token != NULL) {
+
+		/*Is this token starting with "-", if so, compare to our target: */
+		if (strncmp(token,"-",1)==0){
+			if (strcmp(token+1,target)==0){
+				/*Ok, we found our target. Get next token: */
+				token = strtok(NULL, " ");
+				/*This token could actually be another option start with "-", just be sure: */
+				if (strncmp(token,"-",1)==0){
+					/*ok, we hit another option, which means our target value is "":*/
+					value= xNew<char>(strlen("")+1); 
+					sprintf(value,"%s","");
+					continue;
+				}
+				else{
+					/*this token is the value we are looking for, copy: */
+					value= xNew<char>(strlen(token)+1); 
+					sprintf(value,"%s",token);
+				}
+			}
+			else{
+				/*we found the wrong target. Go to the next option: */
+				token = strtok(NULL, " ");
+				if (strncmp(token,"-",1)==0){
+					/*this is indeed an option, continue: */
+					continue;
+				}
+				else{
+					/*this is the value of the option, discard it: */
+				}
+			}
+		}
+		else _error_("token list should start with an option, not a value");
+
+		/*Get new token and continue*/
+		token = strtok(NULL, " ");
+	}
+	return value;
+}
+/*}}}*/
Index: /issm/trunk-jpl/src/c/classes/ToolkitOptions.h
===================================================================
--- /issm/trunk-jpl/src/c/classes/ToolkitOptions.h	(revision 14633)
+++ /issm/trunk-jpl/src/c/classes/ToolkitOptions.h	(revision 14633)
@@ -0,0 +1,31 @@
+/* \file ToolkitOptions.h
+ * \brief  create a class with a static string of options, and static methods to access it
+ * This is a way of protecting access to the toolkit options, and to make it accessible everywhere
+ * in the code.
+ */
+
+#ifndef _TOOLKIT_OPTIONS_H
+#define _TOOLKIT_OPTIONS_H
+
+/*{{{*/
+#ifdef HAVE_CONFIG_H
+	#include <config.h>
+#else
+#error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!"
+#endif
+
+#include "../include/types.h"
+/*}}}*/
+
+class ToolkitOptions {
+
+	private:
+		static char* toolkitoptions;
+
+	public:
+		static void Init(char* options);
+		static char* GetToolkitType(void);
+};
+char* TokenValue(char* tokenlist,char* target);
+
+#endif  /* _TOOLKIT_OPTIONS_H */
Index: /issm/trunk-jpl/src/c/classes/classes.h
===================================================================
--- /issm/trunk-jpl/src/c/classes/classes.h	(revision 14632)
+++ /issm/trunk-jpl/src/c/classes/classes.h	(revision 14633)
@@ -32,4 +32,5 @@
 #include "./AdolcEdf.h"
 #include "./IssmComm.h"
+#include "./ToolkitOptions.h"
 #include "./RiftStruct.h"
 
Index: /issm/trunk-jpl/src/c/include/globals.h
===================================================================
--- /issm/trunk-jpl/src/c/include/globals.h	(revision 14632)
+++ /issm/trunk-jpl/src/c/include/globals.h	(revision 14633)
@@ -3,12 +3,17 @@
  */
 
-#ifndef GLOBALS_H_
-#define GLOBALS_H_
+#ifndef _GLOBALS_H_
+#define _GLOBALS_H_
 
 #include "./types.h"
 #include "../classes/IssmComm.h"
+#include "../classes/ToolkitOptions.h"
 
+/*Communicators: */
 COMM IssmComm::comm;
 bool IssmComm::parallel;
 
+/*String that is used to characterize our toolkits, ends up in Petsc Options database if we use Petsc. Can also be used to characterize the ISSM toolkit, often used when Petsc is not allowed*/
+char* ToolkitOptions::toolkitoptions;
+
 #endif
Index: /issm/trunk-jpl/src/c/shared/Numerics/ToolkitsOptionsFromAnalysis.cpp
===================================================================
--- /issm/trunk-jpl/src/c/shared/Numerics/ToolkitsOptionsFromAnalysis.cpp	(revision 14632)
+++ /issm/trunk-jpl/src/c/shared/Numerics/ToolkitsOptionsFromAnalysis.cpp	(revision 14633)
@@ -1,4 +1,5 @@
 /*!\file:  ToolkitsOptionsFromAnalysis.cpp
- * \brief: this is mainly for the case where we run our toolkits using petsc. In this case, we need to 
+ * \brief: for each analysis, setup the issmoptions string. 
+ * This is mainly for the case where we run our toolkits using petsc. In this case, we need to 
  * plug our toolkits options directly into the petsc options database. This is the case for each analysis type 
  * and parameters
@@ -11,5 +12,5 @@
 #endif
 
-#include "../../classes/objects/objects.h"
+#include "../../classes/classes.h"
 #include "../../Container/Parameters.h"
 #include "../../toolkits/toolkits.h"
@@ -17,32 +18,32 @@
 void ToolkitsOptionsFromAnalysis(Parameters* parameters,int analysis_type){
 
-	/*intermediary: */
 	char* options=NULL;
-
+	
 	/*Recover first the options string for this analysis: */
 	options=OptionsFromAnalysis(parameters,analysis_type);
 
-	/*now, reset the petsc options database with this string. Taken from petsc/install/src/sys/objects/pinit.c. This 
-	 *capability is not covered by Petsc!: */
+	/*Initialize our Toolkit Options: */
+	ToolkitOptions::Init(options);
 
 	#ifdef _HAVE_PETSC_
+		/*In case we are using PETSC, we do not rely on issmoptions. Instead, we dump issmoptions into the Petsc 
+		 * options database: */
 
-	#if _PETSC_MAJOR_ == 2 
-	PetscOptionsDestroy();
-	PetscOptionsCreate();
-	//PetscOptionsCheckInitial_Private();
-	//PetscOptionsCheckInitial_Components();
-	PetscOptionsSetFromOptions();
-	PetscOptionsInsertMultipleString(options); //our patch
-	#else
-	PetscOptionsSetFromOptions();
-	PetscOptionsClear();
-	//PetscOptionsSetFromOptions();
-	PetscOptionsInsertMultipleString(options); //our patch
-	#endif
+		#if _PETSC_MAJOR_ == 2 
+		PetscOptionsDestroy();
+		PetscOptionsCreate();
+		//PetscOptionsCheckInitial_Private();
+		//PetscOptionsCheckInitial_Components();
+		PetscOptionsSetFromOptions();
+		PetscOptionsInsertMultipleString(options); //our patch
+		#else
+		PetscOptionsSetFromOptions();
+		PetscOptionsClear();
+		//PetscOptionsSetFromOptions();
+		PetscOptionsInsertMultipleString(options); //our patch
+		#endif
 
 	#endif
-
-	/*Free ressources:*/
+		
 	xDelete<char>(options);
 }
Index: /issm/trunk-jpl/src/c/toolkits/toolkits.h
===================================================================
--- /issm/trunk-jpl/src/c/toolkits/toolkits.h	(revision 14632)
+++ /issm/trunk-jpl/src/c/toolkits/toolkits.h	(revision 14633)
@@ -27,3 +27,4 @@
 #include "./toolkitsenums.h"
 #include "./issm/issmtoolkit.h"
+#include "../classes/ToolkitOptions.h"
 #endif
