diff --git a/demos/api/t17.py b/demos/api/t17.py index 5e4ef13c8c7c6c22604ce3ade224bd0d10a45c89..8cea47953262f1ba32e55f383dfb85f794cae683 100644 --- a/demos/api/t17.py +++ b/demos/api/t17.py @@ -28,14 +28,8 @@ factory.synchronize() # add a post-processing view to use as a size field gmsh.merge("t17.pos") -field = gmsh.model.mesh.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) +bg_field = model.mesh.field.fromView(0) +model.mesh.field.setAsBackgroundMesh(bg_field) # use bamg gmsh.option.setNumber("Mesh.SmoothRatio", 3) diff --git a/demos/api/t7.py b/demos/api/t7.py index 77542a4869ace4b1210ee8e0d16ed063a7e1bbb3..699cfac62823fc05c3265d1e7e32defbae861b45 100644 --- a/demos/api/t7.py +++ b/demos/api/t7.py @@ -36,11 +36,7 @@ gmsh.merge("bgmesh.pos") field = gmsh.model.mesh.field # add the post-processing view as a new size field -bg_field = field.add("PostView") -# 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 +bg_field = field.fromView(0) field.setAsBackgroundMesh(bg_field) gmsh.model.mesh.generate(2)