Skip to content
Snippets Groups Projects
  • Lionel GUEZ's avatar
    56150231
    Split arborescence into `Inst_eddies` and Overlap · 56150231
    Lionel GUEZ authored
    Also split the tests, Fortran source files, Python files and JSon
    files. Keep at the top level the files used in both `Inst_eddies` and
    Overlap.
    
    Motivations for the split:
    
    - The top directory contained many files.
    
    - It may be useful to compile only one of the two sub-projects. For
    example, only `Inst_eddies` on Ciclad, where MPI 3 is not available.
    56150231
    History
    Split arborescence into `Inst_eddies` and Overlap
    Lionel GUEZ authored
    Also split the tests, Fortran source files, Python files and JSon
    files. Keep at the top level the files used in both `Inst_eddies` and
    Overlap.
    
    Motivations for the split:
    
    - The top directory contained many files.
    
    - It may be useful to compile only one of the two sub-projects. For
    example, only `Inst_eddies` on Ciclad, where MPI 3 is not available.
inside_4.f90 1.25 KiB
module inside_4_m

  implicit none

contains

  logical function inside_4(distance, center, v)

    ! This procedure returns true if the four points center \pm
    ! (distance(1), 0) and center \pm (0, distance(2)) are inside
    ! the polygon v.

    use geometry, only: polygon_contains_point

    real, intent(in):: distance(:) ! (2)
    real, intent(in):: center(:) ! (2) coordinates of the center point

    real, intent(in):: v(:, :) ! (2, :) vertices of the polygon
    ! The last vertex should repeat the first vertex.

    !-------------------------------------------------------------

    ! On the eastern way:
    inside_4 = polygon_contains_point(v, [center(1) + distance(1), center(2)])

    if (inside_4) then
       ! On the northern way:
       inside_4 = polygon_contains_point(v, &
            [center(1), center(2) + distance(2)])

       if (inside_4) then
          ! On the western way:
          inside_4 = polygon_contains_point(v, &
               [center(1) - distance(1), center(2)])

          if (inside_4) then
             ! On the southern way:
             inside_4 = polygon_contains_point(v, &
                  [center(1), center(2) - distance(2)])
          end if
       end if
    end if

  end function inside_4

end module inside_4_m