Check if vertices of facet are identical (with tollerance) to the ones of other facet.
If multiple occurrencies are found the counters are updated.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(facet_object), | intent(inout) | :: | self | Facet. |
||
| type(facet_object), | intent(inout) | :: | other | Other facet. |
pure subroutine check_vertices_occurrencies(self, other)
!< Check if vertices of facet are *identical* (with tollerance) to the ones of other facet.
!<
!< If multiple occurrencies are found the counters are updated.
class(facet_object), intent(inout) :: self !< Facet.
type(facet_object), intent(inout) :: other !< Other facet.
if (check_pair(self%vertex_1, other%vertex_1)) then
call self%add_vertex_occurrence( vertex_id=1, facet_id=other%id)
call other%add_vertex_occurrence(vertex_id=1, facet_id=self%id)
elseif (check_pair(self%vertex_1, other%vertex_2)) then
call self%add_vertex_occurrence( vertex_id=1, facet_id=other%id)
call other%add_vertex_occurrence(vertex_id=2, facet_id=self%id)
elseif (check_pair(self%vertex_1, other%vertex_3)) then
call self%add_vertex_occurrence( vertex_id=1, facet_id=other%id)
call other%add_vertex_occurrence(vertex_id=3, facet_id=self%id)
endif
if (check_pair(self%vertex_2, other%vertex_1)) then
call self%add_vertex_occurrence( vertex_id=2, facet_id=other%id)
call other%add_vertex_occurrence(vertex_id=1, facet_id=self%id)
elseif (check_pair(self%vertex_2, other%vertex_2)) then
call self%add_vertex_occurrence( vertex_id=2, facet_id=other%id)
call other%add_vertex_occurrence(vertex_id=2, facet_id=self%id)
elseif (check_pair(self%vertex_2, other%vertex_3)) then
call self%add_vertex_occurrence( vertex_id=2, facet_id=other%id)
call other%add_vertex_occurrence(vertex_id=3, facet_id=self%id)
endif
if (check_pair(self%vertex_3, other%vertex_1)) then
call self%add_vertex_occurrence( vertex_id=3, facet_id=other%id)
call other%add_vertex_occurrence(vertex_id=1, facet_id=self%id)
elseif (check_pair(self%vertex_3, other%vertex_2)) then
call self%add_vertex_occurrence( vertex_id=3, facet_id=other%id)
call other%add_vertex_occurrence(vertex_id=2, facet_id=self%id)
elseif (check_pair(self%vertex_3, other%vertex_3)) then
call self%add_vertex_occurrence( vertex_id=3, facet_id=other%id)
call other%add_vertex_occurrence(vertex_id=3, facet_id=self%id)
endif
contains
pure function check_pair(a, b)
!< Check equality of vertices pair.
type(vector_R8P), intent(in) :: a, b !< Vertices pair.
logical :: check_pair !< Check result.
check_pair = ((abs(a%x - b%x) <= EPS).and.(abs(a%y - b%y) <= EPS).and.(abs(a%z - b%z) <= EPS))
endfunction check_pair
endsubroutine check_vertices_occurrencies