Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

3D ray-tracing #68

Merged
merged 11 commits into from
May 22, 2022
Merged

3D ray-tracing #68

merged 11 commits into from
May 22, 2022

Conversation

jorgensd
Copy link
Member

Implements raytracing for 3D cells.

MWE:

import dolfinx_contact
from mpi4py import MPI
import dolfinx
import numpy as np

mesh = dolfinx.mesh.create_unit_cube(MPI.COMM_WORLD, 15, 15, 15, dolfinx.mesh.CellType.tetrahedron)
facets = dolfinx.mesh.locate_entities_boundary(mesh, mesh.topology.dim - 1, lambda x: np.isclose(x[2], 0))
integral_pairs = dolfinx_contact.cpp.compute_active_entities(mesh, facets, dolfinx.fem.IntegralType.exterior_facet)

status, cell_idx, points = dolfinx_contact.cpp.compute_3D_ray(
    mesh, [0.5, 0.3, -1], [[1, 0, 0], [0, 1, 0]], integral_pairs, 10, 1e-6)
print(
    f"Converged: {status} Entity: {integral_pairs[cell_idx]} Coordinate {points[0]} Reference Coordinate: {points[1]}")

If no cell is found that the ray goes through, a negative status is returned

@jorgensd jorgensd requested review from IgorBaratta and SarahRo May 12, 2022 11:10
cpp/RayTracing.cpp Outdated Show resolved Hide resolved
cpp/RayTracing.cpp Outdated Show resolved Hide resolved
cpp/RayTracing.cpp Outdated Show resolved Hide resolved
cpp/RayTracing.cpp Outdated Show resolved Hide resolved
@jorgensd jorgensd merged commit 598e862 into Wells-Group:main May 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants