Changeset 17228


Ignore:
Timestamp:
02/07/14 09:37:13 (11 years ago)
Author:
Mathieu Morlighem
Message:

BUG: fixed spawn input in case interpolation is P0

File:
1 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk-jpl/src/c/classes/Inputs/PentaInput.cpp

    r17102 r17228  
    8686        /*output*/
    8787        TriaInput* outinput=NULL;
    88         IssmDouble newvalues[3]; //Assume P1 interpolation only for now
    89 
    90         /*Create arrow of indices depending on location (0=base 1=surface)*/
    91         int indices[3];
    92         switch(location){
    93                 case 0:
    94                         indices[0] = 0;
    95                         indices[1] = 1;
    96                         indices[2] = 2;
    97                         break;
    98                 case 1:
    99                         indices[0] = 3;
    100                         indices[1] = 4;
    101                         indices[2] = 5;
    102                         break;
    103                 default:
    104                         _error_("case "<<location<<" not supported");
    105         }
    106 
    107         /*Loop over the new indices*/
    108         for(int i=0;i<3;i++){
    109 
    110                 /*Check index value*/
    111                 _assert_(indices[i]>=0 && indices[i]<6);
    112 
    113                 /*Assign value to new input*/
    114                 newvalues[i]=this->values[indices[i]];
    115         }
    116 
    117         /*Create new Tria input*/
    118         outinput=new TriaInput(this->enum_type,&newvalues[0],P1Enum);
     88
     89        if(this->element_type==P0Enum){
     90                outinput=new TriaInput(this->enum_type,&this->values[0],P0Enum);
     91        }
     92        else{
     93                /*Assume P1 interpolation only for now*/
     94                IssmDouble newvalues[3];
     95
     96                /*Create arrow of indices depending on location (0=base 1=surface)*/
     97                int indices[3];
     98                switch(location){
     99                        case 0:
     100                                indices[0] = 0;
     101                                indices[1] = 1;
     102                                indices[2] = 2;
     103                                break;
     104                        case 1:
     105                                indices[0] = 3;
     106                                indices[1] = 4;
     107                                indices[2] = 5;
     108                                break;
     109                        default:
     110                                _error_("case "<<location<<" not supported");
     111                }
     112
     113                /*Create new input*/
     114                for(int i=0;i<3;i++){
     115                        _assert_(indices[i]>=0 && indices[i]<6);
     116                        newvalues[i]=this->values[indices[i]];
     117                }
     118                outinput=new TriaInput(this->enum_type,&newvalues[0],P1Enum);
     119        }
    119120
    120121        /*Assign output*/
Note: See TracChangeset for help on using the changeset viewer.