15 #include "sll_working_precision.h"
55 sll_int32 :: rank = -1
73 sll_real64,
intent(in) :: time
81 if (self%rank == 0)
then
82 allocate (self%xdmf_file)
83 call self%xdmf_file%init(time)
91 character(len=*),
intent(in) :: fname
94 if (self%rank == 0)
then
95 call self%xdmf_file%write(fname)
105 if (self%rank == 0)
then
106 if (
allocated(self%xdmf_file))
then
107 call self%xdmf_file%delete()
108 deallocate (self%xdmf_file)
121 character(len=*),
intent(in) :: grid_name
122 character(len=*),
intent(in) :: x1_path
123 character(len=*),
intent(in) :: x2_path
124 sll_int32,
intent(in) :: dims(2)
125 sll_int32,
intent(out) :: gid
127 sll_int32 :: buf_gid(1)
131 if (self%rank == 0)
then
132 call self%xdmf_file%add_grid(grid_name, x1_path, x2_path, dims, gid)
144 grid_id, field_name, field_path, &
148 sll_int32,
intent(in) :: grid_id
149 character(len=*),
intent(in) :: field_name
150 character(len=*),
intent(in) :: field_path
151 logical,
intent(in) :: to_file
158 logical,
allocatable :: recbuf(:)
159 character(len=11) :: rank_str
160 sll_int32 :: stat(mpi_status_size)
161 sll_int32 :: sender_rank
165 character(len=maxlen) :: buf_fn
166 character(len=maxlen) :: buf_fp
170 comm = self%comm%comm
176 if (self%rank == 0)
then
178 allocate (recbuf(0:nprocs - 1))
184 call self%xdmf_file%add_field(grid_id, field_name, field_path)
190 do i = 1, count(recbuf(1:))
195 call mpi_recv(buf_gid, 1, mpi_integer, mpi_any_source, &
196 mpi_any_tag, comm, stat, ierr)
198 sender_rank = stat(mpi_source)
200 call mpi_recv(buf_fn,
maxlen, mpi_character, sender_rank, &
201 mpi_any_tag, comm, stat, ierr)
203 call mpi_recv(buf_fp,
maxlen, mpi_character, sender_rank, &
204 mpi_any_tag, comm, stat, ierr)
206 write (rank_str,
'(i8)') sender_rank
211 call self%xdmf_file%add_field(buf_gid, trim(buf_fn), trim(buf_fp))
220 write (rank_str,
'(i8)') self%rank
226 buf_fn = adjustl(field_name)
227 buf_fp = adjustl(field_path)
231 call mpi_send(buf_gid, 1, mpi_integer, 0, 9, comm, ierr)
232 call mpi_send(buf_fn,
maxlen, mpi_character, 0, 9, comm, ierr)
233 call mpi_send(buf_fp,
maxlen, mpi_character, 0, 9, comm, ierr)
Broadcasts a message from the process with rank "root" to all other processes of the communicator.
Gathers together values from a group of processes.
integer(kind=i32) function, public sll_f_get_collective_rank(col)
Determines the rank of the calling process in the communicator.
integer(kind=i32) function, public sll_f_get_collective_size(col)
Determines the size of the group associated with a communicator.
Construct the XML component of an XDMF database (parallel).
subroutine t_xdmf_parallel__add_grid(self, grid_name, x1_path, x2_path, dims, gid)
subroutine t_xdmf_parallel__delete(self)
subroutine t_xdmf_parallel__init(self, time, comm)
subroutine t_xdmf_parallel__write(self, fname)
subroutine t_xdmf_parallel__add_field(self, grid_id, field_name, field_path, to_file)
integer, parameter maxlen
Maximum length of variable-length strings to be passed through MPI.
Construct the XML component of an XDMF database (sequential).
Wrapper around the communicator.