Index: /issm/trunk/src/c/DataSet/DataSet.cpp
===================================================================
--- /issm/trunk/src/c/DataSet/DataSet.cpp	(revision 4002)
+++ /issm/trunk/src/c/DataSet/DataSet.cpp	(revision 4003)
@@ -908,5 +908,5 @@
 /*}}}*/
 /*FUNCTION DataSet::NumberOfRgbs{{{1*/
-int   DataSet::NumberOfRgbs(){
+int   DataSet::NumberOfRgbs(int analysis_type){
 
 	vector<Object*>::iterator object;
@@ -919,6 +919,6 @@
 		if((*object)->Enum()==RgbEnum){ //we assume uniqueness of all Rgbs, no error checking here.
 
-			count++;
-
+			rgb=(Rgb*)(*object);
+			if(rgb->InAnalysis(analysis_type))count++
 		}
 	}
@@ -974,6 +974,48 @@
 }
 /*}}}*/
+/*FUNCTION DataSet::SetupSpcs{{{1*/
+void   DataSet::SetupSpcs(DataSet* nodes,Vec yg,int analysis_type){
+
+	vector<Object*>::iterator object;
+	Spc* spc=NULL;
+	Node* node=NULL;
+
+	int nodeid;
+	int dof;
+	double value;
+
+	for ( object=objects.begin() ; object < objects.end(); object++ ){
+
+		/*Check this is a single point constraint (spc): */
+		if((*object)->Enum()==SpcEnum){
+
+			spc=(Spc*)(*object);
+
+			if(spc->InAnalysis(analysis_type)){
+
+				/*Ok, this object is a constraint. Get the nodeid from the node it applies to: */
+				nodeid=spc->GetNodeId();
+				dof=spc->GetDof();
+				value=spc->GetValue();
+
+				/*Now, chase through nodes and find the corect node: */
+				node=(Node*)nodes->GetObjectById(NULL,nodeid);
+
+				/*Apply constraint: */
+				if(node){ //in case the spc is dealing with a node on another cpu
+					node->ApplyConstraint(yg,dof,value);
+				}
+			}
+
+		}
+	}
+
+	/*Assemble yg: */
+	VecAssemblyBegin(yg);
+	VecAssemblyEnd(yg);
+}
+/*}}}*/
 /*FUNCTION DataSet::SetupMpcs{{{1*/
-void DataSet::SetupMpcs(Mat Rmg,DataSet* nodes){
+void DataSet::SetupMpcs(Mat Rmg,DataSet* nodes,int analysis_type){
 
 	vector<Object*>::iterator object;
@@ -996,87 +1038,51 @@
 		/*Check this is a single point constraint (spc): */
 		if((*object)->Enum()==RgbEnum){ //we assume uniqueness of all Rgbs, no error checking here.
-
-			/*we found an rgb, increment counter, so that row index for Rmg is up to date: */
-			count++;
+			
 			rgb=(Rgb*)(*object);
-
-
-			nodeid1=rgb->GetNodeId1();
-			nodeid2=rgb->GetNodeId2();
-			dof=rgb->GetDof();
-
-			/*For this rgb, find the nodes that go with it: */
-			node1=(Node*)nodes->GetObjectById(NULL,nodeid1);
-			node2=(Node*)nodes->GetObjectById(NULL,nodeid2);
-
-			if ((node1 && !node2) || (!node1 && node2)){
-				/*we are missing one node, not good!*/
-				ISSMERROR("%s%p%s%p"," in Rgb, missing one node. node1: ",node1," node2: ",node2);
-			}
-
-			if(!node1 && !node2){
-				/*That's ok, this Rgb can't find those nodes, so leave them alone. They are probably not on this 
-				 * cpu!*/
-			}
-			else{
-				/*Ok, this cpu owns both nodes. Put dof for node1 into m set, unless it is already there, 
-				 * in which case node2 gets into the m set: */
-				if(node1->DofIsInMSet(dof-1)){
-					node2->DofInMSet(dof-1);
+			if(rgb->InAnalysis(analysis_type)){
+
+				/*we found an rgb, increment counter, so that row index for Rmg is up to date: */
+				count++;
+
+
+				nodeid1=rgb->GetNodeId1();
+				nodeid2=rgb->GetNodeId2();
+				dof=rgb->GetDof();
+
+				/*For this rgb, find the nodes that go with it: */
+				node1=(Node*)nodes->GetObjectById(NULL,nodeid1);
+				node2=(Node*)nodes->GetObjectById(NULL,nodeid2);
+
+				if ((node1 && !node2) || (!node1 && node2)){
+					/*we are missing one node, not good!*/
+					ISSMERROR("%s%p%s%p"," in Rgb, missing one node. node1: ",node1," node2: ",node2);
+				}
+
+				if(!node1 && !node2){
+					/*That's ok, this Rgb can't find those nodes, so leave them alone. They are probably not on this 
+					 * cpu!*/
 				}
 				else{
-					node1->DofInMSet(dof-1);
+					/*Ok, this cpu owns both nodes. Put dof for node1 into m set, unless it is already there, 
+					 * in which case node2 gets into the m set: */
+					if(node1->DofIsInMSet(dof-1)){
+						node2->DofInMSet(dof-1);
+					}
+					else{
+						node1->DofInMSet(dof-1);
+					}
+
+					/*Plug values into Rmg. We essentially want dofs from node1 and node2 to be the 
+					 *same: */
+					dof1=node1->GetDof(dof-1); //matlab indexing
+					dof2=node2->GetDof(dof-1); //matlab indexing
+
+					MatSetValue(Rmg,count,dof1,1.0,INSERT_VALUES);
+					MatSetValue(Rmg,count,dof2,-1.0,INSERT_VALUES);
+
 				}
-
-				/*Plug values into Rmg. We essentially want dofs from node1 and node2 to be the 
-				 *same: */
-				dof1=node1->GetDof(dof-1); //matlab indexing
-				dof2=node2->GetDof(dof-1); //matlab indexing
-
-				MatSetValue(Rmg,count,dof1,1.0,INSERT_VALUES);
-				MatSetValue(Rmg,count,dof2,-1.0,INSERT_VALUES);
-
 			}
 		}
 	}
-}
-/*}}}*/
-/*FUNCTION DataSet::SetupSpcs{{{1*/
-void   DataSet::SetupSpcs(DataSet* nodes,Vec yg,int analysis_type){
-
-	vector<Object*>::iterator object;
-	Spc* spc=NULL;
-	Node* node=NULL;
-
-	int nodeid;
-	int dof;
-	double value;
-
-	for ( object=objects.begin() ; object < objects.end(); object++ ){
-
-		/*Check this is a single point constraint (spc): */
-		if((*object)->Enum()==SpcEnum){
-
-			spc=(Spc*)(*object);
-
-			/*Ok, this object is a constraint. Get the nodeid from the node it applies to: */
-			nodeid=spc->GetNodeId();
-			dof=spc->GetDof();
-			value=spc->GetValue();
-
-			/*Now, chase through nodes and find the corect node: */
-			node=(Node*)nodes->GetObjectById(NULL,nodeid);
-
-			/*Apply constraint: */
-			if(node){ //in case the spc is dealing with a node on another cpu
-				node->ApplyConstraint(yg,dof,value);
-			}
-
-		}
-	}
-
-	/*Assemble yg: */
-	VecAssemblyBegin(yg);
-	VecAssemblyEnd(yg);
 }
 /*}}}*/
Index: /issm/trunk/src/c/DataSet/DataSet.h
===================================================================
--- /issm/trunk/src/c/DataSet/DataSet.h	(revision 4002)
+++ /issm/trunk/src/c/DataSet/DataSet.h	(revision 4003)
@@ -60,5 +60,5 @@
 		int   NumberOfRgbs();
 		void  SetupSpcs(DataSet* nodes,Vec yg,int analysis_type);
-		void  SetupMpcs(Mat Rmg,DataSet* nodes);
+		void  SetupMpcs(Mat Rmg,DataSet* nodes,int analysis_type);
 		void  FlagNodeSets(Vec pv_g, Vec pv_m, Vec pv_n, Vec pv_f, Vec pv_s);
 		void  clear();
Index: /issm/trunk/src/c/modules/ModelProcessorx/DiagnosticHoriz/CreateConstraintsDiagnosticHoriz.cpp
===================================================================
--- /issm/trunk/src/c/modules/ModelProcessorx/DiagnosticHoriz/CreateConstraintsDiagnosticHoriz.cpp	(revision 4002)
+++ /issm/trunk/src/c/modules/ModelProcessorx/DiagnosticHoriz/CreateConstraintsDiagnosticHoriz.cpp	(revision 4003)
@@ -44,10 +44,10 @@
 
 			if ((int)iomodel->spcvelocity[6*i+0] | (int)iomodel->gridonhutter[i]) 
-				constraints->AddObject(new Spc(iomodel->constraintcounter+count+1,iomodel->nodecounter+i+1,1,*(iomodel->spcvelocity+6*i+3)/iomodel->yts)); //add count'th spc, on node i+1, setting dof 1 to vx.
+				constraints->AddObject(new Spc(iomodel->constraintcounter+count+1,iomodel->nodecounter+i+1,1,*(iomodel->spcvelocity+6*i+3)/iomodel->yts,DiagnosticHorizAnalysisEnum)); //add count'th spc, on node i+1, setting dof 1 to vx.
 
 			count++;
 			
 			if ((int)iomodel->spcvelocity[6*i+1] | (int)iomodel->gridonhutter[i]) 
-				constraints->AddObject(new Spc(iomodel->constraintcounter+count+1,iomodel->nodecounter+i+1,2,*(iomodel->spcvelocity+6*i+4)/iomodel->yts)); //add count'th spc, on node i+1, setting dof 2 to vy
+				constraints->AddObject(new Spc(iomodel->constraintcounter+count+1,iomodel->nodecounter+i+1,2,*(iomodel->spcvelocity+6*i+4)/iomodel->yts,DiagnosticHorizAnalysisEnum)); //add count'th spc, on node i+1, setting dof 2 to vy
 
 			count++;
@@ -73,9 +73,9 @@
 				node2=(int)*(iomodel->penalties+iomodel->numlayers*i+j)+iomodel->nodecounter;
 
-				constraints->AddObject(new Rgb(iomodel->constraintcounter+count+1,node1,node2,1));  //add count'th Rgb on dof 1 between node1 and node2
+				constraints->AddObject(new Rgb(iomodel->constraintcounter+count+1,node1,node2,1,DiagnosticHorizAnalysisEnum));  //add count'th Rgb on dof 1 between node1 and node2
 				
 				count++;
 				
-				constraints->AddObject(new Rgb(iomodel->constraintcounter+count+1,node1,node2,2));  //add count'th Rgb on dof 1 between node1 and node2
+				constraints->AddObject(new Rgb(iomodel->constraintcounter+count+1,node1,node2,2),DiagnosticHorizAnalysisEnum);  //add count'th Rgb on dof 1 between node1 and node2
 
 			}
Index: /issm/trunk/src/c/modules/ModelProcessorx/DiagnosticHoriz/CreateLoadsDiagnosticHoriz.cpp
===================================================================
--- /issm/trunk/src/c/modules/ModelProcessorx/DiagnosticHoriz/CreateLoadsDiagnosticHoriz.cpp	(revision 4002)
+++ /issm/trunk/src/c/modules/ModelProcessorx/DiagnosticHoriz/CreateLoadsDiagnosticHoriz.cpp	(revision 4003)
@@ -56,5 +56,5 @@
 
 		/*Create and  add load: */
-		loads->AddObject(new Icefront(iomodel->loadcounter+count+1,i,iomodel));
+		loads->AddObject(new Icefront(iomodel->loadcounter+count+1,i,iomodel,DiagnosticHorizAnalysisEnum));
 		count++;
 
@@ -79,5 +79,5 @@
 			if(iomodel->my_elements[(int)*(iomodel->riftinfo+RIFTINFOSIZE*i+2)]){
 
-				loads->AddObject(new Riftfront(iomodel->loadcounter+count+1,i,iomodel));
+				loads->AddObject(new Riftfront(iomodel->loadcounter+count+1,i,iomodel,DiagnosticHorizAnalysisEnum));
 				count++;
 			}
Index: /issm/trunk/src/c/modules/MpcNodesx/MpcNodesx.cpp
===================================================================
--- /issm/trunk/src/c/modules/MpcNodesx/MpcNodesx.cpp	(revision 4002)
+++ /issm/trunk/src/c/modules/MpcNodesx/MpcNodesx.cpp	(revision 4003)
@@ -10,5 +10,5 @@
 #include "../../EnumDefinitions/EnumDefinitions.h"
 
-int MpcNodesx( Mat* pRmg, DataSet* nodes,DataSet* constraints){
+int MpcNodesx( Mat* pRmg, DataSet* nodes,DataSet* constraints,int analysis_type){
 
 	int i;
@@ -28,8 +28,8 @@
 
 	/*First, recover number of dofs from nodes: */
-	numberofdofs=nodes->NumberOfDofs();
+	numberofdofs=nodes->NumberOfDofs(analysis_type);
 
 	/*Get number of equations from number of constraints: */
-	numberofequations=constraints->NumberOfRgbs();
+	numberofequations=constraints->NumberOfRgbs(analysis_type);
 
 	if(numberofequations){
@@ -41,5 +41,5 @@
 
 		/*Now, go through constraints, and update the nodes and the constraint vector at the same time: */
-		constraints->SetupMpcs(Rmg,nodes);
+		constraints->SetupMpcs(Rmg,nodes,analysis_type);
 
 		/*Assemble matrix: */
Index: /issm/trunk/src/c/modules/MpcNodesx/MpcNodesx.h
===================================================================
--- /issm/trunk/src/c/modules/MpcNodesx/MpcNodesx.h	(revision 4002)
+++ /issm/trunk/src/c/modules/MpcNodesx/MpcNodesx.h	(revision 4003)
@@ -10,5 +10,5 @@
 
 /* local prototypes: */
-int		MpcNodesx( Mat* pRmg, DataSet* nodes,DataSet* constraints);
+int		MpcNodesx( Mat* pRmg, DataSet* nodes,DataSet* constraints,int analysis_type);
 
 #endif  /* _MPCNODESX_H */
Index: /issm/trunk/src/c/modules/SpcNodesx/SpcNodesx.cpp
===================================================================
--- /issm/trunk/src/c/modules/SpcNodesx/SpcNodesx.cpp	(revision 4002)
+++ /issm/trunk/src/c/modules/SpcNodesx/SpcNodesx.cpp	(revision 4003)
@@ -28,5 +28,5 @@
 
 		/*Now, go through constraints, and update the nodes and the constraint vector at the same time: */
-		constraints->SetupSpcs(nodes,yg);
+		constraints->SetupSpcs(nodes,yg,analysis_type);
 
 		/*Specify numentries: */
Index: /issm/trunk/src/c/objects/Constraints/Rgb.cpp
===================================================================
--- /issm/trunk/src/c/objects/Constraints/Rgb.cpp	(revision 4002)
+++ /issm/trunk/src/c/objects/Constraints/Rgb.cpp	(revision 4003)
@@ -25,5 +25,5 @@
 /*}}}1*/
 /*FUNCTION Rgb::creation {{{1*/
-Rgb::Rgb(int rgb_id,int rgb_nodeid1,int rgb_nodeid2, int rgb_dof){
+Rgb::Rgb(int rgb_id,int rgb_nodeid1,int rgb_nodeid2, int rgb_dof,int rgb_analysis_type){
 
 	id=rgb_id;
@@ -31,4 +31,5 @@
 	nodeid2=rgb_nodeid2;
 	dof=rgb_dof;
+	analysis_type=rgb_analysis_type;
 
 	return;
@@ -62,4 +63,5 @@
 	memcpy(marshalled_dataset,&nodeid2,sizeof(nodeid2));marshalled_dataset+=sizeof(nodeid2);
 	memcpy(marshalled_dataset,&dof,sizeof(dof));marshalled_dataset+=sizeof(dof);
+	memcpy(marshalled_dataset,&analysis_type,sizeof(analysis_type));marshalled_dataset+=sizeof(analysis_type);
 
 	*pmarshalled_dataset=marshalled_dataset;
@@ -74,4 +76,5 @@
 		sizeof(nodeid2)+
 		sizeof(dof)+
+		sizeof(analysis_type)+
 		sizeof(int); //sizeof(int) for enum type
 }
@@ -92,4 +95,5 @@
 	memcpy(&nodeid2,marshalled_dataset,sizeof(nodeid2));marshalled_dataset+=sizeof(nodeid2);
 	memcpy(&dof,marshalled_dataset,sizeof(dof));marshalled_dataset+=sizeof(dof);
+	memcpy(&analysis_type,marshalled_dataset,sizeof(analysis_type));marshalled_dataset+=sizeof(analysis_type);
 
 	/*return: */
@@ -113,4 +117,5 @@
 	printf("   nodeid2: %i\n",nodeid2);
 	printf("   dof: %i\n",dof);
+	printf("   analysis_type: %s\n",EnumAsString(analysis_type));
 	return;
 }		
@@ -124,4 +129,5 @@
 	printf("   nodeid2: %i\n",nodeid2);
 	printf("   dof: %i\n",dof);
+	printf("   analysis_type: %s\n",EnumAsString(analysis_type));
 	return;
 }
@@ -160,2 +166,9 @@
 }
 /*}}}1*/
+/*FUNCTION Rgb::InAnalysis(int analysis_type){{{1*/
+bool Rgb::InAnalysis(int in_analysis_type){
+	if (in_analysis_type=this->analysis_type)return true;
+	else return false;
+}
+/*}}}*/
+
Index: /issm/trunk/src/c/objects/Constraints/Rgb.h
===================================================================
--- /issm/trunk/src/c/objects/Constraints/Rgb.h	(revision 4002)
+++ /issm/trunk/src/c/objects/Constraints/Rgb.h	(revision 4003)
@@ -19,9 +19,10 @@
 		int	nodeid2; 
 		int dof; /*!component*/
+		int analysis_type;
 
 	public:
 
 		Rgb();
-		Rgb(int rgb_id,int rgb_nodeid1,int rgb_nodeid2, int rgb_dof);
+		Rgb(int rgb_id,int rgb_nodeid1,int rgb_nodeid2, int rgb_dof,int analysis_type);
 		~Rgb();
 
@@ -49,4 +50,6 @@
 		int    GetDof();
 		Object* copy();
+		bool  InAnalysis(int analysis_type);
+
 
 };
Index: /issm/trunk/src/c/objects/Constraints/Spc.cpp
===================================================================
--- /issm/trunk/src/c/objects/Constraints/Spc.cpp	(revision 4002)
+++ /issm/trunk/src/c/objects/Constraints/Spc.cpp	(revision 4003)
@@ -26,5 +26,5 @@
 /*}}}1*/
 /*FUNCTION Spc::creation {{{1*/
-Spc::Spc(int spc_sid,int spc_nodeid, int spc_dof,double spc_value){
+Spc::Spc(int spc_sid,int spc_nodeid, int spc_dof,double spc_value,int spc_analysis_type){
 
 	sid=spc_sid;
@@ -32,4 +32,5 @@
 	dof=spc_dof;
 	value=spc_value;
+	analysis_type=spc_analysis_type;
 
 	return;
@@ -63,4 +64,5 @@
 	memcpy(marshalled_dataset,&dof,sizeof(dof));marshalled_dataset+=sizeof(dof);
 	memcpy(marshalled_dataset,&value,sizeof(value));marshalled_dataset+=sizeof(value);
+	memcpy(marshalled_dataset,&analysis_type,sizeof(analysis_type));marshalled_dataset+=sizeof(analysis_type);
 
 	*pmarshalled_dataset=marshalled_dataset;
@@ -71,5 +73,10 @@
 int   Spc::MarshallSize(){
 
-	return sizeof(sid)+sizeof(nodeid)+sizeof(dof)+sizeof(value)+sizeof(int); //sizeof(int) for enum type
+	return sizeof(sid)
+		+sizeof(nodeid)
+		+sizeof(dof)
+		+sizeof(value)
+		+sizeof(analysis_type)
+		+sizeof(int); //sizeof(int) for enum type
 }
 /*}}}1*/
@@ -89,4 +96,5 @@
 	memcpy(&dof,marshalled_dataset,sizeof(dof));marshalled_dataset+=sizeof(dof);
 	memcpy(&value,marshalled_dataset,sizeof(value));marshalled_dataset+=sizeof(value);
+	memcpy(&analysis_type,marshalled_dataset,sizeof(analysis_type));marshalled_dataset+=sizeof(analysis_type);
 
 	/*return: */
@@ -110,4 +118,5 @@
 	printf("   dof: %i\n",dof);
 	printf("   value: %g\n",value);
+	printf("   analysis_type: %s\n",EnumAsString(analysis_type));
 	return;
 }		
@@ -124,4 +133,5 @@
 	printf("   dof: %i\n",dof);
 	printf("   value: %g\n",value);
+	printf("   analysis_type: %s\n",EnumAsString(analysis_type));
 	return;
 }
@@ -159,2 +169,9 @@
 }
 /*}}}1*/
+/*FUNCTION Spc::InAnalysis(int analysis_type){{{1*/
+bool Spc::InAnalysis(int in_analysis_type){
+	if (in_analysis_type=this->analysis_type)return true;
+	else return false;
+}
+/*}}}*/
+
Index: /issm/trunk/src/c/objects/Constraints/Spc.h
===================================================================
--- /issm/trunk/src/c/objects/Constraints/Spc.h	(revision 4002)
+++ /issm/trunk/src/c/objects/Constraints/Spc.h	(revision 4003)
@@ -19,9 +19,10 @@
 		int dof; /*!component*/
 		double value; /*value*/
+		int analysis_type;
 
 	public:
 
 		Spc();
-		Spc(int sid,int nodeid, int dof,double value);
+		Spc(int sid,int nodeid, int dof,double value,int analysis_type);
 		~Spc();
 
@@ -45,6 +46,7 @@
 		void    UpdateInputsFromConstant(int constant, int name){ISSMERROR("Not implemented yet!");}
 		void    UpdateInputsFromConstant(bool constant, int name){ISSMERROR("Not implemented yet!");}
+		void    UpdateInputsFromSolution(double* solution, int analysis_type, int sub_analysis_type){ISSMERROR("Not implemented yet!");}
+		bool    InAnalysis(int analysis_type);
 
-		void    UpdateInputsFromSolution(double* solution, int analysis_type, int sub_analysis_type){ISSMERROR("Not implemented yet!");}
 
 
Index: /issm/trunk/src/c/objects/Elements/Penta.cpp
===================================================================
--- /issm/trunk/src/c/objects/Elements/Penta.cpp	(revision 4002)
+++ /issm/trunk/src/c/objects/Elements/Penta.cpp	(revision 4003)
@@ -232,5 +232,4 @@
 	penta->InitHookNodes(this->nummodels);
 	for(i=0;i<this->nummodels;i++)penta->hnodes[i].copy(&this->hnodes[i]);
-	penta->hnodes.copy(&this->hnodes);
 	penta->hmatice.copy(&this->hmatice);
 	penta->hmatpar.copy(&this->hmatpar);
Index: /issm/trunk/src/c/objects/Elements/Tria.cpp
===================================================================
--- /issm/trunk/src/c/objects/Elements/Tria.cpp	(revision 4002)
+++ /issm/trunk/src/c/objects/Elements/Tria.cpp	(revision 4003)
@@ -222,5 +222,4 @@
 	tria->InitHookNodes(this->nummodels);
 	for(i=0;i<this->nummodels;i++)tria->hnodes[i].copy(&this->hnodes[i]);
-	tria->hnodes.copy(&this->hnodes);
 	tria->hmatice.copy(&this->hmatice);
 	tria->hmatpar.copy(&this->hmatpar);
@@ -229,5 +228,4 @@
 	tria->nodes=(Node**)xmalloc(3*sizeof(Node*)); //we cannot rely on an analysis_counter to tell us which analysis_type we are running, so we just copy the nodes.
 	for(i=0;i<3;i++)tria->nodes[i]=this->nodes[i];
-	tria->nodes=(Node**)tria->hnodes.deliverp();
 	tria->matice=(Matice*)tria->hmatice.delivers();
 	tria->matpar=(Matpar*)tria->hmatpar.delivers();
Index: /issm/trunk/src/c/objects/FemModel.cpp
===================================================================
--- /issm/trunk/src/c/objects/FemModel.cpp	(revision 4002)
+++ /issm/trunk/src/c/objects/FemModel.cpp	(revision 4003)
@@ -131,5 +131,5 @@
 	
 	_printf_("   create rigid body constraints:\n");
-	MpcNodesx( &Rmg[analysis_counter], nodes,constraints); 
+	MpcNodesx( &Rmg[analysis_counter], nodes,constraints,analysis_counter); 
 	
 	_printf_("   create node sets:\n");
Index: /issm/trunk/src/c/objects/Loads/Icefront.cpp
===================================================================
--- /issm/trunk/src/c/objects/Loads/Icefront.cpp	(revision 4002)
+++ /issm/trunk/src/c/objects/Loads/Icefront.cpp	(revision 4003)
@@ -26,39 +26,6 @@
 }
 /*}}}*/
-/*FUNCTION Icefront::Icefront(int id, int* node_ids, int numnodes, int element_id, int matpar_id){{{1*/
-Icefront::Icefront(int icefront_id,int* icefront_node_ids, int icefront_numnodes, int icefront_element_id, int icefront_matpar_id): 
-	hnodes(icefront_node_ids,icefront_numnodes),
-	helement(&icefront_element_id,1),
-	hmatpar(&icefront_matpar_id,1)
-{
-
-	/*all the initialization has been done by the initializer, just fill in the id : */
-	this->id=icefront_id;
-	this->parameters=NULL;
-	this->inputs=new Inputs();
-
-}
-/*}}}*/
-/*FUNCTION Icefront::Icefront(int id, Hook* hnodes, Hook* helement, Hook* hmatpar, Parameters* parameters, Inputs* icefront_inputs) {{{1*/
-Icefront::Icefront(int icefront_id,Hook* icefront_hnodes, Hook* icefront_helement, Hook* icefront_hmatpar, Parameters* icefront_parameters, Inputs* icefront_inputs):
-	hnodes(icefront_hnodes),
-	helement(icefront_helement),
-	hmatpar(icefront_hmatpar)
-{
-
-	/*all the initialization has been done by the initializer, just fill in the id: */
-	this->id=icefront_id;
-	if(icefront_inputs){
-		this->inputs=(Inputs*)icefront_inputs->Copy();
-	}
-	else{
-		this->inputs=new Inputs();
-	}
-	/*point parameters: */
-	this->parameters=icefront_parameters;
-}
-/*}}}*/
-/*FUNCTION Icefront::Icefront(int id, int i, IoModel* iomodel) {{{1*/
-Icefront::Icefront(int icefront_id,int i, IoModel* iomodel){
+/*FUNCTION Icefront::Icefront(int id, int i, IoModel* iomodel,int analysis_type) {{{1*/
+Icefront::Icefront(int icefront_id,int i, IoModel* iomodel,int in_analysis_type){
 
 	int segment_width;
@@ -114,4 +81,5 @@
 	/*Ok, we have everything to build the object: */
 	this->id=icefront_id;
+	this->analysis_type=in_analysis_type;
 
 	/*Hooks: */
@@ -130,4 +98,37 @@
 
 
+/*}}}*/
+/*FUNCTION Icefront::copy {{{1*/
+Object* Icefront::copy() {
+	
+	Icefront* icefront=NULL;
+
+	icefront=new Icefront();
+
+	/*copy fields: */
+	icefront->id=this->id;
+	icefront->analysis=this->analysis;
+	if(this->inputs){
+		icefront->inputs=(Inputs*)this->inputs->Copy();
+	}
+	else{
+		icefront->inputs=new Inputs();
+	}
+	/*point parameters: */
+	icefront->parameters=this->parameters;
+
+	/*now deal with hooks and objects: */
+	icefront->hnodes.copy(&this->hnodes);
+	icefront->helement.copy(&this->helement);
+	icefront->hmatpar.copy(&this->hmatpar);
+
+	/*recover objects: */
+	icefront->nodes=(Node**)icefront->hnodes.deliverp();
+	icefront->element=(Element*)icefront->helement.delivers();
+	icefront->matpar=(Matpar*)icefront->hmatpar.delivers();
+
+	return icefront;
+
+}
 /*}}}*/
 /*FUNCTION Icefront::~Icefront() {{{1*/
@@ -152,9 +153,4 @@
 }
 /*}}}*/
-/*FUNCTION Icefront::copy {{{1*/
-Object* Icefront::copy() {
-	return new Icefront(this->id,&this->hnodes,&this->helement,&this->hmatpar,this->parameters,this->inputs);
-}
-/*}}}*/
 /*FUNCTION Icefront::DeepEcho{{{1*/
 void Icefront::DeepEcho(void){
@@ -162,4 +158,5 @@
 	printf("Icefront:\n");
 	printf("   id: %i\n",id);
+	printf("   analysis_type: %s\n",EnumAsString(analysis_type));
 	hnodes.DeepEcho();
 	helement.DeepEcho();
@@ -184,4 +181,5 @@
 
 	memcpy(&id,marshalled_dataset,sizeof(id));marshalled_dataset+=sizeof(id);
+	memcpy(&analysis_type,marshalled_dataset,sizeof(analysis_type));marshalled_dataset+=sizeof(analysis_type);
 
 	/*demarshall hooks: */
@@ -205,4 +203,5 @@
 	printf("Icefront:\n");
 	printf("   id: %i\n",id);
+	printf("   analysis_type: %s\n",EnumAsString(analysis_type));
 	hnodes.Echo();
 	helement.Echo();
@@ -243,4 +242,5 @@
 	/*marshall Icefront data: */
 	memcpy(marshalled_dataset,&id,sizeof(id));marshalled_dataset+=sizeof(id);
+	memcpy(marshalled_dataset,&analysis_type,sizeof(analysis_type));marshalled_dataset+=sizeof(analysis_type);
 
 	/*Marshall hooks: */
@@ -266,4 +266,5 @@
 	
 	return sizeof(id)
+		+sizeof(analysis_type)
 		+hnodes.MarshallSize()
 		+helement.MarshallSize()
@@ -1384,2 +1385,9 @@
 }
 /*}}}*/
+/*FUNCTION Icefront::InAnalysis(int analysis_type){{{1*/
+bool Icefront::InAnalysis(int in_analysis_type){
+	if (in_analysis_type=this->analysis_type)return true;
+	else return false;
+}
+/*}}}*/
+
Index: /issm/trunk/src/c/objects/Loads/Icefront.h
===================================================================
--- /issm/trunk/src/c/objects/Loads/Icefront.h	(revision 4002)
+++ /issm/trunk/src/c/objects/Loads/Icefront.h	(revision 4003)
@@ -22,4 +22,5 @@
 	public:
 		int id;
+		int analysis_type;
 
 		/*hooks: */
@@ -34,12 +35,10 @@
 		/*constructors: {{{1*/
 		Icefront();
-		Icefront(int icefront_id,int* icefront_node_ids, int icefront_numnodes, int icefront_element_id,int icefront_matpar_id);
-		Icefront(int icefront_id, Hook* icefront_hnodes, Hook* icefront_helement, Hook* icefront_hmatpar, Parameters* parameters, Inputs* icefront_inputs);
-		Icefront(int icefront_id,int i, IoModel* iomodel);
+		Icefront(int icefront_id,int i, IoModel* iomodel,int analysis_type);
 		~Icefront();
+		Object* copy();
 		/*}}}*/
 		/*object management: {{{1*/
 		void  Configure(DataSet* elementsin,DataSet* loadsin,DataSet* nodesin,DataSet* verticesin,DataSet* materialsin,Parameters* parametersin);
-		Object* copy();
 		void  DeepEcho();
 		void  Demarshall(char** pmarshalled_dataset);
@@ -56,6 +55,7 @@
 		void  UpdateInputsFromConstant(int constant, int name);
 		void  UpdateInputsFromConstant(bool constant, int name);
+		void  UpdateInputsFromSolution(double* solution, int analysis_type, int sub_analysis_type);
+		bool  InAnalysis(int analysis_type);
 
-		void  UpdateInputsFromSolution(double* solution, int analysis_type, int sub_analysis_type);
 
 
Index: /issm/trunk/src/c/objects/Loads/Riftfront.cpp
===================================================================
--- /issm/trunk/src/c/objects/Loads/Riftfront.cpp	(revision 4002)
+++ /issm/trunk/src/c/objects/Loads/Riftfront.cpp	(revision 4003)
@@ -27,37 +27,6 @@
 }
 /*}}}*/
-/*FUNCTION Riftfront::Riftfront(int id, int* node_ids, int matice_id, int matpar_id){{{1*/
-Riftfront::Riftfront(int riftfront_id,int* riftfront_node_ids, int riftfront_matpar_id): 
-	hnodes(riftfront_node_ids,2),
-	hmatpar(&riftfront_matpar_id,1)
-{
-
-	/*all the initialization has been done by the initializer, just fill in the id: */
-	this->id=riftfront_id;
-	this->parameters=NULL;
-	this->inputs=new Inputs();
-
-}
-/*}}}*/
-/*FUNCTION Riftfront::Riftfront(int id, Hook* hnodes, Hook* hmatice, Hook* hmatpar, Parameters* parameters, Inputs* riftfront_inputs) {{{1*/
-Riftfront::Riftfront(int riftfront_id,Hook* riftfront_hnodes, Hook* riftfront_hmatpar, Parameters* riftfront_parameters, Inputs* riftfront_inputs):
-	hnodes(riftfront_hnodes),
-	hmatpar(riftfront_hmatpar)
-{
-
-	/*all the initialization has been done by the initializer, just fill in the id: */
-	this->id=riftfront_id;
-	if(riftfront_inputs){
-		this->inputs=(Inputs*)riftfront_inputs->Copy();
-	}
-	else{
-		this->inputs=new Inputs();
-	}
-	/*point parameters: */
-	this->parameters=riftfront_parameters;
-}
-/*}}}*/
-/*FUNCTION Riftfront::Riftfront(int id, int i, IoModel* iomodel){{{1*/
-Riftfront::Riftfront(int riftfront_id,int i, IoModel* iomodel){
+/*FUNCTION Riftfront::Riftfront(int id, int i, IoModel* iomodel,int analysis_type){{{1*/
+Riftfront::Riftfront(int riftfront_id,int i, IoModel* iomodel,int riftfront_analysis_type){
 
 	/*data: */
@@ -83,4 +52,5 @@
 	/*id: */
 	this->id=riftfront_id;
+	this->analysis_type=riftfront_analysis_type;
 
 	/*hooks: */
@@ -124,4 +94,37 @@
 }
 /*}}}1*/
+/*FUNCTION Riftfront::copy {{{1*/
+Object* Riftfront::copy() {
+	
+	Riftfront* riftfront=NULL;
+
+	riftfront=new Riftfront();
+
+	/*copy fields: */
+	riftfront->id=this->id;
+	riftfront->analysis=this->analysis;
+	if(this->inputs){
+		riftfront->inputs=(Inputs*)this->inputs->Copy();
+	}
+	else{
+		riftfront->inputs=new Inputs();
+	}
+	/*point parameters: */
+	riftfront->parameters=this->parameters;
+
+	/*now deal with hooks and objects: */
+	riftfront->hnodes.copy(&this->hnodes);
+	riftfront->helement.copy(&this->helement);
+	riftfront->hmatpar.copy(&this->hmatpar);
+
+	/*recover objects: */
+	riftfront->nodes=(Node**)riftfront->hnodes.deliverp();
+	riftfront->element=(Element*)riftfront->helement.delivers();
+	riftfront->matpar=(Matpar*)riftfront->hmatpar.delivers();
+
+	return riftfront;
+
+}
+/*}}}*/
 /*FUNCTION Riftfront::~Riftfront(){{{1*/
 Riftfront::~Riftfront(){
@@ -132,9 +135,4 @@
 
 /*Object marshall*/
-/*FUNCTION Riftfront::copy {{{1*/
-Object* Riftfront::copy() {
-	return new Riftfront(*this); 
-}
-/*}}}1*/
 /*FUNCTION Riftfront::Configure {{{1*/
 void  Riftfront::Configure(DataSet* elementsin,DataSet* loadsin,DataSet* nodesin,DataSet* verticesin,DataSet* materialsin,Parameters* parametersin){
@@ -155,4 +153,5 @@
 	printf("Riftfront:\n");
 	printf("   id: %i\n",id);
+	printf("   analysis_type: %s\n",EnumAsString(analysis_type));
 	hnodes.DeepEcho();
 	hmatpar.DeepEcho();
@@ -176,4 +175,6 @@
 
 	memcpy(&id,marshalled_dataset,sizeof(id));marshalled_dataset+=sizeof(id);
+	memcpy(&analysis_type,marshalled_dataset,sizeof(analysis_type));marshalled_dataset+=sizeof(analysis_type);
+
 	memcpy(&active,marshalled_dataset,sizeof(active));marshalled_dataset+=sizeof(active);
 	memcpy(&normal,marshalled_dataset,sizeof(normal));marshalled_dataset+=sizeof(normal);
@@ -233,5 +234,7 @@
 
 	/*marshall Riftfront data: */
-	memcpy(marshalled_dataset,&id,sizeof(id));marshalled_dataset+=sizeof(id);
+	memcpy(&id,marshalled_dataset,sizeof(id));marshalled_dataset+=sizeof(id);
+	memcpy(marshalled_dataset,&analysis_type,sizeof(analysis_type));marshalled_dataset+=sizeof(analysis_type);
+
 	memcpy(marshalled_dataset,&active,sizeof(active));marshalled_dataset+=sizeof(active);
 	memcpy(marshalled_dataset,&normal,sizeof(normal));marshalled_dataset+=sizeof(normal);
@@ -265,4 +268,6 @@
 	
 	return sizeof(id)
+		+sizeof(analysis_type)
+
 		+sizeof(active)
 		+sizeof(normal)
@@ -929,2 +934,9 @@
 }
 /*}}}1*/
+/*FUNCTION Riftfront::InAnalysis(int analysis_type){{{1*/
+bool Riftfront::InAnalysis(int in_analysis_type){
+	if (in_analysis_type=this->analysis_type)return true;
+	else return false;
+}
+/*}}}*/
+
Index: /issm/trunk/src/c/objects/Loads/Riftfront.h
===================================================================
--- /issm/trunk/src/c/objects/Loads/Riftfront.h	(revision 4002)
+++ /issm/trunk/src/c/objects/Loads/Riftfront.h	(revision 4003)
@@ -22,4 +22,5 @@
 	public:
 		int		id;
+		int     analysis_type;
 
 		Hook hnodes; //2 nodes
@@ -44,7 +45,5 @@
 		/*constructors,destructors: {{{1*/
 		Riftfront();
-		Riftfront(int riftfront_id,int* riftfront_node_ids, int riftfront_matpar_id);
-		Riftfront(int riftfront_id,Hook* riftfront_hnodes, Hook* riftfront_hmatpar, Parameters* parameters, Inputs* riftfront_inputs);
-		Riftfront(int riftfront_id,int i, IoModel* iomodel);
+		Riftfront(int riftfront_id,int i, IoModel* iomodel,int analysis_type);
 		~Riftfront();
 		/*}}}*/
@@ -66,6 +65,7 @@
 		void    UpdateInputsFromConstant(int constant, int name){ISSMERROR("Not implemented yet!");}
 		void    UpdateInputsFromConstant(bool constant, int name){ISSMERROR("Not implemented yet!");}
+		void    UpdateInputsFromSolution(double* solution, int analysis_type, int sub_analysis_type){ISSMERROR("Not implemented yet!");}
+		bool    InAnalysis(int analysis_type);
 
-		void    UpdateInputsFromSolution(double* solution, int analysis_type, int sub_analysis_type){ISSMERROR("Not implemented yet!");}
 
 
Index: /issm/trunk/src/mex/MpcNodes/MpcNodes.cpp
===================================================================
--- /issm/trunk/src/mex/MpcNodes/MpcNodes.cpp	(revision 4002)
+++ /issm/trunk/src/mex/MpcNodes/MpcNodes.cpp	(revision 4003)
@@ -14,4 +14,5 @@
 	DataSet* nodes=NULL;
 	DataSet* constraints=NULL;
+	int      analysis_type;
 
 	/* output datasets: */
@@ -27,7 +28,8 @@
 	FetchData(&nodes,NODESIN);
 	FetchData(&constraints,CONSTRAINTS);
+	FetchData(&analysis_type,ANALYSISTYPE);
 
 	/*!Generate internal degree of freedom numbers: */
-	MpcNodesx( &Rmg, nodes,constraints); 
+	MpcNodesx( &Rmg, nodes,constraints,analysis_type); 
 	
 	/*write output datasets: */
Index: /issm/trunk/src/mex/MpcNodes/MpcNodes.h
===================================================================
--- /issm/trunk/src/mex/MpcNodes/MpcNodes.h	(revision 4002)
+++ /issm/trunk/src/mex/MpcNodes/MpcNodes.h	(revision 4003)
@@ -21,4 +21,5 @@
 #define NODESIN (mxArray*)prhs[0]
 #define CONSTRAINTS (mxArray*)prhs[1]
+#define ANALYSISTYPE (mxArray*)prhs[2]
 
 /* serial output macros: */
@@ -30,5 +31,5 @@
 #define NLHS  2
 #undef NRHS
-#define NRHS  2
+#define NRHS  3
 
 
Index: /issm/trunk/src/mex/SpcNodes/SpcNodes.cpp
===================================================================
--- /issm/trunk/src/mex/SpcNodes/SpcNodes.cpp	(revision 4002)
+++ /issm/trunk/src/mex/SpcNodes/SpcNodes.cpp	(revision 4003)
@@ -14,4 +14,5 @@
 	DataSet* nodes=NULL;
 	DataSet* constraints=NULL;
+	int      analysis_type;
 
 	/* output datasets: */
@@ -27,7 +28,8 @@
 	FetchData(&nodes,NODESIN);
 	FetchData(&constraints,CONSTRAINTS);
+	FetchData(&analysis_type,ANALYSISTYPE);
 	
 	/*!Generate internal degree of freedom numbers: */
-	SpcNodesx( &yg, nodes,constraints); 
+	SpcNodesx( &yg, nodes,constraints,analysis_type); 
 
 	/*write output datasets: */
Index: /issm/trunk/src/mex/SpcNodes/SpcNodes.h
===================================================================
--- /issm/trunk/src/mex/SpcNodes/SpcNodes.h	(revision 4002)
+++ /issm/trunk/src/mex/SpcNodes/SpcNodes.h	(revision 4003)
@@ -21,4 +21,5 @@
 #define NODESIN (mxArray*)prhs[0]
 #define CONSTRAINTS (mxArray*)prhs[1]
+#define ANALYSISTYPE (mxArray*)prhs[2]
 
 /* serial output macros: */
@@ -30,5 +31,5 @@
 #define NLHS  2
 #undef NRHS
-#define NRHS  2
+#define NRHS  3
 
 
