Changeset 12549


Ignore:
Timestamp:
06/26/12 09:16:36 (13 years ago)
Author:
utke
Message:

drop the ifndefs again and use the cleaner solution with the reCast function template

File:
1 edited

Legend:

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

    r12535 r12549  
    5757        //intialize inputs, and add as many inputs per element as requested:
    5858        this->inputs=new Inputs();
    59         if (iomodel->Data(MeshVertexonbedEnum)) {
    60 #ifndef _HAVE_ADOLC_
    61          this->inputs->AddInput(new BoolInput(MeshVertexonbedEnum,(IssmBool)iomodel->Data(MeshVertexonbedEnum)[io_index]));
    62 #else
    63          this->inputs->AddInput(new BoolInput(MeshVertexonbedEnum,(IssmBool)((iomodel->Data(MeshVertexonbedEnum)[io_index]).getValue())));
    64 #endif
    65         }
    66         if (iomodel->Data(MeshVertexonsurfaceEnum)) {
    67 #ifndef _HAVE_ADOLC_
    68          this->inputs->AddInput(new BoolInput(MeshVertexonsurfaceEnum,(IssmBool)iomodel->Data(MeshVertexonsurfaceEnum)[io_index]));
    69 #else
    70          this->inputs->AddInput(new BoolInput(MeshVertexonsurfaceEnum,(IssmBool)((iomodel->Data(MeshVertexonsurfaceEnum)[io_index]).getValue())));
    71 #endif
    72         }
    73         if (iomodel->Data(MaskVertexonfloatingiceEnum)) {
    74 #ifndef _HAVE_ADOLC_
    75          this->inputs->AddInput(new BoolInput(MaskVertexonfloatingiceEnum,(IssmBool)iomodel->Data(MaskVertexonfloatingiceEnum)[io_index]));
    76 #else
    77          this->inputs->AddInput(new BoolInput(MaskVertexonfloatingiceEnum,(IssmBool)((iomodel->Data(MaskVertexonfloatingiceEnum)[io_index]).getValue())));
    78 #endif
    79         }
    80         if (iomodel->Data(MaskVertexongroundediceEnum)) {
    81 #ifndef _HAVE_ADOLC_
    82           this->inputs->AddInput(new BoolInput(MaskVertexongroundediceEnum,(IssmBool)iomodel->Data(MaskVertexongroundediceEnum)[io_index]));
    83 #else
    84           this->inputs->AddInput(new BoolInput(MaskVertexongroundediceEnum,(IssmBool)((iomodel->Data(MaskVertexongroundediceEnum)[io_index]).getValue())));
    85 #endif
    86         }
    87         if (analysis_type==DiagnosticHorizAnalysisEnum) {
    88 #ifndef _HAVE_ADOLC_
    89          this->inputs->AddInput(new IntInput(ApproximationEnum,(IssmInt)iomodel->Data(FlowequationVertexEquationEnum)[io_index]));
    90 #else
    91          this->inputs->AddInput(new IntInput(ApproximationEnum,(IssmInt)((iomodel->Data(FlowequationVertexEquationEnum)[io_index]).getValue())));
    92 #endif
    93         }
     59        if (iomodel->Data(MeshVertexonbedEnum))
     60         this->inputs->AddInput(new BoolInput(MeshVertexonbedEnum,reCast<IssmBool>(iomodel->Data(MeshVertexonbedEnum)[io_index])));
     61        if (iomodel->Data(MeshVertexonsurfaceEnum))
     62         this->inputs->AddInput(new BoolInput(MeshVertexonsurfaceEnum,reCast<IssmBool>(iomodel->Data(MeshVertexonsurfaceEnum)[io_index])));
     63        if (iomodel->Data(MaskVertexonfloatingiceEnum))
     64         this->inputs->AddInput(new BoolInput(MaskVertexonfloatingiceEnum,reCast<IssmBool>(iomodel->Data(MaskVertexonfloatingiceEnum)[io_index])));
     65        if (iomodel->Data(MaskVertexongroundediceEnum))
     66          this->inputs->AddInput(new BoolInput(MaskVertexongroundediceEnum,reCast<IssmBool>(iomodel->Data(MaskVertexongroundediceEnum)[io_index])));
     67        if (analysis_type==DiagnosticHorizAnalysisEnum)
     68         this->inputs->AddInput(new IntInput(ApproximationEnum,reCast<IssmInt>(iomodel->Data(FlowequationVertexEquationEnum)[io_index])));
    9469        /*set single point constraints: */
    9570
    9671        /*spc all nodes on water*/
    9772        if (!iomodel->Data(MaskVertexonwaterEnum)) _error2_("iomodel->nodeonwater is NULL");
    98         IssmBool maskVertexOnWater;
    99 #ifndef _HAVE_ADOLC_
    100         maskVertexOnWater=iomodel->Data(MaskVertexonwaterEnum)[io_index];
    101 #else
    102         maskVertexOnWater=(IssmBool)((iomodel->Data(MaskVertexonwaterEnum)[io_index]).getValue());
    103 #endif
    104         if (maskVertexOnWater){
     73        if (reCast<IssmBool>(iomodel->Data(MaskVertexonwaterEnum)[io_index])){
    10574                for(k=1;k<=gsize;k++){
    10675                        this->FreezeDof(k);
     
    147116                if (!iomodel->Data(FlowequationVertexEquationEnum)) _error2_("iomodel->vertices_type is NULL");
    148117                /*Constrain all nodes that are not Hutter*/
    149 #ifndef _HAVE_ADOLC_
    150                 if (!(iomodel->Data(FlowequationVertexEquationEnum)[io_index]==HutterApproximationEnum)){
    151 #else
    152                 if (!((iomodel->Data(FlowequationVertexEquationEnum)[io_index]).getValue()==HutterApproximationEnum)){
    153 #endif
     118                if (reCast<int>(iomodel->Data(FlowequationVertexEquationEnum)[io_index])!=HutterApproximationEnum){
    154119                        for(k=1;k<=gsize;k++){
    155120                                this->FreezeDof(k);
     
    169134                        /*On a 3d mesh, we may have collapsed elements, hence dead nodes. Freeze them out: */
    170135                        _assert_(iomodel->Data(MeshVertexonbedEnum));
    171                         IssmBool meshVertexOnBed;
    172 #ifndef _HAVE_ADOLC_
    173                         meshVertexOnBed=iomodel->Data(MeshVertexonbedEnum)[io_index];
    174 #else
    175                         meshVertexOnBed=(IssmBool)((iomodel->Data(MeshVertexonbedEnum)[io_index]).getValue());
    176 #endif
    177                         if (!meshVertexOnBed){
     136                        if (!(reCast<IssmBool>(iomodel->Data(MeshVertexonbedEnum)[io_index]))){
    178137                                for(k=1;k<=gsize;k++){
    179138                                        this->FreezeDof(k);
Note: See TracChangeset for help on using the changeset viewer.