Ignore:
Timestamp:
06/15/10 11:13:28 (15 years ago)
Author:
Eric.Larour
Message:

Starting cleanup of control_core.
Introduced gradient_core and adjoint_core solutions. Trying to get the gradient and the adjoint
inside the elements, instead of as node vectors.

File:
1 edited

Legend:

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

    r4046 r4047  
    45554555/*}}}*/
    45564556/*FUNCTION Penta::Gradj {{{1*/
    4557 void  Penta::Gradj(Vec grad_g,int control_type){
     4557void  Penta::Gradj(int control_type){
    45584558
    45594559        /*inputs: */
     
    45674567
    45684568        if (control_type==DragCoefficientEnum){
    4569                 GradjDrag( grad_g);
     4569                GradjDrag();
    45704570        }
    45714571        else if (control_type=RheologyBEnum){
    4572                 GradjB( grad_g);
     4572                GradjB();
    45734573        }
    45744574        else ISSMERROR("%s%i","control type not supported yet: ",control_type);
     
    45764576/*}}}*/
    45774577/*FUNCTION Penta::GradjDrag {{{1*/
    4578 void  Penta::GradjDrag(Vec grad_g){
     4578void  Penta::GradjDrag(void){
    45794579
    45804580        Tria* tria=NULL;
     4581        TriaVertexInput* triavertexinput=NULL;
     4582        double gradient[6]={0,0,0,0,0,0};
    45814583
    45824584        /*inputs: */
     
    45864588        int analysis_type,sub_analysis_type;
    45874589
    4588         /*retrive parameters: */
     4590        /*retrieve parameters: */
    45894591        parameters->FindParam(&analysis_type,AnalysisTypeEnum);
    45904592        parameters->FindParam(&sub_analysis_type,AnalysisTypeEnum);
     
    46084610                /*MacAyeal or Pattyn*/
    46094611                tria=(Tria*)SpawnTria(0,1,2); //grids 0, 1 and 2 make the new tria.
    4610                 tria->GradjDrag( grad_g);
    4611                 delete tria;
    4612                 return;
     4612                tria->GradjDrag();
    46134613        }
    46144614        else if (sub_analysis_type==StokesAnalysisEnum){
     
    46164616                /*Stokes*/
    46174617                tria=(Tria*)SpawnTria(0,1,2); //grids 0, 1 and 2 make the new tria.
    4618                 tria->GradjDragStokes( grad_g);
    4619                 delete tria;
    4620                 return;
     4618                tria->GradjDragStokes();
    46214619        }
    46224620        else ISSMERROR("%s%i%s\n","sub_analysis: ",sub_analysis_type," not supported yet");
     4621
     4622        /*Now, the tria  has a GradientEnum input. Take it, and make a PentaVertexInput out of it, then delete the tria: */
     4623        triavertexinput=tria->inputs->GetInput(GradientEnum);
     4624        for(i=0;i<3;i++)gradient[i]=triavertexinput->values[i];
     4625        this->inputs->AddInput(new PentaVertexInput(GradientEnum,&gradient[0]));
     4626       
     4627        delete tria;
     4628
    46234629}
    46244630/*}}}*/
    46254631/*FUNCTION Penta::GradjB {{{1*/
    4626 void  Penta::GradjB(Vec grad_g){
     4632void  Penta::GradjB(void){
    46274633
    46284634        Tria* tria=NULL;
     4635        TriaVertexInput* triavertexinput=NULL;
     4636        double gradient[6]={0,0,0,0,0,0};
    46294637
    46304638        /*inputs: */
     
    46484656                 * and compute gardj*/
    46494657                tria=(Tria*)SpawnTria(0,1,2); //grids 0, 1 and 2 make the new tria (lower face).
    4650                 tria->GradjB(grad_g);
    4651                 delete tria;
    4652                 return;
     4658                tria->GradjB();
    46534659        }
    46544660        else{
    46554661                /*B is a 2d field, use MacAyeal(2d) gradient even if it is Stokes or Pattyn*/
    46564662                tria=(Tria*)SpawnTria(0,1,2); //grids 0, 1 and 2 make the new tria (lower face).
    4657                 tria->GradjB(grad_g);
    4658                 delete tria;
    4659                 return;
    4660         }
     4663                tria->GradjB();
     4664        }
     4665       
     4666        /*Now, the tria  has a GradientEnum input. Take it, and make a PentaVertexInput out of it, then delete the tria: */
     4667        triavertexinput=tria->inputs->GetInput(GradientEnum);
     4668        for(i=0;i<3;i++)gradient[i]=triavertexinput->values[i];
     4669        this->inputs->AddInput(new PentaVertexInput(GradientEnum,&gradient[0]));
     4670       
     4671        delete tria;
     4672
    46614673}
    46624674/*}}}*/
     
    53285340}
    53295341/*}}}*/
     5342/*FUNCTION Penta::ScaleInput(int enum_type,double scale_factor){{{1*/
     5343void  Penta::ScaleInput(int enum_type,double scale_factor){
     5344
     5345        Input* input=NULL;
     5346
     5347        /*Make a copy of the original input: */
     5348        input=(Input*)this->inputs->GetInput(enum_type);
     5349
     5350        /*Scale: */
     5351        input->Scale(scale_factor);
     5352}
     5353/*}}}*/
Note: See TracChangeset for help on using the changeset viewer.