concept custom module in category fortran
appears as: custom module

This is an excerpt from Manning's book Modern Fortran: Building efficient parallel applications.
Before we begin, let’s see what a custom module may look like on the inside, and how its building blocks work (figure 4.3).
Listing 4.12. Defining the
set_gaussiansubroutine in a custom module, and storing it in themod_initial.f90source filelanguage="fortran" linenumbering="unnumbered">module mod_initial use iso_fortran_env, only: int32, real32 #1 implicit none #2 contains pure subroutine set_gaussian(x, icenter, decay) #3 real(real32), intent(in out) :: x(:) integer(int32), intent(in) :: icenter real(real32), intent(in) :: decay integer(int32) :: i do concurrent(i = 1:size(x)) x(i) = exp(-decay * (i - icenter)**2) end do end subroutine set_gaussian end module mod_initial