Neko  0.9.99
A portable framework for high-order spectral element flow simulations
signed_distance Module Reference

Module containing Signed Distance Functions.

Functions/Subroutines

subroutine, public signed_distance_field (field_data, object, max_distance)
 Signed distance field. More...
 
subroutine signed_distance_field_tri_mesh (field_data, mesh, max_distance)
 Signed distance field for a triangular mesh. More...
 
real(kind=dp) function tri_mesh_brute_force (mesh, p, max_distance)
 Signed distance function. More...
 
real(kind=dp) function tri_mesh_aabb_tree (tree, object_list, p, max_distance)
 Signed distance function using an AABB tree. More...
 
subroutine element_distance (element, p, distance, weighted_sign)
 Main interface for the signed distance function for an element. More...
 
subroutine element_distance_triangle (triangle, p, distance, weighted_sign)
 Signed distance function for a triangle. More...
 
pure real(kind=dp) function, dimension(3) cross (a, b)
 Compute cross product of two vectors. More...
 

Function/Subroutine Documentation

◆ cross()

pure real(kind=dp) function, dimension(3) signed_distance::cross ( real(kind=dp), dimension(3), intent(in)  a,
real(kind=dp), dimension(3), intent(in)  b 
)
private
Parameters
[in]aFirst vector
[in]bSecond vector
Returns
Cross product \( a \times b \)

Definition at line 426 of file signed_distance.f90.

Here is the caller graph for this function:

◆ element_distance()

subroutine signed_distance::element_distance ( class(*), intent(in)  element,
real(kind=dp), dimension(3), intent(in)  p,
real(kind=dp), intent(out)  distance,
real(kind=dp), intent(out), optional  weighted_sign 
)

Definition at line 314 of file signed_distance.f90.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ element_distance_triangle()

subroutine signed_distance::element_distance_triangle ( type(tri_t), intent(in)  triangle,
real(kind=dp), dimension(3), intent(in)  p,
real(kind=dp), intent(out)  distance,
real(kind=dp), intent(out), optional  weighted_sign 
)
private

This routine computes the signed distance function for the current triangle. We compute the barycentric coordinate of the point projected onto the triangle. If the projection is inside the triangle, the distance is the distance to the plane. If the projection is outside the triangle, the distance is the distance to the nearest edge or vertex.

In order to improve precision of the sign estimation, we also compute the weighted sign, which is the perpendicular distance to the plane divided by the distance to the nearest point.

@Note The returned distance is signed if the weighted_sign is not present.

Parameters
thisTriangle
pPoint
Returns
Distance value
[optional] Weighted sign

Definition at line 350 of file signed_distance.f90.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ signed_distance_field()

subroutine, public signed_distance::signed_distance_field ( type(field_t), intent(inout)  field_data,
class(*), intent(in)  object,
real(kind=dp), intent(in), optional  max_distance 
)

This routine computes the signed distance field for a given object.

Currently supported objects are:

  • Triangular mesh (tri_mesh_t)
Parameters
[in,out]field_dataField data
[in]objectObject
[in,optional]max_distance Maximum distance outside the mesh

Definition at line 60 of file signed_distance.f90.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ signed_distance_field_tri_mesh()

subroutine signed_distance::signed_distance_field_tri_mesh ( type(field_t), intent(inout)  field_data,
type(tri_mesh_t), intent(in)  mesh,
real(kind=dp), intent(in)  max_distance 
)
private

This routine computes the signed distance field for a given triangular mesh. The algorithm utilizes an AABB tree to accelerate the earch for potential elements. The signed distance is computed using the brute force approach, where we compute the signed distance to each element found through the AABB tree, and return the minimum distance.

Parameters
[in,out]field_dataField data
[in]meshTriangular mesh
[in]max_distanceMaximum distance outside the mesh

Definition at line 93 of file signed_distance.f90.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ tri_mesh_aabb_tree()

real(kind=dp) function signed_distance::tri_mesh_aabb_tree ( class(aabb_tree_t), intent(in)  tree,
class(tri_t), dimension(:), intent(in)  object_list,
real(kind=dp), dimension(3), intent(in)  p,
real(kind=dp), intent(in)  max_distance 
)

This routine computes the signed distance function for the boundary mesh, to a given point (x, y, z). The algorithm utilizes an AABB tree to accelerate the search for potential elements. The signed distance is computed using the brute force approach, where we compute the signed distance to each element found through the AABB tree, and return the minimum distance.

Parameters
treeAABB tree
object_listList of objects
pPoint
max_distanceMaximum distance outside the mesh
Returns
Signed distance value

Definition at line 194 of file signed_distance.f90.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ tri_mesh_brute_force()

real(kind=dp) function signed_distance::tri_mesh_brute_force ( type(tri_mesh_t), intent(in)  mesh,
real(kind=dp), dimension(3), intent(in)  p,
real(kind=dp), intent(in)  max_distance 
)
private
Deprecated:
This routine is deprecated and will be removed in the future.

This routine computes the signed distance function for the boundary mesh, to a given point (x, y, z). The algorithm is a brute force approach, where we compute the signed distance to each element in the mesh, and return the minimum distance.

Parameters
pPoint
meshBoundary mesh
Returns
Signed distance value

Definition at line 145 of file signed_distance.f90.

Here is the call graph for this function: