Changeset 9298
- Timestamp:
- 08/11/11 15:16:35 (14 years ago)
- Location:
- issm/trunk/src
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified issm/trunk/src/c/Container/DataSet.cpp ¶
r9285 r9298 448 448 void DataSet::Echo(){ 449 449 450 451 450 vector<Object*>::iterator object; 452 451 … … 493 492 int i; 494 493 494 _assert_(this); 495 495 if(!sorted)_error_(" trying to binary search on a non-sorted dataset!"); 496 496 -
TabularUnified issm/trunk/src/c/modules/ModelProcessorx/DiagnosticHoriz/CreateConstraintsDiagnosticHoriz.cpp ¶
r9285 r9298 167 167 /*Now add the regular spcs*/ 168 168 else{ 169 if (!isnan(iomodel->spcvx[i]) || (int)iomodel->nodeonhutter[i]){169 if (!isnan(iomodel->spcvx[i])){ 170 170 constraints->AddObject(new SpcStatic(iomodel->constraintcounter+count+1,iomodel->nodecounter+i+1,1,iomodel->spcvx[i]/iomodel->yts,DiagnosticHorizAnalysisEnum)); //add count'th spc, on node i+1, setting dof 1 to vx. 171 171 count++; 172 172 } 173 else if (iomodel->nodeonhutter[i]){ 174 constraints->AddObject(new SpcDynamic(iomodel->constraintcounter+count+1,iomodel->nodecounter+i+1,1,DiagnosticHorizAnalysisEnum)); 175 count++; 176 } 173 177 174 if (!isnan(iomodel->spcvy[i]) || (int)iomodel->nodeonhutter[i]){ 175 constraints->AddObject(new SpcStatic(iomodel->constraintcounter+count+1,iomodel->nodecounter+i+1,2,iomodel->spcvy[i]/iomodel->yts,DiagnosticHorizAnalysisEnum)); //add count'th spc, on node i+1, setting dof 2 to vy 176 count++; 177 } 178 if (!isnan(iomodel->spcvy[i])){ 179 constraints->AddObject(new SpcStatic(iomodel->constraintcounter+count+1,iomodel->nodecounter+i+1,2,iomodel->spcvy[i]/iomodel->yts,DiagnosticHorizAnalysisEnum)); //add count'th spc, on node i+1, setting dof 1 to vy. 180 count++; 181 } 182 else if (iomodel->nodeonhutter[i]){ 183 constraints->AddObject(new SpcDynamic(iomodel->constraintcounter+count+1,iomodel->nodecounter+i+1,2,DiagnosticHorizAnalysisEnum)); 184 count++; 185 } 186 178 187 if (!isnan(iomodel->spcvz[i]) && ((int)iomodel->vertices_type[i]==StokesApproximationEnum || ((int)iomodel->vertices_type[i]==NoneApproximationEnum))){ 179 188 constraints->AddObject(new SpcStatic(iomodel->constraintcounter+count+1,iomodel->nodecounter+i+1,3,iomodel->spcvz[i]/iomodel->yts,DiagnosticHorizAnalysisEnum)); //add count'th spc, on node i+1, setting dof 2 to vy -
TabularUnified issm/trunk/src/c/modules/SpcNodesx/SpcNodesx.cpp ¶
r9002 r9298 12 12 void SpcNodesx(Nodes* nodes,Constraints* constraints,Parameters* parameters, int analysis_type){ 13 13 14 int i; 15 16 for(i=0;i<constraints->Size();i++){ 14 for(int i=0;i<constraints->Size();i++){ 17 15 18 16 Constraint* constraint=(Constraint*)constraints->GetObjectByOffset(i); -
TabularUnified issm/trunk/src/c/modules/UpdateDynamicConstraintsx/UpdateDynamicConstraintsx.cpp ¶
r9293 r9298 10 10 #include "../../EnumDefinitions/EnumDefinitions.h" 11 11 12 void UpdateDynamicConstraintsx( Nodes* nodes,Parameters* parameters,Vec ys){12 void UpdateDynamicConstraintsx(Constraints* constraints,Nodes* nodes,Parameters* parameters,Vec yg){ 13 13 14 int i;15 14 int configuration_type; 16 double* y s_serial=NULL;15 double* yg_serial=NULL; 17 16 18 /* retrieve parameters:*/17 /*Get current configuration*/ 19 18 parameters->FindParam(&configuration_type,ConfigurationTypeEnum); 20 19 21 if(nodes->NumberOfNodes(configuration_type)){ 20 /*serialize yg, so nodes can index into it: */ 21 VecToMPISerial(&yg_serial,yg); 22 22 23 /*serialize ys, so nodes can index into it: */ 24 VecToMPISerial(&ys_serial,ys); 23 for(int i=0;i<constraints->Size();i++){ 25 24 26 /*Go through all nodes, and ask them to retrieve values from ys and then update their spc values :*/ 27 for(i=0;i<nodes->Size();i++){ 25 Constraint* constraint=(Constraint*)constraints->GetObjectByOffset(i); 28 26 29 Node* node=(Node*)nodes->GetObjectByOffset(i); 27 /*Check this constraint belongs to this analysis: */ 28 if(constraint->InAnalysis(configuration_type) && constraint->Enum()==SpcDynamicEnum){ 30 29 31 /*Check that this node corresponds to our analysis currently being carried out: */ 32 if (node->InAnalysis(configuration_type)){ 30 ((SpcDynamic*)constraint)->SetDynamicConstraint(nodes,yg_serial); 33 31 34 /*For this object, reset values of spc fields in the node: */35 node->UpdateSpcs(ys_serial);36 }37 32 } 38 33 } 39 34 40 35 /*Free ressources:*/ 41 xfree((void**)&y s_serial);36 xfree((void**)&yg_serial); 42 37 } -
TabularUnified issm/trunk/src/c/modules/UpdateDynamicConstraintsx/UpdateDynamicConstraintsx.h ¶
r9293 r9298 9 9 #include "../../objects/objects.h" 10 10 11 void UpdateDynamicConstraintsx( Nodes* nodes,Parameters* parameters,Vec ys);11 void UpdateDynamicConstraintsx(Constraints* constraints,Nodes* nodes,Parameters* parameters,Vec yg); 12 12 13 13 #endif /* _UPDATESPCSX_H */ -
TabularUnified issm/trunk/src/c/objects/Constraints/SpcDynamic.cpp ¶
r9286 r9298 24 24 /*}}}1*/ 25 25 /*FUNCTION SpcDynamic::SpcDynamic(int spc_sid,int spc_nodeid,...){{{1*/ 26 SpcDynamic::SpcDynamic(int spc_sid,int spc_nodeid, int spc_dof, double spc_value,int spc_analysis_type){26 SpcDynamic::SpcDynamic(int spc_sid,int spc_nodeid, int spc_dof,int spc_analysis_type){ 27 27 28 28 sid=spc_sid; 29 29 nodeid=spc_nodeid; 30 30 dof=spc_dof; 31 value= spc_value;31 value=0; 32 32 analysis_type=spc_analysis_type; 33 isset=false; 33 34 34 35 return; … … 50 51 printf(" dof: %i\n",dof); 51 52 printf(" value: %g\n",value); 53 printf(" isset: %s\n",isset?"true":"false"); 52 54 printf(" analysis_type: %s\n",EnumToStringx(analysis_type)); 53 55 return; … … 57 59 void SpcDynamic::DeepEcho(void){ 58 60 59 printf("SpcDynamic:\n"); 60 printf(" sid: %i\n",sid); 61 printf(" nodeid: %i\n",nodeid); 62 printf(" dof: %i\n",dof); 63 printf(" value: %g\n",value); 64 printf(" analysis_type: %s\n",EnumToStringx(analysis_type)); 61 this->Echo(); 65 62 return; 66 63 } … … 95 92 memcpy(marshalled_dataset,&dof,sizeof(dof));marshalled_dataset+=sizeof(dof); 96 93 memcpy(marshalled_dataset,&value,sizeof(value));marshalled_dataset+=sizeof(value); 94 memcpy(marshalled_dataset,&isset,sizeof(isset));marshalled_dataset+=sizeof(isset); 97 95 memcpy(marshalled_dataset,&analysis_type,sizeof(analysis_type));marshalled_dataset+=sizeof(analysis_type); 98 96 … … 108 106 +sizeof(dof) 109 107 +sizeof(value) 108 +sizeof(isset) 110 109 +sizeof(analysis_type) 111 110 +sizeof(int); //sizeof(int) for enum type … … 127 126 memcpy(&dof,marshalled_dataset,sizeof(dof));marshalled_dataset+=sizeof(dof); 128 127 memcpy(&value,marshalled_dataset,sizeof(value));marshalled_dataset+=sizeof(value); 128 memcpy(&isset,marshalled_dataset,sizeof(isset));marshalled_dataset+=sizeof(isset); 129 129 memcpy(&analysis_type,marshalled_dataset,sizeof(analysis_type));marshalled_dataset+=sizeof(analysis_type); 130 130 … … 164 164 /*Apply constraint: */ 165 165 if(node){ //in case the spc is dealing with a node on another cpu 166 167 /*We should first check that the value has been set... (test306)*/ 166 168 node->ApplyConstraint(dof,value); 167 169 } … … 183 185 /*FUNCTION SpcDynamic::GetValue {{{1*/ 184 186 double SpcDynamic::GetValue(){ 187 _assert_(this->isset); 185 188 _assert_(!isnan(value)); 186 189 return value; 187 190 } 188 191 /*}}}1*/ 192 /*FUNCTION SpcDynamic::SetDynamicConstraint {{{1*/ 193 void SpcDynamic::SetDynamicConstraint(Nodes* nodes,double* yg_serial){ 194 195 int pos; 196 197 Node* node=(Node*)nodes->GetObjectById(NULL,nodeid); 198 pos=node->GetDof(dof,GsetEnum); 199 200 this->value=yg_serial[pos]; 201 this->isset=true; 202 } 203 /*}}}1*/ -
TabularUnified issm/trunk/src/c/objects/Constraints/SpcDynamic.h ¶
r9286 r9298 19 19 int dof; /*!component*/ 20 20 double value; /*value*/ 21 bool isset; 21 22 int analysis_type; 22 23 … … 25 26 /*SpcDynamic constructors, destructors:{{{1*/ 26 27 SpcDynamic(); 27 SpcDynamic(int sid,int nodeid, int dof, double value,int analysis_type);28 SpcDynamic(int sid,int nodeid, int dof,int analysis_type); 28 29 ~SpcDynamic(); 29 30 /*}}}*/ … … 47 48 int GetDof(); 48 49 double GetValue(); 50 void SetDynamicConstraint(Nodes* nodes,double *yg_serial); 49 51 /*}}}*/ 50 52 -
TabularUnified issm/trunk/src/c/solutions/ResetBoundaryConditions.cpp ¶
r9293 r9298 10 10 11 11 /*variables: */ 12 Vec yg=NULL; 13 Vec ys=NULL; 14 Nodes* nodes=NULL; 15 int i; 12 Vec yg = NULL; 13 Nodes *nodes = NULL; 14 int i; 16 15 17 16 _printf_(VerboseSolution(),"%s\n"," updating boundary conditions..."); … … 25 24 /*retrieve boundary conditions from element inputs :*/ 26 25 GetSolutionFromInputsx( &yg, femmodel->elements,femmodel->nodes, femmodel->vertices,femmodel->loads, femmodel->materials, femmodel->parameters); 27 Reducevectorgtosx(&ys,yg,femmodel->nodes,femmodel->parameters);28 26 29 27 /*update spcs using this new vector of constraints: */ 30 UpdateDynamicConstraintsx(femmodel-> nodes,femmodel->parameters,ys);28 UpdateDynamicConstraintsx(femmodel->constraints,femmodel->nodes,femmodel->parameters,yg); 31 29 32 30 /*Free ressources:*/ 33 VecFree(&ys);34 31 VecFree(&yg); 35 32 } -
TabularUnified issm/trunk/src/m/solutions/ResetBoundaryConditions.m ¶
r9293 r9298 14 14 %recreate constraints vector for the current analysis 15 15 ug=GetSolutionFromInputs(femmodel.elements,femmodel.nodes,femmodel.vertices,femmodel.loads,femmodel.materials,femmodel.parameters); 16 ys=Reducevectorgtos(ug,femmodel.nodes,femmodel.parameters);17 16 18 17 %update values of spcs inside nodes 19 femmodel.nodes=UpdateDynamicConstraints(femmodel. nodes,femmodel.parameters,ys);18 femmodel.nodes=UpdateDynamicConstraints(femmodel.constraints,femmodel.nodes,femmodel.parameters,ug); -
TabularUnified issm/trunk/src/mex/UpdateDynamicConstraints/UpdateDynamicConstraints.cpp ¶
r9293 r9298 8 8 9 9 /*input datasets: */ 10 Nodes* nodes=NULL; 11 Parameters* parameters=NULL; 12 Vec ys=NULL; 10 Constraints *constraints = NULL; 11 Nodes *nodes = NULL; 12 Parameters *parameters = NULL; 13 Vec yg = NULL; 13 14 14 15 /*Boot module: */ … … 19 20 20 21 /*Input datasets: */ 22 FetchMatlabData((DataSet**)&constraints,CONSTRAINTSIN); 21 23 FetchMatlabData((DataSet**)&nodes,NODESIN); 22 24 FetchMatlabData((Parameters**)¶meters,PARAMETERS); 23 FetchMatlabData(&y s,YS);25 FetchMatlabData(&yg,YS); 24 26 25 27 /*!Generate internal degree of freedom numbers: */ 26 UpdateDynamicConstraintsx( nodes,parameters,ys);28 UpdateDynamicConstraintsx(constraints,nodes,parameters,yg); 27 29 28 30 /*write output datasets: */ … … 30 32 31 33 /*Free ressources: */ 34 VecFree(&yg); 35 delete constraints; 32 36 delete nodes; 33 37 delete parameters; -
TabularUnified issm/trunk/src/mex/UpdateDynamicConstraints/UpdateDynamicConstraints.h ¶
r9293 r9298 17 17 18 18 /* serial input macros: */ 19 #define NODESIN (mxArray*)prhs[0] 20 #define PARAMETERS (mxArray*)prhs[1] 21 #define YS (mxArray*)prhs[2] 19 #define CONSTRAINTSIN (mxArray*)prhs[0] 20 #define NODESIN (mxArray*)prhs[1] 21 #define PARAMETERS (mxArray*)prhs[2] 22 #define YS (mxArray*)prhs[3] 22 23 23 24 /* serial output macros: */ … … 28 29 #define NLHS 1 29 30 #undef NRHS 30 #define NRHS 331 #define NRHS 4 31 32 32 33 #endif /* _UPDATESPCS_H */
Note:
See TracChangeset
for help on using the changeset viewer.