Changeset 24240 for issm/trunk-jpl/src/c/classes/Inputs/TriaInput.cpp
- Timestamp:
- 10/17/19 06:03:43 (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl/src/c/classes/Inputs/TriaInput.cpp
r24091 r24240 126 126 SegInput* outinput=NULL; 127 127 128 if(this->interpolation_type==P0Enum){ 128 if(this->interpolation_type==P0Enum){ 129 129 outinput=new SegInput(this->enum_type,&this->values[0],P0Enum); 130 130 } … … 165 165 } 166 166 /*}}}*/ 167 void TriaInput::GetInputA llTimeAverages(IssmDouble** pvalues,IssmDouble** ptimes, int* pnumtimes){/*{{{*/167 void TriaInput::GetInputAveragesOnAllTime(IssmDouble** pvalues,IssmDouble** ptimes, int* pnumtimes){/*{{{*/ 168 168 169 169 IssmDouble* outvalues=NULL; … … 224 224 /*}}}*/ 225 225 226 void TriaInput::GetInput UpToCurrentTimeAverages(IssmDouble** pvalues, IssmDouble** ptimes, int* pnumtimes, IssmDouble currenttime){/*{{{*/226 void TriaInput::GetInputAveragesUpToCurrentTime(IssmDouble** pvalues, IssmDouble** ptimes, int* pnumtimes, IssmDouble currenttime){/*{{{*/ 227 227 228 228 IssmDouble* outvalues=NULL; … … 320 320 } 321 321 /*}}}*/ 322 void TriaInput::PointwiseMult(Input* xinput){/*{{{*/ 323 324 const int numnodes=this->NumberofNodes(this->interpolation_type); 325 TriaInput* xtriainput=NULL; 326 327 328 /*xinput is of the same type, so cast it: */ 329 if(xinput->ObjectEnum()!=TriaInputEnum) _error_("Operation not permitted because xinput is of type " << EnumToStringx(xinput->ObjectEnum())); 330 xtriainput=(TriaInput*)xinput; 331 if(xtriainput->interpolation_type!=this->interpolation_type) _error_("Operation not permitted because xinput is of type " << EnumToStringx(xtriainput->interpolation_type)); 332 333 /*Carry out the PointwiseMult operation depending on type:*/ 334 for(int i=0;i<numnodes;i++)this->values[i]=this->values[i]*xtriainput->values[i]; 335 336 } 337 /*}}}*/ 338 void TriaInput::Pow(IssmDouble exponent){/*{{{*/ 339 340 const int numnodes=this->NumberofNodes(this->interpolation_type); 341 if(exponent==0.0){ 342 /* Not-a-number left alone Infinity set to one */ 343 for(int i=0;i<numnodes;i++){ 344 if (this->values[i]==this->values[i])this->values[i]=1.0; 345 } 346 } 347 else if(exponent==0.5){ 348 for(int i=0;i<numnodes;i++){ 349 if(this->values[i]>=0){ 350 this->values[i]=sqrt(this->values[i]); 351 } 352 else{ 353 this->values[i]=INFINITY; 354 } 355 } 356 } 357 else if(exponent==1.0){ 358 /* do nothing */ 359 } 360 else if(exponent==-0.5){ 361 for(int i=0;i<numnodes;i++){ 362 if(this->values[i]>=0){ 363 this->values[i]=1.0/sqrt(this->values[i]); 364 } 365 else{ 366 this->values[i]=INFINITY; 367 } 368 } 369 } 370 else if(exponent==-1.0){ 371 for(int i=0;i<numnodes;i++){ 372 if(this->values[i]!=0.){ 373 this->values[i]=1.0/this->values[i]; 374 } 375 else{ 376 this->values[i]=INFINITY; 377 } 378 } 379 } 380 else { 381 for(int i=0;i<numnodes;i++)this->values[i]=pow(this->values[i],exponent); 382 } 383 } 384 /*}}}*/ 322 385 void TriaInput::Scale(IssmDouble scale_factor){/*{{{*/ 323 386
Note:
See TracChangeset
for help on using the changeset viewer.