From: rudra on
I have a f77 code which starts like this:
subroutine lm_a(oidxdn,opnu,opold,oqnu,oqold, &
clabl_1,lmx,w_oidn,w_opp,w_oqnu,w_oqold, &
d_ialpha,d_ifmt3d,d_itrans,d_jbasdn,d_ldn,d_lmaxw, &
d_ltmax,d_mdn,d_mmixat,d_mmixpq,d_nbas,d_nclass,d_ndimin, &
d_ngen,d_nit,d_nitat,d_niter,d_nkdmx,d_nkxyz,d_nl,d_nopts, &
d_norder,d_npts,d_nrxc,d_nrxyz,d_nsp, &
d_as,d_beta,d_dele,d_deltr,d_efermi,d_kap2,d_kfit, &
d_emax,d_emaxc,d_emin,d_eminc,d_eps,d_facvol,d_gamma,d_ommax1,
&
d_ommax2,d_range,d_rmaxes,d_rmaxs,d_rmaxs2,d_rmines,d_rms2, &
d_rmsdel,d_tolef,d_toleto,d_tolews,d_vmtz,d_wc,d_width,switch,
&
asnit)

! use lmto_init
implicit none
! Common blocks:
! --- dynamical memory allocation:
integer wksize,asnit
parameter(wksize=8000000)
integer w(wksize)
common/wkarr/w

problem is how can i transfer the array w to other subroutine?
From: Richard Maine on
rudra <bnrj.rudra(a)gmail.com> wrote:

> I have a f77 code which starts like this:

Doesn't look much like f77 to me. The USE statement caught my eye at
first before I noticed it was commented out. But even without that,
there is the free source form with it's continuation method, which I
didn'gt think most f77-only compilers accepted as an extension. The
exclamation point comments, underscores, long variable names, and
implicit none are also not f77, although they were at least common as
extensions.

> integer wksize,asnit
> parameter(wksize=8000000)
> integer w(wksize)
> common/wkarr/w
>
> problem is how can i transfer the array w to other subroutine?

You are going to need to explain your problem better, at least if I'm to
be of any help. I fail to see anything that is particularly special
about w in terms of "transferring" w as opposed to anything else. I
have trouble imagining that you are actually asking how one passes data
between subroutines in general, though perhaps you are, because I can't
see what else the question would be, so I supose I'll (very) briefly
answer that, though I'll not take the time to write code examples on
such a speculative basis.

You can pass data between subroutines via argument lists or common in
f77. F90 adds modules and host association. Any of those methods could
plausibly apply here; you haven't shown anything that has any particular
impact on any of them. There is also the half&half method of putting a
common block in a module; one most often sees that in code that is in a
transition of communication methods.

The only thing that even vaguely strikes my eye isn't anything that you
actually asked about. It is highly advised, when using common for much
of anything, to put the common and all associated declarations in an
include file. This helps lower the odds of the common accidentally
declared differently in different scopes. (It doesn't eliminate the
possibility, but it lowers the odds). If you have arrays whose size can
vary from run to run (as your work array might plausibly do), the
include file also facilitates making the size change consistently in all
scopes.

--
Richard Maine | Good judgment comes from experience;
email: last name at domain . net | experience comes from bad judgment.
domain: summertriangle | -- Mark Twain
From: glen herrmannsfeldt on
Richard Maine <nospam(a)see.signature> wrote:
> rudra <bnrj.rudra(a)gmail.com> wrote:

>> I have a f77 code which starts like this:

> Doesn't look much like f77 to me.
(snip)

>> integer wksize,asnit
>> parameter(wksize=8000000)
>> integer w(wksize)
>> common/wkarr/w

>> problem is how can i transfer the array w to other subroutine?

> You are going to need to explain your problem better, at least if I'm to
> be of any help. I fail to see anything that is particularly special
> about w in terms of "transferring" w as opposed to anything else.

(snip)

It does, however, considering the comment before the COMMON that
it was doing dynamic memory, look like the Fortran 77 technique
of allocating a large array, and then subdividing it as necessary.
Often that was done through passing part of it as an actual
argument to a subroutine. If so, you should look for code that
seems to pass array elements of w to other subroutines, after
computing the subscripts for those elements. In the called
subroutine, the dummy arguments are arrays, either dimensioned (1)
(often used in Fortran 66 days), or (*). Or arrays of rank
greater than one, with the appropriate variable dimensions.

Another possibility is that w is in common in many routines,
with the appropriate offsets computed and used in each case.

-- glen
From: robin on
"rudra" <bnrj.rudra(a)gmail.com> wrote in message
news:cd8770f7-b4a0-4abe-9c5c-a630943c8721(a)a27g2000prj.googlegroups.com...
|I have a f77 code which starts like this:

This is F90 code, not F77.

| subroutine lm_a(oidxdn,opnu,opold,oqnu,oqold, &
| clabl_1,lmx,w_oidn,w_opp,w_oqnu,w_oqold, &
| d_ialpha,d_ifmt3d,d_itrans,d_jbasdn,d_ldn,d_lmaxw, &
| d_ltmax,d_mdn,d_mmixat,d_mmixpq,d_nbas,d_nclass,d_ndimin, &
| d_ngen,d_nit,d_nitat,d_niter,d_nkdmx,d_nkxyz,d_nl,d_nopts, &
| d_norder,d_npts,d_nrxc,d_nrxyz,d_nsp, &
| d_as,d_beta,d_dele,d_deltr,d_efermi,d_kap2,d_kfit, &
| d_emax,d_emaxc,d_emin,d_eminc,d_eps,d_facvol,d_gamma,d_ommax1,
| &
| d_ommax2,d_range,d_rmaxes,d_rmaxs,d_rmaxs2,d_rmines,d_rms2, &
| d_rmsdel,d_tolef,d_toleto,d_tolews,d_vmtz,d_wc,d_width,switch,
| &
| asnit)
|
| ! use lmto_init
| implicit none
| ! Common blocks:
| ! --- dynamical memory allocation:
| integer wksize,asnit
| parameter(wksize=8000000)
| integer w(wksize)
| common/wkarr/w
|
| problem is how can i transfer the array w to other subroutine?

By including a similar declaration and COMMON statement in the
called subroutine.

Your comment "dynamical memory allocation" is incorrect.
COMMON storage is static storage.