Prev: buy cheap Ambien without prescription, order Ambien cod fedex, prescription Ambien paypal
Next: calling readline(3c) from fortran
From: Richard Maine on 29 Mar 2010 11:55 Enthalpy <epagone(a)email.it> wrote: > I thought the PASS/NOPASS attribute was necessary just when the > CONTAINS statement is present in a derived type definition (Chapman, > "Fortran 95-2003 for scientists and engineers (3rd ed.)"); am I wrong? I don't have a copy of that book to see what they say (I wasn't too fond of earlier of his books), but that is wrong. The PASS attribute applies to procedure type bindings (that's the stuff after CONTAINS in a derived-type definition) and to procedure components. -- Richard Maine | Good judgment comes from experience; email: last name at domain . net | experience comes from bad judgment. domain: summertriangle | -- Mark Twain
From: Enthalpy on 1 Apr 2010 12:46
Many thanks to James and Richard for their valuable answers, I changed my code accordingly. I also committed other corrections to my code, but I'm still not through. Now my troubles are on the unknowns side. I'm trying to use the following derived type INTEGER, PARAMETER :: dp = SELECTED_REAL_KIND(15,100) TYPE :: arr_ptr REAL(dp), POINTER :: p => NULL() END TYPE arr_ptr in the form of allocatable array TYPE(arr_ptr), DIMENSION(:), ALLOCATABLE, SAVE :: xp as an alias for the unknowns to be linked at runtime (according to the specifications of an input file, for example). For now, I just set explicitly the pointers assignment for "test-driver" purposes (after the proper sizing of the aforementioned array) xp(1)%p => lvlv xp(2)%p => ps xp(3)%p => pc xp(4)%p => mu xp(5)%p => Tc The unknown variables were defined as targets (alongside with others) REAL(dp), TARGET :: mp, pmec, a, b, pmi, eta_is_c, eta_is_t, eta_m_t, eta_m_c, Ts, rho, lvlv, ps, pc, mu, Tc The array x stores the input unknowns values from the root-finding algorithm routine. When I have to compute the values returned by the functions containing the equations, I need to assign to the unknowns the input values using the array of pointers as an alias for them. The following statement is the only one I wrote that compiles correctly (with g95) DO i=1, SIZE(x) xp = arr_ptr(x(i)) END DO But unfortunately, at runtime, the pointed variables (lvlv, ps, pc, mu, Tc) are not affected by the assignment statement and retain the old values. How could I select the unknowns at runtime undertaking the selecting process just once in a "set_system" routine at the start of the computations, and then referring to them by an alias? Thank you. Emanuele |