-
Notifications
You must be signed in to change notification settings - Fork 51
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
f90nml fails to read namelist entries for Fortran90 structure variables #110
Comments
No, we don't support anything like this at the moment. I'm not even sure how it would work, though there are options discussed below. It's rejecting your namelist because it thinks you're trying to assign an array to an array element. I think it would also have issues since it would think this is an array of mixed types. I have to think about how to handle this case. We confront certain limitations since the namelist does not carry information about the type of its input. In this case, though, one might be able to infer it since the data is mixed. Alternatively, we could just start supporting arrays of mixed type as valid inputs for an element, indexed or otherwise. To clarify one point: We do support arrays of derived types. But we don't currently support this sort of array initialization across fields. |
BTW I can confirm that f90nml can parse this array-based assignment over fields if You can get out of your current situation if you replace the array initialization with explicit fields. For example, if I read/write your example namelist in GFortran 9, this is the output:
(taking a few liberties with your example, and also explicit removing the f90nml seems to be reading this namelist correctly. But I still agree that your original example is a valid namelist, even if a challenge to parse, and it's worthwhile to try and support it to the best of our ability. |
Would any Fortran compiler's namelist |
I tested @pjoeckel's example in gfortran 9.2 and it worked, and the standard does seem to support this list-style input for derived types (13.11.3.2p2):
I also agree that this is not the usual output, and I can't imagine any compiler producing this style of output. |
f90nml version: 1.1.2
python: 3.6.9 (default, Oct 29 2019, 10:39:36) [GCC]
OS: SuSe Linux 15.0
f90nml fails to read namelists, which contain entries for initialising arrays of types (fortran structures), such as
with the corresponding import.nml
The output of
becomes
I wonder, if this is a bug or a missing feature?
At least it is a valid namelist ...
The text was updated successfully, but these errors were encountered: