Changeset 12483


Ignore:
Timestamp:
06/20/12 15:03:28 (13 years ago)
Author:
utke
Message:

example for replacing _error_ with _error2_ such that the printing
becomes agnostic to the variable type (see e.g. "s" being adouble or
double)) and one doesn't
have to introduce two different variants to appease the C formatting

File:
1 edited

Legend:

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

    r12472 r12483  
    107107                vmag=sqrt(pow(vx,2)+pow(vy,2)+pow(vz,2));
    108108        }
    109         else _error_("element_type %s not supported yet",element_type);
     109        else _error2_("element_type "<< element_type << " not supported yet");
    110110
    111111        /*Checks that s-1>0 if v=0*/
    112         if(vmag==0 && (s-1)<0) _error_("velocity is 0 ans (s-1)=%g<0, alpha_complement is Inf",s-1);
     112        if(vmag==0 && (s-1)<0) _error2_("velocity is 0 and (s-1)=" << (s-1) << "<0, alpha_complement is Inf");
    113113
    114114        alpha2=pow(drag_coefficient,2)*pow(Neff,r)*pow(vmag,(s-1));
     
    171171                vmag=sqrt(pow(vx,2)+pow(vy,2)+pow(vz,2));
    172172        }
    173         else _error_("element_type %s not supported yet",element_type);
     173        else _error2_("element_type "<< element_type << " not supported yet");
    174174
    175175        /*Checks that s-1>0 if v=0*/
    176         if(vmag==0 && (s-1)<0) _error_("velocity is 0 ans (s-1)=%g<0, alpha_complement is Inf",s-1);
     176        if(vmag==0 && (s-1)<0) _error2_("velocity is 0 and (s-1)=" << (s-1) << "<0, alpha_complement is Inf");
    177177
    178178        alpha2=pow(drag_coefficient,2)*pow(Neff,r)*pow(vmag,(s-1));
     
    238238                vmag=sqrt(pow(vx,2)+pow(vy,2)+pow(vz,2));
    239239        }
    240         else _error_("element_type %s not supported yet",element_type);
     240        else _error2_("element_type "<< element_type << " not supported yet");
    241241
    242242        /*Checks that s-1>0 if v=0*/
    243         if(vmag==0 && (s-1)<0) _error_("velocity is 0 ans (s-1)=%g<0, alpha_complement is Inf",s-1);
     243        if(vmag==0 && (s-1)<0) _error2_("velocity is 0 and (s-1)=" << (s-1) << "<0, alpha_complement is Inf");
    244244
    245245        alpha_complement=pow(Neff,r)*pow(vmag,(s-1));            _assert_(!isnan(alpha_complement));
     
    304304                vmag=sqrt(pow(vx,2)+pow(vy,2)+pow(vz,2));
    305305        }
    306         else _error_("element_type %s not supported yet",element_type);
     306        else _error2_("element_type "<< element_type << " not supported yet");
    307307
    308308        /*Checks that s-1>0 if v=0*/
    309         if(vmag==0 && (s-1)<0) _error_("velocity is 0 ans (s-1)=%g<0, alpha_complement is Inf",s-1);
     309        if(vmag==0 && (s-1)<0) _error2_("velocity is 0 and (s-1)=" << (s-1) << "<0, alpha_complement is Inf");
    310310
    311311        alpha_complement=pow(Neff,r)*pow(vmag,(s-1));            _assert_(!isnan(alpha_complement));
     
    319319
    320320        Input* input=inputs->GetInput(enum_type);
    321         if(!input) _error_("input %s not found",EnumToStringx(enum_type));
     321        if(!input) _error2_("input " << EnumToStringx(enum_type) << " not found");
    322322        input->GetInputValue(pvalue,gauss);
    323323
     
    328328
    329329        Input* input=inputs->GetInput(enum_type);
    330         if(!input) _error_("input %s not found",EnumToStringx(enum_type));
     330        if(!input) _error2_("input " << EnumToStringx(enum_type) << " not found");
    331331        input->GetInputValue(pvalue,gauss);
    332332
Note: See TracChangeset for help on using the changeset viewer.