User law - "int" symbol

Questions and remarks about code_saturne usage
Forum rules
Please read the forum usage recommendations before posting.
Post Reply
lorenzo.iron
Posts: 18
Joined: Tue May 11, 2021 1:22 pm

User law - "int" symbol

Post by lorenzo.iron »

I was trying to use the "int" symbol as a floor function (as mentioned in the used guide).
I tried to use the function like, for example, "x=int(1.5)" to return "x=1" but I got the following message from the Expression Editor:
In function ‘cs_meg_boundary_function’: expected expression before ‘int’'

What is the mistake?
Is it maybe only usable as an "int" type definition like "int x = 1"? (but in the guide it is listed like a function)

Have you got any working example of the correct usage of "int" as a function?

Thank you in advance.
Lorenzo
Yvan Fournier
Posts: 4080
Joined: Mon Feb 20, 2012 3:25 pm

Re: User law - "int" symbol

Post by Yvan Fournier »

Hello,

If the user guide mentions int(), this is an error and we need to update this....

The code snippets defined in the GUI formulas are inserted into C code, so if you want to conver a variable x to an integer, you can use the C casting method:
x =(int)1.5;

Best regards,

Yvan
Post Reply