check_vertices_occurrencies Subroutine

private 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.

Arguments

Type IntentOptional AttributesName
class(facet_object), intent(inout) :: self

Facet.

type(facet_object), intent(inout) :: other

Other facet.



Source Code

   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


aabb_assign_aabb aabb_node_assign_aabb_node aabb_tree_assign_aabb_tree add_facets add_facets add_vertex_occurrence allocate_facets analize bmax bmin build_connectivity check_normal check_vertices_occurrencies cli_parse cli_parse cli_parse cli_parse cli_parse cli_parse close_file closest_point closest_point compute_bb_from_facets compute_metrix compute_metrix compute_normal compute_normals compute_octants compute_octants compute_volume create_aabb_tree destroy destroy destroy destroy destroy distance distance distance distance distance distance_from_facets distance_from_facets do_ray_intersect do_ray_intersect do_ray_intersect edge_connection_in_other_ref facet_assign_facet file_stl_assign_file_stl first_child_node first_node flip_edge has_facets has_facets initialize initialize initialize initialize initialize is_allocated is_inside is_point_inside_polyhedron_ri is_point_inside_polyhedron_sa load_facets_number_from_file load_from_file load_from_file_ascii load_from_file_binary load_header_from_file make_normal_consistent mirror_by_matrix mirror_by_matrix mirror_by_normal mirror_by_normal nodes_number nodes_number_at_level open_file parent_node ray_intersections_number ray_intersections_number ray_intersections_number resize resize reverse_normal reverse_normals rotate_by_axis_angle rotate_by_axis_angle rotate_by_matrix rotate_by_matrix sanitize_normals save_facets_into_file_stl save_facets_into_file_stl save_geometry_tecplot_ascii save_geometry_tecplot_ascii save_geometry_tecplot_ascii save_header_into_file save_into_file save_into_file_ascii save_into_file_binary save_into_file_stl save_trailer_into_file solid_angle statistics tetrahedron_volume translate translate update_connectivity update_extents update_extents vertex vertex_global_id