Make normal of other facet consistent with self.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(facet_object), | intent(in) | :: | self | Facet. |
||
| character(len=*), | intent(in) | :: | edge_dir | Edge (in self numeration) along which other is connected. |
||
| type(facet_object), | intent(inout) | :: | other | Other facet to make consistent with self. |
pure subroutine make_normal_consistent(self, edge_dir, other)
!< Make normal of other facet consistent with self.
class(facet_object), intent(in) :: self !< Facet.
character(*), intent(in) :: edge_dir !< Edge (in self numeration) along which other is connected.
type(facet_object), intent(inout) :: other !< Other facet to make consistent with self.
character(len(edge_dir)) :: edge_dir_other !< Edge (in self numeration) along which other is connected.
type(vector_R8P) :: edge !< Edge of connection in the self reference.
type(vector_R8P) :: edge_other !< Edge of connection in the other reference.
call self%edge_connection_in_other_ref(other=other, edge_dir=edge_dir_other, edge=edge_other)
! get self edge
select case(edge_dir)
case('edge_12')
edge = self%vertex_2 - self%vertex_1
case('edge_23')
edge = self%vertex_3 - self%vertex_2
case('edge_31')
edge = self%vertex_1 - self%vertex_3
endselect
if (edge%dotproduct(edge_other)>0) then
! other numeration is consistent, normal has wrong orientation
call other%flip_edge(edge_dir=edge_dir_other)
endif
endsubroutine make_normal_consistent