Commit 67e68694 authored by Andreas Marek's avatar Andreas Marek

Get method for C interface

parent 23334f01
......@@ -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
......
......@@ -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);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment