Skip to content

query element dimensionality? #788

@jaredmagnusson

Description

@jaredmagnusson

Hello, I've been using Exodus' python API, and I was curious if there's a way to get the dimensionality for an arbitrary element block?

I think it'd be helpful when loading an arbitrary mesh and iterating over blocks to be able to discern quickly which element types are 3D volumes, which are 2D (faces), etc.

Something like

block_id: int = ...  # some block you've iterated upon
dim: int = mesh.elem_dim(block_id)  # returns 2 for 2D, 3 for 3D, etc

Right now a workaround I've found is

elem_type:str = mesh.elem_type(block_id).decode()
elements_3d = ["HEX8", "TETRA4" ...]  # various 3D elements
elements_2d = ["QUAD4", ...]  #  2D elements
if elem_type in elements_3d:
    dim = 3
elif ...

Is there a less verbose manner of achieving this result already using the API?

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