- Marcar como nuevo
- Favorito
- Suscribir
- Silenciar
- Suscribirse a un feed RSS
- Resaltar
- Imprimir
- Informe de contenido inapropiado
I have the following type:
and the following data statements:
Is there an easier/more succinct way of performing this assignment? Can I have a second implied DO to assign to the choices arrays?
Incidently, Steve and FORTRAN documentation peeps, I've notice that a lot of the examples in the documentation deal only with the simple, almost trivial cases and not with anything more complicated (and thus more in need of documenting!) Data assignment to an array of TYPEs for instance.....
TYPE PROP_INFO CHARACTER fl_name*10 ! Fluid name CHARACTER prop_class*10 ! Property calculator class CHARACTER std_item*10 ! Standard property calculator item name INTEGER*4 choices(MAX_CALCS) ! Choices for calculations END TYPE
and the following data statements:
DATA (prop_info(i)%fl_name, i = 1, 4) / 'AIR_CMB', 'AIR_STD', 'H2O', '' / DATA (prop_info(i)%prop_class, i = 1, 4) / 'AIR_C_PROP', 'AIR_S_PROP', 'H2O_PROP', 'MDC_PROP' / DATA (prop_info(i)%std_item, i = 1, 4) / 'AIR_CMB', 'AIR_STD', 'H2O', 'PROPERTY' / DATA (prop_info(i)%choice, i = 1, 4) / STR_CHOICE_2, STR_CHOICE_2, STR_CHOICE_2, STR_CHOICE_2 /
Is there an easier/more succinct way of performing this assignment? Can I have a second implied DO to assign to the choices arrays?
Incidently, Steve and FORTRAN documentation peeps, I've notice that a lot of the examples in the documentation deal only with the simple, almost trivial cases and not with anything more complicated (and thus more in need of documenting!) Data assignment to an array of TYPEs for instance.....
- Etiquetas:
- Intel® Fortran Compiler
Enlace copiado
1 Responder
- Marcar como nuevo
- Favorito
- Suscribir
- Silenciar
- Suscribirse a un feed RSS
- Resaltar
- Imprimir
- Informe de contenido inapropiado
Look up "structure constructor" (and "array constructor") in the documentation. A combination of these is probably what you're looking for. You may also want to use an initialization value on the variable declaration rather than DATA.
Steve
Steve
Responder
Opciones de temas
- Suscribirse a un feed RSS
- Marcar tema como nuevo
- Marcar tema como leído
- Flotar este Tema para el usuario actual
- Favorito
- Suscribir
- Página de impresión sencilla