Index: /issm/trunk/src/mex/CreateNodalConstraints/CreateNodalConstraints.cpp
===================================================================
--- /issm/trunk/src/mex/CreateNodalConstraints/CreateNodalConstraints.cpp	(revision 5775)
+++ /issm/trunk/src/mex/CreateNodalConstraints/CreateNodalConstraints.cpp	(revision 5775)
@@ -0,0 +1,45 @@
+/*\file CreateNodalConstraints.c
+ *\brief: reduce g set vector to s set vector (set of single point constraints)
+ */
+
+#include "./CreateNodalConstraints.h"
+
+void mexFunction( int nlhs, mxArray* plhs[], int nrhs, const mxArray* prhs[]){
+
+	/*input datasets: */
+	Nodes *nodes         = NULL;
+	int    analysis_type;
+
+	/* output datasets: */
+	Vec ys=NULL;
+
+	/*Boot module: */
+	MODULEBOOT();
+
+	/*checks on arguments on the matlab side: */
+	CheckNumMatlabArguments(nlhs,NLHS,nrhs,NRHS,__FUNCT__,&CreateNodalConstraintsUsage);
+
+	/*Input datasets: */
+	FetchData((DataSet**)&nodes,NODES);
+	FetchData(&analysis_type,ANALYSISTYPE);
+
+	/*!Reduce vector: */
+	CreateNodalConstraintsx(&ys,nodes,analysis_type);
+
+	/*write output datasets: */
+	WriteData(YS,ys);
+
+	/*Free ressources: */
+	delete nodes;
+	VecFree(&ys);
+
+	/*end module: */
+	MODULEEND();
+}
+
+void CreateNodalConstraintsUsage(void)
+{
+	_printf_("\n");
+	_printf_("   usage: ys = %s(nodes,analysis_type);\n",__FUNCT__);
+	_printf_("\n");
+}
Index: /issm/trunk/src/mex/CreateNodalConstraints/CreateNodalConstraints.h
===================================================================
--- /issm/trunk/src/mex/CreateNodalConstraints/CreateNodalConstraints.h	(revision 5775)
+++ /issm/trunk/src/mex/CreateNodalConstraints/CreateNodalConstraints.h	(revision 5775)
@@ -0,0 +1,31 @@
+/*
+	CreateNodalConstraints.h
+*/
+
+#ifndef _CREATENODALCONSTRAINTS_H
+#define _CREATENODALCONSTRAINTS_H
+
+/* local prototypes: */
+void CreateNodalConstraintsUsage(void);
+
+#include "../../c/modules/modules.h"
+#include "../../c/Container/Container.h"
+#include "../../c/shared/shared.h"
+
+#undef __FUNCT__ 
+#define __FUNCT__  "CreateNodalConstraints"
+
+/* serial input macros: */
+#define NODES (mxArray*)prhs[0]
+#define ANALYSISTYPE (mxArray*)prhs[1]
+
+/* serial output macros: */
+#define YS (mxArray**)&plhs[0]
+
+/* serial arg counts: */
+#undef NLHS
+#define NLHS  1
+#undef NRHS
+#define NRHS  2
+
+#endif  /* _REDUCEVECTORGTOF_H */
Index: /issm/trunk/src/mex/Makefile.am
===================================================================
--- /issm/trunk/src/mex/Makefile.am	(revision 5774)
+++ /issm/trunk/src/mex/Makefile.am	(revision 5775)
@@ -17,4 +17,5 @@
 				ContourToNodes \
 				CostFunction \
+				CreateNodalConstraints\
 				DakotaResponses\
 				Echo\
@@ -134,4 +135,7 @@
 						CostFunction/CostFunction.h
 
+CreateNodalConstraints_SOURCES =  CreateNodalConstraints/CreateNodalConstraints.cpp \
+								CreateNodalConstraints/CreateNodalConstraints.h
+
 NodesDof_SOURCES = NodesDof/NodesDof.cpp\
 			  NodesDof/NodesDof.h
Index: /issm/trunk/src/mex/SpcNodes/SpcNodes.cpp
===================================================================
--- /issm/trunk/src/mex/SpcNodes/SpcNodes.cpp	(revision 5774)
+++ /issm/trunk/src/mex/SpcNodes/SpcNodes.cpp	(revision 5775)
@@ -13,7 +13,4 @@
 	int      analysis_type;
 
-	/* output datasets: */
-	Vec         yg=NULL;
-
 	/*Boot module: */
 	MODULEBOOT();
@@ -28,14 +25,12 @@
 	
 	/*!Generate internal degree of freedom numbers: */
-	SpcNodesx( &yg, nodes,constraints,analysis_type); 
+	SpcNodesx(nodes,constraints,analysis_type); 
 
 	/*write output datasets: */
 	WriteData(NODES,nodes);
-	WriteData(YG,yg);
 
 	/*Free ressources: */
 	delete nodes;
 	delete constraints;
-	VecFree(&yg);
 
 	/*end module: */
@@ -46,5 +41,5 @@
 {
 	_printf_("\n");
-	_printf_("   usage: [m.node,m.yg]=%s(m.nodes,m.constraints);\n",__FUNCT__);
+	_printf_("   usage: [m.node]=%s(m.nodes,m.constraints);\n",__FUNCT__);
 	_printf_("\n");
 }
Index: /issm/trunk/src/mex/SystemMatrices/SystemMatrices.cpp
===================================================================
--- /issm/trunk/src/mex/SystemMatrices/SystemMatrices.cpp	(revision 5774)
+++ /issm/trunk/src/mex/SystemMatrices/SystemMatrices.cpp	(revision 5775)
@@ -18,5 +18,8 @@
 	/* output datasets: */
 	Mat    Kgg  = NULL;
+	Mat    Kff  = NULL;
+	Mat    Kfs  = NULL;
 	Vec    pg   = NULL;
+	Vec    pf   = NULL;
 	double kmax;
 
@@ -50,12 +53,15 @@
 		FetchData(&penalty_kflag,PENALTYKFLAG);
 		FetchData(&penalty_pflag,PENALTYPFLAG);
-		SystemMatricesx(&Kgg,&pg,&kmax,elements,nodes,vertices,loads,materials,parameters,kflag,pflag,penalty_kflag,penalty_pflag);
+		SystemMatricesx(&Kgg,&Kff,&Kfs,&pg,&pf,&kmax,elements,nodes,vertices,loads,materials,parameters,kflag,pflag,penalty_kflag,penalty_pflag);
 	}
 	else
-	 SystemMatricesx(&Kgg,&pg,&kmax,elements,nodes,vertices,loads,materials,parameters);
+	 SystemMatricesx(&Kgg,&Kff,&Kfs,&pg,&pf,&kmax,elements,nodes,vertices,loads,materials,parameters);
 
 	/*write output datasets: */
 	WriteData(KGG,Kgg);
+	WriteData(KFF,Kff);
+	WriteData(KFS,Kfs);
 	WriteData(PG,pg);
+	WriteData(PF,pf);
 	WriteData(KMAX,kmax);
 	
@@ -68,5 +74,8 @@
 	delete parameters;
 	MatFree(&Kgg);
+	MatFree(&Kff);
+	MatFree(&Kfs);
 	VecFree(&pg);
+	VecFree(&pf);
 
 	/*end module: */
@@ -77,6 +86,6 @@
 {
 	_printf_("\n");
-	_printf_("   usage: [Kgg,pg,kmax] = %s(elements,nodes,vertices,loads,materials,parameters);\n",__FUNCT__);
-	_printf_("   usage: [Kgg,pg,kmax] = %s(elements,nodes,vertices,loads,materials,parameters,kflag,pflag,penalty_kflag,penalty_pflag);\n",__FUNCT__);
+	_printf_("   usage: [Kgg,Kff,Kfs,pg,pf,kmax] = %s(elements,nodes,vertices,loads,materials,parameters);\n",__FUNCT__);
+	_printf_("   usage: [Kgg,Kff,Kfs,pg,pf,kmax] = %s(elements,nodes,vertices,loads,materials,parameters,kflag,pflag,penalty_kflag,penalty_pflag);\n",__FUNCT__);
 	_printf_("\n");
 }
Index: /issm/trunk/src/mex/SystemMatrices/SystemMatrices.h
===================================================================
--- /issm/trunk/src/mex/SystemMatrices/SystemMatrices.h	(revision 5774)
+++ /issm/trunk/src/mex/SystemMatrices/SystemMatrices.h	(revision 5775)
@@ -31,10 +31,13 @@
 /* serial output macros: */
 #define KGG  (mxArray**)&plhs[0]
-#define PG   (mxArray**)&plhs[1]
-#define KMAX (mxArray**)&plhs[2]
+#define KFF  (mxArray**)&plhs[1]
+#define KFS  (mxArray**)&plhs[2]
+#define PG   (mxArray**)&plhs[3]
+#define PF   (mxArray**)&plhs[4]
+#define KMAX (mxArray**)&plhs[5]
 
 /* serial arg counts: */
 #undef NLHS
-#define NLHS  3
+#define NLHS  6
 #undef NRHS
 #define NRHS  10
