fortran

Modeling and Simulation Programming Language

I work with many different models and simulations. Some of the older models and simulations are written in FORTRAN. Some of those models have been converted to C++, but the current trend is to create these models using MATLAB/SIMULINK. From a computer science perspective I have always felt MATLAB/SIMULINK was not a good solution. Wha...

Is the return worth the investment in learning Fortran?

At my current place of employment there are a handful of maybe two to three employees that add and maintain functionality of legacy fortran77 code. When I was first hired I briefly considered trying to become fluent in the ancient language, soon after I changed my mind. This conclusion came from a combination of reasons; initially I ad...

Trouble with file location in excel/fortran dll connection

Platform: WinXP SP2, Intel Fortran 11, Excel 2007 I'm having trouble connecting a dll file with excel. The dll file is relatively simple: subroutine FortranCall (r1, num) !DEC$ ATTRIBUTES DLLEXPORT, STDCALL, REFERENCE, ALIAS:"FortranCall" :: FortranCall integer, intent(in) :: r1 character(10), intent(out) :: num !DEC$ ATTRIBUTES REFER...

Redirecting FORTRAN (called via F2PY) output in Python

Hi, I'm trying to figure out how to redirect output from some FORTRAN code for which I've generated a Python interface by using F2PY. I've tried: from fortran_code import fortran_function stdout_holder = sys.stdout stderr_holder = sys.stderr sys.stdout = file("/dev/null","w") fortran_function() sys.stdout.close() sys.stderr.close() sys...

Pass Pointer to an Array in Haskell to a C Function

I have the following C code: #include <sys/times.h> #include <time.h> float etime_( float *tarray ) { struct tms buf; times( &buf ); tarray[0] = 1.0 * buf.tms_utime / CLOCKS_PER_SEC; tarray[1] = 1.0 * buf.tms_stime / CLOCKS_PER_SEC; return tarray[0] + tarray[1]; } Trying to port this Fortran code to Haskell: ...

BLAS subroutines dgemm, dgemv and ddot doesn't work with scalars?

Hi, I have a Fortran subroutine which uses BLAS' subroutines dgemm, dgemv and ddot, which calculate matrix * matrix, matrix * vector and vector * vector. I have m * m matrices and m * 1 vectors. In some cases m=1. It seems that those subroutines doesn't work well in those cases. They doesn't give errors, but there seems to be some numer...

BLAS daxpy and dcopy when inc=1, are they any faster than just using a(:,t) = b(:,t)?

Well the title says it, I'm doing following kind of operations in Fortran: a(:,t) = b(:,t) c(:,t) = x(i,t)*d(:,t) Is there any benefits of using daxpy and dcopy subroutines from BLAS in this case where inc=1? ...

What is the explicit difference between the fortran intents (in,out,inout)?

Hey. After searching for a while in books, here on stackoverflow and on the general web, I have found that it is difficult to find a straightforward explanation to the real differences between the fortran argument intents. The way I have understood it, is this: `intent(in)` -- The actual argument is copied to the dummy argument at ent...

Are SUBROUTINE variable allocated when calling an ENTRY before calling the SUBROUTINE

I have code that calls an ENTRY in a SUBROUTINE before the SUBROUTINE. Are the variables allocated? SUBROUTINE foo character*5 A,B,C DIMENSION IA(50),IB(50) print* A,B,C RETURN ENTRY bar DO 50 I=1,50 TOTAL = TOTAL + IA(I) 50 CONTINUE print* TOTAL RETURN END So if I CALL bar before foo is IA allocated? ...

Revisited:Stack Overflow in Fortran program

I am getting stack overflow when executing the following code in Compac Fortran. Specially for the line: DIMENSION IZ(NX,NY),VX(NX-1,NY-1),VY(NX-1,NY-1),VZ(NX-1,NY-1) What I am doing is to read the NX,NY,DX,DY from a parameter file. Any suggestions? PARAMETER(NGMAX=30000) INTEGER NX,NY,DX,DY OPEN(6,FILE='MGSTAO...

How do you save a file with the .f90 extension of fortran in Windows Vista?

I typed the source code in WordPad and saved it as addition.f90, but, unfortunately, the only options Windows provides are text files, rtf's, and so forth. I am using the G95 compiler for Windows. ...

Generate Fortran 77 parser from a yacc grammar using Happy (Haskell)

I have stumbled upon the following F77 yacc grammar: http://yaxx.cvs.sourceforge.net/viewvc/yaxx/yaxx/fortran/fortran.y?revision=1.3&amp;view=markup. How can I make a Fortran 77 parser out of this file using Happy? Why is there some C?/C++? code in that .y file? UPDATE: Thank you for your replies! I've been playing with two fresh app...

Does an assignment of a real to a variable starting with I convert to integer?

Does an assignment of a real to a variable starting with I convert to integer? real vx; vx = 2.59808 ix = vx is ix == 2? ...

I would like to know what the following FORTRAN 77 code does.

In a .f file there is code that does this: real Bob, avar ... avar = Bob( 8.3 ) ... Bob appears to be a function but it is declared at the beginning of the file as a real. Then there is a .d file that has a reference to Bob. Also I know avar holds a value that appears is interpolated, The problem is the interpolation is not always r...

Automated Testing of Binaries from SVN on HPC

I would like to setup some automated testing of test cases upon Fortran binaries within an SVN Repository, on demand, or with a Cron job. To complicate the issue slightly, the test cases would be run on a computational cluster, so that each test case would need to generate a PBS script. (Linux Environment) There are a lot of web testin...

Type Declarations in Fortran

I suppose the type of Y below is REAL. SUBROUTINE F(X, Y) C IMPLICIT NONE REAL :: X, Y C REAL :: A, B C REAL, PARAMETER :: C = 3.14E0 C X = Y + 2 * SIN(Y) END But what is it's type here? SUBROUTINE F(X, Y) C IMPLICIT NONE REAL X, Y C REAL :: A, B C REA...

Fortran Compiler Terminology: Dummy Variables and Attributes

Can someone explain to me what sort of an abstraction in the parser / compiler a dummy variable or attribute corresponds to? PURE SUBROUTINE F(X, Y) IMPLICIT NONE REAL, INTENT(INOUT) :: X, Y, C C REAL :: A, B C REAL, SAVE :: C = 3.14E0 PARAMETER (C = 3.14E0, X = 32, Y = X) X = Y + 2 * ...

How to use Fortran compilers to parse-check or pretty print source files?

Is there a way to tell ifort or gfortran to just try to parse a source file (no include following, no compilation, no linking, etc) to tell us whether they find the syntax of the file acceptable / valid for a given Fortran version (77, 90, 95, ...) or at least valid at all? I'm working on a piece of software that will parse and analyze ...

Linking errors from C language in fortran lib.

Hi, I am porting the application with old fortran compiler and old visual studio(VC5) to new fortran compiler 11 and visual studio 2005. Application contains both 'C' and fortran code. I am compiling the fortran code and creating library called server_lib.lib(library is createing with some warnings) and linking to the 'C' code. while l...

linking errors in C language through fortran code

Dupe of http://stackoverflow.com/questions/1077874/linking-errors-from-c-language-in-fortran-lib Hi, I have below code in fortran file called server.for INTEGER iErrPipe !error code for pipe i/o INTEGER clientIndex !index into client list CHARACTER*136 Buffer(17) !buffer for pipe i/o CHARACTER dBuffer(2313) !bu...