Ignore:
Timestamp:
06/30/10 14:17:09 (15 years ago)
Author:
Mathieu Morlighem
Message:

fixing control methods

File:
1 edited

Legend:

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

    r4350 r4353  
    302302/*FUNCTION Tria::InputUpdateFromConstant(int value, int name);{{{1*/
    303303void  Tria::InputUpdateFromConstant(int constant, int name){
    304         /*Nothing updated for now*/
     304        /*Check that name is an element input*/
     305        if (!IsInput(name)) return;
     306
     307        /*update input*/
     308        this->inputs->AddInput(new IntInput(name,constant));
    305309}
    306310/*}}}*/
    307311/*FUNCTION Tria::InputUpdateFromConstant(double value, int name);{{{1*/
    308312void  Tria::InputUpdateFromConstant(double constant, int name){
    309         /*Nothing updated for now*/
     313        /*Check that name is an element input*/
     314        if (!IsInput(name)) return;
     315
     316        /*update input*/
     317        this->inputs->AddInput(new DoubleInput(name,constant));
    310318}
    311319/*}}}*/
    312320/*FUNCTION Tria::InputUpdateFromConstant(bool value, int name);{{{1*/
    313321void  Tria::InputUpdateFromConstant(bool constant, int name){
    314         /*Nothing updated for now*/
     322        /*Check that name is an element input*/
     323        if (!IsInput(name)) return;
     324
     325        /*update input*/
     326        this->inputs->AddInput(new BoolInput(name,constant));
    315327}
    316328/*}}}*/
     
    329341        else if (analysis_type==DiagnosticHorizAnalysisEnum){
    330342                InputUpdateFromSolutionDiagnosticHoriz( solution);
     343        }
     344        else if (analysis_type==AdjointAnalysisEnum){
     345                InputUpdateFromSolutionAdjoint( solution);
    331346        }
    332347        else if (analysis_type==BedSlopeAnalysisEnum || analysis_type==SurfaceSlopeAnalysisEnum){
     
    721736        double scale=0;
    722737        double S=0;
    723         double fit=-1;
     738        int    fit=-1;
    724739
    725740        /*retrieve some parameters: */
     
    18871902        double scaley=1;
    18881903        double S=0;
    1889         double fit=-1;
     1904        int    fit=-1;
    18901905
    18911906        /*inputs: */
     
    21202135        /*inputs: */
    21212136        bool onwater;
    2122         int  fit;
     2137        int fit;
    21232138
    21242139        /*retrieve inputs :*/
     
    53195334}
    53205335/*}}}*/
     5336/*FUNCTION Tria::InputUpdateFromSolutionAdjoint {{{1*/
     5337void  Tria::InputUpdateFromSolutionAdjoint(double* solution){
     5338
     5339        int i;
     5340
     5341        const int    numvertices=3;
     5342        const int    numdofpervertex=2;
     5343        const int    numdof=numdofpervertex*numvertices;
     5344
     5345        int          doflist[numdof];
     5346        double       values[numdof];
     5347        double       lambdax[numvertices];
     5348        double       lambday[numvertices];
     5349
     5350        int          dummy;
     5351
     5352        /*Get dof list: */
     5353        GetDofList(&doflist[0],&dummy);
     5354
     5355        /*Use the dof list to index into the solution vector: */
     5356        for(i=0;i<numdof;i++){
     5357                values[i]=solution[doflist[i]];
     5358        }
     5359
     5360        /*Ok, we have vx and vy in values, fill in vx and vy arrays: */
     5361        for(i=0;i<numvertices;i++){
     5362                lambdax[i]=values[i*numdofpervertex+0];
     5363                lambday[i]=values[i*numdofpervertex+1];
     5364        }
     5365
     5366        /*Add vx and vy as inputs to the tria element: */
     5367        this->inputs->AddInput(new TriaVertexInput(AdjointxEnum,lambdax));
     5368        this->inputs->AddInput(new TriaVertexInput(AdjointyEnum,lambday));
     5369
     5370}
     5371/*}}}*/
    53215372/*FUNCTION Tria::InputUpdateFromSolutionDiagnosticHoriz {{{1*/
    53225373void  Tria::InputUpdateFromSolutionDiagnosticHoriz(double* solution){
     
    54735524/*FUNCTION Tria::IsInput{{{1*/
    54745525bool Tria::IsInput(int name){
    5475         if (name==SurfaceSlopeXEnum ||
    5476                                 name==SurfaceSlopeYEnum){
     5526        if (
     5527                                name==SurfaceSlopeXEnum ||
     5528                                name==SurfaceSlopeYEnum ||
     5529                                name==FitEnum
     5530                ){
    54775531                return true;
    54785532        }
Note: See TracChangeset for help on using the changeset viewer.