Skip to content

Instantly share code, notes, and snippets.

@shkiefer
Last active January 2, 2022 00:35
Show Gist options
  • Save shkiefer/0b72ac0c7e6e26ad0eb4649363ca07d3 to your computer and use it in GitHub Desktop.
Save shkiefer/0b72ac0c7e6e26ad0eb4649363ca07d3 to your computer and use it in GitHub Desktop.
# %%
# 1st result in results set
res_idx = 0
# last available 'time' index
tf_idx = len(tfs) - 1
# first component (if more than 1)
comp_idx = 0
result_info = model.metadata.result_info
res = result_info.available_results[res_idx]
res_op = dpf.Operator(res.operator_name)
res_op.inputs.data_sources.connect(model.metadata.data_sources)
res_op.inputs.time_scoping([tf_idx + 1])
if res.n_components == 1:
fields = res_op.outputs.fields_container()
elif res.n_components > 1:
res_op = dpf.Operator(res.operator_name)
res_op.inputs.data_sources.connect(model.metadata.data_sources)
res_op.inputs.time_scoping([tf_idx + 1])
comp_sel = dpf.operators.logic.component_selector_fc()
comp_sel.inputs.connect(res_op.outputs)
comp_sel.inputs.component_number.connect(comp_idx)
fields = comp_sel.outputs.fields_container()
f0 = fields[0]
mesh.plot(f0)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment