Index: /issm/trunk/src/c/Container/DataSet.cpp
===================================================================
--- /issm/trunk/src/c/Container/DataSet.cpp	(revision 10439)
+++ /issm/trunk/src/c/Container/DataSet.cpp	(revision 10440)
@@ -503,4 +503,5 @@
 
 	/*Check index in debugging mode*/
+	_assert_(this!=NULL);
 	_assert_(offset<this->Size());
 
@@ -572,4 +573,5 @@
 /*FUNCTION DataSet::Size{{{1*/
 int  DataSet::Size(void){
+	_assert_(this!=NULL);
 
 	return objects.size();
Index: /issm/trunk/src/c/EnumDefinitions/EnumDefinitions.h
===================================================================
--- /issm/trunk/src/c/EnumDefinitions/EnumDefinitions.h	(revision 10439)
+++ /issm/trunk/src/c/EnumDefinitions/EnumDefinitions.h	(revision 10440)
@@ -484,4 +484,5 @@
 	SpcDynamicEnum,
 	IceVolumeEnum,
+	DiagnosticStokesBasalPenaltyEnum,
 	MaximumNumberOfEnums
 };
Index: /issm/trunk/src/c/Makefile.am
===================================================================
--- /issm/trunk/src/c/Makefile.am	(revision 10439)
+++ /issm/trunk/src/c/Makefile.am	(revision 10440)
@@ -330,4 +330,6 @@
 					./modules/ResetConstraintsx/ResetConstraintsx.h\
 					./modules/ResetConstraintsx/ResetConstraintsx.cpp\
+					./modules/ResetCoordinateSystemx/ResetCoordinateSystemx.h\
+					./modules/ResetCoordinateSystemx/ResetCoordinateSystemx.cpp\
 					./modules/Solverx/Solverx.cpp\
 					./modules/Solverx/Solverx.h\
Index: /issm/trunk/src/c/modules/EnumToStringx/EnumToStringx.cpp
===================================================================
--- /issm/trunk/src/c/modules/EnumToStringx/EnumToStringx.cpp	(revision 10439)
+++ /issm/trunk/src/c/modules/EnumToStringx/EnumToStringx.cpp	(revision 10440)
@@ -428,4 +428,5 @@
 		case SpcDynamicEnum : return "SpcDynamic";
 		case IceVolumeEnum : return "IceVolume";
+		case DiagnosticStokesBasalPenaltyEnum : return "DiagnosticStokesBasalPenalty";
 		default : return "unknown";
 
Index: /issm/trunk/src/c/modules/ModelProcessorx/CreateParameters.cpp
===================================================================
--- /issm/trunk/src/c/modules/ModelProcessorx/CreateParameters.cpp	(revision 10439)
+++ /issm/trunk/src/c/modules/ModelProcessorx/CreateParameters.cpp	(revision 10440)
@@ -65,4 +65,5 @@
 	parameters->AddObject(iomodel->CopyConstantObject(DiagnosticRiftPenaltyThresholdEnum));
 	parameters->AddObject(iomodel->CopyConstantObject(DiagnosticStokesreconditioningEnum));
+	parameters->AddObject(iomodel->CopyConstantObject(DiagnosticStokesBasalPenaltyEnum));
 	parameters->AddObject(iomodel->CopyConstantObject(DiagnosticShelfDampeningEnum));
 	parameters->AddObject(iomodel->CopyConstantObject(DiagnosticViscosityOvershootEnum));
Index: /issm/trunk/src/c/modules/ModelProcessorx/DiagnosticHoriz/CreateConstraintsDiagnosticHoriz.cpp
===================================================================
--- /issm/trunk/src/c/modules/ModelProcessorx/DiagnosticHoriz/CreateConstraintsDiagnosticHoriz.cpp	(revision 10439)
+++ /issm/trunk/src/c/modules/ModelProcessorx/DiagnosticHoriz/CreateConstraintsDiagnosticHoriz.cpp	(revision 10440)
@@ -20,18 +20,20 @@
 	double  rho_ice;
 	double  stokesreconditioning;
-	bool    isstokes,ismacayealpattyn;
+	bool    isstokes,ismacayealpattyn,stokes_basal_penalty;
    bool    spcpresent=false;
 	int Mx,Nx;
 	int My,Ny;
 	int Mz,Nz;
-	double *spcvx           = NULL;
-	double *spcvy           = NULL;
-	double *spcvz           = NULL;
-	double *nodeonmacayeal  = NULL;
-	double *nodeonpattyn    = NULL;
-	double *nodeonstokes    = NULL;
-	double *vertices_type   = NULL;
-	double *surface         = NULL;
-	double *z               = NULL;
+	double *spcvx          = NULL;
+	double *spcvy          = NULL;
+	double *spcvz          = NULL;
+	double *nodeonmacayeal = NULL;
+	double *nodeonpattyn   = NULL;
+	double *nodeonstokes   = NULL;
+	double *nodeonbed      = NULL;
+	double *nodeonicesheet = NULL;
+	double *vertices_type  = NULL;
+	double *surface        = NULL;
+	double *z              = NULL;
 	double *timesx=NULL;
 	double *timesy=NULL;
@@ -40,9 +42,9 @@
 
 	/*Output*/
-	Constraints* constraints = NULL;
-	SpcStatic*    spcstatic  = NULL;
-	int     node1,node2;
-	int    dim;
-	int    numberofvertices;
+	Constraints *constraints      = NULL;
+	SpcStatic   *spcstatic        = NULL;
+	int          node1,node2;
+	int          dim;
+	int          numberofvertices;
 
 	/*Fetch parameters: */
@@ -55,4 +57,5 @@
 	iomodel->Constant(&isstokes,FlowequationIsstokesEnum);
 	iomodel->Constant(&ismacayealpattyn,FlowequationIsmacayealpattynEnum);
+	iomodel->Constant(&stokes_basal_penalty,DiagnosticStokesBasalPenaltyEnum);
 
 	/*Recover pointer: */
@@ -75,4 +78,6 @@
 	if(dim==3)iomodel->FetchData(&nodeonpattyn,NULL,NULL,FlowequationBorderpattynEnum);
 	if(dim==3)iomodel->FetchData(&nodeonstokes,NULL,NULL,FlowequationBorderstokesEnum);
+	if(dim==3)iomodel->FetchData(&nodeonbed,NULL,NULL,MeshVertexonbedEnum);
+	if(dim==3)iomodel->FetchData(&nodeonicesheet,NULL,NULL,MaskVertexongroundediceEnum);
 	iomodel->FetchData(&vertices_type,NULL,NULL,FlowequationVertexEquationEnum);
 	iomodel->FetchData(&surface,NULL,NULL,SurfaceEnum);
@@ -291,4 +296,12 @@
 						}
 						xfree((void**)&values);
+					}
+
+					/*Constraint at the bedrock interface (v.n ~ vz ~ 0)*/
+					if(!stokes_basal_penalty){
+						if(nodeonbed[i] && nodeonicesheet[i] && nodeonstokes[i]){
+							constraints->AddObject(new SpcStatic(iomodel->constraintcounter+count+1,iomodel->nodecounter+i+1,3,0.,DiagnosticHorizAnalysisEnum));
+							count++;
+						}
 					}
 				}
@@ -309,4 +322,6 @@
 	xfree((void**)&nodeonpattyn);
 	xfree((void**)&nodeonstokes);
+	xfree((void**)&nodeonicesheet);
+	xfree((void**)&nodeonbed);
 	xfree((void**)&vertices_type);
 	xfree((void**)&surface);
Index: /issm/trunk/src/c/modules/ModelProcessorx/DiagnosticHoriz/CreateLoadsDiagnosticHoriz.cpp
===================================================================
--- /issm/trunk/src/c/modules/ModelProcessorx/DiagnosticHoriz/CreateLoadsDiagnosticHoriz.cpp	(revision 10439)
+++ /issm/trunk/src/c/modules/ModelProcessorx/DiagnosticHoriz/CreateLoadsDiagnosticHoriz.cpp	(revision 10440)
@@ -27,5 +27,5 @@
 	int dim;
 	int numberofvertices;
-	bool ismacayealpattyn,isstokes;
+	bool ismacayealpattyn,isstokes,stokes_basal_penalty;
 	int  numpenalties,numberofpressureloads,numrifts,numriftsegments;
 	double *pressureload   = NULL;
@@ -45,4 +45,5 @@
 	iomodel->Constant(&ismacayealpattyn,FlowequationIsmacayealpattynEnum);
 	iomodel->Constant(&numrifts,RiftsNumriftsEnum);
+	iomodel->Constant(&stokes_basal_penalty,DiagnosticStokesBasalPenaltyEnum);
 
 	/*Recover pointer: */
@@ -123,28 +124,30 @@
 	xfree((void**)&pressureload);
 
-	/*create penalties for nodes on the base of icesheet. We must have wb=ub*db/dx+vb*db/dy */
-	iomodel->FetchData(&nodeonbed,NULL,NULL,MeshVertexonbedEnum);
-	iomodel->FetchData(&nodeonicesheet,NULL,NULL,MaskVertexongroundediceEnum);
-	iomodel->FetchData(&nodeonstokes,NULL,NULL,FlowequationBorderstokesEnum);
-	iomodel->FetchData(&vertices_type,NULL,NULL,FlowequationVertexEquationEnum);
-	iomodel->FetchData(1,MeshElementsEnum);
-	CreateSingleNodeToElementConnectivity(iomodel);
-	
-	for (i=0;i<numberofvertices;i++){
-		if(iomodel->my_vertices[i]==1 && iomodel->singlenodetoelementconnectivity[i]!=0){
+	if(stokes_basal_penalty){
+		/*create penalties for nodes on the base of icesheet. We must have wb=ub*db/dx+vb*db/dy */
+		iomodel->FetchData(&nodeonbed,NULL,NULL,MeshVertexonbedEnum);
+		iomodel->FetchData(&nodeonicesheet,NULL,NULL,MaskVertexongroundediceEnum);
+		iomodel->FetchData(&nodeonstokes,NULL,NULL,FlowequationBorderstokesEnum);
+		iomodel->FetchData(&vertices_type,NULL,NULL,FlowequationVertexEquationEnum);
+		iomodel->FetchData(1,MeshElementsEnum);
+		CreateSingleNodeToElementConnectivity(iomodel);
 
-			//if ((nodeonbed[i]) && (nodeonstokes[i])){
-			if ((nodeonbed[i]) && (nodeonicesheet[i]) && (nodeonstokes[i])){
-				
-				loads->AddObject(new Pengrid(iomodel->loadcounter+count+1,i,iomodel,DiagnosticHorizAnalysisEnum));
-				count++;
+		for (i=0;i<numberofvertices;i++){
+			if(iomodel->my_vertices[i]==1 && iomodel->singlenodetoelementconnectivity[i]!=0){
+
+				//if ((nodeonbed[i]) && (nodeonstokes[i])){
+				if ((nodeonbed[i]) && (nodeonicesheet[i]) && (nodeonstokes[i])){
+
+					loads->AddObject(new Pengrid(iomodel->loadcounter+count+1,i,iomodel,DiagnosticHorizAnalysisEnum));
+					count++;
+				}
 			}
 		}
+		xfree((void**)&nodeonbed);
+		xfree((void**)&nodeonstokes);
+		xfree((void**)&nodeonicesheet);
+		xfree((void**)&vertices_type);
+		iomodel->DeleteData(1,MeshElementsEnum);
 	}
-	xfree((void**)&nodeonbed);
-	xfree((void**)&nodeonstokes);
-	xfree((void**)&nodeonicesheet);
-	xfree((void**)&vertices_type);
-	iomodel->DeleteData(1,MeshElementsEnum);
 
 	/*Create Penpair for penalties: */
Index: /issm/trunk/src/c/modules/ResetCoordinateSystemx/ResetCoordinateSystemx.cpp
===================================================================
--- /issm/trunk/src/c/modules/ResetCoordinateSystemx/ResetCoordinateSystemx.cpp	(revision 10440)
+++ /issm/trunk/src/c/modules/ResetCoordinateSystemx/ResetCoordinateSystemx.cpp	(revision 10440)
@@ -0,0 +1,19 @@
+/*!\file ResetCoordinateSystemx
+ * \brief: reset coordinate system for full-Stokes: tangential to the bedrock
+ */
+
+#include "./ResetCoordinateSystemx.h"
+#include "../../shared/shared.h"
+#include "../../include/include.h"
+#include "../../toolkits/toolkits.h"
+
+void ResetCoordinateSystemx(Elements* elements,Nodes* nodes, Vertices* vertices, Loads* loads,Materials* materials,Parameters* parameters){
+
+	Element *element = NULL;
+
+	for (int i=0;i<elements->Size();i++){
+		element=(Element*)elements->GetObjectByOffset(i);
+		element->ResetCoordinateSystem();
+	}
+
+}
Index: /issm/trunk/src/c/modules/ResetCoordinateSystemx/ResetCoordinateSystemx.h
===================================================================
--- /issm/trunk/src/c/modules/ResetCoordinateSystemx/ResetCoordinateSystemx.h	(revision 10440)
+++ /issm/trunk/src/c/modules/ResetCoordinateSystemx/ResetCoordinateSystemx.h	(revision 10440)
@@ -0,0 +1,14 @@
+/*!\file:  ResetCoordinateSystemx.h
+ * \brief header file for reset coordinate system module
+ */ 
+
+#ifndef _RESETCOORDINATESYSTEMX_H
+#define _RESETCOORDINATESYSTEMX_H
+
+#include "../../Container/Container.h"
+#include "../../objects/objects.h"
+
+/* local prototypes: */
+void ResetCoordinateSystemx(Elements* elements,Nodes* nodes, Vertices* vertices, Loads* loads,Materials* materials,  Parameters* parameters); 
+
+#endif  /* _RESETCOORDINATESYSTEMX_H */
Index: /issm/trunk/src/c/modules/StringToEnumx/StringToEnumx.cpp
===================================================================
--- /issm/trunk/src/c/modules/StringToEnumx/StringToEnumx.cpp	(revision 10439)
+++ /issm/trunk/src/c/modules/StringToEnumx/StringToEnumx.cpp	(revision 10440)
@@ -426,4 +426,5 @@
 	else if (strcmp(name,"SpcDynamic")==0) return SpcDynamicEnum;
 	else if (strcmp(name,"IceVolume")==0) return IceVolumeEnum;
+	else if (strcmp(name,"DiagnosticStokesBasalPenalty")==0) return DiagnosticStokesBasalPenaltyEnum;
 	else _error_("Enum %s not found",name);
 
Index: /issm/trunk/src/c/modules/modules.h
===================================================================
--- /issm/trunk/src/c/modules/modules.h	(revision 10439)
+++ /issm/trunk/src/c/modules/modules.h	(revision 10440)
@@ -96,4 +96,5 @@
 #include "./RequestedOutputsx/RequestedOutputsx.h"
 #include "./ResetConstraintsx/ResetConstraintsx.h"
+#include "./ResetCoordinateSystemx/ResetCoordinateSystemx.h"
 #include "./Responsex/Responsex.h"
 #include "./RheologyBbarx/RheologyBbarx.h"
Index: /issm/trunk/src/c/objects/Elements/Element.h
===================================================================
--- /issm/trunk/src/c/objects/Elements/Element.h	(revision 10439)
+++ /issm/trunk/src/c/objects/Elements/Element.h	(revision 10440)
@@ -68,4 +68,5 @@
 		virtual void   PotentialSheetUngrounding(Vec potential_sheet_ungrounding)=0;
 		virtual int    UpdatePotentialSheetUngrounding(double* potential_sheet_ungrounding,Vec vec_nodes_on_iceshelf,double* nodes_on_iceshelf)=0;
+		virtual void   ResetCoordinateSystem()=0;
 
 		#ifdef _HAVE_RESPONSES_
Index: /issm/trunk/src/c/objects/Elements/Penta.cpp
===================================================================
--- /issm/trunk/src/c/objects/Elements/Penta.cpp	(revision 10439)
+++ /issm/trunk/src/c/objects/Elements/Penta.cpp	(revision 10440)
@@ -2350,4 +2350,37 @@
 	}
 
+}
+/*}}}*/
+/*FUNCTION Penta::ResetCoordinateSystem{{{1*/
+void  Penta::ResetCoordinateSystem(void){
+
+	int    approximation;
+	bool   stokes_basal_penalty;
+	double slopex[NUMVERTICES];
+	double slopey[NUMVERTICES];
+	double xz_plane[6];
+
+	/*Do not change CS if stokes_basal_penalty is activated*/
+	parameters->FindParam(&stokes_basal_penalty,DiagnosticStokesBasalPenaltyEnum);
+	if(stokes_basal_penalty) return;
+
+	/*For Stokes only: we want the CS to be tangential to the bedrock*/
+	inputs->GetInputValue(&approximation,ApproximationEnum);
+	if(IsFloating() || !IsOnBed() || (approximation!=StokesApproximationEnum && approximation!=MacAyealStokesApproximationEnum &&  approximation!=PattynStokesApproximationEnum)) return;
+
+	/*Get slope on each node*/
+	GetInputListOnVertices(&slopex[0],BedSlopeXEnum);
+	GetInputListOnVertices(&slopey[0],BedSlopeYEnum);
+
+	/*Loop over basal nodes (first 3) and update their CS*/
+	for(int i=0;i<NUMVERTICES2D;i++){
+
+		/*New X axis             New Z axis*/
+		xz_plane[0]=1.;          xz_plane[3]=-slopex[i];  
+		xz_plane[1]=0.;          xz_plane[4]=-slopey[i];  
+		xz_plane[2]=slopex[i];   xz_plane[5]=1.;          
+
+		XZvectorsToCoordinateSystem(&this->nodes[i]->coord_system[0][0],&xz_plane[0]);
+	}
 }
 /*}}}*/
Index: /issm/trunk/src/c/objects/Elements/Penta.h
===================================================================
--- /issm/trunk/src/c/objects/Elements/Penta.h	(revision 10439)
+++ /issm/trunk/src/c/objects/Elements/Penta.h	(revision 10440)
@@ -110,4 +110,5 @@
 		void   PatchSize(int* pnumrows, int* pnumvertices,int* pnumnodes);
 		void   ProcessResultsUnits(void);
+		void   ResetCoordinateSystem(void);
 		double SurfaceArea(void);
 		void   Update(int index, IoModel* iomodel,int analysis_counter,int analysis_type);
Index: /issm/trunk/src/c/objects/Elements/Tria.h
===================================================================
--- /issm/trunk/src/c/objects/Elements/Tria.h	(revision 10439)
+++ /issm/trunk/src/c/objects/Elements/Tria.h	(revision 10440)
@@ -109,4 +109,5 @@
 		void   PatchSize(int* pnumrows, int* pnumvertices,int* pnumnodes);
 		void   ProcessResultsUnits(void);
+		void   ResetCoordinateSystem(void){_error_("not implemented yet");};
 		double SurfaceArea(void);
 		void   Update(int index, IoModel* iomodel,int analysis_counter,int analysis_type);
Index: /issm/trunk/src/c/solutions/diagnostic_core.cpp
===================================================================
--- /issm/trunk/src/c/solutions/diagnostic_core.cpp	(revision 10439)
+++ /issm/trunk/src/c/solutions/diagnostic_core.cpp	(revision 10440)
@@ -49,5 +49,9 @@
 	/*Compute slopes: */
 	if(ishutter) surfaceslope_core(femmodel);
-	if(isstokes) bedslope_core(femmodel);
+	if(isstokes){
+		bedslope_core(femmodel);
+		femmodel->SetCurrentConfiguration(DiagnosticHorizAnalysisEnum);
+		ResetCoordinateSystemx(femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters);
+	}
 
 	if(ishutter){
Index: /issm/trunk/src/m/classes/diagnostic.m
===================================================================
--- /issm/trunk/src/m/classes/diagnostic.m	(revision 10439)
+++ /issm/trunk/src/m/classes/diagnostic.m	(revision 10440)
@@ -16,4 +16,5 @@
 		icefront                 = modelfield('default',NaN,'marshall',true,'preprocess','marshallicefront','format','DoubleMat','mattype',3);
 		maxiter                  = modelfield('default',0,'marshall',true,'format','Integer');
+		stokes_basal_penalty     = modelfield('default',0,'marshall',true,'format','Boolean');
 		shelf_dampening          = modelfield('default',0,'marshall',true,'format','Integer');
 		vertex_pairing           = modelfield('default',NaN,'marshall',true,'format','DoubleMat','mattype',3);
@@ -75,4 +76,8 @@
 			 %parameter is often used.
 			 obj.rift_penalty_lock=10;
+
+			 %penalty scheme for basal Dirichlet condition of Full-Stokes
+			 %activated by default
+			 obj.stokes_basal_penalty=1;
 
 		end % }}}
@@ -145,4 +150,6 @@
 			disp(sprintf('\n      %s','Other:'));
 			fielddisplay(obj,'shelf_dampening','use dampening for floating ice ? Only for Stokes model');
+			fielddisplay(obj,'stokesreconditioning','multiplier for incompressibility equation. Only for Stokes model');
+			fielddisplay(obj,'stokes_basal_penalty','penalty based basal condition for grounded ice. Only for Stokes model');
 			fielddisplay(obj,'referential','local referential');
 			fielddisplay(obj,'requested_outputs','additional outputs requested');
Index: /issm/trunk/src/m/enum/DiagnosticStokesBasalPenaltyEnum.m
===================================================================
--- /issm/trunk/src/m/enum/DiagnosticStokesBasalPenaltyEnum.m	(revision 10440)
+++ /issm/trunk/src/m/enum/DiagnosticStokesBasalPenaltyEnum.m	(revision 10440)
@@ -0,0 +1,11 @@
+function macro=DiagnosticStokesBasalPenaltyEnum()
+%DIAGNOSTICSTOKESBASALPENALTYENUM - Enum of DiagnosticStokesBasalPenalty
+%
+%   WARNING: DO NOT MODIFY THIS FILE
+%            this file has been automatically generated by src/c/EnumDefinitions/Synchronize.sh
+%            Please read src/c/EnumDefinitions/README for more information
+%
+%   Usage:
+%      macro=DiagnosticStokesBasalPenaltyEnum()
+
+macro=StringToEnum('DiagnosticStokesBasalPenalty');
Index: sm/trunk/src/m/enum/GroundinglineMigration2dSolutionEnum.m
===================================================================
--- /issm/trunk/src/m/enum/GroundinglineMigration2dSolutionEnum.m	(revision 10439)
+++ 	(revision )
@@ -1,11 +1,0 @@
-function macro=GroundinglineMigration2dSolutionEnum()
-%GROUNDINGLINEMIGRATION2DSOLUTIONENUM - Enum of GroundinglineMigration2dSolution
-%
-%   WARNING: DO NOT MODIFY THIS FILE
-%            this file has been automatically generated by src/c/EnumDefinitions/Synchronize.sh
-%            Please read src/c/EnumDefinitions/README for more information
-%
-%   Usage:
-%      macro=GroundinglineMigration2dSolutionEnum()
-
-macro=StringToEnum('GroundinglineMigration2dSolution');
Index: /issm/trunk/src/mex/Makefile.am
===================================================================
--- /issm/trunk/src/mex/Makefile.am	(revision 10439)
+++ /issm/trunk/src/mex/Makefile.am	(revision 10440)
@@ -66,4 +66,5 @@
 				Reducevectorgtof\
 				Response\
+				ResetCoordinateSystem\
 				Scotch\
 				Solver\
@@ -302,4 +303,7 @@
 									Response/Response.h
 
+ResetCoordinateSystem_SOURCES = ResetCoordinateSystem/ResetCoordinateSystem.cpp\
+						 ResetCoordinateSystem/ResetCoordinateSystem.h
+
 Scotch_SOURCES = Scotch/Scotch.cpp\
 			  Scotch/Scotch.h
Index: /issm/trunk/src/mex/ResetCoordinateSystem/ResetCoordinateSystem.cpp
===================================================================
--- /issm/trunk/src/mex/ResetCoordinateSystem/ResetCoordinateSystem.cpp	(revision 10440)
+++ /issm/trunk/src/mex/ResetCoordinateSystem/ResetCoordinateSystem.cpp	(revision 10440)
@@ -0,0 +1,62 @@
+/*\file ResetCoordinateSystem.c
+ *\brief: recover pressure from elements
+ */
+
+#include "./ResetCoordinateSystem.h"
+
+void mexFunction( int nlhs, mxArray* plhs[], int nrhs, const mxArray* prhs[]){
+
+	/*input datasets: */
+	Elements* elements=NULL;
+	Nodes* nodes=NULL; 
+	Vertices* vertices=NULL;
+	Loads* loads=NULL;
+	Materials* materials=NULL;
+	Parameters* parameters=NULL;
+	int      numberofnodes;
+
+	/* output datasets: */
+	Vec sigma_g=NULL;
+
+	/*Boot module: */
+	MODULEBOOT();
+
+	/*checks on arguments on the matlab side: */
+	CheckNumMatlabArguments(nlhs,NLHS,nrhs,NRHS,__FUNCT__,&ResetCoordinateSystemUsage);
+        
+	/*Input datasets: */
+	FetchMatlabData((DataSet**)&elements,ELEMENTS);
+	FetchMatlabData((DataSet**)&nodes,NODES);
+	FetchMatlabData((DataSet**)&vertices,VERTICES);
+	FetchMatlabData((DataSet**)&loads,LOADS);
+	FetchMatlabData((DataSet**)&materials,MATERIALS);
+	FetchMatlabData(&parameters,PARAMETERS);
+
+	/*configure: */
+	elements->  Configure(elements,loads, nodes,vertices, materials,parameters);
+	nodes->     Configure(elements,loads, nodes,vertices, materials,parameters);
+	loads->     Configure(elements, loads, nodes,vertices, materials,parameters);
+
+	/*!Generate internal degree of freedom numbers: */
+	ResetCoordinateSystemx(elements,nodes,vertices,loads,materials,parameters);
+
+	/*write output datasets: */
+	WriteMatlabData(NODESOUT,nodes);
+
+	/*Free ressources: */
+	delete nodes;
+	delete vertices;
+	delete elements;
+	delete materials;
+	delete loads;
+	delete parameters;
+
+	/*end module: */
+	MODULEEND();
+}
+
+void ResetCoordinateSystemUsage(void) {
+	printf("\n");
+	printf("   usage: [nodes] = %s(elements, nodes, vertices, loads, materials, params);\n",__FUNCT__);
+	printf("\n");
+}
Index: /issm/trunk/src/mex/ResetCoordinateSystem/ResetCoordinateSystem.h
===================================================================
--- /issm/trunk/src/mex/ResetCoordinateSystem/ResetCoordinateSystem.h	(revision 10440)
+++ /issm/trunk/src/mex/ResetCoordinateSystem/ResetCoordinateSystem.h	(revision 10440)
@@ -0,0 +1,36 @@
+/*
+	ResetCoordinateSystem.h
+*/
+
+#ifndef _RESETCOORDINATESYSTEM_H
+#define _RESETCOORDINATESYSTEM_H
+
+/* local prototypes: */
+void ResetCoordinateSystemUsage(void);
+
+#include "../../c/modules/modules.h"
+#include "../../c/Container/Container.h"
+#include "../../c/shared/shared.h"
+
+#undef __FUNCT__ 
+#define __FUNCT__  "ResetCoordinateSystem"
+
+/* serial input macros: */
+#define ELEMENTS (mxArray*)prhs[0]
+#define NODES (mxArray*)prhs[1]
+#define VERTICES (mxArray*)prhs[2]
+#define LOADS (mxArray*)prhs[3]
+#define MATERIALS (mxArray*)prhs[4]
+#define PARAMETERS (mxArray*)prhs[5]
+
+/* serial output macros: */
+#define NODESOUT (mxArray**)&plhs[0]
+
+/* serial arg counts: */
+#undef NLHS
+#define NLHS  1
+#undef NRHS
+#define NRHS  6
+
+#endif  /* _COMPUTEPRESSURE_H */
+
