Changeset 19261


Ignore:
Timestamp:
04/06/15 18:54:25 (10 years ago)
Author:
schlegel
Message:

CHG: clean up and reset file param for output file

Location:
issm/trunk-jpl/src/c
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk-jpl/src/c/classes/FemModel.cpp

    r19254 r19261  
    412412                ConfigureObjectsx(output->elements,output->loads,output->nodes,output->vertices,output->materials,output->parameters);
    413413        }
     414
     415        /*Reset current configuration: */
     416        analysis_type=output->analysis_type_list[analysis_counter];
     417        output->SetCurrentConfiguration(analysis_type);
    414418
    415419        return output;
     
    650654
    651655        FILE* restartfid=NULL;
     656        FILE* output_fid=NULL;
    652657        char* restartfilename = NULL;
    653658        int   femmodel_size=0;
     
    679684        femmodel_buffer_ini=femmodel_buffer; //keep track of the initial position, so as to free later.
    680685
     686        this->parameters->FindParam(&output_fid,OutputFilePointerEnum);
     687
    681688        /*Create new FemModel by demarshalling the buffer: */
    682689        this->Marshall(&femmodel_buffer,NULL,MARSHALLING_BACKWARD);
    683690
     691        this->parameters->SetParam(output_fid,OutputFilePointerEnum);
     692
    684693        /*Reset position of buffer: */
    685694        femmodel_buffer=femmodel_buffer_ini;
     
    687696        /*Done, close file :*/
    688697        pfclose(restartfid,restartfilename);
    689        
     698
    690699        /*Free ressources: */
    691700        xDelete<char>(restartfilename);
     
    700709
    701710        if(marshall_direction==MARSHALLING_BACKWARD){
    702                 delete profiler; profiler=new Profiler();
    703                 delete loads; loads=new Loads();
    704                 delete materials; materials=new Materials();
    705                 delete parameters; parameters=new Parameters();
    706                 delete constraints; constraints=new Constraints();
    707                 delete results; results=new Results();
    708                 delete nodes; nodes=new Nodes();
    709                 delete vertices; vertices=new Vertices();
    710                 delete elements; elements=new Elements();
    711                 xDelete<int>(analysis_type_list);
     711                delete this->profiler;
     712                delete this->loads;
     713                delete this->materials;
     714                delete this->parameters;
     715                delete this->constraints;
     716                delete this->results;
     717                delete this->nodes;
     718                delete this->vertices;
     719                delete this->elements;
     720                xDelete<int>(this->analysis_type_list);
     721
     722                this->profiler = new Profiler();
     723                this->loads = new Loads();
     724                this->materials = new Materials();
     725                this->parameters = new Parameters();
     726                this->constraints = new Constraints();
     727                this->results = new Results();
     728                this->nodes = new Nodes();
     729                this->vertices = new Vertices();
     730                this->elements = new Elements();
    712731        }
    713732
     
    719738        MARSHALLING_DYNAMIC(analysis_type_list,int,nummodels);
    720739
    721         profiler->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
    722         loads->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
    723         materials->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
    724         parameters->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
    725         constraints->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
    726         results->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
    727         nodes->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
    728         vertices->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
    729         elements->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
     740        this->profiler->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
     741        this->loads->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
     742        this->materials->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
     743        this->parameters->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
     744        this->constraints->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
     745        this->results->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
     746        this->nodes->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
     747        this->vertices->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
     748        this->elements->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
    730749
    731750        if(marshall_direction==MARSHALLING_BACKWARD){
    732751                //reset hooks for elements, loads and nodes:
    733                 elements->ResetHooks();
    734                 loads->ResetHooks();
    735                 materials->ResetHooks();
     752                this->elements->ResetHooks();
     753                this->loads->ResetHooks();
     754                this->materials->ResetHooks();
    736755
    737756                //do the post-processing of the datasets to get an FemModel that can actually run analyses:
    738757                for(i=0;i<nummodels;i++){
    739                         analysis_type=analysis_type_list[i];
     758                        analysis_type=this->analysis_type_list[i];
    740759                        SetCurrentConfiguration(analysis_type);
    741                         if(i==0) VerticesDofx(vertices,parameters); //only call once, we only have one set of vertices
    742                         SpcNodesx(nodes,constraints,parameters,analysis_type);
    743                         NodesDofx(nodes,parameters,analysis_type);
    744                         ConfigureObjectsx(elements,loads,nodes,vertices,materials,parameters);
     760                        if(i==0) VerticesDofx(this->vertices,this->parameters); //only call once, we only have one set of vertices
     761                        SpcNodesx(this->nodes,this->constraints,this->parameters,analysis_type);
     762                        NodesDofx(this->nodes,this->parameters,analysis_type);
     763                        ConfigureObjectsx(this->elements,this->loads,this->nodes,this->vertices,this->materials,this->parameters);
    745764                }
     765
     766                /*Reset current configuration: */
     767                analysis_type=this->analysis_type_list[analysis_counter];
     768                SetCurrentConfiguration(analysis_type);
    746769        }
    747770
  • issm/trunk-jpl/src/c/classes/Params/FileParam.cpp

    r19254 r19261  
    5858
    5959        MARSHALLING_ENUM(FileParamEnum);
     60        MARSHALLING(enum_type);
    6061        MARSHALLING(value);
    6162
    62         if(marshall_direction==MARSHALLING_BACKWARD)value=NULL; //meaningless file pointer!
     63        if(marshall_direction==MARSHALLING_BACKWARD) value=NULL; //meaningless file pointer!
    6364
    6465}
  • issm/trunk-jpl/src/c/datastructures/DataSet.cpp

    r19254 r19261  
    215215                                fileparam=new FileParam();
    216216                                fileparam->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
    217                                 this->AddObject(fileparam);
     217                                delete fileparam;
     218                                /* No need to add this object, the pointer is not valid             
     219                                   The FemModel should reset all FileParams in the restart function */
    218220                        }
    219221                        else if(obj_enum==StringParamEnum){
Note: See TracChangeset for help on using the changeset viewer.