Fortran Can I Use the Lucy Subprogram in Starlink Project for Fortran Routines?

  • Thread starter Thread starter faeriewhisper
  • Start date Start date
  • Tags Tags
    Beginner Fortran
AI Thread Summary
Using the Starlink Project's Lucy subprogram within a Fortran routine poses challenges due to its design. The subroutine is intended to be called with a single status argument, limiting the ability to directly pass input and output data like arrays. The Lucy source code indicates it was not meant for standalone use, suggesting significant modifications would be necessary to adapt it for this purpose. Users are advised to consider these limitations when attempting to integrate Lucy into their Fortran programs.
faeriewhisper
Messages
4
Reaction score
0
Hello!
I'm trying to use a subprogram from the Starlink Project - Lucy in the library KAPPA - that is already installed and compiled. The idea is to be able to call it from my fortran routine.

Something like this:
Code:
PROGRAM ex
 
INTEGER i
REAL in(10),psf(10),out(10)
 
DO i =1,10
  in(i) = rand()
  psf(i) = rand()
ENDDO

lucy in psf out

WRITE(*,*)out

END

Is that possible?
If so, how should I compile the file (using gfortran)?

After downloading and unpacking the Starlink package you write in the terminal:

$ export STARLINK_DIR=$HOME/Astronomy/Software/star-2015A
$ source $STARLINK_DIR/etc/profile

After that you can run the subprograms by typing:
$ kappa
$ lucy

The compiled lucy file can be found here: $HOME/Astronomy/Software/star-2015A/bin/kappa/lucy

The source file lucy.f can be found here: https://github.com/Starlink/starlink/blob/master/applications/kappa/libkappa/lucy.f

Many thanks in advance!
 
Technology news on Phys.org
You would have to use
Fortran:
call lucy (status)
But the subroutine lucy doesn't take in any other argument than that status, so I don't see how you can pass data to and from your own program.

After a quick look at the source code, it doesn't appear that the subroutine was intended to be used on its own. I think it would take quite some work to disentangle it from the main program.
 
Dear Peeps I have posted a few questions about programing on this sectio of the PF forum. I want to ask you veterans how you folks learn program in assembly and about computer architecture for the x86 family. In addition to finish learning C, I am also reading the book From bits to Gates to C and Beyond. In the book, it uses the mini LC3 assembly language. I also have books on assembly programming and computer architecture. The few famous ones i have are Computer Organization and...
I have a quick questions. I am going through a book on C programming on my own. Afterwards, I plan to go through something call data structures and algorithms on my own also in C. I also need to learn C++, Matlab and for personal interest Haskell. For the two topic of data structures and algorithms, I understand there are standard ones across all programming languages. After learning it through C, what would be the biggest issue when trying to implement the same data...
Back
Top