[petsc-users] Back to struct in Fortran to represent field with dof > 1
Christophe Ortiz
christophe.ortiz at ciemat.es
Thu Sep 26 04:41:39 CDT 2013
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20130926/17cfb9e4/attachment.html>
More information about the petsc-users
mailing list