Advertisement
Guest User

Untitled

a guest
Nov 17th, 2019
123
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. pure function composeMapping(mapping1,mapping2) result(newMapping)
  2.         !compose two mappings a la mapping1(mapping2(x)) function notation.
  3.  
  4.         use env_kindtypes,      only: si
  5.  
  6.         implicit none
  7.  
  8.         !!! Dummy arguments !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
  9.         integer (si),intent(in)          :: mapping1(:)
  10.         integer (si),intent(in)          :: mapping2(:)
  11.         !!! End dummary arguments !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
  12.  
  13.         !return value
  14.         integer (si),allocatable         :: newMapping(:)
  15.  
  16.         !local variables
  17.         integer (si)                     :: i
  18.  
  19.         allocate(newMapping(size(mapping2)))
  20.  
  21.         do i=1,size(mapping2)
  22.                 newMapping(i) = mapping1(mapping2(i))
  23.         enddo
  24. endfunction composemapping
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement