From 73997e58fdf17d77a7b8e6f73675895d8e5693e5 Mon Sep 17 00:00:00 2001 From: Max Orok <morok@mevex.com> Date: Tue, 27 Aug 2019 15:06:32 -0400 Subject: [PATCH] Use the new field::fromView function to clean up background mesh setup --- demos/api/t17.py | 10 ++-------- demos/api/t7.py | 6 +----- 2 files changed, 3 insertions(+), 13 deletions(-) diff --git a/demos/api/t17.py b/demos/api/t17.py index 5e4ef13c8c..8cea479532 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 77542a4869..699cfac628 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) -- GitLab