Changeset 15898


Ignore:
Timestamp:
08/23/13 10:03:26 (12 years ago)
Author:
Mathieu Morlighem
Message:

NEW: when a new result is added, we first check wether it already exists in the results dataset, if yes, it is deleted first

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

Legend:

Unmodified
Added
Removed
  • TabularUnified issm/trunk-jpl/src/c/analyses/transient_core.cpp

    r15877 r15898  
    140140                        _error_("ISSM was not compiled with grounding line migration capabilities. Exiting");
    141141                        #endif
     142                        if(save_results){
     143                                InputToResultx(femmodel,SurfaceEnum);
     144                                InputToResultx(femmodel,BedEnum);
     145                                InputToResultx(femmodel,MaskElementonfloatingiceEnum);
     146                        }
    142147                }
    143148                if(isgia){
     
    155160                        if(VerboseSolution()) _printf0_("   saving transient results\n");
    156161                        InputToResultx(femmodel,SurfaceforcingsMassBalanceEnum);
    157                         InputToResultx(femmodel,MaskElementonfloatingiceEnum);
    158162                        femmodel->RequestedOutputsx(requested_outputs,numoutputs);
    159163                        if(isdelta18o){
  • TabularUnified issm/trunk-jpl/src/c/classes/Elements/Penta.cpp

    r15897 r15898  
    21072107        /*If we don't find it, no big deal, just don't do the transfer. Otherwise, build a new Result
    21082108         * object out of the input, with the additional step and time information: */
    2109         this->results->AddObject((Object*)input->SpawnResult(step,time));
     2109        this->results->AddResult(input->SpawnResult(step,time));
    21102110        #ifdef _HAVE_CONTROL_
    21112111        if(input->ObjectEnum()==ControlInputEnum){
    2112                 if(((ControlInput*)input)->gradient!=NULL) this->results->AddObject((Object*)((ControlInput*)input)->SpawnGradient(step,time));
     2112                if(((ControlInput*)input)->gradient!=NULL) this->results->AddResult(((ControlInput*)input)->SpawnGradient(step,time));
    21132113        }
    21142114        #endif
  • TabularUnified issm/trunk-jpl/src/c/classes/Elements/Tria.cpp

    r15877 r15898  
    14291429        /*If we don't find it, no big deal, just don't do the transfer. Otherwise, build a new Result
    14301430         * object out of the input, with the additional step and time information: */
    1431         this->results->AddObject((Object*)input->SpawnResult(step,time));
     1431        this->results->AddResult(input->SpawnResult(step,time));
    14321432
    14331433        #ifdef _HAVE_CONTROL_
    14341434        if(input->ObjectEnum()==ControlInputEnum){
    1435                 if(((ControlInput*)input)->gradient!=NULL) this->results->AddObject((Object*)((ControlInput*)input)->SpawnGradient(step,time));
     1435                if(((ControlInput*)input)->gradient!=NULL) this->results->AddResult(((ControlInput*)input)->SpawnGradient(step,time));
    14361436        }
    14371437        #endif
  • TabularUnified issm/trunk-jpl/src/c/classes/ExternalResults/Results.cpp

    r15737 r15898  
    5454}
    5555/*}}}*/
     56/*FUNCTION Results::Write{{{*/
     57int Results::AddResult(ElementResult* in_result){
     58
     59        /*First, go through dataset of inputs and check whether any input
     60         * with the same name is already in. If so, erase the corresponding
     61         * object before adding this new one: */
     62        vector<Object*>::iterator object;
     63        ElementResult* result=NULL;
     64
     65        /*In debugging mode, check that the input is not a NULL pointer*/
     66        _assert_(in_result);
     67
     68        for(object=objects.begin() ; object<objects.end(); object++){
     69
     70                result=dynamic_cast<ElementResult*>(*object);
     71
     72                if(result->InstanceEnum()==in_result->InstanceEnum()){
     73                        if(result->GetStep()==in_result->GetStep()){
     74                                this->DeleteObject(result);
     75                                break;
     76                        }
     77                }
     78        }
     79        this->AddObject(in_result);
     80
     81        return 1;
     82}
     83/*}}}*/
  • TabularUnified issm/trunk-jpl/src/c/classes/ExternalResults/Results.h

    r15737 r15898  
    66/*forward declarations */
    77class Parameters;
     8class ElementResult;
    89
    910/*!\brief Declaration of Results class.
     
    1920                ~Results();
    2021
    21                 /*numerics*/
     22                /*Mehthos*/
     23                int AddResult(ElementResult* result);
    2224                void Write(Parameters* parameters);
    2325};
Note: See TracChangeset for help on using the changeset viewer.