Skip to content

Commit

Permalink
Clean-up Element.__str__
Browse files Browse the repository at this point in the history
  • Loading branch information
PProfizi committed Jul 11, 2023
1 parent 460f16a commit 5dd01b4
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions src/ansys/dpf/core/elements.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@
Elements
========
"""
from __future__ import annotations
from enum import Enum
import numpy as np
from ansys.dpf.core import nodes, scoping
from ansys.dpf.core import nodes
from ansys.dpf.core.common import locations, elemental_properties
from ansys.dpf.core.element_descriptor import ElementDescriptor
from ansys.dpf.gate import integral_types
Expand Down Expand Up @@ -139,21 +140,21 @@ def n_nodes(self) -> int:
return len(self._nodes)

def __str__(self):
txt = "DPF Element %d\n" % self.id
txt += "\tIndex: %7d\n" % self.index
txt += "\tNodes: %7d\n" % self.n_nodes
txt += f"\tType: {self.type}\n"
txt += "\tShape: %7s\n" % self.shape.capitalize()
txt = f"DPF Element {self.id:d}\n"
txt += f"\tIndex:{self.index:>13}\n"
txt += f"\tNodes:{self.n_nodes:>13}\n"
txt += f"\tType:{self.type.name:>14}\n"
txt += f"\tShape:{self.shape.capitalize():>13}\n"
return txt

@property
def type(self) -> int:
def type(self) -> element_types:
"""
Type of the element.
Returns
-------
int
element_types
Type of the element. For more information, see
:class:`ansys.dpf.core.elements.element_types`.
Expand Down

0 comments on commit 5dd01b4

Please sign in to comment.