Skip to content

Commit

Permalink
Merge pull request #54 from chmerdon/master
Browse files Browse the repository at this point in the history
fix negative CellVolumes for grids from 3D simplexgrid constructor
  • Loading branch information
j-fu authored Jul 19, 2024
2 parents 4badf7b + 8295ca8 commit df57a32
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
6 changes: 3 additions & 3 deletions src/simplexgrid.jl
Original file line number Diff line number Diff line change
Expand Up @@ -477,11 +477,11 @@ function simplexgrid(_X::AbstractVector,_Y::AbstractVector,_Z::AbstractVector;
p111 = ip+1+nx+nxy;

icell=icell+1; @. cellnodes[:,icell]=(p000,p100,p110,p111)
icell=icell+1; @. cellnodes[:,icell]=(p000,p100,p101,p111)
icell=icell+1; @. cellnodes[:,icell]=(p000,p101,p100,p111)
icell=icell+1; @. cellnodes[:,icell]=(p000,p010,p011,p111)
icell=icell+1; @. cellnodes[:,icell]=(p000,p010,p110,p111)
icell=icell+1; @. cellnodes[:,icell]=(p000,p110,p010,p111)
icell=icell+1; @. cellnodes[:,icell]=(p000,p001,p101,p111)
icell=icell+1; @. cellnodes[:,icell]=(p000,p001,p011,p111)
icell=icell+1; @. cellnodes[:,icell]=(p000,p011,p001,p111)
end
end
end
Expand Down
2 changes: 1 addition & 1 deletion test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -416,7 +416,7 @@ end
sha256(f)
end |> bytes2hex

@test sha_code == "93a31139ccb3ae3017351d7cef0c2639c5def97c9744699543fe8bc58e1ebcea"
@test sha_code == "f7e86e426aa6673699bd470f6db328a177eabdee74c71cfa6a855a2507b4f1bb"
end


Expand Down
3 changes: 2 additions & 1 deletion test/test_gridstuff.jl
Original file line number Diff line number Diff line change
Expand Up @@ -154,14 +154,15 @@ function run_grid_tests()

X = LinRange(0, 1, 10)
grid = simplexgrid(X, X)
@test all(grid[CellVolumes] .> 0)
sub = subgrid(grid, [2], transform=function(a,b) a[1]=b[2] end, boundary=true)
@test check_cellfinder(sub)

grid = simplexgrid(X, X, X)
@test all(grid[CellVolumes] .> 0)
sub = subgrid(grid, [5], boundary=true)
@test check_cellfinder(sub)



@test check_uniform_refinement(reference_domain(Triangle2D), false)
@test check_uniform_refinement(reference_domain(Triangle2D), true)
Expand Down

0 comments on commit df57a32

Please sign in to comment.