Changeset 24926


Ignore:
Timestamp:
05/29/20 22:17:06 (5 years ago)
Author:
Eric.Larour
Message:

CHG: verbose statements for sea level core solution.
Also implemneted a GetArrayPtr for inputs2.

Location:
issm/trunk-jpl/src/c
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk-jpl/src/c/classes/Elements/Tria.cpp

    r24924 r24926  
    56445644                lati=latitude[i]/180*PI; longi=longitude[i]/180*PI;
    56455645                delPhi=fabs(lati-late); delLambda=fabs(longi-longe);
    5646                 alpha=2.*asin(sqrt(pow(sin(delPhi/2),2.0)+cos(lati)*cos(late)*pow(sin(delLambda/2),2)));
     5646                alpha=2.*asin(sqrt(pow(sin(delPhi/2),2)+cos(lati)*cos(late)*pow(sin(delLambda/2),2)));
    56475647                indices[i]=reCast<int,IssmDouble>(alpha/PI*reCast<IssmDouble,int>(M-1));
    56485648        }
     
    57545754
    57555755        /*retrieve indices:*/
    5756         if(computerigid){this->inputs2->GetArray(SealevelriseIndicesEnum,this->lid,&indices,&dummy); _assert_(dummy==gsize);}
     5756        if(computerigid){this->inputs2->GetArrayPtr(SealevelriseIndicesEnum,this->lid,&indices,&dummy); _assert_(dummy==gsize);}
    57575757
    57585758        /*Compute area of element. Scale it by grounded fraction if not fully grounded: */
     
    58235823                }
    58245824        }
    5825 
    5826         /*Free ressources:*/
    5827         if(computerigid)xDelete<IssmDouble>(indices);
    58285825
    58295826        /*Assign output pointer:*/
     
    60356032
    60366033        /*retrieve indices:*/
    6037         if(computerigid){this->inputs2->GetArray(SealevelriseIndicesEnum,this->lid,&indices,&dummy); _assert_(dummy==gsize);}
     6034        if(computerigid){this->inputs2->GetArrayPtr(SealevelriseIndicesEnum,this->lid,&indices,&dummy); _assert_(dummy==gsize);}
    60386035
    60396036        /*From Sg_old, recover water sea level rise:*/
     
    60746071                }
    60756072        }
    6076 
    6077         /*Free ressources:*/
    6078         if(computerigid)xDelete<IssmDouble>(indices);
    60796073
    60806074
     
    61446138
    61456139        /*retrieve indices:*/
    6146         if(computerigid){this->inputs2->GetArray(SealevelriseIndicesEnum,this->lid,&indices,&dummy); _assert_(dummy==gsize);}
     6140        if(computerigid){this->inputs2->GetArrayPtr(SealevelriseIndicesEnum,this->lid,&indices,&dummy); _assert_(dummy==gsize);}
    61476141
    61486142        /*compute area of element:*/
     
    62386232
    62396233        /*free ressources:*/
    6240         if(computerigid)xDelete<IssmDouble>(indices);
    62416234        xDelete<IssmDouble>(U_values);
    62426235        xDelete<IssmDouble>(U_elastic);
  • issm/trunk-jpl/src/c/classes/Inputs2/ArrayInput2.cpp

    r24364 r24926  
    131131}
    132132/*}}}*/
     133void ArrayInput2::GetArrayPtr(int row,IssmDouble** pvalues,int* pN){/*{{{*/
     134
     135        _assert_(this);
     136        _assert_(row>=0 && row<this->numberofelements_local);
     137        if(pvalues){
     138                *pvalues = this->values[row];
     139        }
     140        if(pN){
     141                *pN = this->N[row];
     142        }
     143}
     144/*}}}*/
  • issm/trunk-jpl/src/c/classes/Inputs2/ArrayInput2.h

    r24364 r24926  
    2929                void SetInput(int row,int numinds,IssmDouble* values_in);
    3030                void GetArray(int row,IssmDouble** pvalues,int* pN);
     31                void GetArrayPtr(int row,IssmDouble** pvalues,int* pN);
    3132
    3233};
  • issm/trunk-jpl/src/c/classes/Inputs2/Inputs2.cpp

    r24790 r24926  
    449449        return xDynamicCast<ControlInput2*>(input);
    450450}/*}}}*/
     451void Inputs2::GetArrayPtr(int enum_in,int row,IssmDouble** pvalues,int* pN){/*{{{*/
     452
     453        /*Get input id*/
     454        int id = EnumToIndex(enum_in);
     455
     456        /*Create it if necessary*/
     457        if(this->inputs[id]){
     458                if(this->inputs[id]->ObjectEnum()!=ArrayInput2Enum) _error_(EnumToStringx(this->inputs[id]->ObjectEnum())<<" cannot return an array");
     459        }
     460        else{
     461                _error_("Input "<<EnumToStringx(enum_in)<<" not found");
     462        }
     463
     464        /*Set input*/
     465        ArrayInput2* input = xDynamicCast<ArrayInput2*>(this->inputs[id]);
     466        input->GetArrayPtr(row,pvalues,pN);
     467}/*}}}*/
    451468void Inputs2::GetArray(int enum_in,int row,IssmDouble** pvalues,int* pN){/*{{{*/
    452469
  • issm/trunk-jpl/src/c/classes/Inputs2/Inputs2.h

    r24790 r24926  
    5151                void     GetInputsInterpolations(int* pnuminputs,int** pinterpolations,int** penum);
    5252                void             GetArray(int enum_in,int row,IssmDouble** pvalues,int* pN);
     53                void             GetArrayPtr(int enum_in,int row,IssmDouble** pvalues,int* pN);
    5354                SegInput2*       GetSegInput(int enum_type);
    5455                TriaInput2*      GetTriaInput(int enum_type);
  • issm/trunk-jpl/src/c/cores/sealevelrise_core.cpp

    r24924 r24926  
    351351        /*outputs:*/
    352352        IssmDouble eustatic;
     353       
     354        if(VerboseSolution()) _printf0_("         computing eustatic components on ice\n");
    353355
    354356        /*recover parameters:*/
     
    416418        IssmDouble                      Ixz, Iyz, Izz;
    417419        int                      loop;
     420       
     421        if(VerboseSolution()) _printf0_("         converging on ocean components\n");
    418422
    419423        /*Recover some parameters: */
     
    530534        int  loop;
    531535        int  horiz;
     536       
     537        if(VerboseSolution()) _printf0_("         computing vertical and horizontal geodetic signatures\n");
    532538
    533539        /*retrieve some parameters:*/
     
    577583        int                                     frequency;
    578584        IssmDouble          dt;
     585       
     586        if(VerboseSolution()) _printf0_("         computing viscous components\n");
    579587
    580588        /*retrieve some parameters:*/
Note: See TracChangeset for help on using the changeset viewer.