Skip to content

Commit 04eda20

Browse files
committed
Added example that results in non-compliant if no comm of distances
1 parent 894f69b commit 04eda20

File tree

1 file changed

+78
-0
lines changed

1 file changed

+78
-0
lines changed
Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
module DistributedAggregationTests
2+
3+
using Gridap
4+
using GridapEmbedded
5+
using GridapDistributed
6+
using PartitionedArrays
7+
using Test
8+
9+
using GridapEmbedded.Distributed: distributed_aggregate
10+
11+
distribute = PartitionedArrays.DebugArray
12+
13+
np = (2,1)
14+
15+
ranks = distribute(LinearIndices((prod(np),)))
16+
17+
n = 8
18+
mesh_partition = (n,n)
19+
20+
L = 1
21+
p0 = Point(0.0,0.0)
22+
pmin = Point(-L/4,-L/8)
23+
pmax = Point(L/4,3*L/8)
24+
25+
R = 0.2
26+
x = VectorValue(1.0,0.0)
27+
h = L/(2*n)
28+
29+
geo1 = disk(R,x0=p0)
30+
geo2 = quadrilateral(;x0=Point(-L/4+h/4,5*h/4),
31+
d1=VectorValue(6*h+h/2,0.0),
32+
d2=VectorValue(0.0,4*h+h/2))
33+
geo3 = quadrilateral(;x0=Point(-L/4+3*h/4,7*h/4),
34+
d1=VectorValue(6*h-h/2,0.0),
35+
d2=VectorValue(0.0,4*h-h/2))
36+
geo = union(geo1,intersect(geo2,!geo3))
37+
38+
bgmodel = CartesianDiscreteModel(ranks,np,pmin,pmax,mesh_partition;ghost=(2,2))
39+
40+
cutgeo = cut(bgmodel,geo)
41+
42+
bgf_to_ioc = compute_bgfacet_to_inoutcut(bgmodel,geo)
43+
44+
Ω = Triangulation(cutgeo)
45+
46+
strategy = AggregateCutCellsByThreshold(1.0)
47+
aggregates,aggregate_owner,aggregate_neig = distributed_aggregate(
48+
strategy,cutgeo,geo,IN)
49+
50+
gids = get_cell_gids(bgmodel)
51+
52+
oaggregates = map(aggregates,own_to_local(gids)) do agg,o_to_l
53+
map(Reindex(agg),o_to_l)
54+
end
55+
56+
oaggregate_owner = map(aggregate_owner,own_to_local(gids)) do agg,o_to_l
57+
map(Reindex(agg),o_to_l)
58+
end
59+
60+
map(ranks,oaggregates) do p,a
61+
if p (1)
62+
@test a[end] == 30
63+
end
64+
end
65+
66+
Ωbg = Triangulation(bgmodel)
67+
Ω = Triangulation(cutgeo)
68+
Ωin = Triangulation(cutgeo,IN)
69+
Γ = EmbeddedBoundary(cutgeo)
70+
71+
path = pwd()
72+
writevtk(Ωin,joinpath(path,"trian_in"))
73+
writevtk(Γ,joinpath(path,"bnd"))
74+
writevtk(Ωbg,joinpath(path,"bgtrian"),celldata=
75+
["aggregate"=>oaggregates,
76+
"aggregate_owner"=>oaggregate_owner])
77+
78+
end # module

0 commit comments

Comments
 (0)