Let's say you have a Fortran 90 module containing lots of variables, functions and subroutines. In your USE statement, which convention do you follow:
explicitly declare which variables/functions/subroutines you're using with the , only : syntax, such as USE [module_name], only : variable1, variable2, ...?
Insert a blanket USE [modul...
Context
The toy Fortran code posted below calls two pointer functions. That is, both functions return a pointer. In fact, they're both array pointers. They both attempt to do the same thing, which is to return an integer array pointer referencing an integer array having three elements, 1, 2, and 3. The first function uses the pointe...
Hello friends,
I am a newbie in Fortran.
Can any1 tell me how to define an integer array in prior.
E.g.
I want to define an array with no.of days in 12 months.
like...
integer,allocatable(12,1) :: days
days=[31,28,31,30,31,30,31,31,30,31,30,31]
Is this syntax correct? If not, please let me know the correct one.
Thanks
Praveen
...
I have an issue in Fortran 90.
I have a user-defined type, and when I call one of the MPI subroutines the data looks to be passed by value (not address, as I thought it should). The output arguments aren't modified. It seems to be specific to the MPI calls. I tried the same thing in a simple test, and I can change the passed in values i...
What is the best way to scatter a Fortran 90 matrix by its rows rather than columns? That is, let's say I have a matrix a(4,50) and I want to MPI_SCATTER it onto two processes where each part is alocal(2,50), where rank 0 has rows 1 and 2, and rank 1 has 3 and 4. Now, in C, this is simple since arrays are row-major, but in Fortran 90 th...
In fortran, what would be the practical way to read:
A 1. 2. 3.
if the first character is an "A", but to not read the
Z
rest if the first character is a "Z" for example.
If I try to read the line at whole,
read(1,*)char, number1, number2, number3
then an error will occur if the numbers are missing. So I need a way to rea...
In some scientific environments, you often cannot go without FORTRAN as most of the developers only know that idiom, and there is lot of legacy code and related experience.
And frankly, there are not many other cross-platform options for high performance programming ( C++ would do the task, but the syntax, zero-starting arrays, and point...
I am using Intel's FORTRAN compiler to compile a numerical library. The test case provided errors out within libc.so.6. When I attach Intel's debugger (IDB) the application runs through successfully. How do I debug a bug where the debugger prevents the bug? Note that the same bug arose with gfortran.
I am working within OpenSUSE 11....
Good practice dictates that subroutine arguments in Fortran should each have a specified intent (i.e. intent(in), intent(out) or intent(inout) as described this question):
subroutine bar (a, b)
real, intent(in) :: a
real, intent(inout) :: b
b = b + a
...
However, not specifying an intent is valid Fortran:
subroutine b...
I've read it's entry in the language reference (Intel's), but I cannot quite grasp what it does. Could someone in layman's terms explain it to me, what it means when it is included in a module ?
...
I do not understand the behavior of the present() intrinsic function with pgf90 7.2. I wrote a 20 line sample program to test this, but the results still make no sense to me. Observe:
subroutine testopt(one,two,three,four,five)
implicit none
integer, intent(in) :: one,two
integer, intent(out) :: three
integer, intent(in), o...
Hi,
I am not an expert in programming but have some experience. It is more than a week that I am trying to read a data file from C into a Fortran program. C program saves a matrix in a bin format data file as follow:
FILE * amatFile;
amatFile = fopen("A.dat","wb");
for(krowa=0;krowa<N2;krowa++){
fwrite(amat[krowa], sizeof(float), ...
i have coding for fortran 77 but i want to converted to fortran 90..where can i donwload the converter software??
...
I have a program which iterates over an array, deterministically making new row-vectors which it then appends to the array.
At each iteration the norm of the vector is taken, to ensure it's not a zero vector. If it is zero, the program stops.
There was a bug whereby the third iteration would cause the vector to go to zero.
In looking ...
The subroutine Rule_Tn in the Fortran library CUBPACK needs a parameter Integrand describing the integrated vector function. It's a
INTERFACE
FUNCTION Integrand(NF,X) RESULT(Value)
USE Precision_Model
INTEGER, INTENT(IN) :: NF
REAL(KIND=STND), DIMENSION(:), INTENT(IN) :: X
REAL(KIND=ST...
Are there any quality control systems for fortran as there are with java?
i used valgrind intensively to ensure i have no memory errors, is there more out there, preferably as freeware?
what are your experiences?
...
I am linking some fortran code (f90) from matlab using mex and I am having matlab freeze occasionally.
In the past, I had freezing happening due to mismatch between data types (say integer*4 vs integer*8).
The code I am linking has many implicitly defined variables, so I am wondering if there is a hidden data type conflict that only o...
Dear,
I am new FORTRAN user.
I want to write the output in stack way without deleting the previous one. Suppose we have three outputs A,B,C for one one one "ELECTRON1". When we run the code for another "ELECTRON2" then all previous outputs are over written. So I want to write in a stack way with one blank line.
Please suggest me how I c...
Hey you guys,
i think i wont find that in any textbook, because answering this takes experience.
i am currently in the stage of testing/validating my code / hunting bugs to get it into production state and any errors would lead to many people suffering e.g. the dark side.
What kind of flags do you set when you compile your program fo...
I've been going through a textbook to learn fortran 90. At the moment I'm learning about dummy arguments and local variables in functions.
One of the exercises is to write a program which asks the user for their first name and last name, then joins the names together and prints the full name. Here's the code:
PROGRAM name_test
IMPL...