Changeset 1825 for issm/trunk
- Timestamp:
- 08/24/09 17:46:16 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk/src/c/parallel/objectivefunctionC.cpp
r1805 r1825 23 23 24 24 /*parameters: */ 25 Model* model=NULL; 25 26 FemModel* femmodel=NULL; 26 27 double* param_g=NULL; … … 41 42 int sub_analysis_type; 42 43 Vec u_g=NULL; 44 Vec u_g_full=NULL; 43 45 double* u_g_double=NULL; 44 46 int numberofnodes; 47 48 /*thermalstatic: */ 49 int thermalstatic=0; 50 int isstokes=0; 51 DataSet* results_thermalstatic=NULL; 52 int dofs01[2]={0,1}; 45 53 54 /*Recover active model: */ 55 model=optargs->model; 56 femmodel=model->Active(); 46 57 47 58 /*Recover parameters: */ 48 femmodel=optargs->femmodel;49 59 param_g=optargs->param_g; 50 60 grad_g=optargs->grad_g; … … 62 72 femmodel->parameters->FindParam((void*)&numberofnodes,"numberofnodes"); 63 73 femmodel->parameters->FindParam((void*)&numberofdofspernode,"numberofdofspernode"); 74 femmodel->parameters->FindParam((void*)&thermalstatic,"thermalstatic"); 75 femmodel->parameters->FindParam((void*)&isstokes,"isstokes"); 64 76 65 77 /*First copy param_g so we don't modify it: */ … … 76 88 inputs->Add(control_type,param_g_copy,1,numberofnodes); 77 89 78 //Run diagnostic with updated parameters. 79 diagnostic_core_nonlinear(&u_g,NULL,NULL,NULL,femmodel,inputs,DiagnosticAnalysisEnum(),sub_analysis_type); 80 VecToMPISerial(&u_g_double,u_g); VecFree(&u_g); 90 if(!thermalstatic){ 91 //Run diagnostic with updated parameters. 92 diagnostic_core_nonlinear(&u_g,NULL,NULL,femmodel,inputs,DiagnosticAnalysisEnum(),sub_analysis_type); 93 VecToMPISerial(&u_g_double,u_g); VecFree(&u_g); 94 } 95 else{ 96 //Run full thermalstatic solution with updated parameters. 97 results_thermalstatic=new DataSet(ResultsEnum()); 98 thermalstatic_core(results_thermalstatic,model,inputs); 99 100 //get u_g 101 results_thermalstatic->FindResult(&u_g,"u_g"); 102 delete results_thermalstatic; 103 104 //extract the correct number of dofs (3 or 4) 105 VecDuplicatePatch(&u_g_full,u_g);VecFree(&u_g); 106 if(!isstokes)VecPartition(&u_g, u_g_full, dofsetgen(2,dofs01,3,numberofnodes*3), numberofnodes*2); 107 VecFree(&u_g_full); 108 } 109 81 110 inputs->Add("velocity",u_g_double,numberofdofspernode,numberofnodes); 82 111
Note:
See TracChangeset
for help on using the changeset viewer.