Changeset 15082


Ignore:
Timestamp:
05/22/13 11:24:30 (12 years ago)
Author:
Mathieu Morlighem
Message:

DEL: removed InputConvergence module that is not used anymore and calls GetValuesPtr, which HAS to be deleted because it is wrong to plya with the pointer of another object's field

Location:
issm/trunk-jpl/src/c
Files:
1 deleted
28 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk-jpl/src/c/Makefile.am

    r15070 r15082  
    322322                                        ./modules/InputToResultx/InputToResultx.cpp\
    323323                                        ./modules/InputToResultx/InputToResultx.h\
    324                                         ./modules/InputConvergencex/InputConvergencex.cpp\
    325                                         ./modules/InputConvergencex/InputConvergencex.h\
    326324                                        ./analyses/ProcessArguments.cpp\
    327325                                        ./analyses/ResetBoundaryConditions.cpp\
  • issm/trunk-jpl/src/c/classes/Elements/Element.h

    r15067 r15082  
    7777                virtual void   GetVectorFromResults(Vector<IssmDouble>* vector,int id,int enum_in,int interp)=0;
    7878                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;
    8079                virtual void   AverageOntoPartition(Vector<IssmDouble>* partition_contributions,Vector<IssmDouble>* partition_areas,IssmDouble* vertex_response,IssmDouble* qmu_part)=0;
    8180                virtual int*   GetHorizontalNeighboorSids(void)=0;
  • issm/trunk-jpl/src/c/classes/Elements/Penta.cpp

    r15060 r15082  
    13771377        /*ArtificialNoise: */
    13781378        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 inputs
    1390         old_inputs=xNew<Input*>(num_enums/2); //half the enums are for the old inputs
    1391 
    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;
    14111379}
    14121380/*}}}*/
  • issm/trunk-jpl/src/c/classes/Elements/Penta.h

    r15060 r15082  
    9999                int    Sid();
    100100                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);
    102101                void   InputCreate(IssmDouble scalar,int name,int code);
    103102                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  
    15881588        /*ArtificialNoise: */
    15891589        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 inputs
    1601         old_inputs=xNew<Input*>(num_enums/2); //half the enums are for the old inputs
    1602 
    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;
    16201590}
    16211591/*}}}*/
  • issm/trunk-jpl/src/c/classes/Elements/Tria.h

    r15062 r15082  
    9797                void   GetVectorFromResults(Vector<IssmDouble>* vector,int offset,int enum_in,int interp);
    9898                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);
    10099                void   InputCreate(IssmDouble scalar,int name,int code);
    101100                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  
    169169}
    170170/*}}}*/
    171 /*FUNCTION BoolInput::GetValuesPtr{{{*/
    172 void BoolInput::GetValuesPtr(IssmDouble** pvalues,int* pnum_values){
    173 
    174         _error_("not supported yet!");
    175 
    176 }
    177 /*}}}*/
    178171/*FUNCTION BoolInput::Configure{{{*/
    179172void BoolInput::Configure(Parameters* parameters){
  • issm/trunk-jpl/src/c/classes/Inputs/BoolInput.h

    r14951 r15082  
    7979                void VerticallyIntegrate(Input* thickness_input){_error_("not supported yet");};
    8080                void GetVectorFromInputs(Vector<IssmDouble>* vector,int* doflist);
    81                 void GetValuesPtr(IssmDouble** pvalues,int* pnum_values);
    8281                /*}}}*/
    8382
  • issm/trunk-jpl/src/c/classes/Inputs/ControlInput.h

    r14951 r15082  
    8686                void GetVectorFromInputs(Vector<IssmDouble>* vector,int* doflist,const char* data);
    8787                void GetVectorFromInputs(Vector<IssmDouble>* vector,int* doflist);
    88                 void GetValuesPtr(IssmDouble** pvalues,int* pnum_values){_error_("not implemented yet");};
    8988                ElementResult* SpawnGradient(int step, IssmDouble time);
    9089                void GetGradient(Vector<IssmDouble>* gradient_vec,int* doflist);
  • issm/trunk-jpl/src/c/classes/Inputs/DatasetInput.h

    r14951 r15082  
    7979                void VerticallyIntegrate(Input* thickness_input){_error_("not implemented yet");};
    8080                void GetVectorFromInputs(Vector<IssmDouble>* vector,int* doflist){_error_("not implemented yet");};
    81                 void GetValuesPtr(IssmDouble** pvalues,int* pnum_values){_error_("not implemented yet");};
    8281                ElementResult* SpawnGradient(int step, IssmDouble time){_error_("not implemented yet");};
    8382                void GetGradient(Vector<IssmDouble>* gradient_vec,int* doflist){_error_("not implemented yet");};
  • issm/trunk-jpl/src/c/classes/Inputs/DoubleInput.cpp

    r15012 r15082  
    246246}
    247247/*}}}*/
    248 /*FUNCTION DoubleInput::GetValuesPtr{{{*/
    249 void DoubleInput::GetValuesPtr(IssmDouble** pvalues,int* pnum_values){
    250 
    251         _error_("not supported yet!");
    252 
    253 }
    254 /*}}}*/
    255248/*FUNCTION DoubleInput::GetInputAverage{{{*/
    256249void DoubleInput::GetInputAverage(IssmDouble* pvalue){
  • issm/trunk-jpl/src/c/classes/Inputs/DoubleInput.h

    r14951 r15082  
    7878                void VerticallyIntegrate(Input* thickness_input);
    7979                void GetVectorFromInputs(Vector<IssmDouble>* vector,int* doflist);
    80                 void GetValuesPtr(IssmDouble** pvalues,int* pnum_values);
    8180                /*}}}*/
    8281
  • issm/trunk-jpl/src/c/classes/Inputs/Input.h

    r15067 r15082  
    6363                virtual void   Extrude()=0;
    6464                virtual void   GetVectorFromInputs(Vector<IssmDouble>* vector,int* doflist)=0;
    65                 virtual void   GetValuesPtr(IssmDouble** pvalues,int* pnum_values)=0;
    6665
    6766                virtual Input* SpawnTriaInput(int* indices)=0;
  • issm/trunk-jpl/src/c/classes/Inputs/Inputs.cpp

    r15037 r15082  
    425425}
    426426/*}}}*/
    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 the
    433           inputs, we return the value of the criterion test, which will be used at the
    434           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  
    4343};
    4444
    45 /*Methods relating to inputs: */
    46 void IsInputConverged(IssmDouble* peps, Input** new_inputs,Input** old_inputs,int num_inputs,int criterion_enum);
    47 
    4845#endif //ifndef _INPUTS_H_
  • issm/trunk-jpl/src/c/classes/Inputs/IntInput.cpp

    r15012 r15082  
    175175}
    176176/*}}}*/
    177 /*FUNCTION IntInput::GetValuesPtr{{{*/
    178 void IntInput::GetValuesPtr(IssmDouble** pvalues,int* pnum_values){
    179 
    180         _error_("not supported yet!");
    181 
    182 }
    183 /*}}}*/
    184177/*FUNCTION IntInput::Configure{{{*/
    185178void IntInput::Configure(Parameters* parameters){
  • issm/trunk-jpl/src/c/classes/Inputs/IntInput.h

    r14951 r15082  
    8080                void VerticallyIntegrate(Input* thickness_input){_error_("not supported yet");};
    8181                void GetVectorFromInputs(Vector<IssmDouble>* vector,int* doflist);
    82                 void GetValuesPtr(IssmDouble** pvalues,int* pnum_values);
    8382                /*}}}*/
    8483
  • issm/trunk-jpl/src/c/classes/Inputs/PentaP1Input.cpp

    r15012 r15082  
    477477void PentaP1Input::VerticallyIntegrate(Input* thickness_input){
    478478
    479         /*Intermediaries*/
    480         int i;
    481         const int  numnodes = 6;
    482         int        num_thickness_values;
    483         IssmDouble    *thickness_values = NULL;
     479        IssmDouble thickness;
    484480
    485481        /*Check that input provided is a thickness*/
    486482        if (thickness_input->InstanceEnum()!=ThicknessEnum) _error_("Input provided is not a Thickness (enum_type is " << EnumToStringx(thickness_input->InstanceEnum()) << ")");
    487483
    488         /*Get Thickness value pointer*/
    489         thickness_input->GetValuesPtr(&thickness_values,&num_thickness_values);
    490 
    491484        /*vertically integrate depending on type:*/
    492485        switch(thickness_input->ObjectEnum()){
    493486
    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];
    498494                        }
    499                         return;
     495                        delete gauss;
     496                        return; }
    500497
    501498                default:
     
    600597
    601598} /*}}}*/
    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 /*}}}*/
    610599/*FUNCTION PentaP1Input::Configure{{{*/
    611600void PentaP1Input::Configure(Parameters* parameters){
  • issm/trunk-jpl/src/c/classes/Inputs/PentaP1Input.h

    r14951 r15082  
    8282                void VerticallyIntegrate(Input* thickness_input);
    8383                void GetVectorFromInputs(Vector<IssmDouble>* vector,int* doflist);
    84                 void GetValuesPtr(IssmDouble** pvalues,int* pnum_values);
    8584                /*}}}*/
    8685
  • issm/trunk-jpl/src/c/classes/Inputs/TransientInput.h

    r14951 r15082  
    8383                void VerticallyIntegrate(Input* thickness_forcing){_error_("not supported yet");};
    8484                void GetVectorFromInputs(Vector<IssmDouble>* vector,int* doflist);
    85                 void GetValuesPtr(IssmDouble** pvalues,int* pnum_values){_error_("not supported yet");};
    8685                void GetTimeValues(IssmDouble* values,IssmDouble time){_error_("not implemented yet");};
    8786                Input* GetTimeInput(IssmDouble time);
  • issm/trunk-jpl/src/c/classes/Inputs/TriaP1Input.cpp

    r15012 r15082  
    375375
    376376} /*}}}*/
    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 /*}}}*/
    385377/*FUNCTION TriaP1Input::PointwiseMin{{{*/
    386378Input* TriaP1Input::PointwiseMin(Input* inputB){
  • issm/trunk-jpl/src/c/classes/Inputs/TriaP1Input.h

    r14951 r15082  
    8181                void VerticallyIntegrate(Input* thickness_input){_error_("not supported yet");};
    8282                void GetVectorFromInputs(Vector<IssmDouble>* vector,int* doflist);
    83                 void GetValuesPtr(IssmDouble** pvalues,int* pnum_values);
    8483                /*}}}*/
    8584
  • issm/trunk-jpl/src/c/modules/CMakeLists.txt

    r14284 r15082  
    2929add_subdirectory(InputArtificialNoisex)
    3030add_subdirectory(InputControlUpdatex)
    31 add_subdirectory(InputConvergencex)
    3231add_subdirectory(InputDuplicatex)
    3332add_subdirectory(InputScalex)
  • issm/trunk-jpl/src/c/modules/modules.h

    r15069 r15082  
    3535#include "./HoleFillerx/HoleFillerx.h"
    3636#include "./InputControlUpdatex/InputControlUpdatex.h"
    37 #include "./InputConvergencex/InputConvergencex.h"
    3837#include "./InputDuplicatex/InputDuplicatex.h"
    3938#include "./InputScalex/InputScalex.h"
  • issm/trunk-jpl/src/c/shared/Enum/EnumDefinitions.h

    r15062 r15082  
    529529        TotalSmbEnum,
    530530        /*}}}*/
    531         /*Convergence{{{*/
    532         RelativeEnum,
     531        /*Relaxation{{{*/
    533532        AbsoluteEnum,
    534533        IncrementalEnum,
  • issm/trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp

    r15062 r15082  
    516516                case IceVolumeEnum : return "IceVolume";
    517517                case TotalSmbEnum : return "TotalSmb";
    518                 case RelativeEnum : return "Relative";
    519518                case AbsoluteEnum : return "Absolute";
    520519                case IncrementalEnum : return "Incremental";
  • issm/trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp

    r15062 r15082  
    528528              else if (strcmp(name,"IceVolume")==0) return IceVolumeEnum;
    529529              else if (strcmp(name,"TotalSmb")==0) return TotalSmbEnum;
    530               else if (strcmp(name,"Relative")==0) return RelativeEnum;
    531530              else if (strcmp(name,"Absolute")==0) return AbsoluteEnum;
    532531              else if (strcmp(name,"Incremental")==0) return IncrementalEnum;
  • issm/trunk-jpl/src/c/shared/Numerics/CMakeLists.txt

    r14284 r15082  
    99               $ENV{ISSM_DIR}/src/c/shared/Numerics/extrema.cpp
    1010           $ENV{ISSM_DIR}/src/c/shared/Numerics/GaussPoints.cpp
    11       $ENV{ISSM_DIR}/src/c/shared/Numerics/IsInputConverged.cpp
    1211                 $ENV{ISSM_DIR}/src/c/shared/Numerics/isnan.cpp
    1312   $ENV{ISSM_DIR}/src/c/shared/Numerics/OptionsFromAnalysis.cpp
Note: See TracChangeset for help on using the changeset viewer.