replica nfl jerseysreplica nfl jerseyssoccer jerseyreplica nfl jerseys forums.silverfrost.com :: View topic - Understanding a FORTRAN code snippet
forums.silverfrost.com Forum Index forums.silverfrost.com
Welcome to the Silverfrost forums
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Understanding a FORTRAN code snippet

 
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> General
View previous topic :: View next topic  
Author Message
christyleomin



Joined: 08 Apr 2011
Posts: 155

PostPosted: Wed Apr 24, 2013 5:42 pm    Post subject: Understanding a FORTRAN code snippet Reply with quote

Hi,

I need some help in understanding this bit of FORTRAN code which is written by soemone else.

we have:

Code:
data abc /1.0d0,0.5d0,0.5d0,0.375d0,0.375d0,0.313d0,0.313d0,0.273d0,0.273d0,1.0d0,0.6366197d0,0.5d0,0.4244131d0,0.375d0,0.3395305d0,0.3125d0,0.2910261d0,0.2734375d0/
data pol1 /1.00095d0,-.045316d0,.614739d0,-.968351d0,.700536d0/
data pol2 /1.00084d0,-.040091d0,.689775d0,-1.20273d0,1.42963d0
data pol3 /1.12d0,-0.23d0,10.6d0,-21.7d0,30.4d0/


Well, the above bit I undestand-no problem.


Next,

Code:
I calculate a varioable called 'efg' and 'hij' and 'a' then


Code:
efg=efg*poly(5,pol3,hij)*dsqrt(3.1415926d0*a)


I do not follow what 'poly' indicates above??

My code compiles and runs as expected, but I need to know what is 'poly'?

Can anyone please help?

Christy
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


Joined: 21 Feb 2005
Posts: 8210
Location: Salford, UK

PostPosted: Wed Apr 24, 2013 6:50 pm    Post subject: Reply with quote

poly is the name of a function that your program is calling.

It might be defined somewhere else in your program or it might be defined in a library that your program is linked to.

To my knowledge it is not the name of a standard Fortran 95 function.
Back to top
View user's profile Send private message AIM Address
LitusSaxonicum



Joined: 23 Aug 2005
Posts: 2402
Location: Yateley, Hants, UK

PostPosted: Wed Apr 24, 2013 9:41 pm    Post subject: Reply with quote

Christy,

Search through your code for 'FUNCTION' to see if you have a function called POLY. It is best if your editor is case-insensitive, because it may be 'function' or 'Function' etc..

If you can't find it, then there are two other possibilities.

(1) the function is in an external library, or
(2) it is defined in a STATEMENT FUNCTION.

Statement functions appear before any executable code in a subroutine, and have a scope local to that routine. So, if POLY is a statement function, it should appear AFTER the DATA statements but BEFORE an executable statement that uses it. If it is a statement function, it will take the form of a statement where

POLY( .... ) =

appears on the lefthand side of the assignment. The strength of the statement function is that it is compact - the weakness is that lots of people will miss it when reading the code.

Modern Fortran versions have a replacement system for statement functions.

Eddie
Back to top
View user's profile Send private message
christyleomin



Joined: 08 Apr 2011
Posts: 155

PostPosted: Fri Apr 26, 2013 9:18 am    Post subject: Reply with quote

Hi LitusSaxonicum and Paul,

Thank you very much.

Yes-it was a function. Thanks again

Christy
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> General All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group