@@ -32,6 +32,40 @@ function Cart_create(comm_old::Comm, dims::AbstractArray{T,N}, periods::Array{T,
32
32
Cart_create (comm_old, ndims, cdims, cperiods, reorder)
33
33
end
34
34
35
+ """
36
+ Cart_get(comm::Comm, maxdims::Integer)
37
+
38
+ Obtain information on the Cartesian topology of dimension `maxdims` underlying the
39
+ communicator `comm`. This is specified by two `Cint` arrays of `maxdims` elements
40
+ for the number of processes and periodicity properties along each Cartesian dimension.
41
+ A third `Cint` array is returned, containing the Cartesian coordinates of the calling process.
42
+ """
43
+ function Cart_get (comm:: Comm , maxdims:: Integer )
44
+ # preallocate with nontrivial values
45
+ dims = Cint[- 1 for i = 1 : maxdims]
46
+ periods = Cint[- 1 for i = 1 : maxdims]
47
+ coords = Cint[- 1 for i = 1 : maxdims]
48
+ # int MPI_Cart_get(MPI_Comm comm, int maxdims, int dims[], int periods[], int coords[])
49
+ @mpichk ccall ((:MPI_Cart_get , libmpi), Cint,
50
+ (MPI_Comm, Cint, Ptr{Cint}, Ptr{Cint}, Ptr{Cint}),
51
+ comm, maxdims, dims, periods, coords)
52
+ return dims, periods, coords
53
+ end
54
+
55
+ """
56
+ Cartdim_get(comm::Comm)
57
+
58
+ Return number of dimensions of the Cartesian topology associated with the communicator `comm`.
59
+ """
60
+ function Cartdim_get (comm:: Comm )
61
+ dims = Cint[0 ]
62
+ # int MPI_Cartdim_get(MPI_Comm comm, int *ndims)
63
+ @mpichk ccall ((:MPI_Cartdim_get , libmpi), Cint,
64
+ (MPI_Comm, Ptr{Cint}),
65
+ comm, dims)
66
+ return Int (dims[1 ])
67
+ end
68
+
35
69
function Cart_coords! (comm:: Comm , rank:: Integer , maxdims:: Integer , coords:: MPIBuffertype{Cint} )
36
70
# int MPI_Cart_coords(MPI_Comm comm, int rank, int maxdims, int coords[])
37
71
@mpichk ccall ((:MPI_Cart_coords , libmpi), Cint,
0 commit comments