53 USE iso_c_binding
, ONLY: c_int, c_loc, c_null_ptr, c_ptr
62 INTEGER(c_int) :: rank
69 num_dst_intersections, dst_com, &
70 src_idxlist, dst_idxlist, comm)
RESULT(xmap) &
71 bind(c, name=
'xt_xmap_intersection_new_f2c')
72 IMPORT :: c_int, c_ptr, xt_mpi_fint_kind
73 INTEGER(c_int),
VALUE,
INTENT(in) :: num_src_intersections, &
75 TYPE(c_ptr),
VALUE,
INTENT(in) :: src_com, dst_com, src_idxlist, &
77 INTEGER(xt_mpi_fint_kind),
VALUE,
INTENT(in) :: comm
81 FUNCTION xmi_ext_new_f2c(num_src_intersections, src_com, &
82 num_dst_intersections, dst_com, &
83 src_idxlist, dst_idxlist, comm)
RESULT(xmap) &
84 bind(c, name=
'xt_xmap_intersection_ext_new_f2c')
85 IMPORT :: c_int, c_ptr, xt_mpi_fint_kind
86 INTEGER(c_int),
VALUE,
INTENT(in) :: num_src_intersections, &
88 TYPE(c_ptr),
VALUE,
INTENT(in) :: src_com, dst_com, src_idxlist, &
90 INTEGER(xt_mpi_fint_kind),
VALUE,
INTENT(in) :: comm
92 END FUNCTION xmi_ext_new_f2c
96 MODULE PROCEDURE xmi_new_i_a_i_a
97 MODULE PROCEDURE xmi_new_a_a
101 MODULE PROCEDURE xmi_ext_new_i_a_i_a
102 MODULE PROCEDURE xmi_ext_new_a_a
106 FUNCTION xmi_new_i_a_i_a(num_src_intersections, src_com, &
107 num_dst_intersections, dst_com, &
108 src_idxlist, dst_idxlist, comm)
RESULT(xmap)
109 INTEGER(c_int),
VALUE,
INTENT(in) :: num_src_intersections, &
110 num_dst_intersections
111 TYPE(
xt_com_list),
TARGET,
INTENT(in) :: src_com(num_src_intersections), &
112 dst_com(num_dst_intersections)
113 TYPE(xt_idxlist),
INTENT(in) :: src_idxlist, dst_idxlist
114 INTEGER,
INTENT(in) :: comm
115 TYPE(xt_xmap) :: xmap
116 TYPE(c_ptr) :: src_com_p, dst_com_p
118 src_com_p = c_loc(src_com)
119 dst_com_p = c_loc(dst_com)
121 num_src_intersections, src_com_p, &
122 num_dst_intersections, dst_com_p, &
124 END FUNCTION xmi_new_i_a_i_a
126 FUNCTION xmi_new_a_a(src_com, dst_com, src_idxlist, dst_idxlist, comm) &
128 TYPE(
xt_com_list),
TARGET,
INTENT(in) :: src_com(:), dst_com(:)
129 TYPE(xt_idxlist),
INTENT(in) :: src_idxlist, dst_idxlist
130 INTEGER,
INTENT(in) :: comm
131 TYPE(xt_xmap) :: xmap
133 TYPE(
xt_com_list),
ALLOCATABLE,
TARGET :: src_com_a(:), dst_com_a(:)
134 TYPE(c_ptr) :: src_com_p, dst_com_p
135 INTEGER(c_int) :: num_src_intersections_c, num_dst_intersections_c
136 num_src_intersections_c = int(
SIZE(src_com), c_int)
137 num_dst_intersections_c = int(
SIZE(dst_com), c_int)
138 CALL com_p_arg(src_com, src_com_a, src_com_p)
139 CALL com_p_arg(dst_com, dst_com_a, dst_com_p)
141 xmap = xt_xmap_c2f(
xmi_new_f2c(num_src_intersections_c, src_com_p, &
142 num_dst_intersections_c, dst_com_p, &
144 END FUNCTION xmi_new_a_a
146 FUNCTION xmi_ext_new_i_a_i_a(num_src_intersections, src_com, &
147 num_dst_intersections, dst_com, &
148 src_idxlist, dst_idxlist, comm)
RESULT(xmap)
149 INTEGER(c_int),
VALUE,
INTENT(in) :: num_src_intersections, &
150 num_dst_intersections
151 TYPE(
xt_com_list),
TARGET,
INTENT(in) :: src_com(num_src_intersections), &
152 dst_com(num_dst_intersections)
153 TYPE(xt_idxlist),
INTENT(in) :: src_idxlist, dst_idxlist
154 INTEGER,
INTENT(in) :: comm
155 TYPE(xt_xmap) :: xmap
156 INTEGER(c_int) :: num_src_intersections_c, num_dst_intersections_c
157 num_src_intersections_c = int(num_src_intersections, c_int)
158 num_dst_intersections_c = int(num_dst_intersections, c_int)
160 xmap = xt_xmap_c2f(xmi_ext_new_f2c(&
161 num_src_intersections_c, c_loc(src_com), &
162 num_dst_intersections_c, c_loc(dst_com), &
164 END FUNCTION xmi_ext_new_i_a_i_a
166 FUNCTION xmi_ext_new_a_a(src_com, dst_com, src_idxlist, dst_idxlist, comm) &
168 TYPE(
xt_com_list),
TARGET,
INTENT(in) :: src_com(:), dst_com(:)
169 TYPE(xt_idxlist),
INTENT(in) :: src_idxlist, dst_idxlist
170 INTEGER,
INTENT(in) :: comm
171 TYPE(xt_xmap) :: xmap
173 TYPE(
xt_com_list),
ALLOCATABLE,
TARGET :: src_com_a(:), dst_com_a(:)
174 TYPE(c_ptr) :: src_com_p, dst_com_p
175 INTEGER(c_int) :: num_src_intersections_c, num_dst_intersections_c
176 num_src_intersections_c = int(
SIZE(src_com), c_int)
177 num_dst_intersections_c = int(
SIZE(dst_com), c_int)
179 CALL com_p_arg(src_com, src_com_a, src_com_p)
180 CALL com_p_arg(dst_com, dst_com_a, dst_com_p)
182 xmap = xt_xmap_c2f(xmi_ext_new_f2c(num_src_intersections_c, src_com_p, &
183 num_dst_intersections_c, dst_com_p, &
185 END FUNCTION xmi_ext_new_a_a
187 SUBROUTINE com_p_arg(com, com_a, com_p)
189 TYPE(
xt_com_list),
TARGET,
ALLOCATABLE,
INTENT(inout) :: com_a(:)
190 TYPE(c_ptr),
INTENT(out) :: com_p
195 bind(c, name=
'xt_com_list_contiguous')
203 IF (com_size > huge(1_c_int)) &
204 CALL xt_abort(
'invalid size', &
207 IF (com_size > 0)
THEN 208 IF (com_size > 1)
THEN 210 CALL xt_slice_c_loc(com(1), com_p)
212 ALLOCATE(com_a(com_size))
217 CALL xt_slice_c_loc(com(1), com_p)
222 END SUBROUTINE com_p_arg
type(xt_xmap) function, public xt_xmap_c2f(xmap)
integer, parameter, public xt_mpi_fint_kind
external, public xt_slice_c_loc
Xt_xmap xt_xmap_intersection_new(int num_src_intersections, const struct Xt_com_list src_com[num_src_intersections], int num_dst_intersections, const struct Xt_com_list dst_com[num_dst_intersections], Xt_idxlist src_idxlist, Xt_idxlist dst_idxlist, MPI_Comm comm)
int xt_com_list_contiguous(const struct Xt_com_list *p_com_a, const struct Xt_com_list *p_com_b)
Xt_xmap xt_xmap_intersection_ext_new(int num_src_intersections, const struct Xt_com_list src_com[num_src_intersections], int num_dst_intersections, const struct Xt_com_list dst_com[num_dst_intersections], Xt_idxlist src_idxlist, Xt_idxlist dst_idxlist, MPI_Comm comm)
Xt_idxlist xt_idxlist_f2c(struct xt_idxlist_f *p)