Skip to content

Commit

Permalink
Adding NLIST methods and unit tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
germa89 committed Oct 13, 2022
1 parent b88ace5 commit b850da4
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 1 deletion.
15 changes: 14 additions & 1 deletion src/ansys/mapdl/core/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
# Some of them are not documented (already deprecated?)
# So they are not in the Mapdl class,
# so they won't be wrapped.
CMD_LISTING = [
CMD_RESULT_LISTING = [
"NLIN", # not documented
"PRCI",
"PRDI", # Not documented.
Expand Down Expand Up @@ -83,6 +83,19 @@

CMD_BC_LISTING = ["FLIS", "DLIS"]

CMD_ENTITY_LISTING = [
"NLIS",
# "ELIS", # To be implemented later
# "KLIS",
# "LLIS",
# "ALIS",
# "VLIS",
]

CMD_LISTING = []
CMD_LISTING.extend(CMD_ENTITY_LISTING)
CMD_LISTING.extend(CMD_RESULT_LISTING)

# Adding empty lines to match current format.
docstring_injection = """
Returns
Expand Down
13 changes: 13 additions & 0 deletions tests/test_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -657,3 +657,16 @@ def test_string_with_literal():
assert output.__repr__() == output
assert output.__repr__() == base_
assert len(output.split()) == 2


def test_nlist_to_array(mapdl, beam_solve):
# This kinternal include the internal points, so it matches the
# number of nodes with midside nodes.
nlist = mapdl.nlist(kinternal="internal")
assert isinstance(nlist.to_list(), list)
assert isinstance(nlist.to_array(), np.ndarray)

# above asserts should be removed once fixed the midside issue.
assert len(nlist.to_list()) == len(mapdl.mesh.nodes)
assert len(nlist.to_array()) == len(mapdl.mesh.nodes)
assert np.allclose(nlist.to_array()[:, 1:4], mapdl.mesh.nodes)

0 comments on commit b850da4

Please sign in to comment.