- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi
I'm having problem during compilation process and I don't understand why ...(from my logic!).
I'm including and example and only you need to do ifort /c example.f90.
I have define a type variable (atlist_type) containing a class vector called atom. It is an allocatable vector.
In this module, I have a procedure to print the information about this list of atoms (atlas_type). But the information is highly depending of the type of atom when it be called.
The problem appears when I try to use
select type (A%atom)
type is ....
end select
Why I have a compilation error?
Any suggestion?
Thanks in advance
Javier
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi!
I have resolved the problem!
I had to use associate ....Something as
Select type (pp => A%atom)
....
End Select
Incredible! I don't understand why is not possible use directly A%atom.
Thanks in any case.
Javier
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
.. I don't understand why is not possible use directly A%atom. ..
Refer to Intel Fortran documentation for SELECT TYPE: https://software.intel.com/en-us/fortran-compiler-developer-guide-and-reference-select-type
Note the Fortran standard extends the facility to users to be able to use SELECT TYPE in the context of dynamic (run-time) polymorphism and this block construct provides the selection "based on the dynamic type of a specified expression." A Fortran processor can generally achieve this with named variables in code or with expressions. Toward the second option, Fortran provides the ASSOCIATE construct facility and includes the constraint, "If selector is not a named variable, associate-name => shall appear"
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page