Changeset 21974
- Timestamp:
- 08/18/17 14:20:30 (8 years ago)
- Location:
- issm/trunk-jpl/src/c/classes/Inputs
- Files:
-
- 20 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl/src/c/classes/Inputs/BoolInput.h
r21872 r21974 36 36 int GetResultNumberOfNodes(void){return 1;}; 37 37 int InstanceEnum(); 38 Input* PointwiseDivide(Input* inputB){_error_("not implemented yet");};39 Input* PointwiseMin(Input* inputB){_error_("not implemented yet");};40 Input* PointwiseMax(Input* inputB){_error_("not implemented yet");};41 38 Input* SpawnSegInput(int index1,int index2); 42 39 Input* SpawnTriaInput(int index1,int index2,int index3); … … 46 43 void AXPY(Input* xinput,IssmDouble scalar); 47 44 void ChangeEnum(int newenumtype); 48 void Constrain(IssmDouble cm_min, IssmDouble cm_max){_error_("Constrain not implemented for booleans");};49 void ConstrainMin(IssmDouble minimum){_error_("not implemented yet");};50 45 void Extrude(int start); 51 46 void GetInputAllTimeAverages(IssmDouble** pvalues,IssmDouble** ptimes, int* pnumtimes){_error_("not implemented yet");}; -
issm/trunk-jpl/src/c/classes/Inputs/ControlInput.cpp
r21931 r21974 147 147 } 148 148 /*}}}*/ 149 void ControlInput::Constrain(void){/*{{{*/150 151 Input* newvalues=NULL;152 153 newvalues=this->values->PointwiseMin(maxvalues);154 delete values; this->values=newvalues;155 newvalues=this->values->PointwiseMax(minvalues);156 delete values; this->values=newvalues;157 }/*}}}*/158 void ControlInput::Constrain(IssmDouble min, IssmDouble max){/*{{{*/159 values->Constrain(min,max);160 }/*}}}*/161 149 void ControlInput::Extrude(int start){/*{{{*/ 162 150 values->Extrude(start); -
issm/trunk-jpl/src/c/classes/Inputs/ControlInput.h
r21931 r21974 40 40 void AddTimeValues(IssmDouble* values,int step,IssmDouble time){_error_("not supported yet");}; 41 41 void Configure(Parameters* parameters); 42 Input* PointwiseDivide(Input* inputB){_error_("not implemented yet");};43 Input* PointwiseMax(Input* inputB){_error_("not implemented yet");};44 Input* PointwiseMin(Input* inputB){_error_("not implemented yet");};45 42 int InstanceEnum(); 46 43 Input* SpawnSegInput(int index1,int index2); … … 49 46 /*numerics: {{{*/ 50 47 void AXPY(Input* xinput,IssmDouble scalar); 51 void Constrain(void);52 void Constrain(IssmDouble min,IssmDouble max);53 void ConstrainMin(IssmDouble minimum){_error_("not implemented yet");};54 48 void ChangeEnum(int newenumtype){_error_("not implemented yet");}; 55 49 void Extrude(int start); -
issm/trunk-jpl/src/c/classes/Inputs/DatasetInput.h
r21931 r21974 39 39 void Configure(Parameters* parameters); 40 40 int InstanceEnum(); 41 Input* PointwiseDivide(Input* inputB){_error_("not implemented yet");};42 Input* PointwiseMin(Input* inputB){_error_("not implemented yet");};43 Input* PointwiseMax(Input* inputB){_error_("not implemented yet");};44 41 Input* SpawnSegInput(int index1,int index2); 45 42 Input* SpawnTriaInput(int index1,int index2,int index3); … … 48 45 void AXPY(Input* xinput,IssmDouble scalar){_error_("not implemented yet");}; 49 46 void ChangeEnum(int newenumtype){_error_("not implemented yet");}; 50 void Constrain(void){_error_("not implemented yet");};51 void Constrain(IssmDouble min,IssmDouble max){_error_("not implemented yet");};52 void ConstrainMin(IssmDouble minimum){_error_("not implemented yet");};53 47 void Extrude(int start){_error_("not implemented yet");}; 54 48 void GetGradient(Vector<IssmDouble>* gradient_vec,int* doflist){_error_("not implemented yet");}; -
issm/trunk-jpl/src/c/classes/Inputs/DoubleArrayInput.h
r21872 r21974 38 38 int GetResultNumberOfNodes(void){return 1;}; 39 39 int InstanceEnum(); 40 Input* PointwiseDivide(Input* inputB){_error_("not implemented yet");};41 Input* PointwiseMax(Input* inputB){_error_("not implemented yet");};42 Input* PointwiseMin(Input* inputB){_error_("not implemented yet");};43 40 void ResultToMatrix(IssmDouble* values,int ncols,int sid); 44 41 Input* SpawnSegInput(int index1,int index2){_error_("not implemented yet");}; … … 48 45 void AXPY(Input* xinput,IssmDouble scalar){_error_("not implemented yet");}; 49 46 void ChangeEnum(int newenumtype); 50 void Constrain(IssmDouble cm_min, IssmDouble cm_max){_error_("not implemented yet");};51 void ConstrainMin(IssmDouble minimum){_error_("not implemented yet");};52 47 void Extrude(int start){_error_("not supported yet");}; 53 48 void GetInputAllTimeAverages(IssmDouble** pvalues,IssmDouble** ptimes, int* pnumtimes){_error_("not implemented yet");}; -
issm/trunk-jpl/src/c/classes/Inputs/DoubleInput.cpp
r21872 r21974 127 127 } 128 128 /*}}}*/ 129 void DoubleInput::Constrain(IssmDouble cm_min, IssmDouble cm_max){/*{{{*/130 131 if(!xIsNan<IssmDouble>(cm_min)) if (this->value<cm_min)this->value=cm_min;132 if(!xIsNan<IssmDouble>(cm_max)) if (this->value>cm_max)this->value=cm_max;133 134 }135 /*}}}*/136 void DoubleInput::ConstrainMin(IssmDouble minimum){/*{{{*/137 if (value<minimum) value=minimum;138 }139 /*}}}*/140 129 void DoubleInput::GetInputAverage(IssmDouble* pvalue){/*{{{*/ 141 130 *pvalue=value; … … 182 171 } 183 172 /*}}}*/ 184 Input* DoubleInput::PointwiseDivide(Input* inputB){/*{{{*/185 186 /*Ouput*/187 DoubleInput* outinput=NULL;188 189 /*Intermediaries*/190 IssmDouble Bvalue;191 192 /*Check that inputB is of the same type*/193 inputB->GetInputAverage(&Bvalue);194 195 /*Create new DoubleInput*/196 outinput=new DoubleInput(this->enum_type,this->value/Bvalue);197 198 /*Return output pointer*/199 return outinput;200 201 }202 /*}}}*/203 Input* DoubleInput::PointwiseMax(Input* input){/*{{{*/204 205 /*Ouput*/206 DoubleInput* outinput=NULL;207 208 /*Intermediaries*/209 IssmDouble max;210 211 /*Check that inputB is of the same type*/212 if (input->Max() > this->Max()) max=input->Max();213 else max=this->Max();214 215 /*Create new DoubleInput*/216 outinput=new DoubleInput(this->enum_type,max);217 218 /*Return output pointer*/219 return outinput;220 221 }222 /*}}}*/223 Input* DoubleInput::PointwiseMin(Input* input){/*{{{*/224 225 /*Ouput*/226 DoubleInput* outinput=NULL;227 228 /*Intermediaries*/229 IssmDouble min;230 231 /*Check that inputB is of the same type*/232 if (input->Min() < this->Min()) min=input->Min();233 else min=this->Min();234 235 /*Create new DoubleInput*/236 outinput=new DoubleInput(this->enum_type,min);237 238 /*Return output pointer*/239 return outinput;240 241 }242 /*}}}*/243 173 void DoubleInput::Scale(IssmDouble scale_factor){/*{{{*/ 244 174 value=value*scale_factor; -
issm/trunk-jpl/src/c/classes/Inputs/DoubleInput.h
r21872 r21974 39 39 int GetResultNumberOfNodes(void){return 1;}; 40 40 int InstanceEnum(); 41 Input* PointwiseDivide(Input* inputB);42 Input* PointwiseMax(Input* inputB);43 Input* PointwiseMin(Input* inputB);44 41 void ResultToPatch(IssmDouble* values,int nodesperelement,int sid){_error_("not supported yet");}; 45 42 Input* SpawnSegInput(int index1,int index2); … … 49 46 void AXPY(Input* xinput,IssmDouble scalar); 50 47 void ChangeEnum(int newenumtype); 51 void Constrain(IssmDouble cm_min, IssmDouble cm_max);52 void ConstrainMin(IssmDouble minimum);53 48 void Extrude(int start){_error_("not supported yet");}; 54 49 void GetInputAllTimeAverages(IssmDouble** pvalues,IssmDouble** ptimes, int* pnumtimes){_error_("not implemented yet");}; -
issm/trunk-jpl/src/c/classes/Inputs/Input.h
r21872 r21974 42 42 43 43 virtual void AXPY(Input* xinput,IssmDouble scalar)=0; 44 virtual void Constrain(IssmDouble cm_min, IssmDouble cm_max)=0;45 virtual void ConstrainMin(IssmDouble minimum)=0;46 44 virtual void Extrude(int start)=0; 47 45 virtual void GetVectorFromInputs(Vector<IssmDouble>* vector,int* doflist)=0; … … 57 55 virtual int GetResultInterpolation(void)=0; 58 56 virtual int GetResultNumberOfNodes(void)=0; 59 virtual Input* PointwiseDivide(Input* inputB)=0;60 virtual Input* PointwiseMax(Input* inputmax)=0;61 virtual Input* PointwiseMin(Input* inputmin)=0;62 57 virtual Input* SpawnSegInput(int index1,int index2)=0; 63 58 virtual Input* SpawnTriaInput(int index1,int index2,int index3)=0; -
issm/trunk-jpl/src/c/classes/Inputs/Inputs.cpp
r20827 r21974 111 111 } 112 112 /*}}}*/ 113 void Inputs::ConstrainMin(int constrain_enum, IssmDouble minimum){/*{{{*/114 115 /*Find x and y inputs: */116 Input* constrain_input=xDynamicCast<Input*>(this->GetInput(constrain_enum));117 118 /*some checks: */119 if(!constrain_input) _error_("input " << EnumToStringx(constrain_enum) << " could not be found!");120 121 /*Apply ContrainMin: */122 constrain_input->ConstrainMin(minimum);123 }124 /*}}}*/125 113 int Inputs::DeleteInput(int enum_type){/*{{{*/ 126 114 -
issm/trunk-jpl/src/c/classes/Inputs/Inputs.h
r20827 r21974 26 26 void ChangeEnum(int enumtype,int new_enumtype); 27 27 void Configure(Parameters* parameters); 28 void ConstrainMin(int constrain_enum, IssmDouble minimum);29 28 int DeleteInput(int enum_type); 30 29 void DuplicateInput(int original_enum,int new_enum); -
issm/trunk-jpl/src/c/classes/Inputs/IntInput.cpp
r21872 r21974 127 127 } 128 128 /*}}}*/ 129 void IntInput::Constrain(IssmDouble cm_min, IssmDouble cm_max){/*{{{*/130 131 if(!xIsNan<IssmDouble>(cm_min)) if (this->value<cm_min)this->value=reCast<int>(cm_min);132 if(!xIsNan<IssmDouble>(cm_max)) if (this->value>cm_max)this->value=reCast<int>(cm_max);133 134 }135 /*}}}*/136 129 void IntInput::GetInputAverage(IssmDouble* pvalue){/*{{{*/ 137 130 *pvalue=reCast<IssmDouble>(value); -
issm/trunk-jpl/src/c/classes/Inputs/IntInput.h
r21872 r21974 40 40 int GetResultNumberOfNodes(void){return 1;}; 41 41 int InstanceEnum(); 42 Input* PointwiseDivide(Input* inputB){_error_("not implemented yet");};43 Input* PointwiseMax(Input* inputB){_error_("not implemented yet");};44 Input* PointwiseMin(Input* inputB){_error_("not implemented yet");};45 42 void ResultToPatch(IssmDouble* values,int nodesperelement,int sid){_error_("not supported yet");}; 46 43 Input* SpawnSegInput(int index1,int index2); … … 50 47 void AXPY(Input* xinput,IssmDouble scalar); 51 48 void ChangeEnum(int newenumtype); 52 void Constrain(IssmDouble cm_min, IssmDouble cm_max);53 void ConstrainMin(IssmDouble minimum){_error_("not implemented yet");};54 49 void Extrude(int start){_error_("not supported yet");}; 55 50 void GetInputAllTimeAverages(IssmDouble** pvalues,IssmDouble** ptimes, int* pnumtimes){_error_("not implemented yet");}; -
issm/trunk-jpl/src/c/classes/Inputs/PentaInput.cpp
r21894 r21974 217 217 void PentaInput::Configure(Parameters* parameters){/*{{{*/ 218 218 /*do nothing: */ 219 }220 /*}}}*/221 void PentaInput::Constrain(IssmDouble cm_min, IssmDouble cm_max){/*{{{*/222 223 int i;224 const int numnodes=this->NumberofNodes(this->interpolation_type);225 226 if(!xIsNan<IssmDouble>(cm_min)) for(i=0;i<numnodes;i++)if (this->values[i]<cm_min)this->values[i]=cm_min;227 if(!xIsNan<IssmDouble>(cm_max)) for(i=0;i<numnodes;i++)if (this->values[i]>cm_max)this->values[i]=cm_max;228 229 }230 /*}}}*/231 void PentaInput::ConstrainMin(IssmDouble minimum){/*{{{*/232 233 int numnodes = this->NumberofNodes(this->interpolation_type);234 for(int i=0;i<numnodes;i++) if (values[i]<minimum) values[i]=minimum;235 219 } 236 220 /*}}}*/ … … 321 305 } 322 306 /*}}}*/ 323 Input* PentaInput::PointwiseDivide(Input* inputB){/*{{{*/324 325 /*Ouput*/326 PentaInput* outinput=NULL;327 328 /*Intermediaries*/329 PentaInput *xinputB = NULL;330 const int numnodes = this->NumberofNodes(this->interpolation_type);331 332 /*Check that inputB is of the same type*/333 if(inputB->ObjectEnum()!=PentaInputEnum) _error_("Operation not permitted because inputB is of type " << EnumToStringx(inputB->ObjectEnum()));334 xinputB=(PentaInput*)inputB;335 if(xinputB->interpolation_type!=this->interpolation_type) _error_("Operation not permitted because inputB is of type " << EnumToStringx(xinputB->interpolation_type));336 337 /*Allocate intermediary*/338 IssmDouble* AdotBvalues=xNew<IssmDouble>(numnodes);339 340 /*Create point wise sum*/341 for(int i=0;i<numnodes;i++){342 _assert_(xinputB->values[i]!=0);343 AdotBvalues[i]=this->values[i]/xinputB->values[i];344 }345 346 /*Create new Penta vertex input (copy of current input)*/347 outinput=new PentaInput(this->enum_type,AdotBvalues,this->interpolation_type);348 349 /*Return output pointer*/350 xDelete<IssmDouble>(AdotBvalues);351 return outinput;352 353 }354 /*}}}*/355 Input* PentaInput::PointwiseMax(Input* inputB){/*{{{*/356 357 /*Ouput*/358 PentaInput* outinput=NULL;359 360 /*Intermediaries*/361 int i;362 PentaInput *xinputB = NULL;363 const int numnodes = this->NumberofNodes(this->interpolation_type);364 IssmDouble *maxvalues = xNew<IssmDouble>(numnodes);365 366 /*Check that inputB is of the same type*/367 if(inputB->ObjectEnum()!=PentaInputEnum) _error_("Operation not permitted because inputB is of type " << EnumToStringx(inputB->ObjectEnum()));368 xinputB=(PentaInput*)inputB;369 if(xinputB->interpolation_type!=this->interpolation_type) _error_("Operation not permitted because inputB is of type " << EnumToStringx(xinputB->interpolation_type));370 371 /*Create point wise max*/372 for(i=0;i<numnodes;i++){373 if(this->values[i] < xinputB->values[i]) maxvalues[i]=xinputB->values[i];374 else maxvalues[i]=this->values[i];375 }376 377 /*Create new Penta vertex input (copy of current input)*/378 outinput=new PentaInput(this->enum_type,&maxvalues[0],this->interpolation_type);379 380 /*Return output pointer*/381 xDelete<IssmDouble>(maxvalues);382 return outinput;383 }384 /*}}}*/385 Input* PentaInput::PointwiseMin(Input* inputB){/*{{{*/386 387 /*Ouput*/388 PentaInput* outinput=NULL;389 390 /*Intermediaries*/391 int i;392 PentaInput *xinputB = NULL;393 const int numnodes = this->NumberofNodes(this->interpolation_type);394 IssmDouble *minvalues = xNew<IssmDouble>(numnodes);395 396 /*Check that inputB is of the same type*/397 if(inputB->ObjectEnum()!=PentaInputEnum) _error_("Operation not permitted because inputB is of type " << EnumToStringx(inputB->ObjectEnum()));398 xinputB=(PentaInput*)inputB;399 if(xinputB->interpolation_type!=this->interpolation_type) _error_("Operation not permitted because inputB is of type " << EnumToStringx(xinputB->interpolation_type));400 401 /*Create point wise min*/402 for(i=0;i<numnodes;i++){403 if(this->values[i] > xinputB->values[i]) minvalues[i]=xinputB->values[i];404 else minvalues[i]=this->values[i];405 }406 407 /*Create new Penta vertex input (copy of current input)*/408 outinput=new PentaInput(this->enum_type,&minvalues[0],this->interpolation_type);409 410 /*Return output pointer*/411 xDelete<IssmDouble>(minvalues);412 return outinput;413 }414 /*}}}*/415 307 void PentaInput::Scale(IssmDouble scale_factor){/*{{{*/ 416 308 -
issm/trunk-jpl/src/c/classes/Inputs/PentaInput.h
r21872 r21974 36 36 /*PentaInput management*/ 37 37 int InstanceEnum(); 38 Input* PointwiseDivide(Input* inputB);39 Input* PointwiseMin(Input* inputB);40 Input* PointwiseMax(Input* inputB);41 38 int GetResultInterpolation(void); 42 39 int GetResultNumberOfNodes(void); … … 48 45 void AXPY(Input* xinput,IssmDouble scalar); 49 46 void ChangeEnum(int newenumtype); 50 void Constrain(IssmDouble cm_min, IssmDouble cm_max);51 void ConstrainMin(IssmDouble minimum);52 47 void Extrude(int start); 53 48 void GetInputAllTimeAverages(IssmDouble** pvalues,IssmDouble** ptimes, int* pnumtimes){_error_("not implemented yet");}; -
issm/trunk-jpl/src/c/classes/Inputs/SegInput.h
r21897 r21974 41 41 int GetResultNumberOfNodes(void){_error_("not implemented");}; 42 42 int InstanceEnum(); 43 Input* PointwiseDivide(Input* inputB){_error_("not supported yet");};44 Input* PointwiseMax(Input* inputB){_error_("not supported yet");};45 Input* PointwiseMin(Input* inputB){_error_("not supported yet");};46 43 void ResultToPatch(IssmDouble* values,int nodesperelement,int sid){_error_("not supported yet");}; 47 44 Input* SpawnSegInput(int index1,int index2){_error_("not implemented yet");}; … … 51 48 void AXPY(Input* xinput,IssmDouble scalar){_error_("not implemented yet");}; 52 49 void ChangeEnum(int newenumtype){_error_("not implemented yet");}; 53 void Constrain(IssmDouble cm_min, IssmDouble cm_max){_error_("not implemented yet");};54 void ConstrainMin(IssmDouble minimum){_error_("not implemented yet");};55 50 void Extrude(int start){_error_("not supported yet");}; 56 51 void GetInputAllTimeAverages(IssmDouble** pvalues,IssmDouble** ptimes, int* pnumtimes){_error_("not implemented yet");}; -
issm/trunk-jpl/src/c/classes/Inputs/TetraInput.cpp
r21872 r21974 238 238 } 239 239 /*}}}*/ 240 void TetraInput::Constrain(IssmDouble cm_min, IssmDouble cm_max){/*{{{*/241 242 int i;243 const int numnodes=this->NumberofNodes(this->interpolation_type);244 245 if(!xIsNan<IssmDouble>(cm_min)) for(i=0;i<numnodes;i++)if (this->values[i]<cm_min)this->values[i]=cm_min;246 if(!xIsNan<IssmDouble>(cm_max)) for(i=0;i<numnodes;i++)if (this->values[i]>cm_max)this->values[i]=cm_max;247 248 }249 /*}}}*/250 void TetraInput::ConstrainMin(IssmDouble minimum){/*{{{*/251 252 int numnodes = this->NumberofNodes(this->interpolation_type);253 for(int i=0;i<numnodes;i++) if (values[i]<minimum) values[i]=minimum;254 }255 /*}}}*/256 240 void TetraInput::GetVectorFromInputs(Vector<IssmDouble>* vector,int* doflist){/*{{{*/ 257 241 const int numvertices=4; … … 312 296 } 313 297 /*}}}*/ 314 Input* TetraInput::PointwiseDivide(Input* inputB){/*{{{*/315 316 /*Ouput*/317 TetraInput* outinput=NULL;318 319 /*Intermediaries*/320 TetraInput *xinputB = NULL;321 const int numnodes = this->NumberofNodes(this->interpolation_type);322 323 /*Check that inputB is of the same type*/324 if(inputB->ObjectEnum()!=TetraInputEnum) _error_("Operation not permitted because inputB is of type " << EnumToStringx(inputB->ObjectEnum()));325 xinputB=(TetraInput*)inputB;326 if(xinputB->interpolation_type!=this->interpolation_type) _error_("Operation not permitted because inputB is of type " << EnumToStringx(xinputB->interpolation_type));327 328 /*Allocate intermediary*/329 IssmDouble* AdotBvalues=xNew<IssmDouble>(numnodes);330 331 /*Create point wise division*/332 for(int i=0;i<numnodes;i++){333 _assert_(xinputB->values[i]!=0);334 AdotBvalues[i]=this->values[i]/xinputB->values[i];335 }336 337 /*Create new Tetra vertex input (copy of current input)*/338 outinput=new TetraInput(this->enum_type,AdotBvalues,this->interpolation_type);339 340 /*Return output pointer*/341 xDelete<IssmDouble>(AdotBvalues);342 return outinput;343 344 }345 /*}}}*/346 Input* TetraInput::PointwiseMax(Input* inputB){/*{{{*/347 348 /*Ouput*/349 TetraInput* outinput=NULL;350 351 /*Intermediaries*/352 int i;353 TetraInput *xinputB = NULL;354 const int numnodes = this->NumberofNodes(this->interpolation_type);355 IssmDouble *maxvalues = xNew<IssmDouble>(numnodes);356 357 /*Check that inputB is of the same type*/358 if(inputB->ObjectEnum()!=TetraInputEnum) _error_("Operation not permitted because inputB is of type " << EnumToStringx(inputB->ObjectEnum()));359 xinputB=(TetraInput*)inputB;360 if(xinputB->interpolation_type!=this->interpolation_type) _error_("Operation not permitted because inputB is of type " << EnumToStringx(xinputB->interpolation_type));361 362 /*Create point wise max*/363 for(i=0;i<numnodes;i++){364 if(this->values[i] < xinputB->values[i]) maxvalues[i]=xinputB->values[i];365 else maxvalues[i]=this->values[i];366 }367 368 /*Create new Tetra vertex input (copy of current input)*/369 outinput=new TetraInput(this->enum_type,&maxvalues[0],this->interpolation_type);370 371 /*Return output pointer*/372 xDelete<IssmDouble>(maxvalues);373 return outinput;374 375 }376 /*}}}*/377 Input* TetraInput::PointwiseMin(Input* inputB){/*{{{*/378 379 /*Ouput*/380 TetraInput* outinput=NULL;381 382 /*Intermediaries*/383 int i;384 TetraInput *xinputB = NULL;385 const int numnodes = this->NumberofNodes(this->interpolation_type);386 IssmDouble *minvalues = xNew<IssmDouble>(numnodes);387 388 /*Check that inputB is of the same type*/389 if(inputB->ObjectEnum()!=TetraInputEnum) _error_("Operation not permitted because inputB is of type " << EnumToStringx(inputB->ObjectEnum()));390 xinputB=(TetraInput*)inputB;391 if(xinputB->interpolation_type!=this->interpolation_type) _error_("Operation not permitted because inputB is of type " << EnumToStringx(xinputB->interpolation_type));392 393 /*Create point wise min*/394 for(i=0;i<numnodes;i++){395 if(this->values[i] > xinputB->values[i]) minvalues[i]=xinputB->values[i];396 else minvalues[i]=this->values[i];397 }398 399 /*Create new Tetra vertex input (copy of current input)*/400 outinput=new TetraInput(this->enum_type,&minvalues[0],this->interpolation_type);401 402 /*Return output pointer*/403 xDelete<IssmDouble>(minvalues);404 return outinput;405 406 }407 /*}}}*/408 298 void TetraInput::Scale(IssmDouble scale_factor){/*{{{*/ 409 299 -
issm/trunk-jpl/src/c/classes/Inputs/TetraInput.h
r21872 r21974 41 41 int GetResultNumberOfNodes(void); 42 42 int InstanceEnum(); 43 Input* PointwiseDivide(Input* inputB);44 Input* PointwiseMax(Input* inputB);45 Input* PointwiseMin(Input* inputB);46 43 void ResultToPatch(IssmDouble* values,int nodesperelement,int sid); 47 44 Input* SpawnSegInput(int index1,int index2){_error_("not supported yet");}; … … 51 48 void AXPY(Input* xinput,IssmDouble scalar); 52 49 void ChangeEnum(int newenumtype); 53 void Constrain(IssmDouble cm_min, IssmDouble cm_max);54 void ConstrainMin(IssmDouble minimum);55 50 void Extrude(int start){_error_("not supported yet");}; 56 51 void GetInputAllTimeAverages(IssmDouble** pvalues,IssmDouble** ptimes, int* pnumtimes); -
issm/trunk-jpl/src/c/classes/Inputs/TransientInput.h
r21917 r21974 45 45 int GetResultNumberOfNodes(void); 46 46 int InstanceEnum(); 47 Input* PointwiseDivide(Input* input_in){_error_("not implemented yet");};48 Input* PointwiseMax(Input* input_in){_error_("not implemented yet");};49 Input* PointwiseMin(Input* input_in){_error_("not implemented yet");};50 47 void ResultToPatch(IssmDouble* values,int nodesperelement,int sid){_error_("not supported yet");}; 51 48 Input* SpawnSegInput(int index1,int index2); … … 55 52 void AXPY(Input* xforcing,IssmDouble scalar){_error_("not implemented yet");}; 56 53 void ChangeEnum(int newenumtype); 57 void Constrain(IssmDouble cm_min, IssmDouble cm_max){_error_("not implemented yet");};58 void ConstrainMin(IssmDouble minimum){_error_("not implemented yet");};59 54 void Extrude(int start); 60 55 void GetInputAllTimeAverages(IssmDouble** pvalues,IssmDouble** ptimes, int* pnumtimes); -
issm/trunk-jpl/src/c/classes/Inputs/TriaInput.cpp
r21872 r21974 271 271 } 272 272 /*}}}*/ 273 void TriaInput::Constrain(IssmDouble cm_min, IssmDouble cm_max){/*{{{*/274 275 int i;276 const int numnodes=this->NumberofNodes(this->interpolation_type);277 278 if(!xIsNan<IssmDouble>(cm_min)) for(i=0;i<numnodes;i++)if (this->values[i]<cm_min)this->values[i]=cm_min;279 if(!xIsNan<IssmDouble>(cm_max)) for(i=0;i<numnodes;i++)if (this->values[i]>cm_max)this->values[i]=cm_max;280 281 }282 /*}}}*/283 void TriaInput::ConstrainMin(IssmDouble minimum){/*{{{*/284 285 int numnodes = this->NumberofNodes(this->interpolation_type);286 for(int i=0;i<numnodes;i++) if (values[i]<minimum) values[i]=minimum;287 }288 /*}}}*/289 273 void TriaInput::GetVectorFromInputs(Vector<IssmDouble>* vector,int* doflist){/*{{{*/ 290 274 const int numvertices=3; … … 345 329 } 346 330 /*}}}*/ 347 Input* TriaInput::PointwiseMax(Input* inputB){/*{{{*/348 349 /*Ouput*/350 TriaInput* outinput=NULL;351 352 /*Intermediaries*/353 int i;354 TriaInput *xinputB = NULL;355 const int numnodes = this->NumberofNodes(this->interpolation_type);356 IssmDouble *maxvalues = xNew<IssmDouble>(numnodes);357 358 /*Check that inputB is of the same type*/359 if(inputB->ObjectEnum()!=TriaInputEnum) _error_("Operation not permitted because inputB is of type " << EnumToStringx(inputB->ObjectEnum()));360 xinputB=(TriaInput*)inputB;361 if(xinputB->interpolation_type!=this->interpolation_type) _error_("Operation not permitted because inputB is of type " << EnumToStringx(xinputB->interpolation_type));362 363 /*Create point wise max*/364 for(i=0;i<numnodes;i++){365 if(this->values[i] < xinputB->values[i]) maxvalues[i]=xinputB->values[i];366 else maxvalues[i]=this->values[i];367 }368 369 /*Create new Tria vertex input (copy of current input)*/370 outinput=new TriaInput(this->enum_type,&maxvalues[0],this->interpolation_type);371 372 /*Return output pointer*/373 xDelete<IssmDouble>(maxvalues);374 return outinput;375 376 }377 /*}}}*/378 Input* TriaInput::PointwiseMin(Input* inputB){/*{{{*/379 380 /*Ouput*/381 TriaInput* outinput=NULL;382 383 /*Intermediaries*/384 int i;385 TriaInput *xinputB = NULL;386 const int numnodes = this->NumberofNodes(this->interpolation_type);387 IssmDouble *minvalues = xNew<IssmDouble>(numnodes);388 389 /*Check that inputB is of the same type*/390 if(inputB->ObjectEnum()!=TriaInputEnum) _error_("Operation not permitted because inputB is of type " << EnumToStringx(inputB->ObjectEnum()));391 xinputB=(TriaInput*)inputB;392 if(xinputB->interpolation_type!=this->interpolation_type) _error_("Operation not permitted because inputB is of type " << EnumToStringx(xinputB->interpolation_type));393 394 /*Create point wise min*/395 for(i=0;i<numnodes;i++){396 if(this->values[i] > xinputB->values[i]) minvalues[i]=xinputB->values[i];397 else minvalues[i]=this->values[i];398 }399 400 /*Create new Tria vertex input (copy of current input)*/401 outinput=new TriaInput(this->enum_type,&minvalues[0],this->interpolation_type);402 403 /*Return output pointer*/404 xDelete<IssmDouble>(minvalues);405 return outinput;406 407 }408 /*}}}*/409 Input* TriaInput::PointwiseDivide(Input* inputB){/*{{{*/410 411 /*Ouput*/412 TriaInput* outinput=NULL;413 414 /*Intermediaries*/415 TriaInput *xinputB = NULL;416 const int numnodes = this->NumberofNodes(this->interpolation_type);417 418 /*Check that inputB is of the same type*/419 if(inputB->ObjectEnum()!=TriaInputEnum) _error_("Operation not permitted because inputB is of type " << EnumToStringx(inputB->ObjectEnum()));420 xinputB=(TriaInput*)inputB;421 if(xinputB->interpolation_type!=this->interpolation_type) _error_("Operation not permitted because inputB is of type " << EnumToStringx(xinputB->interpolation_type));422 423 /*Allocate intermediary*/424 IssmDouble* AdotBvalues=xNew<IssmDouble>(numnodes);425 426 /*Create point wise division*/427 for(int i=0;i<numnodes;i++){428 _assert_(xinputB->values[i]!=0);429 AdotBvalues[i]=this->values[i]/xinputB->values[i];430 }431 432 /*Create new Tria vertex input (copy of current input)*/433 outinput=new TriaInput(this->enum_type,AdotBvalues,this->interpolation_type);434 435 /*Return output pointer*/436 xDelete<IssmDouble>(AdotBvalues);437 return outinput;438 439 }440 /*}}}*/441 331 void TriaInput::Scale(IssmDouble scale_factor){/*{{{*/ 442 332 -
issm/trunk-jpl/src/c/classes/Inputs/TriaInput.h
r21872 r21974 41 41 int GetResultNumberOfNodes(void); 42 42 int InstanceEnum(); 43 Input* PointwiseDivide(Input* inputB);44 Input* PointwiseMax(Input* inputB);45 Input* PointwiseMin(Input* inputB);46 43 void ResultToPatch(IssmDouble* values,int nodesperelement,int sid); 47 44 Input* SpawnSegInput(int index1,int index2); … … 51 48 void AXPY(Input* xinput,IssmDouble scalar); 52 49 void ChangeEnum(int newenumtype); 53 void Constrain(IssmDouble cm_min, IssmDouble cm_max);54 void ConstrainMin(IssmDouble minimum);55 50 void Extrude(int start){_error_("not supported yet");}; 56 51 void GetInputAllTimeAverages(IssmDouble** pvalues,IssmDouble** ptimes, int* pnumtimes);
Note:
See TracChangeset
for help on using the changeset viewer.