Research Article

High-Performance Design Patterns for Modern Fortran

Listing 14

subroutine assign_local_to_global(lhs, rhs)
class(tensor), intent(inout):: lhs
class(local_tensor), intent(in):: rhs
 ! Requires
call assert(rhs%user_defined())
 ! update global field
lhs%global_f(:) = rhs%state()
 ! Ensures
call lhs%mark_as_defined
sync all
end subroutine