- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I get the following error message for a structure constructor of a derived type:
error #8212: Omitted field is not initialized. Field initialization missing: [RR143]
However, RR143 is not an additional field, but amapping. Am I missing something or is this a compiler problem?
Before Iused equivalence to mapan instance of the derived type and the array representationin the same memory. Since this presented serious problems (which are actually resolved in 11.1.051) I tried the UNION..END UNION, which obviously resulted in a different kind of problem. What would be the preferred method anyway, equivalencing or using UNION .. ENDUNION (provided the issue with the structure constructor is resolved)?
The constructor looks like this:
RC143=ST143(' ',(/' ',' ',' '/),0.,0.,0.,0.,0., &
0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0)
and the derived type declaration looks like this:
TYPE ST143
SEQUENCE
UNION
MAP
CHARACTER(4) IDF
CHARACTER(4) NAME(3)
REAL(4) TFL1
REAL(4) TFLX
REAL(4) DTMX
REAL(4) FFL
REAL(4) CPFL
REAL(4) UA
REAL(4) WFH
REAL(4) XT
REAL(4) DUA
REAL(4) TFL2
REAL(4) WCFL
REAL(4) WCS
REAL(4) CPS
REAL(4) XNTU
REAL(4) CAR
REAL(4) EFF
REAL(4) TS2
REAL(4) XLMTD
INTEGER(4) IP2
END MAP
MAP
REAL(4) RR143(23)
END MAP
END UNION
END TYPE
TYPE(ST143) RC143
Walter Kramer
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
TYPE ST143_FIELDS
SEQUENCE
CHARACTER(4) IDF
CHARACTER(4) NAME(3)
REAL(4) TFL1
REAL(4) TFLX
REAL(4) DTMX
REAL(4) FFL
REAL(4) CPFL
REAL(4) UA
REAL(4) WFH
REAL(4) XT
REAL(4) DUA
REAL(4) TFL2
REAL(4) WCFL
REAL(4) WCS
REAL(4) CPS
REAL(4) XNTU
REAL(4) CAR
REAL(4) EFF
REAL(4) TS2
REAL(4) XLMTD
INTEGER(4) IP2
END TYPE ST143_FIELDS
TYPE ST143
UNION
MAP
TYPE(ST143_FIELDS) ::F
END MAP
MAP
REAL(4) RR143(23)
END MAP
END UNION
END TYPE ST143
TYPE(ST143) RC143
RC143%F=ST143_FIELDS(' ',(/' ',' ',' '/),0.,0.,0.,0.,0., &
0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0)
Jim Demspey
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello Jim,
Thanks for the answer. Is this the way the developers have actually intended it or is it aworkaround?
It would mean that I now have to refer to a member of the structure as: RC143%F%FIELDNAME.
In that case I prefer the methodwith EQUIVALENCE.
I have also looked at the possibility to use TRANSFER (which may be feasible under some circumstances), however this results in more memory use and in my opinion to unnecessary copying of data. Moreover, the mold for copying data from the structure to a one dimensional array is fairly straightforward (RR143=TRANSFER(RC143, (/23*0.0/)), however if I want to copy the data back I need the mold based on structure ST143_FIELDS (and I have many of these structures all with different composition), or can I also use the type name "ST143_FIELDS" to represent the mold?
Walter Kramer
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Try a pointer
[cpp]TYPE ST143_FIELDS SEQUENCE CHARACTER(4) IDF CHARACTER(4) NAME(3) REAL(4) TFL1 REAL(4) TFLX REAL(4) DTMX REAL(4) FFL REAL(4) CPFL REAL(4) UA REAL(4) WFH REAL(4) XT REAL(4) DUA REAL(4) TFL2 REAL(4) WCFL REAL(4) WCS REAL(4) CPS REAL(4) XNTU REAL(4) CAR REAL(4) EFF REAL(4) TS2 REAL(4) XLMTD INTEGER(4) IP2 END TYPE ST143_FIELDS TYPE ST143_UNION UNION MAP TYPE(ST143_FIELDS) :: F END MAP MAP REAL(4) RR143(23) END MAP END UNION END TYPE ST143_UNION TYPE(ST143_UNION) RC143_UNION TYPE(ST143_FIELDS), POINTER :: RC143 ...
RC143 => RC143_UNION ! done once
... RC143=ST143_FIELDS(' ',(/' ',' ',' '/),0.,0.,0.,0.,0., & 0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0) ...
RC143%CPS = 12.34
Jim Dempsey
[/cpp]
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks Jim, Steve
The issue is clear to me now,
Walter Kramer

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page