Skip to content

toc object returned from python interface not iterable or introspectable #372

Open

Description

@markcmiller86

In the python interface, DBGetToc() returns a toc object that that object is useless except to print. A program needs to be able to iterate over it, introspect it, etc.

Activity

  1. markcmiller86 commented on Apr 25, 2024

    @markcmiller86
    MemberAuthor

    So, it looks like this is possible...

    >>> x=db.GetToc()
    >>> print(x)
    nvar = 30
    var_names = (_fileinfo, _meshtv_defvars, _meshtvinfo, _silolibinfo, cycle, dx_data, dy_data, dz_data, fl_nodelist, fl_shapecnt, fl_shapesize, fl_zoneno, mat1_dims, mat1_matlist, mat1_matnos, mesh1_align_nodal, mesh1_align_zonal, mesh1_coord0, mesh1_coord1, mesh1_coord2, mesh1_max_extents, mesh1_min_extents, t_data, time, u_data, v_data, w_data, zl_nodelist, zl_shapecnt, zl_shapesize)
    nucdmesh = 1
    ucdmesh_names = (mesh1)
    nobj = 2
    obj_names = (fl, zl)
    nucdvar = 7
    ucdvar_names = (dx, dy, dz, t, u, v, w)
    nmat = 1
    mat_names = (mat1)
     
     
    >>> type(x)
    <type 'DBtoc'>
    >>> dir(x)
    []
    >>> x.nvar
    30
    >>> x.var_names
    ('_fileinfo', '_meshtv_defvars', '_meshtvinfo', '_silolibinfo', 'cycle', 'dx_data', 'dy_data', 'dz_data', 'fl_nodelist', 'fl_shapecnt', 'fl_shapesize', 'fl_zoneno', 'mat1_dims', 'mat1_matlist', 'mat1_matnos', 'mesh1_align_nodal', 'mesh1_align_zonal', 'mesh1_coord0', 'mesh1_coord1', 'mesh1_coord2', 'mesh1_max_extents', 'mesh1_min_extents', 't_data', 'time', 'u_data', 'v_data', 'w_data', 'zl_nodelist', 'zl_shapecnt', 'zl_shapesize')
    >>> x.nobj
    2
    >>> x.nmat
    1
    >>> x.mat_names
    ('mat1',)
    >>> x.nucdvar
    7
    

    I think the issue is that dir() and help() don't produce useful output for a DBtoc() object.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions