Changeset 15082
- Timestamp:
- 05/22/13 11:24:30 (12 years ago)
- Location:
- issm/trunk-jpl/src/c
- Files:
-
- 1 deleted
- 28 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl/src/c/Makefile.am
r15070 r15082 322 322 ./modules/InputToResultx/InputToResultx.cpp\ 323 323 ./modules/InputToResultx/InputToResultx.h\ 324 ./modules/InputConvergencex/InputConvergencex.cpp\325 ./modules/InputConvergencex/InputConvergencex.h\326 324 ./analyses/ProcessArguments.cpp\ 327 325 ./analyses/ResetBoundaryConditions.cpp\ -
issm/trunk-jpl/src/c/classes/Elements/Element.h
r15067 r15082 77 77 virtual void GetVectorFromResults(Vector<IssmDouble>* vector,int id,int enum_in,int interp)=0; 78 78 virtual void InputArtificialNoise(int enum_type,IssmDouble min,IssmDouble max)=0; 79 virtual bool InputConvergence(IssmDouble* eps, int* enums,int num_enums,int* criterionenums,IssmDouble* criterionvalues,int num_criterionenums)=0;80 79 virtual void AverageOntoPartition(Vector<IssmDouble>* partition_contributions,Vector<IssmDouble>* partition_areas,IssmDouble* vertex_response,IssmDouble* qmu_part)=0; 81 80 virtual int* GetHorizontalNeighboorSids(void)=0; -
issm/trunk-jpl/src/c/classes/Elements/Penta.cpp
r15060 r15082 1377 1377 /*ArtificialNoise: */ 1378 1378 input->ArtificialNoise(min,max); 1379 }1380 /*}}}*/1381 /*FUNCTION Penta::InputConvergence{{{*/1382 bool Penta::InputConvergence(IssmDouble* eps, int* enums,int num_enums,int* criterionenums,IssmDouble* criterionvalues,int num_criterionenums){1383 1384 int i;1385 bool converged=true;1386 Input** new_inputs=NULL;1387 Input** old_inputs=NULL;1388 1389 new_inputs=xNew<Input*>(num_enums/2); //half the enums are for the new inputs1390 old_inputs=xNew<Input*>(num_enums/2); //half the enums are for the old inputs1391 1392 for(i=0;i<num_enums/2;i++){1393 new_inputs[i]=(Input*)this->inputs->GetInput(enums[2*i+0]);1394 old_inputs[i]=(Input*)this->inputs->GetInput(enums[2*i+1]);1395 if(!new_inputs[i])_error_("could not find input with enum " << EnumToStringx(enums[2*i+0]));1396 if(!old_inputs[i])_error_("could not find input with enum " << EnumToStringx(enums[2*i+0]));1397 }1398 1399 /*ok, we've got the inputs (new and old), now loop throught the number of criterions and fill the eps array:*/1400 for(i=0;i<num_criterionenums;i++){1401 IsInputConverged(eps+i,new_inputs,old_inputs,num_enums/2,criterionenums[i]);1402 if(eps[i]>criterionvalues[i]) converged=false;1403 }1404 1405 /*clean up*/1406 xDelete<Input*>(new_inputs);1407 xDelete<Input*>(old_inputs);1408 1409 /*Return output*/1410 return converged;1411 1379 } 1412 1380 /*}}}*/ -
issm/trunk-jpl/src/c/classes/Elements/Penta.h
r15060 r15082 99 99 int Sid(); 100 100 void InputArtificialNoise(int enum_type,IssmDouble min, IssmDouble max); 101 bool InputConvergence(IssmDouble* eps, int* enums,int num_enums,int* criterionenums,IssmDouble* criterionvalues,int num_criterionenums);102 101 void InputCreate(IssmDouble scalar,int name,int code); 103 102 void InputCreate(IssmDouble* vector, int index,IoModel* iomodel,int M,int N,int vector_type,int vector_enum,int code); -
issm/trunk-jpl/src/c/classes/Elements/Tria.cpp
r15062 r15082 1588 1588 /*ArtificialNoise: */ 1589 1589 input->ArtificialNoise(min,max); 1590 }1591 /*}}}*/1592 /*FUNCTION Tria::InputConvergence{{{*/1593 bool Tria::InputConvergence(IssmDouble* eps, int* enums,int num_enums,int* criterionenums,IssmDouble* criterionvalues,int num_criterionenums){1594 1595 bool converged=true;1596 int i;1597 Input** new_inputs=NULL;1598 Input** old_inputs=NULL;1599 1600 new_inputs=xNew<Input*>(num_enums/2); //half the enums are for the new inputs1601 old_inputs=xNew<Input*>(num_enums/2); //half the enums are for the old inputs1602 1603 for(i=0;i<num_enums/2;i++){1604 new_inputs[i]=(Input*)this->inputs->GetInput(enums[2*i+0]);1605 old_inputs[i]=(Input*)this->inputs->GetInput(enums[2*i+1]);1606 if(!new_inputs[i])_error_("could not find input with enum " << EnumToStringx(enums[2*i+0]));1607 if(!old_inputs[i])_error_("could not find input with enum " << EnumToStringx(enums[2*i+0]));1608 }1609 1610 /*ok, we've got the inputs (new and old), now loop throught the number of criterions and fill the eps array:*/1611 for(i=0;i<num_criterionenums;i++){1612 IsInputConverged(eps+i,new_inputs,old_inputs,num_enums/2,criterionenums[i]);1613 if(eps[i]>criterionvalues[i]) converged=false;1614 }1615 1616 /*clean up and return*/1617 xDelete<Input*>(new_inputs);1618 xDelete<Input*>(old_inputs);1619 return converged;1620 1590 } 1621 1591 /*}}}*/ -
issm/trunk-jpl/src/c/classes/Elements/Tria.h
r15062 r15082 97 97 void GetVectorFromResults(Vector<IssmDouble>* vector,int offset,int enum_in,int interp); 98 98 void InputArtificialNoise(int enum_type,IssmDouble min, IssmDouble max); 99 bool InputConvergence(IssmDouble* eps, int* enums,int num_enums,int* criterionenums,IssmDouble* criterionvalues,int num_criterionenums);100 99 void InputCreate(IssmDouble scalar,int name,int code); 101 100 void InputCreate(IssmDouble* vector, int index,IoModel* iomodel,int M,int N,int vector_type,int vector_enum,int code); -
issm/trunk-jpl/src/c/classes/Inputs/BoolInput.cpp
r15012 r15082 169 169 } 170 170 /*}}}*/ 171 /*FUNCTION BoolInput::GetValuesPtr{{{*/172 void BoolInput::GetValuesPtr(IssmDouble** pvalues,int* pnum_values){173 174 _error_("not supported yet!");175 176 }177 /*}}}*/178 171 /*FUNCTION BoolInput::Configure{{{*/ 179 172 void BoolInput::Configure(Parameters* parameters){ -
issm/trunk-jpl/src/c/classes/Inputs/BoolInput.h
r14951 r15082 79 79 void VerticallyIntegrate(Input* thickness_input){_error_("not supported yet");}; 80 80 void GetVectorFromInputs(Vector<IssmDouble>* vector,int* doflist); 81 void GetValuesPtr(IssmDouble** pvalues,int* pnum_values);82 81 /*}}}*/ 83 82 -
issm/trunk-jpl/src/c/classes/Inputs/ControlInput.h
r14951 r15082 86 86 void GetVectorFromInputs(Vector<IssmDouble>* vector,int* doflist,const char* data); 87 87 void GetVectorFromInputs(Vector<IssmDouble>* vector,int* doflist); 88 void GetValuesPtr(IssmDouble** pvalues,int* pnum_values){_error_("not implemented yet");};89 88 ElementResult* SpawnGradient(int step, IssmDouble time); 90 89 void GetGradient(Vector<IssmDouble>* gradient_vec,int* doflist); -
issm/trunk-jpl/src/c/classes/Inputs/DatasetInput.h
r14951 r15082 79 79 void VerticallyIntegrate(Input* thickness_input){_error_("not implemented yet");}; 80 80 void GetVectorFromInputs(Vector<IssmDouble>* vector,int* doflist){_error_("not implemented yet");}; 81 void GetValuesPtr(IssmDouble** pvalues,int* pnum_values){_error_("not implemented yet");};82 81 ElementResult* SpawnGradient(int step, IssmDouble time){_error_("not implemented yet");}; 83 82 void GetGradient(Vector<IssmDouble>* gradient_vec,int* doflist){_error_("not implemented yet");}; -
issm/trunk-jpl/src/c/classes/Inputs/DoubleInput.cpp
r15012 r15082 246 246 } 247 247 /*}}}*/ 248 /*FUNCTION DoubleInput::GetValuesPtr{{{*/249 void DoubleInput::GetValuesPtr(IssmDouble** pvalues,int* pnum_values){250 251 _error_("not supported yet!");252 253 }254 /*}}}*/255 248 /*FUNCTION DoubleInput::GetInputAverage{{{*/ 256 249 void DoubleInput::GetInputAverage(IssmDouble* pvalue){ -
issm/trunk-jpl/src/c/classes/Inputs/DoubleInput.h
r14951 r15082 78 78 void VerticallyIntegrate(Input* thickness_input); 79 79 void GetVectorFromInputs(Vector<IssmDouble>* vector,int* doflist); 80 void GetValuesPtr(IssmDouble** pvalues,int* pnum_values);81 80 /*}}}*/ 82 81 -
issm/trunk-jpl/src/c/classes/Inputs/Input.h
r15067 r15082 63 63 virtual void Extrude()=0; 64 64 virtual void GetVectorFromInputs(Vector<IssmDouble>* vector,int* doflist)=0; 65 virtual void GetValuesPtr(IssmDouble** pvalues,int* pnum_values)=0;66 65 67 66 virtual Input* SpawnTriaInput(int* indices)=0; -
issm/trunk-jpl/src/c/classes/Inputs/Inputs.cpp
r15037 r15082 425 425 } 426 426 /*}}}*/ 427 428 /*Methods relating to inputs: */429 void IsInputConverged(IssmDouble* peps, Input** new_inputs,Input** old_inputs,int num_inputs,int criterion_enum){ /*{{{*/430 431 /*figure out convergence at the input level.432 We are given a list of inputs, new and old, and a criterion, and using the433 inputs, we return the value of the criterion test, which will be used at the434 solution level to determine convergence.435 */436 437 int i,j;438 439 /*output: */440 IssmDouble eps;441 442 /*intermediary: */443 IssmDouble *newvalues = NULL;444 IssmDouble *oldvalues = NULL;445 int num_values;446 IssmDouble ndu = 0;447 IssmDouble nu = 0;448 449 if(criterion_enum==RelativeEnum){450 451 /*conpute ndu/du (where u could be velocity, pressure, temperature, etc ...): */452 for(i=0;i<num_inputs;i++){453 454 /*in debugging mode, check that the inputs are of the same type*/455 _assert_(new_inputs[i]->ObjectEnum()==old_inputs[i]->ObjectEnum());456 457 /*Get pointers*/458 new_inputs[i]->GetValuesPtr(&newvalues,&num_values);459 old_inputs[i]->GetValuesPtr(&oldvalues,&num_values);460 for(j=0;j<num_values;j++){461 ndu+=pow(newvalues[j]-oldvalues[j],2);462 nu+=pow(oldvalues[j],2);463 }464 }465 466 /*take square root: */467 ndu=sqrt(ndu);468 nu=sqrt(nu);469 470 /*now, compute eps: */471 if(reCast<bool>(nu))eps=ndu/nu;472 else eps=0;473 }474 else _error_("convergence criterion " << EnumToStringx(criterion_enum) << " not supported yet!");475 476 /*Assign output pointers:*/477 *peps=eps;478 }479 /*}}}*/ -
issm/trunk-jpl/src/c/classes/Inputs/Inputs.h
r15067 r15082 43 43 }; 44 44 45 /*Methods relating to inputs: */46 void IsInputConverged(IssmDouble* peps, Input** new_inputs,Input** old_inputs,int num_inputs,int criterion_enum);47 48 45 #endif //ifndef _INPUTS_H_ -
issm/trunk-jpl/src/c/classes/Inputs/IntInput.cpp
r15012 r15082 175 175 } 176 176 /*}}}*/ 177 /*FUNCTION IntInput::GetValuesPtr{{{*/178 void IntInput::GetValuesPtr(IssmDouble** pvalues,int* pnum_values){179 180 _error_("not supported yet!");181 182 }183 /*}}}*/184 177 /*FUNCTION IntInput::Configure{{{*/ 185 178 void IntInput::Configure(Parameters* parameters){ -
issm/trunk-jpl/src/c/classes/Inputs/IntInput.h
r14951 r15082 80 80 void VerticallyIntegrate(Input* thickness_input){_error_("not supported yet");}; 81 81 void GetVectorFromInputs(Vector<IssmDouble>* vector,int* doflist); 82 void GetValuesPtr(IssmDouble** pvalues,int* pnum_values);83 82 /*}}}*/ 84 83 -
issm/trunk-jpl/src/c/classes/Inputs/PentaP1Input.cpp
r15012 r15082 477 477 void PentaP1Input::VerticallyIntegrate(Input* thickness_input){ 478 478 479 /*Intermediaries*/ 480 int i; 481 const int numnodes = 6; 482 int num_thickness_values; 483 IssmDouble *thickness_values = NULL; 479 IssmDouble thickness; 484 480 485 481 /*Check that input provided is a thickness*/ 486 482 if (thickness_input->InstanceEnum()!=ThicknessEnum) _error_("Input provided is not a Thickness (enum_type is " << EnumToStringx(thickness_input->InstanceEnum()) << ")"); 487 483 488 /*Get Thickness value pointer*/489 thickness_input->GetValuesPtr(&thickness_values,&num_thickness_values);490 491 484 /*vertically integrate depending on type:*/ 492 485 switch(thickness_input->ObjectEnum()){ 493 486 494 case PentaP1InputEnum: 495 for(i=0;i<3;i++){ 496 this->values[i]=0.5*(this->values[i]+this->values[i+3]) * thickness_values[i]; 497 this->values[i+3]=this->values[i]; 487 case PentaP1InputEnum:{ 488 GaussPenta *gauss=new GaussPenta(); 489 for(int iv=0;iv<3;iv++){ 490 gauss->GaussVertex(iv); 491 thickness_input->GetInputValue(&thickness,gauss); 492 this->values[iv]=0.5*(this->values[iv]+this->values[iv+3]) * thickness; 493 this->values[iv+3]=this->values[iv]; 498 494 } 499 return; 495 delete gauss; 496 return; } 500 497 501 498 default: … … 600 597 601 598 } /*}}}*/ 602 /*FUNCTION PentaP1Input::GetValuesPtr{{{*/603 void PentaP1Input::GetValuesPtr(IssmDouble** pvalues,int* pnum_values){604 605 *pvalues=this->values;606 *pnum_values=6;607 608 }609 /*}}}*/610 599 /*FUNCTION PentaP1Input::Configure{{{*/ 611 600 void PentaP1Input::Configure(Parameters* parameters){ -
issm/trunk-jpl/src/c/classes/Inputs/PentaP1Input.h
r14951 r15082 82 82 void VerticallyIntegrate(Input* thickness_input); 83 83 void GetVectorFromInputs(Vector<IssmDouble>* vector,int* doflist); 84 void GetValuesPtr(IssmDouble** pvalues,int* pnum_values);85 84 /*}}}*/ 86 85 -
issm/trunk-jpl/src/c/classes/Inputs/TransientInput.h
r14951 r15082 83 83 void VerticallyIntegrate(Input* thickness_forcing){_error_("not supported yet");}; 84 84 void GetVectorFromInputs(Vector<IssmDouble>* vector,int* doflist); 85 void GetValuesPtr(IssmDouble** pvalues,int* pnum_values){_error_("not supported yet");};86 85 void GetTimeValues(IssmDouble* values,IssmDouble time){_error_("not implemented yet");}; 87 86 Input* GetTimeInput(IssmDouble time); -
issm/trunk-jpl/src/c/classes/Inputs/TriaP1Input.cpp
r15012 r15082 375 375 376 376 } /*}}}*/ 377 /*FUNCTION TriaP1Input::GetValuesPtr{{{*/378 void TriaP1Input::GetValuesPtr(IssmDouble** pvalues,int* pnum_values){379 380 *pvalues=this->values;381 if(pnum_values)*pnum_values=3;382 383 }384 /*}}}*/385 377 /*FUNCTION TriaP1Input::PointwiseMin{{{*/ 386 378 Input* TriaP1Input::PointwiseMin(Input* inputB){ -
issm/trunk-jpl/src/c/classes/Inputs/TriaP1Input.h
r14951 r15082 81 81 void VerticallyIntegrate(Input* thickness_input){_error_("not supported yet");}; 82 82 void GetVectorFromInputs(Vector<IssmDouble>* vector,int* doflist); 83 void GetValuesPtr(IssmDouble** pvalues,int* pnum_values);84 83 /*}}}*/ 85 84 -
issm/trunk-jpl/src/c/modules/CMakeLists.txt
r14284 r15082 29 29 add_subdirectory(InputArtificialNoisex) 30 30 add_subdirectory(InputControlUpdatex) 31 add_subdirectory(InputConvergencex)32 31 add_subdirectory(InputDuplicatex) 33 32 add_subdirectory(InputScalex) -
issm/trunk-jpl/src/c/modules/modules.h
r15069 r15082 35 35 #include "./HoleFillerx/HoleFillerx.h" 36 36 #include "./InputControlUpdatex/InputControlUpdatex.h" 37 #include "./InputConvergencex/InputConvergencex.h"38 37 #include "./InputDuplicatex/InputDuplicatex.h" 39 38 #include "./InputScalex/InputScalex.h" -
issm/trunk-jpl/src/c/shared/Enum/EnumDefinitions.h
r15062 r15082 529 529 TotalSmbEnum, 530 530 /*}}}*/ 531 /*Convergence{{{*/ 532 RelativeEnum, 531 /*Relaxation{{{*/ 533 532 AbsoluteEnum, 534 533 IncrementalEnum, -
issm/trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp
r15062 r15082 516 516 case IceVolumeEnum : return "IceVolume"; 517 517 case TotalSmbEnum : return "TotalSmb"; 518 case RelativeEnum : return "Relative";519 518 case AbsoluteEnum : return "Absolute"; 520 519 case IncrementalEnum : return "Incremental"; -
issm/trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp
r15062 r15082 528 528 else if (strcmp(name,"IceVolume")==0) return IceVolumeEnum; 529 529 else if (strcmp(name,"TotalSmb")==0) return TotalSmbEnum; 530 else if (strcmp(name,"Relative")==0) return RelativeEnum;531 530 else if (strcmp(name,"Absolute")==0) return AbsoluteEnum; 532 531 else if (strcmp(name,"Incremental")==0) return IncrementalEnum; -
issm/trunk-jpl/src/c/shared/Numerics/CMakeLists.txt
r14284 r15082 9 9 $ENV{ISSM_DIR}/src/c/shared/Numerics/extrema.cpp 10 10 $ENV{ISSM_DIR}/src/c/shared/Numerics/GaussPoints.cpp 11 $ENV{ISSM_DIR}/src/c/shared/Numerics/IsInputConverged.cpp12 11 $ENV{ISSM_DIR}/src/c/shared/Numerics/isnan.cpp 13 12 $ENV{ISSM_DIR}/src/c/shared/Numerics/OptionsFromAnalysis.cpp
Note:
See TracChangeset
for help on using the changeset viewer.