diff --git a/README_new.md b/README_new.md index 6cfd91a7f00276fbce735331e4e13f50dbba20a8..92afa7fd847394fbe19e4ba4119ad9a89d0b1c52 100644 --- a/README_new.md +++ b/README_new.md @@ -201,7 +201,7 @@ and then retrieve the new vertices using or new neighbors with - void ALL::ALL<T,W>::getNeighbors ( std::vector<in> &neighbors ) + std::vector<int> &ALL::ALL<T,W>::getNeighbors () ### Special considerations for the Fortran interface The Fortran interface exists in two versions. Either in the form of @@ -227,6 +227,18 @@ and previous interfaces. In previous interfaces all MPI types are the communicator used in the user's application, build the library with enabled Fortran 2008 features and this communicator type is expected. +Retrieving information from the balancer is also different, since most +getter return (a reference to) an object itself. The Fortran subroutines +set the values of its arguments. As an example + + int work = all.getWork(); + +becomes + + integer(c_int) :: work + call ALL_get_work(work) !or + !call all%get_work(work) + ### Details of the balancing methods #### Tensor based diff --git a/src/ALL_fortran.cpp b/src/ALL_fortran.cpp index 38c2d02f1743e3050e7bb03e0b7c407303a80799..da1575205c9f82fd967953ae6a615cc198d3b030 100644 --- a/src/ALL_fortran.cpp +++ b/src/ALL_fortran.cpp @@ -173,7 +173,7 @@ void all_balance_c(ALL_t *all_obj) { ALL_catch } -double all_get_gamma_c(ALL_t *all_obj) { return all_obj->getGamma(); } +double all_get_gamma_c(ALL_t *all_obj, double *gamma) { *gamma = all_obj->getGamma(); } // wrapper to get number of new vertices void all_get_number_of_vertices_c(ALL_t *all_obj, int *n_vertices) { diff --git a/src/ALL_module.F90 b/src/ALL_module.F90 index 3758ee5e7c3fe5e6d02c45845ec9629942798de8..94f7eb84968368737821b206bc6481a9f5833429 100644 --- a/src/ALL_module.F90 +++ b/src/ALL_module.F90 @@ -138,11 +138,11 @@ module ALL_module use iso_c_binding type(c_ptr), value :: obj end subroutine - function all_get_gamma_c(obj) result(gamma) bind(C) + subroutine all_get_gamma_c(obj, gamma) bind(C) use iso_c_binding type(c_ptr), value :: obj real(c_double) :: gamma - end function + end subroutine subroutine all_get_number_of_vertices_c(obj, n) bind(C) use iso_c_binding type(c_ptr), value :: obj @@ -376,11 +376,11 @@ contains call all_balance_c(this%object) end subroutine !> Retrieve currently set gamma value of balancer - function ALL_get_gamma(this) result(gamma) + subroutine ALL_get_gamma(this, gamma) class(ALL_t), intent(in) :: this - real(c_double) :: gamma - gamma = all_get_gamma_c(this%object) - end function + real(c_double), intent(out) :: gamma + call all_get_gamma_c(this%object, gamma) + end subroutine !> Retrieve number of vertices for current vertices subroutine ALL_get_number_of_vertices(this, n) class(ALL_t), intent(in) :: this