diff --git a/src/GmshDiscreteModels.jl b/src/GmshDiscreteModels.jl index a041afe..f4b4150 100644 --- a/src/GmshDiscreteModels.jl +++ b/src/GmshDiscreteModels.jl @@ -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") @@ -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) diff --git a/test/GmshDiscreteModelsTests.jl b/test/GmshDiscreteModelsTests.jl index 77cc083..95b1e4f 100644 --- a/test/GmshDiscreteModelsTests.jl +++ b/test/GmshDiscreteModelsTests.jl @@ -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) diff --git a/test/twoTetraeder.msh b/test/twoTetraeder.msh new file mode 100644 index 0000000..e07d2f6 --- /dev/null +++ b/test/twoTetraeder.msh @@ -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