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 

Common block variables - include files

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



Joined: 28 May 2010
Posts: 4

PostPosted: Fri Jun 04, 2010 5:13 pm    Post subject: Common block variables - include files Reply with quote

Hi,

I had so much success with solving my last problem in this forum that I'll try again. I have an existing fortran program that contains a lot of 'include' files in which common block variables are declared in the following way:


common /stpdat/ytran(2,MAXSOIL,MAXPROD,73,MAXDPTHS),
- yevap(2,MAXSOIL,MAXPROD,73,MAXDPTHS),
- yswc(2,MAXSOIL,MAXPROD,73,MAXDPTHS),
- germ(2,MAXSOIL,MAXPROD,366)

real ytran,yevap,yswc

integer germ

When I try to compile this in silverfrost it gives me the error message:

germ is NOT an array etc.

Is this way of declaring variables not acceptable in Silverfrost? If it is acceptable, then it may also have something to do with how I include the variable files in the code:

I'm using the command line:
include file='variables.inc'

Related to this: I also got a lot of error messages saying that there is a problem with the 'statement order': I generally include my variables.inc file at the very beginning of the programme/ subroutine because I need some of the variables in there to declare my arrays in the subroutines.

Any suggestions?

Thanks

Tamara
Back to top
View user's profile Send private message
JohnCampbell



Joined: 16 Feb 2006
Posts: 2554
Location: Sydney

PostPosted: Sat Jun 05, 2010 3:08 am    Post subject: Reply with quote

I am not sure about your questions.

The line " include file='variables.inc' " includes the code in that file into your program file. It should not be on the command line. It should be in every subroutine or function that used these variables, as it merely includes the code lines. It does not work like CONTAINS in a MODULE.

Make sure you are not mixing free format and fixed format fortran code. These interpret continuation selection differently. I now only use free-format.

"germ(2,MAXSOIL,MAXPROD,366)" requires the integer parameters MAXSOIL and MAXPROD to be defined earlier in the routine or include file.

I hope these comments help.
Back to top
View user's profile Send private message
Wilfried Linder



Joined: 14 Nov 2007
Posts: 314
Location: Düsseldorf, Germany

PostPosted: Sat Jun 05, 2010 6:43 am    Post subject: Reply with quote

Include files, modules and common blocks can be combined in various ways. For instance, common blocks can be used within include files. Example, file "files.inc" (used below):

Code:
      external       search_f
      integer*4      x_nr,mzl
      character*3    x_ext(10)
      character*120  xfile(10)

      parameter    (mzl=100000)

      common  /search_dat/ xfile,x_ext,x_nr


Within the programme, subroutines and/or functions then the sequence is:

Code:
c     name
      INTEGER FUNCTION RAS_I()

c     module(s)
      USE M_FREEIMA

      IMPLICIT NONE
      INCLUDE <WINDOWS.INS>

c     include file(s)
      include        'c:\lisa_g\files.inc'

c     declarations
      character*1    buffer1(mzl),buffer2(mzl),buffer3(mzl)

      integer*2,allocatable::BUFFER8(:)

      integer*4      iii(8)
      real*8         xmin,xmax,ymin,ymax,zmin,zmax
      logical*2      ll
      character*120  afile(1000)

c     common block(s)
      common  /tr_par/   ell,pi,rad,rho,ell_a,ell_b,ell_e,ell_f,zbr



Regards, Wilfried
Back to top
View user's profile Send private message
DanRRight



Joined: 10 Mar 2008
Posts: 2816
Location: South Pole, Antarctica

PostPosted: Mon Jun 07, 2010 9:10 pm    Post subject: Reply with quote

Just post your code here or somewhere. Sure, people, both users and developers, are very helpful in this forum. It is much easier and extremely more efficient to demonstrate to the novice compiler/computer logics (decently, pretty twisted from human one) and other things after he/she tried and failed. Most probably your problem is just a millisecond for most of pros here, so they will be happy to get one more new happy fan of this great compiler.

( I can estimate Steve Lionel, one of developers of Intel Visual Fortran who always takes his time to help literally everyone who asks IVF related questions on the forums or emails, converted tens of thousand people into loyal IVF users just using his generosity and personal charm Smile . Aside from that, that's tens of millions of dollars of revenue for the company. And the more users - the less bugs.)
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