Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ENH] Add fAssumedShapeDT to support the allocatable array of derived types #59

Open
vincent-skywalker opened this issue Apr 22, 2024 · 2 comments

Comments

@vincent-skywalker
Copy link

Description of the new feature
Allows fortran function to return an allocatable array of derived types.

Proposed Fortran code
An example of what the Fortran code looks like

    function func_return_allocatable_s_struct_nested_2() result(s)
        type(s_struct_nested_2),allocatable::s(:)
        allocate(s(2))
        s(1)%a_int = 123
        s(1)%f_nested%a_int = 234
        s(1)%f_nested%f_struct%a_int = 345
        s(2)%a_int = 456
        s(2)%f_nested%a_int = 567
        s(2)%f_nested%f_struct%a_int = 678
    end function func_return_allocatable_s_struct_nested_2

Proposed Python code
Sorry, I am not familiar.

@vincent-skywalker
Copy link
Author

vincent-skywalker commented Apr 22, 2024

I tried and give up. It seems too complex. It is on my fork's branch fAssumedShapeDT.

Is there a plan to add this feature? @rjfarmer

@rjfarmer
Copy link
Owner

Yes I agree they are very complicated :)

There are plans but I don't know when I'll have time. They probably first need the assumed shape array code to be re written to more agnostic about what it's an array of. Before then trying to fold derived types in.

For now your beat bet would be a fixed sized array of derived types, and just size it to be as large as the largest size you need.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants