Changeset 8791


Ignore:
Timestamp:
07/05/11 13:23:33 (14 years ago)
Author:
schlegel
Message:

No more crashes

File:
1 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk/src/c/objects/Inputs/TransientInput.cpp

    r8762 r8791  
    2121/*FUNCTION TransientInput::TransientInput(){{{1*/
    2222TransientInput::TransientInput(){
    23         enum_type=NoneEnum;
     23
     24   enum_type=UNDEF;
    2425        inputs=NULL;
    25         numtimesteps=0;
    26         parameters=NULL;
    27         timesteps=NULL;
    28         return;
     26        this->numtimesteps=0;
     27        this->parameters=NULL;
     28        this->timesteps=NULL;
     29
    2930}
    3031/*}}}*/
     
    4647TransientInput::~TransientInput(){
    4748        xfree((void**)&this->timesteps);
     49        this->timesteps=NULL;
    4850        this->numtimesteps=0;
    4951        parameters=NULL;
     
    198200        output->enum_type=this->enum_type;
    199201        output->numtimesteps=this->numtimesteps;
     202        output->timesteps=(double*)xmalloc(this->numtimesteps*sizeof(double));
    200203   memcpy(output->timesteps,this->timesteps,this->numtimesteps*sizeof(double));
    201204        output->inputs=(Inputs*)this->inputs->Copy();
     
    224227        outinput=new TransientInput();
    225228        outinput->enum_type=this->enum_type;
     229        outinput->numtimesteps=this->numtimesteps;
     230        outinput->timesteps=(double*)xmalloc(this->numtimesteps*sizeof(double));
     231        memcpy(outinput->timesteps,this->timesteps,this->numtimesteps*sizeof(double));
    226232        outinput->inputs=(Inputs*)this->inputs->SpawnTriaInputs(indices);
     233        outinput->parameters=this->parameters;
    227234
    228235        /*Assign output*/
     
    242249        elementresult=input->SpawnResult(step,time);
    243250
    244    xfree((void**)&input);
     251   delete input;
    245252
    246253        return elementresult;
     
    255262
    256263        /*First, recover current time from parameters: */
    257         parameters->FindParam(&time,TimeEnum);
     264        this->parameters->FindParam(&time,TimeEnum);
    258265
    259266        /*Retrieve interpolated values for this time step: */
     
    263270        input->GetParameterValue(pvalue,gauss);
    264271
    265         xfree((void**)&input);
     272        delete input;
    266273
    267274}
     
    281288        input->GetParameterDerivativeValue(p,xyz_list,gauss);
    282289
    283         xfree((void**)&input);
     290        delete input;
     291
    284292}
    285293/*}}}*/
     
    303311        input->GetParameterAverage(pvalue);
    304312                           
    305         xfree((void**)&input);
     313        delete input;
    306314
    307315}
     
    323331        input->SquareMin(psquaremin,process_units,parameters);
    324332                           
    325         xfree((void**)&input);
     333        delete input;
    326334
    327335}
     
    342350        infnorm=input->InfinityNorm();
    343351                           
    344         xfree((void**)&input);
     352        delete input;
    345353
    346354}
     
    361369        max=input->Max();
    362370                           
    363         xfree((void**)&input);
     371        delete input;
    364372
    365373        return max;
     
    381389        maxabs=input->MaxAbs();
    382390
    383         xfree((void**)&input);
     391        delete input;
    384392
    385393        return maxabs;
     394
    386395}
    387396/*}}}*/
     
    401410        min=input->Min();
    402411
    403         xfree((void**)&input);
     412        delete input;
    404413
    405414        return min;
     415
    406416}
    407417/*}}}*/
     
    421431        minabs=input->MinAbs();
    422432                           
    423         xfree((void**)&input);
     433        delete input;
    424434
    425435        return minabs;
     
    440450        input->GetVectorFromInputs(vector,doflist);
    441451                           
    442         xfree((void**)&input);
     452        delete input;
    443453
    444454} /*}}}*/
Note: See TracChangeset for help on using the changeset viewer.