Changeset 24790 for issm/trunk-jpl/src/c/classes/Inputs2/TriaInput2.cpp
- Timestamp:
- 05/05/20 06:20:58 (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl/src/c/classes/Inputs2/TriaInput2.cpp
r24360 r24790 142 142 143 143 _assert_(this); 144 _assert_(row>=0); 145 _assert_(row<this->M); 144 _assert_(row>=0); 145 _assert_(row<this->M); 146 146 _assert_(this->N==1); 147 147 … … 157 157 for(int i=0;i<numindices;i++){ 158 158 int row = indices[i]; 159 _assert_(row>=0); 160 _assert_(row<this->M); 159 _assert_(row>=0); 160 _assert_(row<this->M); 161 161 this->values[row] = values_in[i]; 162 162 } … … 166 166 for(int i=0;i<numindices;i++){ 167 167 int row = indices[i]; 168 _assert_(row>=0); 169 _assert_(row<this->M); 168 _assert_(row>=0); 169 _assert_(row<this->M); 170 170 this->values[row] = values_in[i]; 171 171 } … … 175 175 for(int i=0;i<numindices;i++){ 176 176 int row = indices[i]; 177 _assert_(row>=0); 178 _assert_(row<this->M); 177 _assert_(row>=0); 178 _assert_(row<this->M); 179 179 this->values[row] = values_in[i]; 180 180 } … … 207 207 for(int i=0;i<numindices;i++){ 208 208 int row = indices[i]; 209 _assert_(row>=0); 210 _assert_(row<this->M); 209 _assert_(row>=0); 210 _assert_(row<this->M); 211 211 this->element_values[i] = this->values[row]; 212 212 } … … 364 364 } 365 365 /*}}}*/ 366 void TriaInput2::Pow(IssmDouble alpha){/*{{{*/ 367 368 for(int i=0;i<this->M*this->N;i++) this->values[i] = pow(this->values[i],alpha); 369 for(int i=0;i<TriaRef::NumberofNodes(this->interpolation);i++) this->element_values[i] = pow(this->element_values[i],alpha); 370 } 371 /*}}}*/ 366 372 void TriaInput2::AXPY(Input2* xinput,IssmDouble alpha){/*{{{*/ 367 373 … … 376 382 } 377 383 /*}}}*/ 384 void TriaInput2::PointWiseMult(Input2* xinput){/*{{{*/ 385 386 /*xinput is of the same type, so cast it: */ 387 if(xinput->ObjectEnum()!=TriaInput2Enum) _error_("Operation not permitted because xinput is of type " << EnumToStringx(xinput->ObjectEnum())); 388 TriaInput2* xtriainput=xDynamicCast<TriaInput2*>(xinput); 389 if(xtriainput->GetInterpolation()!=this->interpolation) _error_("Operation not permitted because xinput is of type " << EnumToStringx(xinput->ObjectEnum())); 390 391 /* we need to check that the vector sizes are identical*/ 392 if(xtriainput->M!=this->M||xtriainput->N!=this->N) _error_("Operation not permitted because the inputs have different sizes"); 393 394 /*Carry out the AXPY operation depending on type:*/ 395 for(int i=0;i<this->M*this->N;i++) this->values[i] = xtriainput->values[i] * this->values[i]; 396 for(int i=0;i<TriaRef::NumberofNodes(this->interpolation);i++) this->element_values[i] = xtriainput->element_values[i] * this->element_values[i]; 397 } 398 /*}}}*/ 378 399 379 400 /*Object functions*/
Note:
See TracChangeset
for help on using the changeset viewer.