Quantcast
Channel: Intel® Fortran Compiler
Viewing all articles
Browse latest Browse all 3270

Struggles with Fortran Structures...

$
0
0

All,

I'm currently having fun attempting to translate the 'GPC General Polygon Clipper library' from C to Fortran. Also, in the process, I'm converting from the abstract Pointer-style of memory/data operations to the more understandable (IMO) Allocatable array/Counter style of memory/data operations. it is just easier for me to understand & follow the flow...especially for future support.

Anyway, came across a section where a location in a data structure is trying to be assigned a value & IVF is erroring out. Here is the module & a snippet of code showing the faulty bit...

MODULE POLYGON_TEST
     
  INTEGER :: FALSE=0
  INTEGER :: TRUE=1

  INTEGER :: LEFT    =0
  INTEGER :: RIGHT    =1

  INTEGER :: ABOVE    =0
  INTEGER :: BELOW    =1

  TYPE :: bundle_state                                !    /* Edge bundle state                 */
    INTEGER :: UNBUNDLED=0                            !    /* Isolated edge not within a bundle */
    INTEGER :: BUNDLE_HEAD=1                        !    /* Bundle head node                  */
    INTEGER :: BUNDLE_TAIL=2                        !    /* Passive bundle tail node          */
  END TYPE

  TYPE :: V_SHAPE !*** gpc only                        !    /* Internal vertex list datatype     */
    REAL(8) :: x                                    !    /* X coordinate component            */
    REAL(8) :: y                                    !    /* Y coordinate component            */
    INTEGER :: next                                 !    /* Pointer to next vertex in list    */
  END TYPE
 
  TYPE :: P_SHAPE !*** gpc only                        !    /* Internal contour / tristrip type  */
    INTEGER :: active                                !    /* Active flag / vertex count        */
    INTEGER :: hole                                    !    /* Hole / external contour flag      */
    TYPE (V_SHAPE) :: v(0:1)                        !    /* Left and right vertex list ptrs   */
    INTEGER :: next                                  !    /* Pointer to next polygon contour   */
    INTEGER :: proxy                                 !    /* Pointer to actual structure used  */
  END TYPE

  TYPE :: EDGE_SHAPE !*** gpc only
    TYPE (POINT) :: vertex                            !    /* Piggy-backed contour vertex data  */
    TYPE (POINT) :: bot                                !    /* Edge lower (x, y) coordinate      */
    INTEGER :: Itype                                !    /* Clip / subject edge flag          */
    INTEGER :: bundle(0:1,0:1)                        !    /* Bundle edge flags                 */
    INTEGER :: bside(0:1)                            !    /* Bundle left / right indicators    */
    TYPE (bundle_state) :: bstate(0:1)                !    /* Edge bundle state                 */
    TYPE (P_SHAPE) :: outp(0:1)                        !    /* Output polygon / tristrip pointer */
  END TYPE

END MODULE

program POLYGONTEST
!
USE POLYGON_TEST

! - - - local declarations - - -
  TYPE (EDGE_SHAPE) :: e(0:100)
  TYPE (bundle_state) :: BS

   e(0)%bstate(BELOW) = BS%UNBUNDLED    !<<<error #6303:

   DO i = 1,10
     e(i)%outp(ABOVE) = 0                !<<<error #6303:
     e(i)%outp(BELOW) = 0                !<<<error #6303:

        *
        *
        *
    < snip rest>

 

POLYGON_TEST.f90(72): error #6303: The assignment operation or the binary expression operation is invalid for the data types of the two operands.   [0]

What is the way to get those specific type members assigned a value to please the compiler?

 

Thanks in advance,

Jeff


Viewing all articles
Browse latest Browse all 3270

Trending Articles



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