- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
extern "C" struct
{
char[32] Recipe_ID;
double Means[];
double Std_Devns[];
double Covariances[][];
long n_Observations;
} MMSPC_mp_t_Recipe;
TYPE t_Recipe
CHARACTER Recipe_ID*32
REAL*8, ALLOCATABLE :: Means( : )
REAL*8, ALLOCATABLE :: Std_Devns( : )
REAL*8, ALLOCATABLE :: Covariances( : ,: )
INTEGER*4 n_Observations
END TYPE t_Recipe
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Alas, it's not a correct translation (although it may appear so at first glance). CVF implementation of ALLOCATABLE component arrays is the same as for POINTER arrays (although the semantic is different) -- 28-byte descriptor for 1-dimension array. See page "Handling arrays and Visual Fortran array descriptors" under Mixed-language chapter of Programmer's Guide.
Thereis even a CVF sample called "DESCRIPT" containing samples with manipulation with array descriptor. Take a look at it.
Jugoslav
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hmmm. This is getting more complicated than I hoped. To be honest, I'm not sure if I'm following the DESCRIPT stuff at all.
It ispopulating the array of POINTERS with the addresses of the elements of farray yes? And populating the array in the 'C' fashion? So you use the pointer array in FORTRAN and the actual array in C?
Bring on FORTRAN CLR compatibility! Please! :smileyvery-happy:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I'm going to have to think about this.I might get my head around it eventually.:smileysad:
Maybe I'll just pass each value individually, which will involve writing lots of functions...hmmm....maybe not...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Sorry for harping on with this, but....
My FORTRAN currently has a module with lots of types containing allocatable arrays of values, and types containingg allocatable arrays of other types.
Even if I have to fiddle with the definitions of 'allocatable' elements etc., I still think it would be possible to access and populate these module values directly from C/C++ and then use the data in FORTRAN.
Am I correct? If so, I'll start fiddling with test code to get it working.
Cheers,
Dan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Jugoslav, thanks for the reply.
With regard to 'who knows what', the sizes of the arrays are stored in the XML file, so I guess the C will 'know' the size first and could 'allocate'. However, since I'll need to store the sizes for use in FORTRAN loops etc., the FORTRAN side will need to 'know' and could do the allocation/deallocation.
I was hoping to have a single call from FORTRAN to C to read the file, then return to FORTRAN to do some maths with thedata store inthe FORTRAN module.I'm essentially in a FORTRAN environment utilizing a bit of C not the other way around - I'd like FORTRAN to retain 'control' so to speak, so I would favour keeping the FORTRAN 'clean' also.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Steve,
Can I ask what has changed in the decriptor layout? My documentation seems consistent with the DESCRIPT example...? Do I have the 'wrong' help file? (I have updated to 6.6C)
Thanks,
Dan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Please note that with Intel Visual Fortran, the descriptor layout will change again in a way incompatible with CVF. An extra longword is added. The new layout is as follows
The components of the current Intel Fortran array descriptor on IA-32 systems are as follows:
-
- The first longword (bytes 0 to 3) contains the base address. The base address plus the offset defines the first memory location (start) of the array.
- The second longword (bytes 4 to 7) contains the size of a single element of the array.
- The third longword (bytes 8 to 11) contains the offset. The offset is added to the base address to define the start of the array.
- The fourth longword (bytes 12 to 15) contains the low-order bit set if the array has been defined (storage allocated). Other bits may also be set by the compiler within this longword, for example, to indicate a contiguous array.
- The fifth longword (bytes 16 to 19) contains the number of dimensions (rank) of the array.
- The sixth longword (bytes 20 to 23) is reserved and should not be explicitly set.
- The remaining longwords (bytes 24 to 103) contain information about each dimension (up to seven). Each dimension is described by three additional longwords:
- The number of elements (extent)
- The distance between the starting address of two successive elements in this dimension, in bytes.
- The lower bound
The format for the descriptor on Itanium-based systems is identical to that on IA-32 systems, except that all fields are 8-bytes long, instead of 4-bytes.
Message Edited by MADsblionel on 12-03-2003 05:46 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page