Quantcast
Channel: Intel® Software - Intel® Fortran Compiler for Linux* and macOS*
Viewing all articles
Browse latest Browse all 2746

Set kind of user derived type at runtime

$
0
0

I am trying to figure out the correct methodology for setting a user derived type variable at runtime based on some user input.  The following would be a very simply example of two user derived types: One and Two.

type One
   integer :: ivalue=0
end type One

type Two
   integer :: ivalue=0
end type Two

How would I go about setting a variable,x, to a specific user derived type based on user input.  Pseudocode would be something along the lines of

if userinput = 1, then set x to type One

elseif userinput =2, then set x to type Two


Viewing all articles
Browse latest Browse all 2746

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>