GridapEmbedded.jl
GridapEmbedded.jl copied to clipboard
Bounds Error when no cut cells are present
@fverdugo @santiagobadia If we consider the following code
using Gridap
using GridapEmbedded
using Gridap.ReferenceFEs
u(x) = x[1] + x[2]
f(x) = 0.0
bgdomain = (0,1,0,1)
n = 10
partition = (n,n)
bgmodel = CartesianDiscreteModel(bgdomain,partition)
geo = square(L=0.8,x0=Point(0.5,0.5))
cutgeo = cut(bgmodel,geo)
model = DiscreteModel(cutgeo)
strategy = AggregateCutCellsByThreshold(1.0)
aggregates = aggregate(strategy,cutgeo)
T = Float64
order = 1
reffe = LagrangianRefFE(T,QUAD,order)
V0 = TestFESpace(reffe=reffe, model=model,dof_space=:physical)
V = AgFEMSpace(V0,aggregates)
U = TrialFESpace(V)
Here, all cells are well-posed (no cut cells).

We can see an error BoundsError: attempt to access 81-element Array{Int32,1} at index [0] in the line
V = AgFEMSpace(V0,aggregates).
Hi @diliphridya it seems a bug that shows up for the degenerated case of 0-cut cells. Since in this case, you don't need aggregation at all, it should be easy to fix.
Thanks @fverdugo . I will have a look at it.