Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Rémy Mozul
FortHon
Commits
f1d74f83
Commit
f1d74f83
authored
Apr 03, 2014
by
Mozul Rémy
Browse files
prepare string link
parent
9d76e237
Changes
4
Hide whitespace changes
Inline
Side-by-side
README
View file @
f1d74f83
Le fichier mod_type.f90 contient
Utilisation :
make
python pytest
mod_type.f90 : description du type bind(c)
type.h : header associé a mod_type.f90
ctest.pxd : equivalent d'un header pour cython
(voir si on peut faire une génération auto)
test.pyx : module p/cython implémentant la classe python
wrappant le contenu du .pxd
pytest.py : le test
ctest.pxd
View file @
f1d74f83
...
...
@@ -3,6 +3,7 @@ cdef extern from 'type.h':
ctypedef
struct
myctype
:
int
i
,
j
double
*
s
char
*
chaine
void
print_type
(
myctype
*
ct
)
...
...
mod_type.f90
View file @
f1d74f83
...
...
@@ -8,6 +8,7 @@ module test_type
type
,
bind
(
c
)
::
myftype
integer
(
c_int
)
::
i
,
j
type
(
c_ptr
)
::
s
type
(
c_ptr
)
::
str
end
type
myftype
contains
...
...
@@ -16,12 +17,15 @@ module test_type
type
(
myftype
)
::
ft
!
real
(
c_double
),
dimension
(:,:),
pointer
::
tab
character
(
len
=
256
,
kind
=
c_char
),
pointer
::
str
call
c_f_pointer
(
fptr
=
tab
,
cptr
=
ft
%
s
,
shape
=
(/
ft
%
j
,
ft
%
i
/))
call
c_f_pointer
(
fptr
=
str
,
cptr
=
ft
%
str
)
print
*
,
ft
%
i
print
*
,
ft
%
j
print
*
,
tab
print
*
,
str
end
subroutine
...
...
type.h
View file @
f1d74f83
...
...
@@ -2,6 +2,7 @@
typedef
struct
{
int
i
,
j
;
double
*
s
;
char
*
chaine
;
}
myctype
;
//void init_type(int n, int i, int j);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment