Skip to content

Commit

Permalink
Added Boundary and Skeleton for DistributedTriangulations
Browse files Browse the repository at this point in the history
  • Loading branch information
JordiManyer committed Oct 30, 2024
1 parent 76bb3d2 commit a2941bb
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 3 deletions.
32 changes: 32 additions & 0 deletions src/Geometry.jl
Original file line number Diff line number Diff line change
Expand Up @@ -491,11 +491,21 @@ function Geometry.BoundaryTriangulation(
BoundaryTriangulation(no_ghost,model;kwargs...)
end

function Geometry.BoundaryTriangulation(
trian::DistributedTriangulation;kwargs...)
BoundaryTriangulation(no_ghost,trian;kwargs...)
end

function Geometry.SkeletonTriangulation(
model::DistributedDiscreteModel;kwargs...)
SkeletonTriangulation(no_ghost,model;kwargs...)
end

function Geometry.SkeletonTriangulation(
trian::DistributedTriangulation;kwargs...)
SkeletonTriangulation(no_ghost,trian;kwargs...)
end

function Geometry.Triangulation(
portion,::Type{ReferenceFE{Dt}},model::DistributedDiscreteModel{Dm};kwargs...) where {Dt,Dm}
# Generate global ordering for the faces of dimension Dt (if needed)
Expand All @@ -515,6 +525,17 @@ function Geometry.BoundaryTriangulation(
DistributedTriangulation(trians,model)
end

function Geometry.BoundaryTriangulation(
portion,trian::DistributedTriangulation;kwargs...
)
model = get_background_model(trian)
gids = get_cell_gids(model)
trians = map(local_views(trian),partition(gids)) do trian, gids
BoundaryTriangulation(portion,gids,trian;kwargs...)
end
DistributedTriangulation(trians,model)
end

function Geometry.SkeletonTriangulation(
portion,model::DistributedDiscreteModel{Dc};kwargs...) where Dc
gids = get_face_gids(model,Dc)
Expand All @@ -524,6 +545,17 @@ function Geometry.SkeletonTriangulation(
DistributedTriangulation(trians,model)
end

function Geometry.SkeletonTriangulation(
portion,trian::DistributedTriangulation;kwargs...
)
model = get_background_model(trian)
gids = get_cell_gids(model)
trians = map(local_views(trian),partition(gids)) do trian, gids
SkeletonTriangulation(portion,gids,trian;kwargs...)
end
DistributedTriangulation(trians,model)
end

function Geometry.Triangulation(
portion,gids::AbstractLocalIndices, args...;kwargs...)
trian = Triangulation(args...;kwargs...)
Expand Down
13 changes: 10 additions & 3 deletions test/GeometryTests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -92,14 +92,21 @@ function main(distribute,parts)
add_tag!(labels,"fluid",[fluid])
cell_to_entity
end
cell_gids=get_cell_gids(model)
vcache=PartitionedArrays.p_vector_cache(cell_to_entity,partition(cell_gids))
assemble!((a,b)->b, cell_to_entity, map(reverse,vcache) ) |> wait # Make tags consistent
cell_gids = get_cell_gids(model)
consistent!(PVector(cell_to_entity,partition(cell_gids))) |> wait # Make tags consistent
#vcache = PartitionedArrays.p_vector_cache(cell_to_entity,partition(cell_gids))
#assemble!((a,b)->b, cell_to_entity, map(reverse,vcache) ) |> wait # Make tags consistent

Ωs = Interior(model,tags="solid")
Ωf = Interior(model,tags="fluid")
Γfs = Interface(Ωf,Ωs)

# CompositeTriangulations
Γf = Boundary(Ωf)
Λf = Skeleton(Ωf)
Λs = Skeleton(Ωs)
Γs = Boundary(Ωs)

end

function test_local_part_face_labelings_consistency(lmodel::CartesianDiscreteModel{D},gids,gmodel) where {D}
Expand Down

0 comments on commit a2941bb

Please sign in to comment.