Skip to content
Snippets Groups Projects
Commit 73997e58 authored by Max Orok's avatar Max Orok
Browse files

Use the new field::fromView function to clean up background mesh setup

parent f16305bb
No related branches found
No related tags found
1 merge request!270Add more python tutorials
Pipeline #4668 failed
...@@ -28,14 +28,8 @@ factory.synchronize() ...@@ -28,14 +28,8 @@ factory.synchronize()
# add a post-processing view to use as a size field # add a post-processing view to use as a size field
gmsh.merge("t17.pos") gmsh.merge("t17.pos")
field = gmsh.model.mesh.field bg_field = model.mesh.field.fromView(0)
model.mesh.field.setAsBackgroundMesh(bg_field)
# The field is of type "PostView"
bg_field = field.add("PostView")
# "IView" is the index of the view you want to use.
field.setNumber(bg_field, "IView", 0)
# set the field as a background mesh
field.setAsBackgroundMesh(bg_field)
# use bamg # use bamg
gmsh.option.setNumber("Mesh.SmoothRatio", 3) gmsh.option.setNumber("Mesh.SmoothRatio", 3)
......
...@@ -36,11 +36,7 @@ gmsh.merge("bgmesh.pos") ...@@ -36,11 +36,7 @@ gmsh.merge("bgmesh.pos")
field = gmsh.model.mesh.field field = gmsh.model.mesh.field
# add the post-processing view as a new size field # add the post-processing view as a new size field
bg_field = field.add("PostView") bg_field = field.fromView(0)
# pass the view tag you want to use as a size field
field.setNumber(bg_field, "IView", 0)
# set the field as a background mesh
field.setAsBackgroundMesh(bg_field) field.setAsBackgroundMesh(bg_field)
gmsh.model.mesh.generate(2) gmsh.model.mesh.generate(2)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment