Changeset 17231


Ignore:
Timestamp:
02/07/14 09:53:00 (11 years ago)
Author:
jbondzio
Message:

CHG: correct revert gone too far

Location:
issm/trunk-jpl/src/c/classes/Inputs
Files:
2 edited

Legend:

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

    r17230 r17231  
    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 array 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*/
  • issm/trunk-jpl/src/c/classes/Inputs/TriaInput.cpp

    r17230 r17231  
    100100        /*output*/
    101101        SegInput* outinput=NULL;
    102         IssmDouble newvalues[2]; //Assume P1 interpolation only for now
    103 
    104         /*Create arrow of indices depending on location (0=base 1=surface)*/
    105 
    106         newvalues[0]=this->values[index1];
    107         newvalues[1]=this->values[index2];
    108 
    109         /*Create new Seg input*/
    110         outinput=new SegInput(this->enum_type,&newvalues[0],P1Enum);
     102
     103        if(this->element_type==P0Enum){
     104                outinput=new SegInput(this->enum_type,&this->values[0],P0Enum);
     105        }
     106        else{
     107                /*Assume P1 interpolation only for now*/
     108                IssmDouble newvalues[2];
     109
     110                /*Create array of indices depending on location (0=base 1=surface)*/
     111                newvalues[0]=this->values[index1];
     112                newvalues[1]=this->values[index2];
     113
     114                /*Create new Seg input*/
     115                outinput=new SegInput(this->enum_type,&newvalues[0],P1Enum);
     116        }
    111117
    112118        /*Assign output*/
Note: See TracChangeset for help on using the changeset viewer.