Changeset 4753


Ignore:
Timestamp:
07/22/10 14:20:34 (15 years ago)
Author:
Eric.Larour
Message:

Faster input management

Location:
issm/trunk/src/c/objects/Elements
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk/src/c/objects/Elements/Tria.cpp

    r4739 r4753  
    29402940
    29412941        /*inputs: */
     2942        Input* thickness_input=NULL;
     2943        Input* vx_input=NULL;
     2944        Input* vy_input=NULL;
     2945        Input* vxold_input=NULL;
     2946        Input* vyold_input=NULL;
    29422947        bool onwater,shelf;
    29432948
     
    29582963        /* Get gaussian points and weights (make this a statically initialized list of points? fstd): */
    29592964        GaussTria( &num_gauss, &first_gauss_area_coord, &second_gauss_area_coord, &third_gauss_area_coord, &gauss_weights, 2);
     2965
     2966        /*Retrieve all inputs we will be needing: */
     2967        thickness_input=inputs->GetInput(ThicknessEnum);
     2968        vx_input=inputs->GetInput(VxEnum);
     2969        vy_input=inputs->GetInput(VyEnum);
     2970        vxold_input=inputs->GetInput(VxOldEnum);
     2971        vyold_input=inputs->GetInput(VyOldEnum);
    29602972
    29612973        /* Start  looping on the number of gaussian points: */
     
    29692981
    29702982                /*Compute thickness at gaussian point: */
    2971                 inputs->GetParameterValue(&thickness, gauss_l1l2l3,ThicknessEnum);
     2983                thickness_input->GetParameterValue(&thickness, gauss_l1l2l3);
    29722984
    29732985                /*Get strain rate from velocity: */
    2974                 inputs->GetStrainRate2d(&epsilon[0],&xyz_list[0][0],gauss_l1l2l3,VxEnum,VyEnum);
    2975                 inputs->GetStrainRate2d(&oldepsilon[0],&xyz_list[0][0],gauss_l1l2l3,VxOldEnum,VyOldEnum);
     2986                this->GetStrainRate2d(&epsilon[0],&xyz_list[0][0],gauss_l1l2l3,vx_input,vy_input);
     2987                this->GetStrainRate2d(&oldepsilon[0],&xyz_list[0][0],gauss_l1l2l3,vxold_input,vyold_input);
    29762988
    29772989                /*Get viscosity: */
     
    30733085        bool shelf;
    30743086        int  drag_type;
     3087        Input* surface_input=NULL;
    30753088
    30763089        /*retrive parameters: */
     
    30803093        inputs->GetParameterValue(&shelf,ElementOnIceShelfEnum);
    30813094        inputs->GetParameterValue(&drag_type,DragTypeEnum);
     3095        surface_input=inputs->GetInput(SurfaceEnum);
    30823096       
    30833097        /* Get node coordinates and dof list: */
     
    31143128                GetParameterValue(&alpha2,&alpha2_list[0],gauss_l1l2l3); // TO BE DELETED
    31153129
    3116 
    31173130                // If we have a slope > 6% for this element,  it means  we are on a mountain. In this particular case,
    31183131                //velocity should be = 0. To achieve this result, we set alpha2_list to a very high value: */
    3119                 inputs->GetParameterDerivativeValue(&slope[0],&xyz_list[0][0],&gauss_l1l2l3[0],SurfaceEnum);
     3132                surface_input->GetParameterDerivativeValue(&slope[0],&xyz_list[0][0],&gauss_l1l2l3[0]);
    31203133                slope_magnitude=sqrt(pow(slope[0],2)+pow(slope[1],2));
    31213134
     
    42124225        bool onwater;
    42134226        int  drag_type;
     4227        Input* thickness_input=NULL;
     4228        Input* surface_input=NULL;
     4229        Input* drag_input=NULL;
    42144230
    42154231        /*retrieve inputs :*/
    42164232        inputs->GetParameterValue(&onwater,ElementOnWaterEnum);
    42174233        inputs->GetParameterValue(&drag_type,DragTypeEnum);
     4234        thickness_input=inputs->GetInput(ThicknessEnum);
     4235        surface_input=inputs->GetInput(SurfaceEnum);
     4236        drag_input=inputs->GetInput(DragCoefficientEnum);
    42184237
    42194238        /*First, if we are on water, return empty vector: */
     
    42374256
    42384257                /*Compute thickness at gaussian point: */
    4239                 inputs->GetParameterValue(&thickness, &gauss_l1l2l3[0],ThicknessEnum);
    4240                 inputs->GetParameterDerivativeValue(&slope[0],&xyz_list[0][0],&gauss_l1l2l3[0],SurfaceEnum);
     4258                thickness_input->GetParameterValue(&thickness, &gauss_l1l2l3[0]);
     4259                surface_input->GetParameterDerivativeValue(&slope[0],&xyz_list[0][0],&gauss_l1l2l3[0]);
    42414260               
    42424261                /*In case we have plastic basal drag, compute plastic stress at gaussian point from k1, k2 and k3 fields in the
    42434262                 * element itself: */
    42444263                if(drag_type==1){
    4245                         inputs->GetParameterValue(&plastic_stress, &gauss_l1l2l3[0],DragCoefficientEnum);
     4264                        drag_input->GetParameterValue(&plastic_stress, &gauss_l1l2l3[0]);
    42464265                }
    42474266
     
    54735492        /*Add value to global vector*/
    54745493        VecSetValues(solution,numdof,doflist,(const double*)values,INSERT_VALUES);
     5494
     5495}
     5496/*}}}*/
     5497/*FUNCTION Tria::GetStrainRate2d{{{1*/
     5498void Tria::GetStrainRate2d(double* epsilon,double* xyz_list, double* gauss, Input* vx_input, Input* vy_input){
     5499        /*Compute the 2d Strain Rate (3 components):
     5500         *
     5501         * epsilon=[exx eyy exy]
     5502         */
     5503
     5504        int i;
     5505
     5506        double epsilonvx[3];
     5507        double epsilonvy[3];
     5508
     5509        /*Check that both inputs have been found*/
     5510        if (!vx_input || !vy_input){
     5511                ISSMERROR("Input missing. Here are the input pointers we have for vx: %p, vy: %p\n",vx_input,vy_input);
     5512        }
     5513
     5514        /*Get strain rate assuming that epsilon has been allocated*/
     5515        vx_input->GetVxStrainRate2d(epsilonvx,xyz_list,gauss);
     5516        vy_input->GetVyStrainRate2d(epsilonvy,xyz_list,gauss);
     5517
     5518        /*Sum all contributions*/
     5519        for(i=0;i<3;i++) epsilon[i]=epsilonvx[i]+epsilonvy[i];
    54755520
    54765521}
  • issm/trunk/src/c/objects/Elements/Tria.h

    r4739 r4753  
    153153                void      GetParameterDerivativeValue(double* p, double* plist,double* xyz_list, double* gauss_l1l2l3);
    154154                void      GetParameterValue(double* pp, double* plist, double* gauss_l1l2l3);
    155                 void    GetParameterValue(double* pvalue,Node* node,int enumtype);
    156                 void    GetParameterValue(double* pvalue,Node* node1,Node* node2,double gauss_seg,int enumtype);
     155                void      GetParameterValue(double* pvalue,Node* node,int enumtype);
     156                void      GetParameterValue(double* pvalue,Node* node1,Node* node2,double gauss_seg,int enumtype);
    157157                void      GetSolutionFromInputsDiagnosticHoriz(Vec solution);
    158158                void      GetSolutionFromInputsAdjointHoriz(Vec solution);
    159159                void      GetSolutionFromInputsDiagnosticHutter(Vec solution);
     160                void      GetStrainRate2d(double* epsilon,double* xyz_list, double* gauss, Input* vx_input, Input* vy_input);
    160161                void      GradjDragStokes(Vec gradient);
    161162                void      InputUpdateFromSolutionAdjointHoriz( double* solution);
Note: See TracChangeset for help on using the changeset viewer.