Flip facet edge.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(facet_object), | intent(inout) | :: | self | Facet. |
||
| character(len=*), | intent(in) | :: | edge_dir | Edge to be flipped. |
pure subroutine flip_edge(self, edge_dir)
!< Flip facet edge.
class(facet_object), intent(inout) :: self !< Facet.
character(*), intent(in) :: edge_dir !< Edge to be flipped.
integer(I4P) :: fcon !< Temporary facet connectiviy variable.
select case(edge_dir)
case('edge_12')
call flip_vertices(a=self%vertex_1, b=self%vertex_2, &
fcon_bc=self%fcon_edge_23, fcon_ca=self%fcon_edge_31, &
vertex_a_occurrence=self%vertex_1_occurrence, vertex_b_occurrence=self%vertex_2_occurrence)
case('edge_23')
call flip_vertices(a=self%vertex_2, b=self%vertex_3, &
fcon_bc=self%fcon_edge_12, fcon_ca=self%fcon_edge_31, &
vertex_a_occurrence=self%vertex_2_occurrence, vertex_b_occurrence=self%vertex_3_occurrence)
case('edge_31')
call flip_vertices(a=self%vertex_3, b=self%vertex_1, &
fcon_bc=self%fcon_edge_12, fcon_ca=self%fcon_edge_23, &
vertex_a_occurrence=self%vertex_3_occurrence, vertex_b_occurrence=self%vertex_1_occurrence)
endselect
call self%compute_metrix
contains
pure subroutine flip_vertices(a, b, fcon_bc, fcon_ca, vertex_a_occurrence, vertex_b_occurrence)
!< Flip two vertices of facet.
type(vector_R8P), intent(inout) :: a, b !< Vertices to be flipped.
integer(I4P), intent(inout) :: fcon_bc !< Connected face ID along edge b-c.
integer(I4P), intent(inout) :: fcon_ca !< Connected face ID along edge c-a.
integer(I4P), allocatable, intent(inout) :: vertex_a_occurrence(:) !< List of vertex a "occurrencies".
integer(I4P), allocatable, intent(inout) :: vertex_b_occurrence(:) !< List of vertex b "occurrencies".
type(vector_R8P) :: vertex !< Temporary vertex variable.
integer(I4P) :: fcon !< Temporary connected face ID.
integer(I4P), allocatable :: vertex_occurrence(:) !< Temporary list of vertex "occurrencies".
! flip vertex
vertex = a
a = b
b = vertex
! flip facet connectivity
fcon = fcon_bc
fcon_bc = fcon_ca
fcon_ca = fcon
! flip vertex occurrences
if (allocated(vertex_a_occurrence).and.allocated(vertex_a_occurrence)) then
vertex_occurrence = vertex_a_occurrence
vertex_a_occurrence = vertex_b_occurrence
vertex_b_occurrence = vertex_occurrence
elseif (allocated(vertex_a_occurrence)) then
vertex_b_occurrence = vertex_a_occurrence
deallocate(vertex_a_occurrence)
elseif (allocated(vertex_b_occurrence)) then
vertex_a_occurrence = vertex_b_occurrence
deallocate(vertex_b_occurrence)
endif
endsubroutine flip_vertices
endsubroutine flip_edge