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

add multi dimensional setWork in Fortran interface (#18)

parent 98754cd3
Branches
Tags
1 merge request!8Refactor
......@@ -112,6 +112,14 @@ void all_set_work_c(ALL::ALL<double, double> *all_obj, double work) {
ALL_catch
}
// set multidimensional work
void all_set_work_multi_c(ALL::ALL<double, double> *all_obj, double *work, int dim) {
ALL_try
std::vector<double> t_work(work, work+dim);
all_obj->setWork(t_work);
ALL_catch
}
// wrapper to set the vertices (using an array of double values and dimension)
void all_set_vertices_c(ALL::ALL<double, double> *all_obj, const int n,
const int dim, const double *vertices) {
......
......@@ -101,6 +101,12 @@ module ALL_module
type(c_ptr), value :: obj
real(c_double), value :: work
end subroutine
subroutine all_set_work_multi_c(obj, work, dim) bind(C)
use iso_c_binding
type(c_ptr), value :: obj
integer(c_int), value :: dim
real(c_double), dimension(dim) :: work
end subroutine
subroutine all_set_vertices_c(obj, n, dim, vertices) bind(C)
use iso_c_binding
type(c_ptr), value :: obj
......@@ -178,6 +184,7 @@ module ALL_module
procedure :: set_proc_tag => ALL_set_proc_tag
procedure :: set_min_domain_size => ALL_set_min_domain_size
procedure :: set_work => ALL_set_work
procedure :: set_work_multi => ALL_set_work_multi
procedure :: set_vertices => ALL_set_vertices
#ifdef ALL_USE_F08
procedure :: set_communicator => ALL_set_communicator_f08
......@@ -203,6 +210,7 @@ module ALL_module
public :: ALL_set_proc_tag
public :: ALL_set_min_domain_size
public :: ALL_set_work
public :: ALL_set_work_multi
public :: ALL_set_vertices
public :: ALL_set_communicator
public :: ALL_setup
......@@ -270,6 +278,18 @@ contains
real(c_double), intent(in) :: work !< work of this domain
call all_set_work_c(this%object, work)
end subroutine
!> Set multi dimensional work of this process
subroutine ALL_set_work_multi(this, work)
class(ALL_t), intent(in) :: this
real(c_double), dimension(:), intent(in) :: work !< multi dimensional work of this domain
#ifndef NDEBUG
if(size(work) /= this%dim) then
write(error_unit, '(a)') "ALL_set_work_multi: Wrong dimension for work"
stop
endif
#endif
call all_set_work_multi_c(this%object, work, size(work))
end subroutine
!> Set new vertices
!!
!! @todo write interface for single rank array of vertices
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment