Follow master's time (it must stay alive while synchronized), or stop
following (master not associated, or this clock itself), keeping the
master's current time and settings. Returns false, and changes nothing,
if this would make a cycle.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(SimulationClock), | intent(inout), | target | :: | self | ||
| type(SimulationClock), | intent(in), | pointer | :: | master |
the clock to follow (null: stop following) |
|
| real(kind=wp), | intent(in), | optional | :: | wall |
wall time (s; default: wall_time()) |
recursive logical function synchronize(self, master, wall) result(ok) class(SimulationClock), intent(inout), target :: self type(SimulationClock), pointer, intent(in) :: master !! the clock to follow (null: stop following) real(wp), intent(in), optional :: wall !! wall time (s; default: wall_time()) type(SimulationClock), pointer :: c real(wp) :: t ok = .true. if (.not. associated(master)) then if (associated(self%sync)) then t = self%sync%time() self%scale_ = self%sync%time_scale() self%paused_ = self%sync%is_paused() call self%sync%time_range(self%t_min, self%t_max) self%sync => null() call self%set_time(t, wall) end if return end if if (same_clock(master, self)) then ok = self%synchronize(null(), wall) return end if c => master do while (associated(c)) if (same_clock(c, self)) then ok = .false. return end if c => c%sync end do self%sync => master end function synchronize