Index: /issm/trunk/src/c/ModelProcessorx/Balancedvelocities/CreateConstraintsBalancedvelocities.cpp
===================================================================
--- /issm/trunk/src/c/ModelProcessorx/Balancedvelocities/CreateConstraintsBalancedvelocities.cpp	(revision 3455)
+++ /issm/trunk/src/c/ModelProcessorx/Balancedvelocities/CreateConstraintsBalancedvelocities.cpp	(revision 3456)
@@ -18,12 +18,9 @@
 	Spc*    spc  = NULL;
 
-	/*spc intermediary data: */
-	double* spcvelocity=NULL;
-	
 	/*Create constraints: */
 	constraints = new DataSet(ConstraintsEnum());
 
 	/*Fetch data: */
-	IoModelFetchData(&spcvelocity,NULL,NULL,iomodel_handle,"spcvelocity");
+	IoModelFetchData(&iomodel->spcvelocity,NULL,NULL,iomodel_handle,"spcvelocity");
 
 	count=1; //matlab indexing
@@ -33,8 +30,8 @@
 		if((iomodel->my_vertices[i]==1)){
 
-			if ((int)spcvelocity[6*i+0] && (int)spcvelocity[6*i+1]){ //spc if vx and vy are constrained
+			if ((int)iomodel->spcvelocity[6*i+0] && (int)iomodel->spcvelocity[6*i+1]){ //spc if vx and vy are constrained
 
 				/*This grid needs to be spc'd: */
-				constraints->AddObject(new Spc(count,i+1,1,pow( pow(*(spcvelocity+6*i+4),2.0) + pow(*(spcvelocity+6*i+5),2.0) ,0.5)));
+				constraints->AddObject(new Spc(count,i+1,1,pow( pow(*(iomodel->spcvelocity+6*i+4),2.0) + pow(*(iomodel->spcvelocity+6*i+5),2.0) ,0.5)));
 				count++;
 			}
@@ -43,11 +40,11 @@
 	}
 
+	/*Free data: */
+	xfree((void**)&iomodel->spcvelocity);
+	
 	/*All our datasets are already order by ids. Set presort flag so that later on, when sorting is requested on these 
 	 * datasets, it will not be redone: */
 	constraints->Presort();
 
-	/*Free data: */
-	xfree((void**)&spcvelocity);
-	
 	cleanup_and_return:
 	
Index: /issm/trunk/src/c/ModelProcessorx/DiagnosticHutter/CreateLoadsDiagnosticHutter.cpp
===================================================================
--- /issm/trunk/src/c/ModelProcessorx/DiagnosticHutter/CreateLoadsDiagnosticHutter.cpp	(revision 3455)
+++ /issm/trunk/src/c/ModelProcessorx/DiagnosticHutter/CreateLoadsDiagnosticHutter.cpp	(revision 3456)
@@ -1,5 +1,4 @@
 /*! \file CreateLoadsDiagnosticHutter.c:
  */
-
 
 #include "../../DataSet/DataSet.h"
@@ -10,5 +9,4 @@
 #include "../../include/macros.h"
 #include "../IoModel.h"
-
 
 void	CreateLoadsDiagnosticHutter(DataSet** ploads, IoModel* iomodel,ConstDataHandle iomodel_handle){
Index: /issm/trunk/src/c/ModelProcessorx/DiagnosticStokes/CreateConstraintsDiagnosticStokes.cpp
===================================================================
--- /issm/trunk/src/c/ModelProcessorx/DiagnosticStokes/CreateConstraintsDiagnosticStokes.cpp	(revision 3455)
+++ /issm/trunk/src/c/ModelProcessorx/DiagnosticStokes/CreateConstraintsDiagnosticStokes.cpp	(revision 3456)
@@ -15,8 +15,5 @@
 	DataSet* constraints = NULL;
 	Spc*    spc  = NULL;
-	int count;
-
-	/*spc intermediary data: */
-	double* gridonstokes=NULL;
+	int count=0;
 
 	/*Create constraints: */
@@ -27,5 +24,5 @@
 
 	/*Fetch data: */
-	IoModelFetchData(&gridonstokes,NULL,NULL,iomodel_handle,"gridonstokes");
+	IoModelFetchData(&iomodel->gridonstokes,NULL,NULL,iomodel_handle,"gridonstokes");
 
 	count=1; //matlab indexing
@@ -35,5 +32,5 @@
 		if((iomodel->my_vertices[i]==1)){
 
-			if ((int)!gridonstokes[i]){
+			if ((int)!iomodel->gridonstokes[i]){
 
 				/*This grid will see its vx,vy and vz dofs spc'd to pattyn velocities: */
@@ -50,10 +47,10 @@
 	}
 
+	/*Free data: */
+	xfree((void**)&iomodel->gridonstokes);
+
 	/*All our datasets are already order by ids. Set presort flag so that later on, when sorting is requested on these 
 	 * datasets, it will not be redone: */
 	constraints->Presort();
-
-	/*Free data: */
-	xfree((void**)&gridonstokes);
 
 	cleanup_and_return:
Index: /issm/trunk/src/c/ModelProcessorx/DiagnosticStokes/CreateLoadsDiagnosticStokes.cpp
===================================================================
--- /issm/trunk/src/c/ModelProcessorx/DiagnosticStokes/CreateLoadsDiagnosticStokes.cpp	(revision 3455)
+++ /issm/trunk/src/c/ModelProcessorx/DiagnosticStokes/CreateLoadsDiagnosticStokes.cpp	(revision 3456)
@@ -10,12 +10,9 @@
 #include "../IoModel.h"
 
-
 void	CreateLoadsDiagnosticStokes(DataSet** ploads, IoModel* iomodel,ConstDataHandle iomodel_handle){
-
 
 	int i;
 	
 	DataSet*    loads    = NULL;
-	Icefront*   icefront = NULL;
 	Pengrid*    pengrid  = NULL;
 
@@ -24,16 +21,6 @@
 
 	/*pengrid intermediary data: */
-	int pengrid_id;
-	int pengrid_mparid;
-	int pengrid_node_id;
-	int pengrid_dof;
-	double pengrid_penalty_offset;
-	int pengrid_active=0;
-	int pengrid_thermal_steadystate=1;
-	int pengrid_stabilize_constraints=0;
-
 	int numberofpressureloads;
-	int count;
-
+	int count=0;
 
 	/*Create loads: */
@@ -50,6 +37,5 @@
 	IoModelFetchData(&iomodel->bed,NULL,NULL,iomodel_handle,"bed");
 
-	count=0;
-
+	count=1; //matlab indexing
 	/*First load data:*/
 	for (i=0;i<numberofpressureloads;i++){
@@ -84,25 +70,13 @@
 	
 	for (i=0;i<iomodel->numberofvertices;i++){
-	#ifdef _PARALLEL_
-	/*keep only this partition's nodes:*/
-	if((iomodel->my_vertices[i]==1)){
-	#endif
+		/*keep only this partition's nodes:*/
+		if((iomodel->my_vertices[i]==1)){
 
-		if ((iomodel->gridonbed[i]) && (iomodel->gridonicesheet[i]) && (iomodel->gridonstokes[i])){
+			if ((iomodel->gridonbed[i]) && (iomodel->gridonicesheet[i]) && (iomodel->gridonstokes[i])){
 
-			pengrid_id=count+1; //matlab indexing
-			pengrid_node_id=i+1;
-			pengrid_dof=1;
-			pengrid_penalty_offset=iomodel->penalty_offset;
-			pengrid_mparid=iomodel->numberofelements+1;//refers to the corresponding parmat property card
-			pengrid_stabilize_constraints=iomodel->stabilize_constraints;
-			pengrid= new Pengrid(pengrid_id, pengrid_node_id,pengrid_mparid,pengrid_dof, pengrid_active, pengrid_penalty_offset,pengrid_thermal_steadystate,pengrid_stabilize_constraints);
-			
-			loads->AddObject(pengrid);
-			count++;
-		}
-	#ifdef _PARALLEL_
-	} //if((iomodel->my_vertices[i]==1))
-	#endif
+				loads->AddObject(new Pengrid(count+1, i+1,iomodel->numberofelements+1,1, 0, iomodel->penalty_offset,1,iomodel->stabilize_constraints));
+				count++;
+			}
+		} //if((iomodel->my_vertices[i]==1))
 	}
 
Index: /issm/trunk/src/c/ModelProcessorx/Melting/CreateConstraintsMelting.cpp
===================================================================
--- /issm/trunk/src/c/ModelProcessorx/Melting/CreateConstraintsMelting.cpp	(revision 3455)
+++ /issm/trunk/src/c/ModelProcessorx/Melting/CreateConstraintsMelting.cpp	(revision 3456)
@@ -10,7 +10,5 @@
 #include "../IoModel.h"
 
-
 void	CreateConstraintsMelting(DataSet** pconstraints, IoModel* iomodel,ConstDataHandle iomodel_handle){
-
 
 	int i;
Index: /issm/trunk/src/c/ModelProcessorx/Melting/CreateLoadsMelting.cpp
===================================================================
--- /issm/trunk/src/c/ModelProcessorx/Melting/CreateLoadsMelting.cpp	(revision 3455)
+++ /issm/trunk/src/c/ModelProcessorx/Melting/CreateLoadsMelting.cpp	(revision 3456)
@@ -10,18 +10,10 @@
 #include "../IoModel.h"
 
-
 void	CreateLoadsMelting(DataSet** ploads, IoModel* iomodel,ConstDataHandle iomodel_handle){
 
 	int i;
-	int element;
+	int count=0;
 
-	extern int my_rank;
-	extern int num_procs;
-	
 	DataSet*    loads    = NULL;
-
-	/*pengrid intermediary data: */
-	int pengrid_thermal_steadystate=1;
-	int count=0;
 
 	/*if 2d: return*/
@@ -41,6 +33,5 @@
 			if (iomodel->gridonbed[i]){ 
 
-				loads->AddObject( new Pengrid(count+1, i+1,iomodel->numberofelements+1, 1, 0, iomodel->penalty_offset, pengrid_thermal_steadystate, iomodel->stabilize_constraints));
-
+				loads->AddObject( new Pengrid(count+1, i+1,iomodel->numberofelements+1, 1, 0, iomodel->penalty_offset, 1, iomodel->stabilize_constraints));
 				count++;
 			}
Index: /issm/trunk/src/c/ModelProcessorx/Prognostic/CreateConstraintsPrognostic.cpp
===================================================================
--- /issm/trunk/src/c/ModelProcessorx/Prognostic/CreateConstraintsPrognostic.cpp	(revision 3455)
+++ /issm/trunk/src/c/ModelProcessorx/Prognostic/CreateConstraintsPrognostic.cpp	(revision 3456)
@@ -18,12 +18,9 @@
 	Spc*    spc  = NULL;
 
-	/*spc intermediary data: */
-	double* spcthickness=NULL;
-	
 	/*Create constraints: */
 	constraints = new DataSet(ConstraintsEnum());
 
 	/*Fetch data: */
-	IoModelFetchData(&spcthickness,NULL,NULL,iomodel_handle,"spcthickness");
+	IoModelFetchData(&iomodel->spcthickness,NULL,NULL,iomodel_handle,"spcthickness");
 
 	count=1;//matlab indexing
@@ -33,20 +30,19 @@
 		if((iomodel->my_vertices[i]==1)){
 
-			if ((int)spcthickness[2*i]){
+			if ((int)iomodel->spcthickness[2*i]){
 
-				constraints->AddObject(new Spc(count,i+1,1,*(spcthickness+2*i+1)));
+				constraints->AddObject(new Spc(count,i+1,1,*(iomodel->spcthickness+2*i+1)));
 				count++;
 			}
-
 		} //if((my_vertices[i]==1))
 	}
 
+	/*Free data: */
+	xfree((void**)&iomodel->spcthickness);
+	
 	/*All our datasets are already order by ids. Set presort flag so that later on, when sorting is requested on these 
 	 * datasets, it will not be redone: */
 	constraints->Presort();
 
-	/*Free data: */
-	xfree((void**)&spcthickness);
-	
 	cleanup_and_return:
 	
Index: /issm/trunk/src/c/ModelProcessorx/Prognostic/CreateLoadsPrognostic.cpp
===================================================================
--- /issm/trunk/src/c/ModelProcessorx/Prognostic/CreateLoadsPrognostic.cpp	(revision 3455)
+++ /issm/trunk/src/c/ModelProcessorx/Prognostic/CreateLoadsPrognostic.cpp	(revision 3456)
@@ -1,5 +1,4 @@
 /*! \file CreateLoadsPrognostic.c:
  */
-
 
 #include "../../DataSet/DataSet.h"
@@ -11,5 +10,4 @@
 #include "../IoModel.h"
 
-
 void	CreateLoadsPrognostic(DataSet** ploads, IoModel* iomodel,ConstDataHandle iomodel_handle){
 
@@ -18,5 +16,4 @@
 	/*Create loads: */
 	loads   = new DataSet(LoadsEnum());
-	
 	
 	/*All our datasets are already order by ids. Set presort flag so that later on, when sorting is requested on these 
Index: /issm/trunk/src/c/ModelProcessorx/SlopeCompute/CreateConstraintsSlopeCompute.cpp
===================================================================
--- /issm/trunk/src/c/ModelProcessorx/SlopeCompute/CreateConstraintsSlopeCompute.cpp	(revision 3455)
+++ /issm/trunk/src/c/ModelProcessorx/SlopeCompute/CreateConstraintsSlopeCompute.cpp	(revision 3456)
@@ -2,5 +2,4 @@
  * CreateConstraintsSlopeCompute.c:
  */
-
 
 #include "../../DataSet/DataSet.h"
@@ -10,5 +9,4 @@
 #include "../../shared/shared.h"
 #include "../IoModel.h"
-
 
 void	CreateConstraintsSlopeCompute(DataSet** pconstraints, IoModel* iomodel,ConstDataHandle iomodel_handle){
Index: /issm/trunk/src/c/ModelProcessorx/SlopeCompute/CreateLoadsSlopeCompute.cpp
===================================================================
--- /issm/trunk/src/c/ModelProcessorx/SlopeCompute/CreateLoadsSlopeCompute.cpp	(revision 3455)
+++ /issm/trunk/src/c/ModelProcessorx/SlopeCompute/CreateLoadsSlopeCompute.cpp	(revision 3456)
@@ -1,5 +1,4 @@
 /*! \file CreateLoadsSlopeCompute.c:
  */
-
 
 #include "../../DataSet/DataSet.h"
@@ -10,5 +9,4 @@
 #include "../../include/macros.h"
 #include "../IoModel.h"
-
 
 void	CreateLoadsSlopeCompute(DataSet** ploads, IoModel* iomodel,ConstDataHandle iomodel_handle){
Index: /issm/trunk/src/c/ModelProcessorx/Thermal/CreateLoadsThermal.cpp
===================================================================
--- /issm/trunk/src/c/ModelProcessorx/Thermal/CreateLoadsThermal.cpp	(revision 3455)
+++ /issm/trunk/src/c/ModelProcessorx/Thermal/CreateLoadsThermal.cpp	(revision 3456)
@@ -10,16 +10,11 @@
 #include "../IoModel.h"
 
-
 void	CreateLoadsThermal(DataSet** ploads, IoModel* iomodel,ConstDataHandle iomodel_handle){
 
 	int i;
+	int count=0;
 
 	DataSet*    loads    = NULL;
 	Pengrid*    pengrid  = NULL;
-
-	/*pengrid intermediary data: */
-	int pengrid_thermal_steadystate=1;
-
-	int count=0;
 
 	/*return if 2d mesh*/
@@ -39,6 +34,5 @@
 			if (!iomodel->spctemperature[2*i]){ //No penalty applied on spc grids!
 
-				loads->AddObject( new Pengrid(count+1, i+1,iomodel->numberofelements+1,1, 0, iomodel->penalty_offset,pengrid_thermal_steadystate,iomodel->stabilize_constraints));
-
+				loads->AddObject( new Pengrid(count+1, i+1,iomodel->numberofelements+1,1, 0, iomodel->penalty_offset,1,iomodel->stabilize_constraints));
 				count++;
 			}
