- Timestamp:
- 04/16/21 10:47:27 (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl/src/c/classes/Params/TransientArrayParam.cpp
r25508 r26196 20 20 } 21 21 /*}}}*/ 22 TransientArrayParam::TransientArrayParam(int in_enum_type,IssmDouble* in_values,IssmDouble* in_time,bool interpolation_on, int in_N,int in_M){/*{{{*/22 TransientArrayParam::TransientArrayParam(int in_enum_type,IssmDouble* in_values,IssmDouble* in_time,bool interpolation_on,bool cycle_in,int in_N,int in_M){/*{{{*/ 23 23 24 24 _assert_(in_values && in_time); … … 28 28 this->N=in_N; //Number of timesteps 29 29 this->interpolation=interpolation_on; 30 this->cycle=cycle_in; 30 31 31 32 this->values=xNew<IssmDouble>(M*N); 32 xMemCpy<IssmDouble>( values,in_values,M*N);33 xMemCpy<IssmDouble>(this->values,in_values,M*N); 33 34 34 35 this->timesteps=xNew<IssmDouble>(N); 35 xMemCpy<IssmDouble>(t imesteps,in_time,N);36 xMemCpy<IssmDouble>(this->timesteps,in_time,N); 36 37 } 37 38 /*}}}*/ … … 44 45 Param* TransientArrayParam::copy() {/*{{{*/ 45 46 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); 47 48 48 49 } … … 80 81 marshallhandle->call(this->enum_type); 81 82 marshallhandle->call(this->interpolation); 83 marshallhandle->call(this->cycle); 82 84 marshallhandle->call(this->M); 83 85 marshallhandle->call(this->N); … … 102 104 bool found; 103 105 _assert_(row>=0 && row<this->M); 106 107 if(this->cycle) _error_("not implemented yet"); 104 108 105 109 /*Ok, we have the time and row, go through the timesteps, and figure out which interval we … … 129 133 IssmDouble deltat = this->timesteps[i+1]-this->timesteps[i]; 130 134 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]; 132 136 else output=this->values[row*this->N+i]; 133 137 found=true;
Note:
See TracChangeset
for help on using the changeset viewer.