elType¶
Module Contents¶
The elType module provides the elType class, which stores information about an Abaqus element type.
- class elType.elType(name, numNodes, solvers='', description='')¶
Bases:
objectThe
elTypeclass stores information about a particular Abaqus element type.- __init__(name, numNodes, solvers, description='')¶
Initializes attributes of the
elTypeclass.At the moment,
numNodesis the only attribute used byinpRW. The other attributes are provided for the user’s convenience.If numNodes is an integer, it will be stored to
numNodes. If numNodes is a set, it will be stored tonumNodesSet.- Parameters:
name (str) – The name of the element type.
numNodes (int or set) – The number of nodes needed to define the element. This is either an integer or a set of integers if the element type can have a varying number of nodes.
solvers (str) – A string indicating which Abaqus solvers support the element type. ‘S’ for Standard, ‘E’ for Explicit, and ‘SE’ for both.
description (str) – The description string for the element type, taken from the Abaqus documentation.
Examples
Here’s the basic usage of the class:
>>> from elType import elType >>> elType('AC1D2', 2, 'S', ' 2-node acoustic link') elType(name='AC1D2', numNodes=2, solvers='S', description=' 2-node acoustic link')
If numNodes is a set, you need to use the
numNodesSetattribute instead ofnumNodes:>>> elType1 = elType('C3D15V', {16, 17, 18, 15}, 'S', ' 15 to 18-node triangular prism') >>> l = list(elType1.numNodesSet) >>> l.sort() >>> l [15, 16, 17, 18]
- description¶
The description string for the element type, taken from the Abaqus documentation.
- Type:
- solvers¶
A string indicating which Abaqus solvers support the element type. ‘S’ for Standard, ‘E’ for Explicit, and ‘SE’ for both.
- Type:
- __getattr__(name)¶
Overrides the default attribute retrieval behavior for cases where
numNodesis not defined.This function raises an
AttributeErrorguiding users towards thenumNodesSetattribute ifnumNodesdoes not exist.See
__getattr__()for more information.- Parameters:
name (str) – The attribute name.
- Raises:
Examples
Here’s an example of trying to retrieve
numNodesif it doesn’t exist:>>> from elType import elType >>> elType1 = elType('C3D15V', {16, 17, 18, 15}, 'S', ' 15 to 18-node triangular prism') >>> elType1.numNodes Traceback (most recent call last): ... AttributeError: elType object has no attribute 'numNodes'. Use 'numNodesSet' instead...
The error is slightly different for any other attribute:
>>> elType1.test Traceback (most recent call last): ... AttributeError: elType object has no attribute 'test'.
- __repr__()¶
Produces a repr of the
elTypeinstance.If the instance includes
numNodesSet, this will be reported as numNodes.- Returns:
str
Examples
Here’s a basic example:
>>> from elType import elType >>> elType('AC1D2', 2, 'S', ' 2-node acoustic link') elType(name='AC1D2', numNodes=2, solvers='S', description=' 2-node acoustic link')
If the instance has
numNodesSet, this will be listed as ‘numNodes’:>>> elType('C3D15V', {16, 17, 18, 15}, 'S', ' 15 to 18-node triangular prism') elType(name='C3D15V', numNodes={16, 17, 18, 15}, solvers='S', description=' 15 to 18-node triangular prism')
- __str__()¶
Produces a string of the
elTypeinstance.Produces an identical string as
__repr__().- Returns:
str
Examples
>>> from elType import elType >>> str(elType(name='C3D8R', numNodes=8, solvers='SE')) "elType(name='C3D8R', numNodes=8, solvers='SE', description='')"
- __weakref__¶
list of weak references to the object (if defined)