source: issm/oecreview/Archive/24307-24683/ISSM-24343-24344.diff@ 24684

Last change on this file since 24684 was 24684, checked in by Mathieu Morlighem, 5 years ago

CHG: added new review

File size: 7.9 KB
  • ../trunk-jpl/src/c/classes/Inputs2/BoolInput2.cpp

     
    4343/*}}}*/
    4444void BoolInput2::DeepEcho(void){/*{{{*/
    4545
    46         //_printf_(setw(15)<<"   BoolInput2 "<<setw(25)<<left<<EnumToStringx(this->enum_type)<<" "<<(value?"true":"false") << "\n");
    47         _error_("Not implemented");
     46        _printf_("BoolInput2 Echo:\n");
     47        _printf_("   Size:          "<<size<<"\n");
     48        printarray(this->values,this->size);
    4849}
    4950/*}}}*/
    5051void BoolInput2::Echo(void){/*{{{*/
  • ../trunk-jpl/src/c/classes/Inputs2/Inputs2.cpp

     
    245245        return false;
    246246}
    247247/*}}}*/
     248int Inputs2::GetInputObjectEnum(int enum_in){/*{{{*/
     249
     250        _assert_(this);
     251
     252        int index = EnumToIndex(enum_in);
     253        if(!this->inputs[index]) _error_("Input "<<EnumToStringx(enum_in)<<" not found");
     254        return this->inputs[index]->ObjectEnum();
     255}
     256/*}}}*/
    248257void Inputs2::GetInputsInterpolations(int* pnuminputs,int** pinterpolations,int** pinputenums){/*{{{*/
    249258
    250259        /*First count number of inputs*/
  • ../trunk-jpl/src/c/classes/Inputs2/Inputs2.h

     
    5959                DatasetInput2*   GetDatasetInput2(int enum_type);
    6060                ControlInput2*   GetControlInput2(int enum_type);
    6161                void  Marshall(char** pmarshalled_data, int* pmarshalled_data_size, int marshall_direction);
     62                int   GetInputObjectEnum(int enum_type);
    6263                void  GetInputValue(bool* pvalue,int enum_in,int index);
    6364                void  GetInputValue(int*  pvalue,int enum_in,int index);
    6465                void  ResultInterpolation(int* pinterpolation,int*nodesperelement,int* parray_size, int output_enum);
  • ../trunk-jpl/src/c/classes/Elements/Element.cpp

     
    32813281        }
    32823282
    32833283        /*If this input is not already in Inputs, maybe it needs to be computed?*/
    3284         Input2* input2 = this->GetInput2(output_enum);
    3285         if(!input2) _error_("input "<<EnumToStringx(output_enum)<<" not found in element");
     3284        switch(this->inputs2->GetInputObjectEnum(output_enum)){
     3285                case TriaInput2Enum:
     3286                case PentaInput2Enum:{
     3287                        Input2* input2 = this->GetInput2(output_enum);
     3288                        if(!input2) _error_("input "<<EnumToStringx(output_enum)<<" not found in element");
     3289                        *pinterpolation   = input2->GetResultInterpolation();
     3290                        *pnodesperelement = input2->GetResultNumberOfNodes();
     3291                        *parray_size      = input2->GetResultArraySize();
     3292                        }
     3293                        break;
     3294                case BoolInput2Enum:
     3295                        *pinterpolation   = P0Enum;
     3296                        *pnodesperelement = 1;
     3297                        *parray_size      = 1;
     3298                        break;
     3299                default:
     3300                        _error_("Input type \""<<EnumToStringx(this->inputs2->GetInputObjectEnum(output_enum))<<"\" not supported yet");
     3301        }
    32863302
     3303
    32873304        /*Assign output pointer*/
    3288         *pinterpolation   = input2->GetResultInterpolation();
    3289         *pnodesperelement = input2->GetResultNumberOfNodes();
    3290         *parray_size      = input2->GetResultArraySize();
     3305
    32913306        return;
    32923307}/*}}}*/
    32933308void       Element::ResultToPatch(IssmDouble* values,int nodesperelement,int output_enum){/*{{{*/
     
    33103325} /*}}}*/
    33113326void       Element::ResultToVector(Vector<IssmDouble>* vector,int output_enum){/*{{{*/
    33123327
     3328        switch(this->inputs2->GetInputObjectEnum(output_enum)){
     3329                case TriaInput2Enum:
     3330                case PentaInput2Enum:{
    33133331
    3314                 Input2* input2=this->GetInput2(output_enum);
    3315                 if(!input2) _error_("input "<<EnumToStringx(output_enum)<<" not found in element");
     3332                        Input2* input2 = this->GetInput2(output_enum);
     3333                        if(!input2) _error_("input "<<EnumToStringx(output_enum)<<" not found in element");
    33163334
    3317                 switch(input2->GetResultInterpolation()){
    3318                         case P0Enum:{
    3319                                                                 IssmDouble  value;
    3320                                                                 bool        bvalue;
    3321                                                                 switch(input2->ObjectEnum()){
    3322                                                                         case BoolInputEnum:
    3323                                                                                 (xDynamicCast<BoolInput2*>(input2))->GetInput(&bvalue,this->lid);
    3324                                                                                 value=reCast<IssmDouble>(bvalue);
    3325                                                                                 break;
    3326                                                                         default:
    3327                                                                                 Gauss* gauss = this->NewGauss();
    3328                                                                                 input2->GetInputValue(&value,gauss);
    3329                                                                                 delete gauss;
    3330                                                                 }
    3331                                                                 vector->SetValue(this->Sid(),value,INS_VAL);
    3332                                                                 break;
    3333                                                         }
    3334                         case P1Enum:{
    3335                                                                 const int NUM_VERTICES = this->GetNumberOfVertices();
     3335                        switch(input2->GetResultInterpolation()){
     3336                                case P0Enum:{
     3337                                        IssmDouble  value;
     3338                                        bool        bvalue;
     3339                                        Gauss* gauss = this->NewGauss();
     3340                                        input2->GetInputValue(&value,gauss);
     3341                                        delete gauss;
     3342                                        vector->SetValue(this->Sid(),value,INS_VAL);
     3343                                        break;
     3344                                        }
     3345                                case P1Enum:{
     3346                                        const int NUM_VERTICES = this->GetNumberOfVertices();
    33363347
    3337                                                                 IssmDouble *values      = xNew<IssmDouble>(NUM_VERTICES);
    3338                                                                 int        *connectivity= xNew<int>(NUM_VERTICES);
    3339                                                                 int        *sidlist     = xNew<int>(NUM_VERTICES);
     3348                                        IssmDouble *values      = xNew<IssmDouble>(NUM_VERTICES);
     3349                                        int        *connectivity= xNew<int>(NUM_VERTICES);
     3350                                        int        *sidlist     = xNew<int>(NUM_VERTICES);
    33403351
    3341                                                                 this->GetVerticesSidList(sidlist);
    3342                                                                 this->GetVerticesConnectivityList(connectivity);
    3343                                                                 this->GetInputListOnVertices(values,output_enum);
    3344                                                                 for(int i=0;i<NUM_VERTICES;i++) values[i] = values[i]/reCast<IssmDouble>(connectivity[i]);
     3352                                        this->GetVerticesSidList(sidlist);
     3353                                        this->GetVerticesConnectivityList(connectivity);
     3354                                        this->GetInputListOnVertices(values,output_enum);
     3355                                        for(int i=0;i<NUM_VERTICES;i++) values[i] = values[i]/reCast<IssmDouble>(connectivity[i]);
    33453356
    3346                                                                 vector->SetValues(NUM_VERTICES,sidlist,values,ADD_VAL);
     3357                                        vector->SetValues(NUM_VERTICES,sidlist,values,ADD_VAL);
    33473358
    3348                                                                 xDelete<IssmDouble>(values);
    3349                                                                 xDelete<int>(connectivity);
    3350                                                                 xDelete<int>(sidlist);
    3351                                                                 break;
    3352                                                         }
    3353                         default:
    3354                                                  _error_("interpolation "<<EnumToStringx(input2->GetResultInterpolation())<<" not supported yet");
    3355                 }
     3359                                        xDelete<IssmDouble>(values);
     3360                                        xDelete<int>(connectivity);
     3361                                        xDelete<int>(sidlist);
     3362                                        break;
     3363                                        }
     3364                                default:
     3365                                        _error_("interpolation "<<EnumToStringx(input2->GetResultInterpolation())<<" not supported yet");
     3366                                }
     3367                        }
     3368                        break;
     3369                case BoolInput2Enum:
     3370                        bool bvalue;
     3371                        this->GetInput2Value(&bvalue,output_enum);
     3372                        vector->SetValue(this->Sid(),reCast<IssmDouble>(bvalue),INS_VAL);
     3373                        break;
     3374                default:
     3375                        _error_("Input type \""<<EnumToStringx(this->inputs2->GetInputObjectEnum(output_enum))<<"\" not supported yet");
     3376        }
     3377
    33563378} /*}}}*/
    33573379void       Element::SetBoolInput(Inputs2* inputs2,int enum_in,bool value){/*{{{*/
    33583380
  • ../trunk-jpl/src/c/classes/Elements/Tria.cpp

     
    193193        /*Call inputs method*/
    194194        if(!this->inputs2){
    195195                int* temp = xNew<int>(3);
     196                _error_("inputs2 not set");
    196197        }
    197198        _assert_(this->inputs2);
    198199        switch(interpolation_enum){
  • ../trunk-jpl/src/c/analyses/HydrologyDCEfficientAnalysis.cpp

     
    688688                        }
    689689                }
    690690        }
    691         basalelement->AddInput2(HydrologydcEplThicknessSubstepEnum,epl_thickness,basalelement->GetElementType());
     691        element->AddBasalInput2(HydrologydcEplThicknessSubstepEnum,epl_thickness,basalelement->GetElementType());
    692692
    693693        if(domaintype!=Domain2DhorizontalEnum){
    694694                basalelement->DeleteMaterials();
Note: See TracBrowser for help on using the repository browser.