Skip to content

Commit

Permalink
Adding opposite_faces
Browse files Browse the repository at this point in the history
  • Loading branch information
fverdugo committed Feb 5, 2024
1 parent fdc7408 commit d1e0aca
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 0 deletions.
23 changes: 23 additions & 0 deletions src/geometry.jl
Original file line number Diff line number Diff line change
Expand Up @@ -906,11 +906,18 @@ function vtk_mesh_cell(ref_face)
nodes -> WriteVTK.MeshCell(cell_type,(nodes[lib_to_user])[vtk_to_lib])
end

opposite_faces(geom,d) = opposite_faces(geom)[d+1]

# TODO use the same convention than in Gridap
# allow the user to customize the boundary object ids
function boundary(geom::ExtrusionPolytope{0})
nothing
end

function opposite_faces(geom::ExtrusionPolytope{0})
[[1]]
end

function boundary(geom::ExtrusionPolytope{1})
Tv = real_type(geom)
Ti = int_type(geom)
Expand All @@ -936,6 +943,11 @@ function boundary(geom::ExtrusionPolytope{1})
outwards_normals
)
end

function opposite_faces(geom::ExtrusionPolytope{1})
[[2,1],[1]]
end

function boundary(geom::ExtrusionPolytope{2})
Tv = real_type(geom)
Ti = int_type(geom)
Expand Down Expand Up @@ -969,6 +981,12 @@ function boundary(geom::ExtrusionPolytope{2})
outwards_normals
)
end

function opposite_faces(geom::ExtrusionPolytope{2})
@assert is_n_cube(geom)
[[4,3,2,1],[2,1,4,3],[1]]
end

function boundary(geom::ExtrusionPolytope{3})
Tv = real_type(geom)
Ti = int_type(geom)
Expand Down Expand Up @@ -1014,6 +1032,11 @@ function boundary(geom::ExtrusionPolytope{3})
)
end

function opposite_faces(geom::ExtrusionPolytope{3})
@assert is_n_cube(geom)
[[8,7,6,5,4,3,2,1],[6,5,8,7,2,1,4,3,12,11,10,9],[2,1,4,3,6,5],[1]]
end

function boundary(refface::AbstractMeshFace)
boundary_from_mesh_face(refface)
end
Expand Down
10 changes: 10 additions & 0 deletions test/geometry_tests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,16 @@ end
@show gk.unit_n_cube(2) |> gk.boundary
@show gk.unit_n_cube(3) |> gk.boundary

gk.unit_n_cube(0) |> gk.opposite_faces
gk.unit_n_cube(1) |> gk.opposite_faces
gk.unit_n_cube(2) |> gk.opposite_faces
gk.unit_n_cube(3) |> gk.opposite_faces

gk.opposite_faces(cube3,0)
gk.opposite_faces(cube3,1)
gk.opposite_faces(cube3,2)
gk.opposite_faces(cube3,3)

order = 2
gk.lagrange_mesh_face(spx1,order) |> gk.boundary |> gk.topology

Expand Down

0 comments on commit d1e0aca

Please sign in to comment.