def test_render_3d(self): # if we don't have ascent, simply return info = ascent.about() if info["runtimes/ascent/vtkm/status"] != "enabled": return obase = "tout_python_ascent_render_3d" ofile = obase + "100.png" # clean up old results if they exist if os.path.isfile(ofile): os.remove(ofile) # create example mesh n_mesh = conduit.Node() conduit.blueprint.mesh.examples.braid("hexs", 10, 10, 10, n_mesh) # open ascent a = ascent.Ascent() a.open() a.publish(n_mesh) actions = conduit.Node() scenes = conduit.Node() scenes["s1/plots/p1/type"] = "pseudocolor" scenes["s1/plots/p1/field"] = "braid" scenes["s1/image_prefix"] = obase add_act = actions.append() add_act["action"] = "add_scenes" add_act["scenes"] = scenes a.execute(actions) a.close() self.assertTrue(os.path.isfile(ofile))
def test_render_flow_inspect(self): # if we don't have ascent, simply return info = ascent.about() if info["runtimes/ascent/status"] != "enabled": return flow.Workspace.register_builtin_filter_types() flow.Workspace.register_filter_type(flow.wrap_function(inspect)); # create example mesh n_mesh = conduit.Node() conduit.blueprint.mesh.examples.braid("quads", 10, 10, 0, n_mesh) # open ascent a = ascent.Ascent() open_opts = conduit.Node() open_opts["runtime/type"].set("flow") a.open(open_opts) a.publish(n_mesh) actions = conduit.Node() add_py = actions.append() add_py["action"] = "add_filter"; add_py["type_name"] = "ensure_python"; add_py["name"] = "py"; add_ins = actions.append() add_ins["action"] = "add_filter"; add_ins["type_name"] = "inspect"; add_ins["name"] = "my_inspect"; conn_py = actions.append() conn_py["action"] = "connect"; conn_py["src"] = "source"; conn_py["dest"] = "py"; conn_ins = actions.append() conn_ins["action"] = "connect"; conn_ins["src"] = "py"; conn_ins["dest"] = "my_inspect"; print(actions) actions.append()["action"] = "execute" # this will fail for static libs case # b/c the py libs are still dynamic, and they each # link their own static copy of flow try: a.execute(actions) except RuntimeError as e: if not e.message.count("ensure_python") > 0: raise(e) a.close()
# ############################################################################### """ file: ascent_first_light_example.py description: Demonstrates using ascent to render a pseudocolor plot. """ import conduit import conduit.blueprint import ascent # print details about ascent print(ascent.about().to_yaml()) # create conduit node with an example mesh using conduit blueprint's braid function # ref: https://llnl-conduit.readthedocs.io/en/latest/blueprint_mesh.html#braid # things to explore: # changing the mesh resolution mesh = conduit.Node() conduit.blueprint.mesh.examples.braid("hexs", 50, 50, 50, mesh) # create an Ascent instance a = ascent.Ascent() # set options to allow errors propagate to python ascent_opts = conduit.Node()
# ############################################################################### """ file: ascent_python_render_example.py description: Demonstrates using ascent to render a pseudocolor plot. """ import conduit import conduit.blueprint import ascent # print details about ascent print(ascent.about()) # open ascent a = ascent.Ascent() a.open() # create example mesh using conduit blueprint n_mesh = conduit.Node() conduit.blueprint.mesh.examples.braid("hexs", 10, 10, 10, n_mesh) # publish mesh to ascent a.publish(n_mesh) # declare a scene to render the dataset scenes = conduit.Node() scenes["s1/plots/p1/type"] = "pseudocolor" scenes["s1/plots/p1/field"] = "braid"
def test_about(self): print(ascent.about()) s = ascent.Ascent()