Index: ../trunk-jpl/src/c/solutions/PrintBanner.cpp
===================================================================
--- ../trunk-jpl/src/c/solutions/PrintBanner.cpp	(revision 13588)
+++ ../trunk-jpl/src/c/solutions/PrintBanner.cpp	(revision 13589)
@@ -1,15 +0,0 @@
-/*!\file: PrintBanner.cpp
- * \brief: print banner information on ISSM
- */ 
-
-#include "../include/include.h"
-#include "../shared/shared.h"
-
-void PrintBanner(void){
-
-	_pprintLine_("");
-	_pprintLine_("Ice Sheet System Model (" << PACKAGE_NAME << ") version " << PACKAGE_VERSION);
-	_pprintLine_("(website: " << PACKAGE_URL << " contact: " << PACKAGE_BUGREPORT << ")");
-	_pprintLine_("");
-}
-
Index: ../trunk-jpl/src/c/solutions/solutions.h
===================================================================
--- ../trunk-jpl/src/c/solutions/solutions.h	(revision 13588)
+++ ../trunk-jpl/src/c/solutions/solutions.h	(revision 13589)
@@ -7,6 +7,7 @@
 
 #include "../classes/objects/objects.h"
 #include "../io/io.h"
+#include "../toolkits/toolkits.h"
 
 struct OptArgs;
 class FemModel;
@@ -46,7 +47,7 @@
 void WriteLockFile(char* filename);
 void controlrestart(FemModel* femmodel,IssmDouble* J);
 void ResetBoundaryConditions(FemModel* femmodel, int analysis_type);
-void EnvironmentInit(int argc,char** argv);
+COMM EnvironmentInit(int argc,char** argv);
 void EnvironmentFinalize(void);
 int  DakotaSpawnCore(double* responses, int numresponses, double* variables, char** variables_descriptors,int numvariables, void* femmodel,int counter);
 void PrintBanner(void);
Index: ../trunk-jpl/src/c/solutions/issm.cpp
===================================================================
--- ../trunk-jpl/src/c/solutions/issm.cpp	(revision 13588)
+++ ../trunk-jpl/src/c/solutions/issm.cpp	(revision 13589)
@@ -6,17 +6,20 @@
 	
 int main(int argc,char **argv){
 
-	/*Print starting banner:*/
-	PrintBanner();
+	COMM comm_init;
 
 	/*Initialize exception trapping: */
 	ExceptionTrapBegin();
 
 	/*Initialize environment (MPI, PETSC, MUMPS, etc ...)*/
-	EnvironmentInit(argc,argv);
-		
+	comm_init=EnvironmentInit(argc,argv);
+
+	/*Hack for now: */
+	MPI_Comm_rank(comm_init,&my_rank);
+	MPI_Comm_size(comm_init,&num_procs);
+
 	/*Initialize femmodel from arguments provided command line: */
-	FemModel *femmodel = new FemModel(argc,argv);
+	FemModel *femmodel = new FemModel(argc,argv,comm_init);
 
 	/*Solve: */
 	femmodel->Solve();
Index: ../trunk-jpl/src/c/solutions/EnvironmentInit.cpp
===================================================================
--- ../trunk-jpl/src/c/solutions/EnvironmentInit.cpp	(revision 13588)
+++ ../trunk-jpl/src/c/solutions/EnvironmentInit.cpp	(revision 13589)
@@ -9,24 +9,21 @@
 #include "../include/include.h"
 #include "../toolkits/toolkits.h"
 
-void EnvironmentInit(int argc,char** argv){
-	
-	extern int my_rank;
-	extern int num_procs;
+COMM EnvironmentInit(int argc,char** argv){
 
 	/*Initialize environments: Petsc, MPI, etc...: */
 	#ifdef _HAVE_PETSC_
 	int ierr=PetscInitialize(&argc,&argv,(char*)0,"");  
 	if(ierr) _error_("Could not initialize Petsc");
+	return MPI_COMM_WORLD;
 	#else
 	#ifdef _HAVE_MPI_
 	MPI_Init(&argc,&argv);
+	return MPI_COMM_WORLD;
+	#else
+	return 1; //return bogus number for comm, which does not exist anyway.
 	#endif
 	#endif
 	
-	/*Size and rank: */
-	#ifdef _HAVE_MPI_
-	MPI_Comm_rank(MPI_COMM_WORLD,&my_rank);  
-	MPI_Comm_size(MPI_COMM_WORLD,&num_procs); 
-	#endif
+
 }
Index: ../trunk-jpl/src/c/include/globals.h
===================================================================
--- ../trunk-jpl/src/c/include/globals.h	(revision 13588)
+++ ../trunk-jpl/src/c/include/globals.h	(revision 13589)
@@ -5,6 +5,11 @@
 #ifndef GLOBALS_H_
 #define GLOBALS_H_
 
+
+#include "./types.h"
+#include "../classes/IssmComm.h"
+COMM IssmComm::comm;
+
 int my_rank=0;
 int num_procs=1;
 
Index: ../trunk-jpl/src/c/include/types.h
===================================================================
--- ../trunk-jpl/src/c/include/types.h	(revision 13588)
+++ ../trunk-jpl/src/c/include/types.h	(revision 13589)
@@ -39,4 +39,12 @@
 typedef IssmDouble IssmPDouble;
 #endif
 
+/*Define communicator: */
+#ifdef _HAVE_MPI_
+#include "mpi.h"
+typedef MPI_Comm COMM;
+#else
+typedef int COMM;
+#endif
+
 #endif //ifndef _TYPES_H_
Index: ../trunk-jpl/src/c/Makefile.am
===================================================================
--- ../trunk-jpl/src/c/Makefile.am	(revision 13588)
+++ ../trunk-jpl/src/c/Makefile.am	(revision 13589)
@@ -67,6 +67,8 @@
 					./classes/objects/Vertex.h\
 					./classes/objects/Vertex.cpp\
 					./classes/objects/AdolcEdf.h\
+					./classes/IssmComm.h\
+					./classes/IssmComm.cpp\
 					./classes/Hook.h\
 					./classes/Hook.cpp\
 					./classes/Patch.h\
@@ -342,7 +344,6 @@
 					./modules/InputToResultx/InputToResultx.h\
 					./modules/InputConvergencex/InputConvergencex.cpp\
 					./modules/InputConvergencex/InputConvergencex.h\
-					./solutions/PrintBanner.cpp\
 					./solutions/convergence.cpp\
 					./solutions/ProcessArguments.cpp\
 					./solutions/ResetBoundaryConditions.cpp\
Index: ../trunk-jpl/src/c/classes/classes.h
===================================================================
--- ../trunk-jpl/src/c/classes/classes.h	(revision 13588)
+++ ../trunk-jpl/src/c/classes/classes.h	(revision 13589)
@@ -30,5 +30,6 @@
 #include "./OptArgs.h"
 #include "./OptPars.h"
 #include "./AdolcEdf.h"
+#include "./IssmComm.h"
 
 #endif
Index: ../trunk-jpl/src/c/classes/IssmComm.cpp
===================================================================
--- ../trunk-jpl/src/c/classes/IssmComm.cpp	(revision 0)
+++ ../trunk-jpl/src/c/classes/IssmComm.cpp	(revision 13589)
@@ -0,0 +1,38 @@
+/*! \file IssmComm.cpp
+ * \brief  file containing the methods for IssmComm.h
+ */
+
+#ifdef HAVE_CONFIG_H
+	#include <config.h>
+#else
+#error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!"
+#endif
+
+#include "./IssmComm.h"
+
+void IssmComm::SetComm(COMM incomm){ /*{{{*/
+	comm=incomm;
+}/*}}}*/
+COMM IssmComm::GetComm(){  /*{{{*/
+	return comm;
+}/*}}}*/
+int IssmComm::GetRank(){  /*{{{*/
+	int my_rank;
+	#ifdef _HAVE_MPI_
+	MPI_Comm_rank(comm,&my_rank);
+	#else
+	my_rank=0;
+	#endif
+	return my_rank;
+
+}/*}}}*/
+int IssmComm::GetSize(){  /*{{{*/
+	int size;
+	#ifdef _HAVE_MPI_
+	MPI_Comm_size(comm,&size);
+	#else
+	size=1;
+	#endif
+	return size;
+
+}/*}}}*/
Index: ../trunk-jpl/src/c/classes/IoModel.cpp
===================================================================
--- ../trunk-jpl/src/c/classes/IoModel.cpp	(revision 13588)
+++ ../trunk-jpl/src/c/classes/IoModel.cpp	(revision 13589)
@@ -1339,17 +1339,17 @@
 			}
 		}
 	}
-#ifdef _HAVE_MPI_
+	#ifdef _HAVE_MPI_
 	MPI_Bcast(&found,1,MPI_INT,0,MPI_COMM_WORLD); 
 	if(!found)_error_("could not find data with name " << EnumToStringx(data_enum) << " in binary file");
-#endif
+	#endif
 
 	/*Broadcast code and vector type: */
-#ifdef _HAVE_MPI_
+	#ifdef _HAVE_MPI_
 	MPI_Bcast(&record_code,1,MPI_INT,0,MPI_COMM_WORLD); 
 	MPI_Bcast(&vector_type,1,MPI_INT,0,MPI_COMM_WORLD); 
 	if(record_code==5) MPI_Bcast(&vector_type,1,MPI_INT,0,MPI_COMM_WORLD); 
-#endif
+	#endif
 
 	/*Assign output pointers:*/
 	*pcode=record_code;
Index: ../trunk-jpl/src/c/classes/FemModel.cpp
===================================================================
--- ../trunk-jpl/src/c/classes/FemModel.cpp	(revision 13588)
+++ ../trunk-jpl/src/c/classes/FemModel.cpp	(revision 13589)
@@ -20,7 +20,7 @@
 
 /*Object constructors and destructor*/
 /*FUNCTION FemModel::FemModel(int argc,char** argv){{{*/
-FemModel::FemModel(int argc,char** argv){
+FemModel::FemModel(int argc,char** argv,COMM incomm){
 
 	/*configuration: */
 	int* analyses=NULL;
@@ -34,6 +34,13 @@
 	char *petscfilename  = NULL;
 	char *rootpath       = NULL;
 
+	/*First things first, store the communicator, and set it as a global variable: */
+	this->comm=incomm;
+	this->SetStaticComm();
+
+	/*Print starting banner:*/
+	this->PrintBanner();
+
 	/*Start profiler: */
 	this->profiler=new Profiler();
 	profiler->Tag(Start);
@@ -263,7 +270,26 @@
 
 }
 /*}}}*/
+/*FUNCTION FemModel::SetStaticComm {{{*/
+void FemModel::SetStaticComm(void){
 
+	/*This routine sets the global communicator variable hidden inside the IssmComm 
+	 *class: */
+	IssmComm::SetComm(this->comm);
+
+}
+/*}}}*/
+/*FUNCTION FemModel::PrintBanner {{{*/
+void FemModel::PrintBanner(void){
+
+	_pprintLine_("");
+	_pprintLine_("Ice Sheet System Model (" << PACKAGE_NAME << ") version " << PACKAGE_VERSION);
+	_pprintLine_("(website: " << PACKAGE_URL << " contact: " << PACKAGE_BUGREPORT << ")");
+	_pprintLine_("");
+
+}
+/*}}}*/
+
 /*Numerics: */
 /*FUNCTION FemModel::SetCurrentConfiguration(int configuration_type,int analysis_type){{{*/
 void FemModel::SetCurrentConfiguration(int configuration_type,int analysis_type){
Index: ../trunk-jpl/src/c/classes/IssmComm.h
===================================================================
--- ../trunk-jpl/src/c/classes/IssmComm.h	(revision 0)
+++ ../trunk-jpl/src/c/classes/IssmComm.h	(revision 13589)
@@ -0,0 +1,31 @@
+/* \file IssmComm.h
+ * \brief  create a class with a static comm, and static methods to access it
+ * This is a way of protecting access to the communicator.
+ */
+
+#ifndef _ISSM_COMM_H
+#define _ISSM_COMM_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 IssmComm {
+
+	private:
+		static COMM comm;
+
+	public:
+		static void SetComm(COMM incomm);
+		static COMM GetComm();
+		static int GetRank();
+		static int GetSize();
+};
+
+#endif  /* _ISSM_COMM_H */
Index: ../trunk-jpl/src/c/classes/FemModel.h
===================================================================
--- ../trunk-jpl/src/c/classes/FemModel.h	(revision 13588)
+++ ../trunk-jpl/src/c/classes/FemModel.h	(revision 13589)
@@ -43,9 +43,10 @@
 		Materials   *materials;            //one set of materials, for each element
 		Parameters  *parameters;           //one set of parameters, independent of the analysis_type
 		Results     *results;              //results that cannot be fit into the elements 
+		COMM        comm;                  //communicator for this particular model
 
 		/*constructors, destructors: */
-		FemModel(int argc,char** argv);
+		FemModel(int argc,char** argv,COMM comm_init);
 		FemModel(char* rootpath, char* inputfilename, char* outputfilename, char* petscfilename, char* lockfilename, const int solution_type,const int* analyses,const int nummodels);
 		~FemModel();
 		void InitFromFiles(char* rootpath, char* inputfilename, char* outputfilename, char* petscfilename, char* lockfilename, const int solution_type,const int* analyses,const int nummodels);
@@ -54,6 +55,8 @@
 		void Echo();
 		void Solve(void);
 		void OutputResults(void);
+		void SetStaticComm();
+		void PrintBanner(void);
 
 		/*Fem: */
 		void  SetCurrentConfiguration(int configuration_type);
