Changeset 1671
- Timestamp:
- 08/13/09 15:49:12 (15 years ago)
- Location:
- issm/trunk/src/c
- Files:
-
- 1 added
- 1 deleted
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk/src/c/Makefile.am
r1669 r1671 587 587 ./parallel/control.cpp\ 588 588 ./parallel/control_core.cpp\ 589 ./parallel/Control PrepareStokes.cpp\589 ./parallel/ControlInitialization.cpp\ 590 590 ./parallel/ControlTemporaryResults.cpp\ 591 591 ./parallel/objectivefunctionC.cpp\ -
issm/trunk/src/c/parallel/control_core.cpp
r1619 r1671 13 13 extern int my_rank; 14 14 15 /*fem models: */ 16 FemModel* fem_dh=NULL; 17 FemModel* fem_dv=NULL; 18 FemModel* fem_dhu=NULL; 19 FemModel* fem_ds=NULL; 20 FemModel* fem_sl=NULL; 15 /*fem model: */ 16 FemModel* fem_model=NULL; 21 17 22 18 /*output: */ … … 47 43 48 44 /*flags: */ 49 int 50 int 45 int analysis_type; 46 int sub_analysis_type; 51 47 int debug=0; 52 int dim=-1;53 int ishutter=0;54 int ismacayealpattyn=0;55 int isstokes=0;56 int numberofdofspernode_sl;57 int numberofdofspernode_dh;58 int numberofdofspernode_ds;59 48 int numberofnodes; 60 49 61 /*recover fem models: */ 62 fem_dh=fems+0; 63 fem_dv=fems+1; 64 fem_ds=fems+2; 65 fem_dhu=fems+3; 66 fem_sl=fems+4; 67 68 //first recover parameters common to all solutions 69 fem_dh->parameters->FindParam((void*)&debug,"debug"); 70 fem_dh->parameters->FindParam((void*)&dim,"dim"); 71 fem_dh->parameters->FindParam((void*)&ishutter,"ishutter"); 72 fem_dh->parameters->FindParam((void*)&ismacayealpattyn,"ismacayealpattyn"); 73 fem_dh->parameters->FindParam((void*)&numberofnodes,"numberofnodes"); 74 fem_dh->parameters->FindParam((void*)&isstokes,"isstokes"); 50 /*Process models*/ 51 ControlInitialization(&fem_model,fems,inputs); 75 52 76 53 /*Recover parameters used throughout the solution:*/ 77 fem_ dh->parameters->FindParam((void*)&nsteps,"nsteps");78 fem_ dh->parameters->FindParam((void*)&control_type,"control_type");79 fem_ dh->parameters->FindParam((void*)&fit,"fit");80 fem_ dh->parameters->FindParam((void*)&optscal,"optscal");81 fem_ dh->parameters->FindParam((void*)&maxiter,"maxiter");82 fem_ dh->parameters->FindParam((void*)&tolx,"tolx");83 fem_ dh->parameters->FindParam((void*)&mincontrolconstraint,"mincontrolconstraint");84 fem_ dh->parameters->FindParam((void*)&maxcontrolconstraint,"maxcontrolconstraint");85 fem_ dh->parameters->FindParam((void*)¶m_g,"param_g");86 fem_ dh->parameters->FindParam((void*)&analysis_type,"analysis_type");87 fem_ dh->parameters->FindParam((void*)&sub_analysis_type,"sub_analysis_type");88 fem_ dh->parameters->FindParam((void*)&numberofnodes,"numberofnodes");89 gsize=fem_ dh->nodes->NumberOfDofs();54 fem_model->parameters->FindParam((void*)&nsteps,"nsteps"); 55 fem_model->parameters->FindParam((void*)&control_type,"control_type"); 56 fem_model->parameters->FindParam((void*)&fit,"fit"); 57 fem_model->parameters->FindParam((void*)&optscal,"optscal"); 58 fem_model->parameters->FindParam((void*)&maxiter,"maxiter"); 59 fem_model->parameters->FindParam((void*)&tolx,"tolx"); 60 fem_model->parameters->FindParam((void*)&mincontrolconstraint,"mincontrolconstraint"); 61 fem_model->parameters->FindParam((void*)&maxcontrolconstraint,"maxcontrolconstraint"); 62 fem_model->parameters->FindParam((void*)¶m_g,"param_g"); 63 fem_model->parameters->FindParam((void*)&analysis_type,"analysis_type"); 64 fem_model->parameters->FindParam((void*)&sub_analysis_type,"sub_analysis_type"); 65 fem_model->parameters->FindParam((void*)&numberofnodes,"numberofnodes"); 66 gsize=fem_model->nodes->NumberOfDofs(); 90 67 91 68 /*Initialize misfit: */ … … 93 70 94 71 /*erase useless parameters: */ 95 param=(Param*)fem_ dh->parameters->FindParamObject("param_g");96 fem_ dh->parameters->DeleteObject((Object*)param);72 param=(Param*)fem_model->parameters->FindParamObject("param_g"); 73 fem_model->parameters->DeleteObject((Object*)param); 97 74 98 param=(Param*)fem_dh->parameters->FindParamObject("u_g"); 99 fem_dh->parameters->DeleteObject((Object*)param); 100 101 /*take care of Stokes: compute slope and get spc once for all*/ 102 if (isstokes) ControlPrepareStokes(fems,inputs); 75 param=(Param*)fem_model->parameters->FindParamObject("u_g"); 76 fem_model->parameters->DeleteObject((Object*)param); 103 77 104 78 /*Start looping: */ … … 110 84 111 85 /*Update parameters: */ 112 if (isstokes) UpdateFromInputsx(fem_ds->elements,fem_ds->nodes,fem_ds->loads, fem_ds->materials,inputs); 113 else UpdateFromInputsx(fem_dh->elements,fem_dh->nodes,fem_dh->loads, fem_dh->materials,inputs); 86 UpdateFromInputsx(fem_model->elements,fem_model->nodes,fem_model->loads, fem_model->materials,inputs); 114 87 115 88 _printf_("%s\n"," computing gradJ..."); 116 if (isstokes) grad_g=GradJCompute(inputs,fem_ds); 117 else grad_g=GradJCompute(inputs,fem_dh); 89 grad_g=GradJCompute(inputs,fem_model); 118 90 _printf_("%s\n"," done."); 119 91 … … 126 98 127 99 _printf_("%s\n"," optimizing along gradient direction..."); 128 if (isstokes) optargs.femmodel=fem_ds; 129 else optargs.femmodel=fem_dh; 100 optargs.femmodel=fem_model; 130 101 optargs.param_g=param_g; optargs.grad_g=grad_g_double; optargs.inputs=inputs;optargs.n=n; 131 102 optpars.xmin=0; optpars.xmax=1; optpars.tolerance=tolx; optpars.maxiter=(int)maxiter[n]; -
issm/trunk/src/c/parallel/parallel.h
r1669 r1671 41 41 void WriteLockFile(char* filename); 42 42 43 void Control PrepareStokes(FemModel* fems, ParameterInputs* inputs);43 void ControlInitialization(FemModel** pmodel, FemModel* fems, ParameterInputs* inputs); 44 44 void ControlTemporaryResults(FemModel* fems,double* param_g,double* J,int n,ParameterInputs* inputs); 45 45
Note:
See TracChangeset
for help on using the changeset viewer.