Skip to content

Commit b86c26e

Browse files
authored
Merge pull request #192 from gridap/fix_1d_cartesian_grid
Small bugfix in 1d CartesianGrid
2 parents e25ccbe + 86b81a3 commit b86c26e

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

src/Geometry/CartesianGrids.jl

+6
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,12 @@ end
9898
getindex!(cache,a,Tuple(ci)...)
9999
end
100100

101+
@inline function getindex!(v,a::CartesianCellNodes{1},i::Integer)
102+
v[1] = i
103+
v[2] = i+1
104+
v
105+
end
106+
101107
@inline function getindex!(v,a::CartesianCellNodes{D},i::Integer...) where D
102108
nodes = LinearIndices(size(a).+1)
103109
lnodes = CartesianIndices(tfill(2,Val{D}()))

test/GeometryTests/CartesianGridsTests.jl

+6
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,12 @@ using Gridap.Fields
1010
using Gridap.Geometry
1111
using Gridap.ReferenceFEs
1212

13+
domain = (0,1)
14+
partition = (1,)
15+
grid = CartesianGrid(domain,partition)
16+
test_grid(grid)
17+
test_grid(UnstructuredGrid(grid))
18+
1319
domain = (0.0,1.0,-1.0,2.0)
1420
partition = (3,4)
1521

0 commit comments

Comments
 (0)