comp.lang.fortran
  Home FAQ Contact Sign in
comp.lang.fortran only
 
Advanced search
May 2008
motuwethfrsasuw
   1234 18
567891011 19
12131415161718 20
19202122232425 21
262728293031  22
2008
 Jan   Feb   Mar   Apr 
 May   Jun   Jul   Aug 
 Sep   Oct   Nov   Dec 
2008 2007 2006  
total
comp.lang.fortran Profile…
RELATED GROUPS

POPULAR GROUPS

more...

 Up
  about recursion function.         


Author: alex
Date: May 23, 2008 07:31

Hi, everybody,

The following two functions FACTORIAL and FACTORIAL2, both of which
can work very well. Is FACTORIAL F90/F95 Standard conforming?

module mod1
contains
function factorial(n)
implicit none
integer :: n, factorial

factorial = n * temp(n-1)
end function factorial

function temp( n )
implicit none
integer n, temp
Show full article (0.84Kb)
3 Comments
  allocatable array component with intent(out)         


Author: Ron Shepard
Date: May 23, 2008 05:26

I have some code with user defined data types that have pointer
arrays. I don't really use them as pointers, they are really just
allocated and used in the normal way. Now, most of my compilers
support the allocatable TR, so I'm switching these to allocatable
arrays in the declarations.

When compiling this code with gfortran, I came across the following
situation involving intent(out) dummy arguments. My code apparently
works with pointer components, but it gives me a bus error when I
use allocatable components. If I change the intent(out) to
intent(inout) in the dummy declaration, then both versions
apparently work.

The following short program demonstrates this. On MacOSX 10.5.2
with gfortran 4.3.0, the code errs after the first call.
With several other compilers (including the ABSOFT 9.2 compiler on
PPC and the intel ifort 10.1 compiler on intel) both calls
apparently succeed.
Show full article (2.02Kb)
8 Comments
  Array Filtering         


Author: Infinity77
Date: May 23, 2008 03:57

Hi All,

I am building some 3D grids for visualization starting from a much
bigger grid. I build these grids by satisfying certain conditions on
x, y, z coordinates of their cells.
Basically, for every cell I have the coordinates of its center point
(centroids), named xCent, yCent and zCent. These values are stored in
arrays (i.e., if I have 10,000 cells, I have 3 vectors xCent, yCent
and zCent with 10,000 values in them). What I'd like to do is to find
the indices for which all these 3 conditions are satisfied:

! Filter cells which do not satisfy Z requirements:
zMin <= zCent <= zMax

! Filter cells which do not satisfy Y requirements:
yMin <= yCent <= yMax

! Filter cells which do not satisfy X requirements:
xMin <= xCent <= xMax

I'd like to end up with a vector of indices which tells me which are
the cells in the original grid that satisfy all 3 conditions. I have
implemented 2 different solutions in Fortran (see below), but they are
both slower than a pure Python-NumPy implementation like this:
Show full article (2.74Kb)
14 Comments