>From what I've read (please correct me if I am wrong), REAL*8 is still
valid in Fortran 95. However, we really ought to allow specifying
multiple standards to the function, so that the newer standards can
output more idiomatic code.
I believe it should be possible to change what codegen() is outputting
from changing the DataType that is used. I'm not quite clear how to
pass it in to the codegen() function. In SymPy 1.1 you can pass in a
custom CodeGen subclass, so it should be doable, however it's
complicated because currently types are handled by the classes in the
codegen module rather than the code printers.
Maybe someone more well versed in the module can give a better answer,
but monkeypatching should work
import sympy.utilities.codegen as codegen_mod
codegen_mod.default_datatypes.update({
"int": codegen_mod.DataType("int", "INTEGER(kind=4)", "int", "", "", "i32"),
"float": codegen_mod.DataType("double", "REAL(kind=8)", "float",
"", "", "f64"),
})
(see
https://github.com/sympy/sympy/blob/b2b4bfbbbe85e4b19fbc68fb4f72bdaccb476e79/sympy/utilities/codegen.py#L240)
Aaron Meurer
On Mon, Jul 10, 2017 at 11:17 AM, Flo Bidou65
<[email protected]> wrote:
> Hi,
>
> I'm new to sympy and i'm trying to generate fully compliant f95 fortran
> code. But for instance, the declaration of datatypes (real, int, etc) is not
> compliant with the f95 --std.
>
> Is there a way to automatically generate codes with for instance : real
> (kind=8) :: toto instead of REAL*8 :: toto ?
>
> Instead of rewriting the source code, is someone using codegen for standard
> fortran generation codes purposes ?
>
> Thanks in advance
>
> Best regards.
>
> Florent
>
> --
> You received this message because you are subscribed to the Google Groups
> "sympy" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at https://groups.google.com/group/sympy.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/sympy/dcd1bd81-3be1-45fa-a828-62aec52d398a%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups
"sympy" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/sympy.
To view this discussion on the web visit
https://groups.google.com/d/msgid/sympy/CAKgW%3D6K3PEb%2Bby7%2B8Z6T6sRw6WDaD-HxZOy7yPQjTWMJmMB3UQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.