Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Fortran > Re: Call Array ...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 4 of 11 Topic 8155 of 8774
Post > Topic >>

Re: Call Array valued Fortran function from C

by "FX" <coudert@[EMAIL PROTECTED] > Apr 19, 2008 at 10:23 PM

> But you should ask the gfortran folks if they can round up some
> do***entation about gfortran array descriptors for you.  They are
> different in every compiler.

Yep, that's on the TODO list. Here's the short version (in C syntax).

The descriptor for a given type (named here TYPE) is then:

struct {
  TYPE *data;
  size_t offset;
  ssize_t dtype;
  descriptor_dimension dim[7];
}

where descriptor_dimension is defined as

typedef struct descriptor_dimension
{
  ssize_t stride;
  ssize_t lbound;
  ssize_t ubound;
}
descriptor_dimension;

All fields have the meaning implied by their name, and dtype is such that:

  * (dtype & 0x07) is the rank
  * (dtype >> 6) is the size of an array element

The data component points to the first element in the array.  The offset
field is the position of the element (0, 0, ...). An element is accessed
by data[offset + index0*stride0 + index1*stride1 + ...]


All this information and more can be found in the big comment in the
source at gcc/fortran/trans-types.c, line 949 in the current sources.

-- 
FX
 




 11 Posts in Topic:
Call Array valued Fortran function from C
koentjepoppe@[EMAIL PROTE  2008-04-19 10:33:39 
Re: Call Array valued Fortran function from C
glen herrmannsfeldt <g  2008-04-19 12:11:20 
Re: Call Array valued Fortran function from C
"James Van Buskirk&q  2008-04-19 15:54:39 
Re: Call Array valued Fortran function from C
"FX" <couder  2008-04-19 22:23:33 
Re: Call Array valued Fortran function from C
"James Van Buskirk&q  2008-04-19 17:14:50 
Re: Call Array valued Fortran function from C
"FX" <couder  2008-04-20 10:49:38 
Re: Call Array valued Fortran function from C
"James Van Buskirk&q  2008-04-20 09:26:43 
Re: Call Array valued Fortran function from C
"James Van Buskirk&q  2008-04-20 21:21:14 
Re: Call Array valued Fortran function from C
Sebastian Hanigk <hani  2008-04-20 09:44:34 
Re: Call Array valued Fortran function from C
nf.editor@[EMAIL PROTECTE  2008-04-20 08:56:10 
Re: Call Array valued Fortran function from C
"FX" <couder  2008-04-20 16:11:16 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Sun Oct 12 23:43:08 CDT 2008.