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
elpa
elpa
Commits
67e68694
Commit
67e68694
authored
May 23, 2017
by
Andreas Marek
Browse files
Get method for C interface
parent
23334f01
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
src/elpa_impl.F90
View file @
67e68694
...
...
@@ -301,6 +301,22 @@ module elpa_impl
end
if
end
function
!c> int elpa_get_integer(elpa_t handle, const char *name, int *error);
function
elpa_get_integer_for_c
(
handle
,
name_p
,
error
)
result
(
value
)
bind
(
C
,
name
=
"elpa_get_integer"
)
type
(
c_ptr
),
intent
(
in
),
value
::
handle
type
(
elpa_impl_t
),
pointer
::
self
type
(
c_ptr
),
intent
(
in
),
value
::
name_p
character
(
len
=
elpa_strlen_c
(
name_p
)),
pointer
::
name
integer
(
kind
=
c_int
)
::
value
integer
(
kind
=
c_int
),
optional
,
intent
(
inout
)
::
error
call
c_f_pointer
(
handle
,
self
)
call
c_f_pointer
(
name_p
,
name
)
value
=
elpa_get_integer
(
self
,
name
,
error
)
end
function
!> \brief function to check whether a key/value pair is set
!> Parameters
!> \param self class(elpa_impl_t) the allocated ELPA object
...
...
@@ -419,6 +435,22 @@ module elpa_impl
end
if
end
function
!c> int elpa_get_double(elpa_t handle, const char *name, int *error);
function
elpa_get_double_for_c
(
handle
,
name_p
,
error
)
result
(
value
)
bind
(
C
,
name
=
"elpa_get_double"
)
type
(
c_ptr
),
intent
(
in
),
value
::
handle
type
(
elpa_impl_t
),
pointer
::
self
type
(
c_ptr
),
intent
(
in
),
value
::
name_p
character
(
len
=
elpa_strlen_c
(
name_p
)),
pointer
::
name
real
(
kind
=
c_double
)
::
value
integer
(
kind
=
c_int
),
optional
,
intent
(
inout
)
::
error
call
c_f_pointer
(
handle
,
self
)
call
c_f_pointer
(
name_p
,
name
)
value
=
elpa_get_double
(
self
,
name
,
error
)
end
function
function
elpa_associate_int
(
self
,
name
)
result
(
value
)
use
iso_c_binding
...
...
test/C/test.c
View file @
67e68694
...
...
@@ -107,7 +107,7 @@ int main(int argc, char** argv) {
elpa_t
handle
;
int
value
;
#ifdef WITH_MPI
MPI_Init
(
&
argc
,
&
argv
);
MPI_Comm_size
(
MPI_COMM_WORLD
,
&
nprocs
);
...
...
@@ -217,6 +217,9 @@ int main(int argc, char** argv) {
assert_elpa_ok
(
error
);
#endif
value
=
elpa_get_integer
(
handle
,
"solver"
,
&
error
);
printf
(
"Solver is set to %d
\n
"
,
value
);
/* Solve EV problem */
elpa_solve
(
handle
,
a
,
ev
,
z
,
&
error
);
assert_elpa_ok
(
error
);
...
...
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