Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
29253 Discussions

Passing a two-dimensional table (array of arrays) from VB to Fortran - Help

belmiro
Beginner
507 Views
Dear fellow developers.

We are struggling hard to accomplish the integration between some code part
written in Fortran and part written in VB.

Departing from the following definition of "two-dimensional table" in C#:

======================================

A two-dimensional table is an array in which each element object is itself an
array. This is not like in C, where a single block of memory contains all
elements of multidimensional tables. For example, this line of code represents
a table of two rows, but the first row has three elements, while the second
one has only two:

int[][] table1 = {{11, 12, 13}, {21, 22}};

If you define something like this:

int[][] table = new int[2][3];

you have a table with two rows and three columns, with all elements
initialized to zero. When declaring a table, you can leave the last dimension
empty. For example, the following declaration results in a table of two rows,
but the rows are undefined and remain set to null:

int[][] table = new int[2][];

Before being able to assign values to the individual elements of such a
partially defined table, youll have to declare its rows or assign already
declared monodimensional arrays to them:

int[] anArray = {10, 100};

table[0] = anArray;

table[1] = new int[5];

======================================

We wonder whether you could be kind enough to provide us a working example of
a method, written in Visual Basic, that is able to call a library (.dll)
written in Fortran, passing a two-dimensional table as one of its parameters. We have already looked in Fortran reference documents an examples, and it only deals with bidimensional arrays ( not twodim-table arrays - or array of arrays).

Best Regards,
Pedro Campos
0 Kudos
1 Reply
g_f_thomas
Beginner
507 Views

AFAIKVBand Fortran do not have direct support for arrays of arrays. As you know, C# does in addition tosupporting jagged arrays (rows or columns of different size).Try googling Kronecker or tensor algebra to see if it can be done easily in Fortran. I've only ever seen it done in C.

Gerry

0 Kudos
Reply