Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7841367
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T16:05:07+00:00 2026-06-02T16:05:07+00:00

I’m writing a linked list structure in Fortran2003. The nodes in this linked list

  • 0

I’m writing a linked list structure in Fortran2003. The nodes in this linked list come in two varieties that alternate. The list represents a topological ring of edges, each edge is bounded by two vertices, and each vertex connects to two edges.
These structures are declared as an abstract NODE_T type, and implemented by two subclasses, VN_T and EN_T. A VN_T points to two EN_Ts, and vice versa.
Since the list alternates between types, the pointers are stored in the subclasses.
My problem is with adding type bound functions (methods?) to VN_T and EN_T that are called NEXT() and PREV(), and that do the right thing via polymorphism. VN_T%NEXT() should skip on two steps, and get the next VN_T (that is separated from the starting one by an EN_T).

My type/class definitions are as follows:

TYPE, ABSTRACT :: NODE_T
  INTEGER :: IENT
  INTEGER :: ISIDE
  INTEGER :: ISUBTYPE
  INTEGER :: IPAD
CONTAINS
  PROCEDURE(NEXTA), DEFERRED :: NEXT
  PROCEDURE(PREVA), DEFERRED :: PREV
  END TYPE NODE_T

ABSTRACT INTERFACE
FUNCTION NEXTA(PENT)
IMPORT NODE_T
CLASS(NODE_T), POINTER :: NEXTA
CLASS(NODE_T) :: PENT
END FUNCTION

FUNCTION PREVA(PENT)
IMPORT NODE_T
CLASS(NODE_T), POINTER :: PREVA
CLASS(NODE_T) :: PENT
END FUNCTION
END INTERFACE

  TYPE, EXTENDS(NODE_T) :: VN_T
     DOUBLE PRECISION DT
     CLASS(EN_T), POINTER :: N
     CLASS(EN_T), POINTER :: P
     CONTAINS
      PROCEDURE :: NEXT => NEXTV
      PROCEDURE :: PREV => PREVV
  END TYPE

  TYPE, EXTENDS(NODE_T) :: EN_T
     CLASS(VN_T), POINTER :: N
     CLASS(VN_T), POINTER :: P
     CONTAINS
      PROCEDURE :: NEXT => NEXTE
      PROCEDURE :: PREV => PREVE
  END TYPE

The implementations of the next/prev routines are all much the same, the four combinations of next/prev and EN/VN:

FUNCTION NEXTE(PENT)
CLASS(NODE_T), POINTER :: NEXTE
CLASS(EN_T) PENT
NEXTE => PENT%N%N
END FUNCTION

When I call these functions:

CLASS(NODE_T), POINTER :: NODE1, NODE2
NODE2 => NODE1%NEXT()

Then my compiler (Intel FORTRAN XE Composer 2011, i.e. v12.0) complains with the message

error #8314: If the rightmost part-name is of abstract type, data-ref shall be polymorphic   [NEXT]
            NODE2 => NODE1%NEXT()
---------------------------^

Which based on this this documentation seems to indicate that it is trying to call the procdure NEXT on the base class rather than selecting one of the subclass implementations (which it should be able to do based on the concrete type of NODE1 which is on the right hand side, right?).

I’m new at the OOP features of F2003, so I made a mockup of this pattern in JAVA which I got working to my satisfaction. Can anyone shed light on whether this is either a) a difference in the OOP behaviour of F2003, 2) a compiler bug or 3) just me being braindead…

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T16:05:08+00:00Added an answer on June 2, 2026 at 4:05 pm

    You may need to update your compiler. As discussed in this thread

    http://software.intel.com/en-us/forums/showthread.php?t=78855
    

    the Fortran standard originally disallowed calling type-bound procedures of abstract types directly, which you are trying to do. However, the standard was changed and it should have made it into Intel Fortran by now.

    An alternative is to modify the base class as:

    TYPE :: NODE_T
      INTEGER :: IENT
      INTEGER :: ISIDE
      INTEGER :: ISUBTYPE
      INTEGER :: IPAD
    CONTAINS
      PROCEDURE :: NEXT
      PROCEDURE :: PREV
      END TYPE NODE_T
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
For some reason, after submitting a string like this Jack’s Spindle from a text
this is what i have right now Drawing an RSS feed into the php,
I've got a string that has curly quotes in it. I'd like to replace
I have this code to decode numeric html entities to the UTF8 equivalent character.
I have a French site that I want to parse, but am running into
I am doing a simple coin flipping experiment for class that involves flipping a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.