mesh¶
Module Contents¶
The mesh module contains classes that store node and element data.
- class mesh.Node(dataline='', label=None, data=None, elements=None, _joinS=', ', _ParamInInp=False, preserveSpacing=True, useDecimal=True)¶
Bases:
objectThe Node class stores nodal information from a single node (i.e. one dataline from a *NODE keyword block).
- __init__(dataline='', elements=None, _ParamInInp=False, preserveSpacing=True, useDecimal=True)¶
- __init__(label=None, data=None, elements=None, _joinS=', ') None
Initializes attributes of the Node.
In most cases, this will be used by
_parseDataNode(). That function will handle creating the inputs to this class from the string corresponding to the node dataline. See that function for an example of instancing this class. If you are instancing this class manually, there are two recommended options.First, specify the dataline parameter and the other related parameters if you know them prior to creating the
Nodeinstance and/or do not wish to use the default values. dataline will be parsed, andlabelanddatawill be populated from the parsed information.Here’s an example using the default settings, which will use
inpInt,inpDecimal.inpDecimal, andinpStringto store data items and preserve the exact spacing:>>> from mesh import Node >>> dataline = ' 21, 70.00, 0.00' >>> node = Node(dataline) >>> node Node(label=inpInt(' 21'), data=[inpInt(' 21'), inpDecimal(' 70.00'), inpDecimal(' 0.00')], elements=[])
The
repr()of anNodeinstance is consistent across the different methods to instantiate the class. If you wish to see how theNodewill be written out, you can use a function to call its string representation. For example:>>> print(node) 21, 70.00, 0.00
Here’s an example of turning off the mechanisms for preserving the exact spacing (for a performance benefit):
>>> node = Node(dataline, preserveSpacing=False, useDecimal=False) >>> print(node) 21, 70.0, 0.0
We can also specify a custom separator to join the parsed strings when we create a string of the node. This will only be applied if preserveSpacing and useDecimal are False. Example:
>>> node = Node(dataline, _joinS = ',__', preserveSpacing=False, useDecimal=False) >>> print(node) 21,__70.0,__0.0
If an item in dataline could be a *PARAMETER reference, either _ParamInInp or preserveSpacing must be True, or else a
ValueErrorwill be raised. Example:>>> dataline = ' 21, <coord>, 0.00' >>> node = Node(dataline, preserveSpacing=False, useDecimal=False) Traceback (most recent call last): ... ValueError: could not convert string to float: ' <coord>'
The second option is to specify label and data instead of dataline. Those items should be formatted properly prior to instancing
Node. Example:>>> label = 21 >>> data = [21, 70.0, 0.00] >>> node = Node(label=label, data=data) >>> print(node) 21, 70.0, 0.0
Using either method, elements can be specified if the user knows the list of elements which connect to the node. In most cases, this should not be specified, and the elements connected to the node should instead be added using
setConnectedNodes().- Parameters:
dataline (str) – The string which contains the entire dataline for the node. Will be parsed to populate the
node'sattributes. Defaults to ‘’label (int) – The label for the node. Defaults to None.
data (list) – The data for the node. This will be a parsed dataline. The format should be [
int,float,float, …]. Defaults to None.elements (list) – The elements which are connected to the
Nodeinstance. Defaults to None._joinS (str) – The string used to join the data items together when creating strings of the
Nodeinstance. Defaults ‘, ‘._ParamInInp (bool) – Indicates if *PARAMETER is in the input file, which would mean that the dataline items could be strings instead of exclusively integers. Defaults to False.
preserveSpacing (bool) – If True, the exact spacing of all items will be preserved by using
inpInt. In most cases when creating newElementinstances, you will want to use the same value that the rest of the input file was parsed with. Defaults to True.useDecimal (bool) – If True, any floating point numbers will be parsed as
DecimalorinpDecimal. In most cases when creating newElementinstances, you will want to use the same value that the rest of the input file was parsed with. Defaults to True.
- _ParamInInp¶
Indicates if *PARAMETER is in the input file. If True, data items could be references to *PARAMETER functions, and the datalines might be strings, so the :func:’~eval2.eval2’ function must be used when parsing data items instead of assuming they must be integers. Defaults to False.
- Type:
- preserveSpacing¶
If True, the exact spacing of all items will be preserved by using
inpIntinstead ofint._joinSwill be set to ‘,’ if preserveSpacing is True, as the spacing will be stored in the data objects. Defaults to True.- Type:
- useDecimal¶
If True, any floating point numbers will be parsed as
DecimalorinpDecimal. Defaults to True.
- _joinS¶
The string used to join data items together when creating a string for the entire dataline. Defaults to ‘, ‘, which will be sufficient for most cases.
- Type:
- elements¶
Will store the elements that reference this
Node. This is populated byElement.setConnectedNodes().- Type:
- _parseDataLine(dataline)¶
Populates the
Nodeinstance by parsing the dataline string.This function will be called automatically when
Nodeis initialized if datalines is specified.Example usage:
>>> from mesh import Node >>> node = Node() >>> node._parseDataLine(' 21, 70.00, 0.00') >>> node Node(label=inpInt(' 21'), data=[inpInt(' 21'), inpDecimal(' 70.00'), inpDecimal(' 0.00')], elements=[])
- Parameters:
dataline (str) – A string containing the information for the entire dataline.
- _mergeElementData(other)¶
Currently unused
- updateElements(ed)¶
Checks if each element in
elementsexists in ed. Returns 0 ifelementsis empty, 1 if elements have been removed, or 2 if no changes were made.
- __repr__()¶
Produces a repr of the Node.
Example
>>> from mesh import Node >>> Node(' 21, 70.00, 0.00') Node(label=inpInt(' 21'), data=[inpInt(' 21'), inpDecimal(' 70.00'), inpDecimal(' 0.00')], elements=[])
- __str__()¶
Produces a str of the dataline for the Node.
Example
>>> from mesh import Node >>> node = Node(' 21, 70.00, 0.00') >>> print(node) 21, 70.00, 0.00
- __weakref__¶
list of weak references to the object (if defined)
- class mesh.Element(eltype, numNodes=None, datalines=None, label=None, data=None, _lineEnd=None, _npll=None, _joinS=', ', _ParamInInp=False, preserveSpacing=True, useDecimal=True, _checkNumNodes=True, _nl='\n')¶
Bases:
objectThe Element class stores element information from a single element (i.e. one dataline from a *ELEMENT keyword block).
- __init__(eltype, numNodes=None, datalines=None, ', _ParamInInp=False, preserveSpacing=True, useDecimal=True, _checkNumNodes=True, _nl='\n')¶
- __init__(eltype, numNodes=None, label=None, data=None, _lineEnd=None, _npll=None, _joinS=', ') None
Initializes attributes of the Element.
In most cases, this will be used by
_parseDataElement(). That function will handle creating the inputs to this class from the string corresponding to the element dataline. See that function for more details. If you are instancing this class manually, you can omit specifying the private parameters. The default values should be sufficient.All parameters are optional except eltype, but there are two recommend methods to create an instance of this class. The first method is to specify datalines and allow
Elementto parse these datalines to populatelabelanddata. Here is an example of this use case with a CPS4R element:>>> from mesh import Element >>> datalines = ' 1, 1, 2, 102, 101' >>> element = Element(eltype='CPS4R', datalines=datalines) >>> element Element(label=inpInt(' 1'), data=[inpInt(' 1'), inpInt(' 1'), inpInt(' 2'), inpInt(' 102'), inpInt(' 101')], eltype='CPS4R', numNodes=4)
The
repr()of anElementinstance is consistent across the different methods to instantiate the class. If you wish to see how theElementwill be written out, you can use a function to call its string representation. For example:>>> print(element) 1, 1, 2, 102, 101
Here’s a similar example with an element defined over multiple lines:
>>> datalines = [' 1, 16, 4, 24, 57, 13, 1, 32, 66, 92, 91, 90, 89, 93, 94, 95,', ... ' 96, 98, 97, 99, 100'] >>> Element(eltype='C3D20', datalines=datalines) Element(label=inpInt(' 1'), data=[inpInt(' 1'), inpInt(' 16'), inpInt(' 4'), inpInt(' 24'), inpInt(' 57'), inpInt(' 13'), inpInt(' 1'), inpInt(' 32'), inpInt(' 66'), inpInt(' 92'), inpInt(' 91'), inpInt(' 90'), inpInt(' 89'), inpInt(' 93'), inpInt(' 94'), inpInt(' 95'), inpInt(' 96'), inpInt(' 98'), inpInt(' 97'), inpInt(' 99'), inpInt(' 100')], eltype='C3D20', numNodes=20)
We can also specify datalines as a single string with newline characters. Example:
>>> datalines = ' 1, 16, 4, 24, 57, 13, 1, 32, 66, 92, 91, 90, 89, 93, 94, 95,\n 96, 98, 97, 99, 100' >>> Element(eltype='C3D20', datalines=datalines) Element(label=inpInt(' 1'), data=[inpInt(' 1'), inpInt(' 16'), inpInt(' 4'), inpInt(' 24'), inpInt(' 57'), inpInt(' 13'), inpInt(' 1'), inpInt(' 32'), inpInt(' 66'), inpInt(' 92'), inpInt(' 91'), inpInt(' 90'), inpInt(' 89'), inpInt(' 93'), inpInt(' 94'), inpInt(' 95'), inpInt(' 96'), inpInt(' 98'), inpInt(' 97'), inpInt(' 99'), inpInt(' 100')], eltype='C3D20', numNodes=20)
If we set preserveSpacing, useDecimal, and _ParamInInp all to False, we gain some performance at the expense of some formatting accuracy. See the difference below:
>>> datalines = ' 1, 16, 4, 24, 57, 13, 1, 32, 66, 92, 91, 90, 89, 93, 94, 95,\n 96, 98, 97, 99, 100' >>> print(Element(eltype='C3D20', datalines=datalines, preserveSpacing=False, useDecimal=False)) 1, 16, 4, 24, 57, 13, 1, 32, 66, 92, 91, 90, 89, 93, 94, 95, 96, 98, 97, 99, 100 >>> print(Element(eltype='C3D20', datalines=datalines)) 1, 16, 4, 24, 57, 13, 1, 32, 66, 92, 91, 90, 89, 93, 94, 95, 96, 98, 97, 99, 100
The second method is to instead specify label and data directly. We will need to get the data into a suitable form prior to inserting it into the
Elementinstance. You will use this option most often if you are creating new elements and do not start with a string containing the entire element definition. Example usage:>>> label = 1 >>> data = [1, 16, 4, 24, 57, 13, 1, 32, 66, 92, 91, 90, 89, 93, 94, 95, 96, 98, 97, 99, 100] >>> element = Element(eltype='C3D20', label=label, data=data) >>> print(element) 1, 16, 4, 24, 57, 13, 1, 32, 66, 92, 91, 90, 89, 93, 94, 95, 96, 98, 97, 99, 100
If you don’t specify the number of nodes to include per each line via _npll, there will be 16 items per line.
We can also specify the strings used to join data items (_joinS), and a string to include at the end of each line (_lineEnd). This should normally be whitespace characters, but different characters are used here for illustrative purposes:
>>> element = Element(eltype='C3D20', label=label, data=data, _lineEnd=['++', None], _joinS = ',_') >>> print(element) 1,_16,_4,_24,_57,_13,_1,_32,_66,_92,_91,_90,_89,_93,_94,_95,++ 96,_98,_97,_99,_100
- Parameters:
eltype (str) – The element type name. Should be a valid Abaqus element type name, or the name of a user-element.
numNodes (int) – The number of nodes the element needs. If not specified, this will be retrieved from
_elementTypeDictionary[eltype]. This should only be specified if an element type is not in that dictionary, which will mainly be for user or substructure elements.datalines (list, str) – A list of strings representing the datalines for the
Element. This can also be a string representing the entirety of the data for the element, with new line characters if the definition is spread across multiple lines. Defaults to None.label (int) – The label for the element. Defaults to None.
data (list) – The data for the element. This will be a parsed dataline. The format should be [
int,int, …]._lineEnd (str, list) – Holds any additional whitespace characters to include at the end of the dataline. Mainly used to exactly reproduce the string representation of the keyword block. Defaults to None. If the data must be printed across multiple lines, _lineEnd will be expanded to a list if necessary, with each item in the list corresponding to the old value of
_lineEnd. If a _lineEnd item is None, nothing will be added to the end of that line. If a _lineEnd item is a string, the _lineEnd item will follow a comma on the effected line._npll (list) – Nodes Per Line List, controls how many nodes should be printed on each line when converting the Element to a string. The default value of None will cause the maximum number of nodes to be printed on each line (up to 15 for line 0, and up to 16 for all subsequent lines).
_joinS (str) – The string used to join the data items together when creating strings of the
Elementinstance. Defaults to None, which will use ‘, ‘. If preserveSpacing is True and datalines is not None, ‘,’ will be used._ParamInInp (bool) – Indicates if *PARAMETER is in the input file, which would mean that the dataline items could be strings instead of exclusively integers. Defaults to False.
preserveSpacing (bool) – If True, the exact spacing of all items will be preserved by using
inpInt. In most cases when creating newElementinstances, you will want to use the same value that the rest of the input file was parsed with. Defaults to True.useDecimal (bool) – If True, any floating point numbers will be parsed as
DecimalorinpDecimal. In most cases when creating newElementinstances, you will want to use the same value that the rest of the input file was parsed with. Defaults to True._checkNumNodes (bool) – If True, the number of nodes parsed from datalines will be checked against
numNodes. If theElementhas the incorrect number of nodes, anElementIncorrectNodeNumErrorwill be raised. Defaults to True._nl (str) – Used to split datalines if it is a string. Defaults to ‘n’.
- _checknumNodes¶
If True, the number of nodes parsed from datalines will be checked against the number in
numNodes. Defaults to True.- Type:
- numNodes¶
The number of nodes needed for the Element. Can be specified by the user, or will be retrieved from
_elementTypeDictionary[eltype].- Type:
- _ParamInInp¶
Indicates if *PARAMETER is in the input file. If True, data items could be references to *PARAMETER functions, and the datalines might be strings, so the :func:’~eval2.eval2’ function must be used when parsing data items instead of assuming they must be integers. Defaults to False.
- Type:
- preserveSpacing¶
If True, the exact spacing of all items will be preserved by using
inpIntinstead ofint. Defaults to True.- Type:
- _nl¶
Used to split datalines if it is a string. Defaults to ‘n’, which should be correct for most cases.
- Type:
- useDecimal¶
If True, any floating point numbers will be parsed as
DecimalorinpDecimal. Defaults to True.- Type:
- _joinS¶
The string used to join the data items together when creating strings of the
Elementinstance.- Type:
- data¶
The data for the element. This will be a parsed dataline. The format should be [
int, …].- Type:
- _npll¶
Nodes Per Line List, controls how many nodes will be printed on each line when converting
Elementto a string.- Type:
- _lineEnd¶
Holds any additional whitespace characters to include at the end of the dataline.
- Type:
- checkNumberNodes()¶
checkNumberNodes()
This function will check if the number of nodes in
datamatches that specified innumNodes.It raises an
ElementIncorrectNodeNumErrorif the number of nodes does not match the element type requirements. Otherwise, it does nothing. This function will be called by_parseDataLines()if_checknumNodesis True (thus, it will be called ifElementis initialized with datalines and the default settings). It should be called manually if theElementis populated in another manner.Example
>>> from mesh import Element >>> element = Element(eltype='CPS4R', label=1, data=[1, 1, 2, 102, 101, 103]) >>> element.checkNumberNodes() Traceback (most recent call last): ... inpRWErrors.ElementIncorrectNodeNumError: ERROR! An element of type CPS4R must have 4 nodes.
- Raises:
- _parseDataLines(datalines)¶
Populates the
Elementinstance by parsing the strings in datalines.This function will also call
checkNumberNodes()if_checknumNodes= True. It is called automatically ifElementis instantiated with the datalines argument.Example usage:
>>> from mesh import Element >>> element = Element(eltype='CPS4R') >>> element._parseDataLines('1, 1, 2, 102, 101') >>> print(element) 1, 1, 2, 102, 101
- Parameters:
datalines (list) – A list of strings containing the information for the entire dataline.
- _parseDataLine(dataline, con=False)¶
Parses an individual *ELEMENT dataline. Meant to be used by
_parseDataLines().Example usage:
>>> from mesh import Element >>> dataline1 = ' 1, 16, 4, 24, 57, 13, 1, 32, 66, 92, 91, 90, 89, 93, 94, 95,' >>> dataline2 = ' 96, 98, 97, 99, 100' >>> element = Element(eltype='C3D20') >>> element._parseDataLine(dataline1) >>> element Element(label=inpInt(' 1'), data=[inpInt(' 1'), inpInt(' 16'), inpInt(' 4'), inpInt(' 24'), inpInt(' 57'), inpInt(' 13'), inpInt(' 1'), inpInt(' 32'), inpInt(' 66'), inpInt(' 92'), inpInt(' 91'), inpInt(' 90'), inpInt(' 89'), inpInt(' 93'), inpInt(' 94'), inpInt(' 95')], eltype='C3D20', numNodes=20) >>> element._parseDataLine(dataline2, con=True) >>> element Element(label=inpInt(' 1'), data=[inpInt(' 1'), inpInt(' 16'), inpInt(' 4'), inpInt(' 24'), inpInt(' 57'), inpInt(' 13'), inpInt(' 1'), inpInt(' 32'), inpInt(' 66'), inpInt(' 92'), inpInt(' 91'), inpInt(' 90'), inpInt(' 89'), inpInt(' 93'), inpInt(' 94'), inpInt(' 95'), inpInt(' 96'), inpInt(' 98'), inpInt(' 97'), inpInt(' 99'), inpInt(' 100')], eltype='C3D20', numNodes=20)
- _processDataLinesInput(datalines)¶
If datalines is a string, split datalines on
_nl, which will convert datalines to a string.This is called automatically by
_parseDataLines(), so the user will likely never need to call it directly.Example usage:
>>> from mesh import Element >>> element = Element(eltype='CPS4R') >>> element._processDataLinesInput(' 1, 1, 2, 102, 101') [' 1, 1, 2, 102, 101'] >>> element._processDataLinesInput(' 1, 16, 4, 24, 57, 13, 1, 32, 66, 92, 91, 90, 89, 93, 94, 95,\n 96, 98, 97, 99, 100') [' 1, 16, 4, 24, 57, 13, 1, 32, 66, 92, 91, 90, 89, 93, 94, 95,', ' 96, 98, 97, 99, 100']
- setConnectedNodes(nd)¶
This function will find each node in nd corresponding to the node labels in
dataand appendlabelto theelements.- Parameters:
nd (TotalMesh) – The TotalMesh instance containing the nodes for the input file.
- __repr__()¶
Produces a repr of the dataline for the Element.
Example usage:
>>> from mesh import Element >>> Element(eltype='CPS4R', datalines=' 1, 1, 2, 102, 101') Element(label=inpInt(' 1'), data=[inpInt(' 1'), inpInt(' 1'), inpInt(' 2'), inpInt(' 102'), inpInt(' 101')], eltype='CPS4R', numNodes=4)
- Returns:
string
- __str__()¶
Produces a str of the dataline for the Element.
Example usage:
>>> from mesh import Element >>> print(Element(eltype='CPS4R', datalines='1, 1, 2, 102, 101')) 1, 1, 2, 102, 101
- Returns:
string
- __weakref__¶
list of weak references to the object (if defined)
- class mesh.Mesh(data=None)¶
Bases:
csidThis class is a
csidused to store the data from a node keyword block.- __init__(data=None)¶
Initializes the class. In most cases, users should not directly instantiate this class. Rather, they should create a *NODE
inpKeywordinstance and allow that keyword block to handle the logistics.Example usage:
>>> from mesh import Node, Mesh >>> node1 = Node(' 1 , 0.00, 0.00') >>> node2 = Node(' 21, 70.00, 0.00') >>> Mesh([[i.label, i] for i in [node1, node2]]) csid(inpInt(' 1 '): Node(label=inpInt(' 1 '), data=[inpInt(' 1 '), inpDecimal(' 0.00'), inpDecimal(' 0.00')], elements=[]), inpInt(' 21'): Node(label=inpInt(' 21'), data=[inpInt(' 21'), inpDecimal(' 70.00'), inpDecimal(' 0.00')], elements=[]))
- Parameters:
data – data should be a format that can generate a
dictionary. Defaults to None, which will produce a blank object.
- __repr__()¶
Uses the default __repr__ method from
dict.Example usage:
>>> from mesh import Node, Mesh >>> node1 = Node(' 1 , 0.00, 0.00') >>> node2 = Node(' 21, 70.00, 0.00') >>> Mesh([[i.label, i] for i in [node1, node2]]) csid(inpInt(' 1 '): Node(label=inpInt(' 1 '), data=[inpInt(' 1 '), inpDecimal(' 0.00'), inpDecimal(' 0.00')], elements=[]), inpInt(' 21'): Node(label=inpInt(' 21'), data=[inpInt(' 21'), inpDecimal(' 70.00'), inpDecimal(' 0.00')], elements=[]))
- class mesh.MeshElement(eltype, data=None)¶
Bases:
MeshMeshElementis identical toMesh, except that it checks to make sure that every item added to it has the same element type.- __init__(eltype, data=None)¶
__init__(eltype, data=None)
Initializes the class. In most cases, users should not directly instantiate this class. Rather, they should create a *ELEMENT
inpKeywordinstance and allow that keyword block to handle the logistics.Example usage:
>>> from mesh import Element, MeshElement >>> element1 = Element(eltype='C3D20', datalines=' 1, 16, 4, 24, 57, 13, 1, 32, 66, 92, 91, 90, 89, 93, 94, 95,\n 96, 98, 97, 99, 100') >>> element2 = Element(eltype='C3D20', datalines=' 2, 15, 16, 57, 58, 14, 13, 66, 65, 103, 89, 102, 101, 104, 96, 105,\n 106, 107, 98, 100, 108') >>> mesh = MeshElement(eltype='C3D20', data=[[i.label, i] for i in [element1, element2]]) >>> mesh csid(inpInt(' 1'): Element(label=inpInt(' 1'), data=[inpInt(' 1'), inpInt(' 16'), inpInt(' 4'), inpInt(' 24'), inpInt(' 57'), inpInt(' 13'), inpInt(' 1'), inpInt(' 32'), inpInt(' 66'), inpInt(' 92'), inpInt(' 91'), inpInt(' 90'), inpInt(' 89'), inpInt(' 93'), inpInt(' 94'), inpInt(' 95'), inpInt(' 96'), inpInt(' 98'), inpInt(' 97'), inpInt(' 99'), inpInt(' 100')], eltype='C3D20', numNodes=20), inpInt(' 2'): Element(label=inpInt(' 2'), data=[inpInt(' 2'), inpInt(' 15'), inpInt(' 16'), inpInt(' 57'), inpInt(' 58'), inpInt(' 14'), inpInt(' 13'), inpInt(' 66'), inpInt(' 65'), inpInt(' 103'), inpInt(' 89'), inpInt(' 102'), inpInt(' 101'), inpInt(' 104'), inpInt(' 96'), inpInt(' 105'), inpInt(' 106'), inpInt(' 107'), inpInt(' 98'), inpInt(' 100'), inpInt(' 108')], eltype='C3D20', numNodes=20))
- Parameters:
eltype (str) – The string representing the Abaqus element type name.
data – data should be a format that can generate a
dictionary. Defaults to None, which will produce a blank object.
- __setitem__(label, element)¶
Checks if element.eltype matches
eltype. If it does, set MeshElement[label] = element, else raiseElementTypeMismatchError.Correct usage, the
eltypeof theElementmatches that of theMeshElement:>>> from mesh import Element, MeshElement >>> element1 = Element(eltype='C3D20', datalines=' 1, 16, 4, 24, 57, 13, 1, 32, 66, 92, 91, 90, 89, 93, 94, 95,\n 96, 98, 97, 99, 100') >>> mesh = MeshElement(eltype='C3D20', data=[[element1.label, element1]])
The class raises a
ElementTypeMismatchErrorif we try to add an element with a different eltype:>>> element2 = Element(eltype='CPS4R', datalines='1, 1, 2, 102, 101') >>> mesh[element2.label] = element2 Traceback (most recent call last): ... inpRWErrors.ElementTypeMismatchError: ERROR! An element of type CPS4R cannot be added to a MeshElement with eltype C3D20
- Parameters:
label (int) – The element label.
element (Element) – The
Elementto add to theMeshElement.
- Raises:
- class mesh.TotalMesh(_data=None)¶
Bases:
csidTotalMeshis a parent class, and not meant to be instantiated directly. Users should instead work with one of the sub-classes, which areTotalNodeMeshandTotalElementMesh.Users should not need to created instances of this class or the child classes directly. In most cases, they can rely on
inpKeywordSequenceto create and manage these instances.Every
inpKeywordSequencecontains attributes_ndand_ed, which areTotalNodeMeshandTotalElementMeshinstances, respectively. They provide a convenient method to access all the mesh and element data in an input file, without needing to navigate through multiple keyword blocks. These instances of the top-levelinpKeywordSequence(keywords) will be mapped tondanded.Any operations on items in this class will be propagated back to the data of the appropriate node and element
inpKeywordblocks.Items should not be directly deleted from a
TotalMesh, in most cases. The user should instead use a combination offindItemReferences()along withdeleteItemReferences()to delete these entities, as it will also find and delete all references to those entities throughout the input file.A function for replacing item references still needs to be written.
Items should not be added to this class directly. Rather, they should be added to
dataof a *NODE or *ELEMENT keyword block and added to this class viaupdateInp().- __init__(_data=None)¶
A
TotalMeshinstance holds all the nodes or elements for the children of aninpKeywordSequence. This class is meant to be initialized with _data = None. Data should be added to it viaupdate()using aMeshinstance.
- subMeshes¶
Will hold a shared memory reference to every
MeshorTotalMeshinstance which is a child of this object. This is thus a link to thedataattributes of the appropriate keyword blocks.- Type:
- removeEmptySubMeshes()¶
Deletes any
subMesheswhich are now empty. This will also delete theMeshinstance.
- renameKeys(mapping)¶
Renames all keys in the
TotalMeshinstance (d) as specified by mapping.d and each
subMeshwill be cleared and repopulated with the renamed keys to preserve the original order. Thus, this can be an expensive operation, so try to provide the entirety of the information to rename and call this function only once.
- update(other)¶
Adds the data from other to the
TotalMeshinstance (d), and tracks other insubMeshes.
- __delitem__(key)¶
Deletes key and value in self and in the subMesh.
- Parameters:
key – A valid hashable key. Should be an integer in most cases, as the node and element labels will be integers.
- class mesh.TotalNodeMesh(_data=None)¶
Bases:
TotalMeshA
TotalNodeMeshenhancesTotalMeshwith some additional functions specific to working with Abaqus nodes.- setNodesConnectedElements(nd)¶
This function will set the
elementsattribute of each node in theTotalMeshinstance for each node found in nd.It should be passed a
Meshinstance which maps the node labels to the elements connected to those nodes. In most cases, this specialMeshinstance should be created by_parseDataElement()and it will be available as the_ndattribute of a *ELEMENT keyword block and as the ‘nd_ed’ entry of_inpItemsToUpdate.
- updateNodesConnectedElements(ed)¶
Calls
updateElements()on allNodeinstances.- Parameters:
ed (TotalMesh) – This should be the
TotalMeshinstance holding the elements.- Returns:
A dictionary with the node labels as the key, and the return value of
updateElements()as the value.- Return type: