fortran90 Questions
6
Solved
I have the following code:
program main
character (len=15) :: abc = "te st tex t"
print *, trim(abc)
end program main
Which outputs:
te st tex t
I excepted all the whitespace to be remo...
3
Solved
I am trying to define a array of arrays.
I have defined:
integer,dimension(2,2):: &
x=reshape(source= (/0,1,1,0/), shape=(/2,2/)), &
y=reshape(source= (/1,0,0,1/), shape=(/2,2/)), &...
4
Solved
My program is running though 3D array, labelling 'clusters' that it finds and then doing some checks to see if any neighbouring clusters have a label higher than the current cluster. There's a seco...
Windbound asked 5/12, 2011 at 11:11
5
Solved
I am writing some simple output in fortran, but I want whitespace delimiters. If use the following statement, however:
format(A20,ES18.8,A12,ES18.8)
I get output like this:
p001t0000 3.49141273...
4
Solved
I am wanting to mask a Fortran array. Here's the way I am currently doing it...
where (my_array <=15.0)
mask_array = 1
elsewhere
mask_array = 0
end where
So then I get my masked array with:...
7
I have seen /* block comment */ for block commenting in C++. I know I can do line commenting by using ! or c, but is there any option for block commenting in Fortran?
2
Solved
In Fortran, is it possible to define a function which returns multiple values like below?
[a, b] = myfunc(x, y)
4
Solved
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)
r...
2
Solved
Define an array in Fortran:
real, dimension(a,b) :: matrix
How do I obtain a and b given matrix?
3
Solved
I would like to program some procedure that will work with different types. I am planning to use the "include" method used in flibs described here and here. I give here a simple exemple.
! ------...
Kincardine asked 5/6, 2014 at 15:46
3
Is there an intrinsic in Fortran that generates an array containing a sequence of numbers from a to b, similar to python's range()
>>> range(1,5)
[1, 2, 3, 4]
>>> range(6,10)
[6...
2
Solved
I need to use dynamical arrays in Fortran 90 for cases when I can't predict exact size of array initially. So I wrote a code, which should expand allocatable array each time new element is added to...
Doralia asked 20/1, 2015 at 14:59
2
Solved
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 ...
Shabby asked 25/6, 2010 at 22:56
3
Solved
Is there possibility to use indexing directly on a function's return value? Something like this:
readStr()(2:5)
where readStr() is a function which returns a character string or an array. In many ...
Dominican asked 27/2, 2015 at 10:28
1
Solved
I understand that some languages combine elements for many different paradigms in programming. I'm told that Fortran is an example of a Functional language, however I'm just a little confused as to...
Fluidize asked 27/1, 2020 at 0:32
2
Solved
I am trying to use trim/adjustl for the following code. It seems that I'm getting either X_eq_ 10.0.dat or X_eq_10.0 .dat as the output file's name where I'm expecting it to be X_eq_10.0.dat (no bl...
5
Solved
How do you format a string to have constant width and be left-justified? There is the Aw formatter, where w denotes desired width of character output, but it prepends the spaces if w > len(chara...
Wellmeaning asked 11/12, 2017 at 21:41
4
I have developed a Fortran code which has the following characteristics:
Global variables
13 Modules with multiple subroutines
Independent subroutines
Using Intel MKL library for LAPACK libraries...
2
Solved
I can call compile this fortran code 'test.f90'
subroutine test(g,o)
double precision, intent(in):: g
double precision, intent(out):: o
o=g*g
end subroutine
with
gfortran -shared -fPIC test.f90...
2
I know that IACHAR(s) returns the code for the ASCII character in the first character position of the string s, but I need to convert the entire string to an integer. I also have a few number of st...
3
Solved
Experience:
fortran for about 3 months
python - intermediate : never used the ctypes module in python before this
I was looking for a way to use the fortran code for my doctoral work in python - s...
1
Solved
Compiling with gfortran --version == GNU Fortran (Homebrew GCC 8.2.0) 8.2.0
When I write the following test code I get the functions MOD and MODULO giving the same results. However, as I understan...
2
Solved
I'm trying to get a fortran 90 application to open a fifo and write formatted data to it. I've stripped this down to a minimal example. Let foo.f90 be the following program:
program foo
open(1,fi...
Novation asked 2/8, 2012 at 15:11
2
Solved
Believe it or not, that title is about as short as I could make it and still describe the problem I'm having!
So here's the scenario: I'm calling a Fortran DLL from VBA, and the DLL uses user-defin...
2
Solved
The method for setting random seeds using the Fortran 90 subroutine random_seed is quite straightforward.
call random_seed( put=seed )
But I can't find any information about guidelines for setti...
Estep asked 17/8, 2018 at 10:46
1 Next >
© 2022 - 2025 — McMap. All rights reserved.