Skip to content
Snippets Groups Projects
Commit 350522d8 authored by Stephan Schulz's avatar Stephan Schulz
Browse files

change Fortran get_gamma to argument call

parent 96fd363a
Branches
Tags
1 merge request!8Refactor
......@@ -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
......
......@@ -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) {
......
......@@ -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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment