Greetings. As the title suggests, I would like to define a macro cheking out first the sign of other macro. I've never used macros before, so I don't even really know if this is possible to do. Here's the idea:
where "V" is another macro defined on other header file. I'm sure that this use of "#if" and "#define" is not correct, but how could I get this expression of "DT" in a MACRO-definition way?Code:#if V<0#define DT -(DX / (2*V)) // CFL condition for the linear transport equation #endif /* V<0 */ #if V>=0 #define DT (DX / (2*V)) // CFL condition for the linear transport equation #endif /* V>=0 */
Thank you very much in advance.