Changeset 12553


Ignore:
Timestamp:
06/26/12 11:00:01 (13 years ago)
Author:
utke
Message:

recast - the calls with the second template argument imply a conversion from a temporary ("adub") to a complete active variable (adouble) which one would not get otherwise and consequently could not call getValue (in the template definition).

File:
1 edited

Legend:

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

    r12551 r12553  
    16491649       
    16501650        if ((code==5) || (code==1)){ //boolean
    1651                 this->inputs->AddInput(new BoolInput(name,(bool)scalar));
     1651                this->inputs->AddInput(new BoolInput(name,reCast<bool>(scalar)));
    16521652        }
    16531653        else if ((code==6) || (code==2)){ //integer
    1654                 this->inputs->AddInput(new IntInput(name,(int)scalar));
     1654                this->inputs->AddInput(new IntInput(name,reCast<int>(scalar)));
    16551655        }
    16561656        else if ((code==7) || (code==3)){ //IssmDouble
    1657                 this->inputs->AddInput(new DoubleInput(name,(int)scalar));
     1657                this->inputs->AddInput(new DoubleInput(name,reCast<int>(scalar)));
    16581658        }
    16591659        else _error2_("could not recognize nature of vector from code " << code);
     
    16861686                /*Recover vertices ids needed to initialize inputs*/
    16871687                for(i=0;i<3;i++){
    1688                         tria_vertex_ids[i]=(int)iomodel->Data(MeshElementsEnum)[3*index+i]; //ids for vertices are in the elements array from Matlab
     1688                        tria_vertex_ids[i]=reCast<int>(iomodel->Data(MeshElementsEnum)[3*index+i]); //ids for vertices are in the elements array from Matlab
    16891689                }
    16901690
     
    17311731
    17321732                        if (code==5){ //boolean
    1733                                 this->inputs->AddInput(new BoolInput(vector_enum,(bool)vector[index]));
     1733                                this->inputs->AddInput(new BoolInput(vector_enum,reCast<bool>(vector[index])));
    17341734                        }
    17351735                        else if (code==6){ //integer
    1736                                 this->inputs->AddInput(new IntInput(vector_enum,(int)vector[index]));
     1736                                this->inputs->AddInput(new IntInput(vector_enum,reCast<int>(vector[index])));
    17371737                        }
    17381738                        else if (code==7){ //IssmDouble
    1739                                 this->inputs->AddInput(new DoubleInput(vector_enum,(IssmDouble)vector[index]));
     1739                                this->inputs->AddInput(new DoubleInput(vector_enum,vector[index]));
    17401740                        }
    17411741                        else _error2_("could not recognize nature of vector from code " << code);
     
    18231823
    18241824        for(i=0;i<NUMVERTICES;i++){
    1825                 if (flags[nodes[i]->Sid()]){
     1825                if (reCast<bool>(flags[nodes[i]->Sid()])){
    18261826                        shelf=true;
    18271827                        break;
     
    19141914        for(i=0;i<NUMVERTICES;i++){
    19151915                /*Ice shelf: if bed below bathymetry, impose it at the bathymetry and update surface, elso do nothing */
    1916                 if(old_floating_ice[nodes[i]->Sid()]){
     1916                if(reCast<bool>(old_floating_ice[nodes[i]->Sid()])){
    19171917                        if(b[i]<=ba[i]){
    19181918                                b[i]=ba[i];
     
    19341934                                        nodes[i]->inputs->AddInput(new BoolInput(MaskVertexongroundediceEnum,false));
    19351935                                }
    1936                                 else if(migration_style==SoftMigrationEnum && sheet_ungrounding[nodes[i]->Sid()]){
     1936                                else if(migration_style==SoftMigrationEnum && reCast<bool>(sheet_ungrounding[nodes[i]->Sid()])){
    19371937                                        s[i]=(1-density)*h[i];
    19381938                                        b[i]=-density*h[i];
     
    21872187       if (tstar < PDup){
    21882188         pd = 1;
    2189          if (tstar >= -siglimc){ pd = pds[int(tstar/DT + siglim0c)];}}
     2189         if (tstar >= -siglimc){ pd = pds[reCast<int,IssmDouble>(tstar/DT + siglim0c)];}}
    21902190       else {
    21912191         pd = 0;}
     
    22072207       if (tstar >= siglim) {pdd[i] = pdd[i] + tstar*deltm;}
    22082208       else if (tstar> -siglim){
    2209          pddsig=pdds[int(tstar/DT + siglim0)];
     2209         pddsig=pdds[reCast<int,IssmDouble>(tstar/DT + siglim0)];
    22102210         pdd[i] = pdd[i] + pddsig*deltm;
    22112211         frzndd[i] = frzndd[i] - (tstar-pddsig)*deltm;}
     
    25212521        /*Recover vertices ids needed to initialize inputs*/
    25222522        for(i=0;i<3;i++){
    2523                 tria_vertex_ids[i]=(int)iomodel->Data(MeshElementsEnum)[3*index+i]; //ids for vertices are in the elements array from Matlab
     2523                tria_vertex_ids[i]=reCast<int>(iomodel->Data(MeshElementsEnum)[3*index+i]); //ids for vertices are in the elements array from Matlab
    25242524        }
    25252525
     
    25342534                /*Continuous Galerkin*/
    25352535                for(i=0;i<3;i++){
    2536                         tria_node_ids[i]=iomodel->nodecounter+(int)*(iomodel->Data(MeshElementsEnum)+3*index+i); //ids for vertices are in the elements array from Matlab
     2536                        tria_node_ids[i]=iomodel->nodecounter+reCast<int,IssmDouble>(*(iomodel->Data(MeshElementsEnum)+3*index+i)); //ids for vertices are in the elements array from Matlab
    25372537                }
    25382538        }
     
    25922592        /*Go through nodes, and whoever is on the potential_sheet_ungrounding, ends up in nodes_on_iceshelf: */
    25932593        for(i=0;i<3;i++){
    2594                 if (vertices_potentially_ungrounding[nodes[i]->Sid()]){
     2594                if (reCast<bool>(vertices_potentially_ungrounding[nodes[i]->Sid()])){
    25952595                        vec_nodes_on_iceshelf->SetValue(nodes[i]->Sid(),1,INS_VAL);
    25962596               
Note: See TracChangeset for help on using the changeset viewer.