Ignore:
Timestamp:
04/16/21 10:47:27 (4 years ago)
Author:
Mathieu Morlighem
Message:

CHG: preparing for cycling forcing

File:
1 edited

Legend:

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

    r25508 r26196  
    2020}
    2121/*}}}*/
    22 TransientArrayParam::TransientArrayParam(int in_enum_type,IssmDouble* in_values,IssmDouble* in_time,bool interpolation_on,int in_N,int in_M){/*{{{*/
     22TransientArrayParam::TransientArrayParam(int in_enum_type,IssmDouble* in_values,IssmDouble* in_time,bool interpolation_on,bool cycle_in,int in_N,int in_M){/*{{{*/
    2323
    2424        _assert_(in_values && in_time);
     
    2828        this->N=in_N; //Number of timesteps
    2929        this->interpolation=interpolation_on;
     30        this->cycle=cycle_in;
    3031
    3132        this->values=xNew<IssmDouble>(M*N);
    32         xMemCpy<IssmDouble>(values,in_values,M*N);
     33        xMemCpy<IssmDouble>(this->values,in_values,M*N);
    3334
    3435        this->timesteps=xNew<IssmDouble>(N);
    35         xMemCpy<IssmDouble>(timesteps,in_time,N);
     36        xMemCpy<IssmDouble>(this->timesteps,in_time,N);
    3637}
    3738/*}}}*/
     
    4445Param* TransientArrayParam::copy() {/*{{{*/
    4546
    46         return new TransientArrayParam(this->enum_type,this->values,this->timesteps,this->interpolation,this->M,this->N);
     47        return new TransientArrayParam(this->enum_type,this->values,this->timesteps,this->interpolation,this->cycle,this->M,this->N);
    4748
    4849}
     
    8081        marshallhandle->call(this->enum_type);
    8182        marshallhandle->call(this->interpolation);
     83        marshallhandle->call(this->cycle);
    8284        marshallhandle->call(this->M);
    8385        marshallhandle->call(this->N);
     
    102104        bool       found;
    103105        _assert_(row>=0 && row<this->M);
     106
     107        if(this->cycle) _error_("not implemented yet");
    104108
    105109        /*Ok, we have the time and row, go through the timesteps, and figure out which interval we
     
    129133                                        IssmDouble deltat = this->timesteps[i+1]-this->timesteps[i];
    130134                                        IssmDouble alpha  = (time-this->timesteps[i])/deltat;
    131                                         if(interpolation==true) output=(1.0-alpha)*this->values[row*this->N+i] + alpha*this->values[row*this->N+i+1];
     135                                        if(this->interpolation==true) output=(1.0-alpha)*this->values[row*this->N+i] + alpha*this->values[row*this->N+i+1];
    132136                                        else output=this->values[row*this->N+i];
    133137                                        found=true;
Note: See TracChangeset for help on using the changeset viewer.