Hi all,

Me again !

I have read in previous posts that it is hard in Fortran to declare
something similar to a typedef struct in C to manage a multicomponent
problem.

Is it still the case ? Has the problem been solved ?

I am asking because my plan is to implement a multicomponent problem (in
1D), with many components that will be organized in arrays of two
dimensions. In C I could define

typedef struct{
PetscScalar U;
PetscScalar V;
PetscScalar A[N][N];
} Field;

and then I could calculate the residual function with

F[i].U = ...
F[i].V = ...
F[i].A[k][n] = ...

which is quite convenient.

If in Fortran it is not possible to use a struct as in C, I am afraid I'll
have to deal with

F(jdof,i) = ...

where I will have only jdof to address U, V and A[ ][ ], which can be
difficult and not very convenient I guess. Before I move all my code to C,
does anyone have an alternative idea to manage this multi(many)component
problem in Fortran ?

Many thanks in advance for your help and suggestion !

Christophe

Reply via email to