Ignore:
Timestamp:
06/16/10 18:20:52 (15 years ago)
Author:
Eric.Larour
Message:

Serious cleanup of the control solutoin

File:
1 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk/src/c/solutions/ControlRestart.cpp

    r3938 r4048  
    1 
    21/*!\file: ControlRestart.cpp
    3  * \brief: core of the control solution
     2 * \brief: save as much as possible, to be able to restart the control_core solution
    43 */
    54
     
    87#include "../EnumDefinitions/EnumDefinitions.h"
    98
    10 void ControlRestart(Model* model,double* param_g){
     9void ControlRestart(FemModel* femmodel){
    1110
    12         extern int my_rank;
    13 
    14         /*output: */
    15         Results* results=NULL;
    1611        char*    outputfilename=NULL;
    17 
    18         /*Intermediary: */
    19         int      i;
    20         int      numberofnodes;
    21         double* param_g_copy;
    22 
    23         /*Recover parameters used throughout the solution:*/
    24         model->FindParam(&numberofnodes,NumberOfNodesEnum);
     12       
     13        /*retrieve output file name: */
    2514        model->FindParam(&outputfilename,OutputFileNameEnum);
    2615
    27         /*Plug COPYS of the results into output dataset:
    28          * only the pointer is given to temporary_results and at the
    29          * end of ProcessResultsx the pointer is deleted. That would
    30          * destroy param_g*/
     16        /*we essentially want J and the parameter: */
     17        InputToResultx(femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters,control_type); //the parameter itself!
     18        femmodel->otherresults->AddObject(new DoubleResult(femmodel->otherresults->Size()+1,0,1,"J",J,nsteps));
     19        femmodel->otherresults->AddObject(new StringResult(results->Size()+1,ControlTypeEnum,0,1,EnumAsString(control_type)));
    3120
    32         param_g_copy=(double*)xcalloc(numberofnodes,sizeof(double));
    33         for(i=0;i<numberofnodes;i++) param_g_copy[i]=param_g[i];
    34 
    35         results=new Results();
    36         results->AddObject(new Result(results->Size()+1,0,1,"param_g",param_g_copy,numberofnodes));
    37         results->AddObject(new StringResult(results->Size()+1,AnalysisTypeEnum,0,1,EnumAsString(DiagnosticAnalysisEnum)));
    38 
    39         //Write results on disk
    40         OutputResults(results,outputfilename);
     21        /*write to disk: */
     22        OutputResults(femmodel->elements, femmodel->loads, femmodel->nodes, femmodel->vertices, femmodel->materials, femmodel->parameters, outputfilename);
    4123       
    4224        /*Free ressources:*/
    43         delete results;
    4425        xfree((void**)&outputfilename);
    45         xfree((void**)&param_g_copy);
    4626}
Note: See TracChangeset for help on using the changeset viewer.