Skip to content

Commit

Permalink
Merge branch 'master' of github.com:gridap/GridapGmsh.jl into reorder…
Browse files Browse the repository at this point in the history
…_local_numbering_for_quad_and_hex
  • Loading branch information
Jesus Bonilla committed Sep 21, 2020
2 parents 6e70a00 + 4245e1c commit e249ec0
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/GmshDiscreteModels.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ const D3=3
const POINT=15
const UNSET = 0

function GmshDiscreteModel(mshfile)
function GmshDiscreteModel(mshfile; renumber=false)
@check_if_loaded
if !isfile(mshfile)
error("Msh file not found: $mshfile")
Expand All @@ -12,7 +12,10 @@ function GmshDiscreteModel(mshfile)
gmsh.initialize()
gmsh.option.setNumber("General.Terminal", 1)
gmsh.open(mshfile)


renumber && gmsh.model.mesh.renumberNodes()
renumber && gmsh.model.mesh.renumberElements()

grid, cell_to_entity = _setup_grid(gmsh)
grid_topology = UnstructuredGridTopology(grid)
labeling = _setup_labeling(gmsh,grid,grid_topology,cell_to_entity)
Expand Down
4 changes: 4 additions & 0 deletions test/GmshDiscreteModelsTests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ mshfile = joinpath(@__DIR__,"t1.msh")
model = GmshDiscreteModel(mshfile)
test_discrete_model(model)

mshfile = joinpath(@__DIR__,"twoTetraeder.msh")
model = GmshDiscreteModel(mshfile; renumber=true)
test_discrete_model(model)

mshfile = joinpath(@__DIR__,"..","demo","demo.msh")
model = GmshDiscreteModel(mshfile)
test_discrete_model(model)
Expand Down
38 changes: 38 additions & 0 deletions test/twoTetraeder.msh
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
$MeshFormat
4.1 0 8
$EndMeshFormat
$PhysicalNames
2
3 1 "Solid_1"
3 2 "Solid_2"
$EndPhysicalNames
$Entities
0 1 1 2
0 -100 -100 -100 100 100 100 0 0
0 -100 -100 -100 100 100 100 0 0
6 -100 -100 -100 100 100 100 1 1 0
7 -100 -100 -100 100 100 100 1 2 0
$EndEntities
$Nodes
3 5 1 5
1 0 0 5
1
2
3
4
5
100 100 -100
100 -100 100
-33.33333333333331 -33.33333333333331 -33.33333333333331
-100 100 100
100 100 100
3 6 0 0
3 7 0 0
$EndNodes
$Elements
2 2 11 18
3 6 4 1
11 4 2 3 1
3 7 4 1
18 5 2 4 1
$EndElements

0 comments on commit e249ec0

Please sign in to comment.