- Als neu kennzeichnen
- Lesezeichen
- Abonnieren
- Stummschalten
- RSS-Feed abonnieren
- Kennzeichnen
- Anstößigen Inhalt melden
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.....
Link kopiert
1 Antworten
- Als neu kennzeichnen
- Lesezeichen
- Abonnieren
- Stummschalten
- RSS-Feed abonnieren
- Kennzeichnen
- Anstößigen Inhalt melden
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
Antworten
Themen-Optionen
- RSS-Feed abonnieren
- Thema als neu kennzeichnen
- Thema als gelesen kennzeichnen
- Diesen Thema für aktuellen Benutzer floaten
- Lesezeichen
- Abonnieren
- Drucker-Anzeigeseite