inpKeywordSequence

Module Contents

class inpKeywordSequence.inpKeywordSequence(iterable=None, parentBlock=None)

Bases: list

An inpKeywordSequence inherits from list, but it has some additional enhancements to make it more useful to inpRW. Mainly, an inpKeywordSequence automatically builds a reference to certain important information from each inpKeyword instance placed into the inpKeywordSequence, and it has a a function which the main inpRW instance can call to retrieve this information from the main inpKeywordSequence, and all its children recursively. String formatting has also been modified to be more suited to this application.

__init__(iterable=None, parentBlock=None)

This class creates a blank inpKeywordSequence object, which inherits from the list type. It’s main purpose is to hold inpKeyword objects, and it provides convenient methods for gathering important information from certain keyword blocks and making it available to the inpRW instance.

Creating a string representation of this class will create a useful summary of the keyword lines for each block, along with the path to the block, and the same information for the suboptions of each block if printSubBlocks = True.

For most users, the details of this class can be ignored. Simply create inpKeyword objects using one of the recommended options, and add the keyword blocks to the appropriate location.

In particular, this class has the following attributes which hold information needed by inpRW: _nd, _ed, _pd, _namedRefs, and _delayedPlaceBlocks. The first four items are created when instancing particular keyword blocks and stored in _inpItemsToUpdate, and will be automatically inserted into the inpKeywordSequence if inpRW is on the correct insertion loop (specified by _keywordsDelayPlacingData) when the keyword block is added to the inpKeywordSequence.

This class is also setup to pull these attributes from the same attributes from child inpKeywordSequences via mergeSuboptionsGlobalData().

Parameters:
parentBlock

This will be None if the inpKeywordSequence is the keywords attribute, else it will refer to the inpKeyword block for which this item is the suboptions attribute.

Type:

inpKeyword

printSubBlocks

If False, generating a string of this inpKeywordSequence will generate a string for each block in this sequence, along with the path to each block. If True, the suboptions for each block will also be fully expanded and represented.

Type:

bool

_nd

Stores the nodal data for all keyword blocks in this inpKeywordSequence, including that in the suboptions of blocks in this sequence. The user should interact with nd, which this attribute will eventually feed.

Type:

TotalMesh

_ed

Stores the element data for all keyword blocks in this inpKeywordSequence, including that in the suboptions of blocks in this sequence. The user should interact with ed, which this attribute will eventually feed.

Type:

TotalMesh

_pd

Stores the *PARAMETER data for all keyword blocks in this inpKeywordSequence, including that in the suboptions of blocks in this sequence. The user should interact with pd, which this attribute will eventually feed.

Type:

csid

_namedRefs

Stores the named reference definitions for all keyword blocks in this inpKeywordSequence, including that in the suboptions of blocks in this sequence. The user should interact with namedRefs, which this attribute will eventually feed.

Type:

csid

_delayedPlaceBlocks

Contains the loop number on which specific information from keyword blocks should be placed, along with a list of all effected keyword blocks for that loop.

Type:

csid

_grandchildBlocks

contains the number of suboptions keyword blocks in each child block with suboptions.

Type:

list

append(x, place=True, loop=None)

Appends x to the end of the inpKeywordSequence.

If place = True, will call self._placeInpItemsToUpdate(x) before running list.append. If place = False, x will be appended to self.parentInp._delayedPlaceBlocks[loop], and it will also be inserted into the inpKeywordSequence.

Parameters:
extend(iterable, place=True, loop=None)

Extends the inpKeywordSequence by appending all the items from iterable.

If place = True, will call self._placeInpItemsToUpdate(x) for x in iterable before running list.extend. If place = False, each item in iterable will be appended to self.parentInp._delayedPlaceBlocks[loop], and they will also be inserted into the inpKeywordSequence.

Parameters:
insert(i, x, place=True, loop=None)

Inserts x into the inpKeywordSequence at position i.

If place = True, will call self._placeInpItemsToUpdate(x) before running list.insert. If place = False, x will be appended to self.parentInp._delayedPlaceBlocks[loop], and it will also be inserted into the inpKeywordSequence.

Parameters:
mergeSuboptionsGlobalData()

This function will add the contents of _nd, _ed, _pd, _namedRefs, and _delayedPlaceBlocks from the suboptions of every block in the inpKeywordSequence recursively.

_placeInpItemsToUpdate(block)

This function will place all items from block._inpItemsToUpdate into the appropriate attribute of the inpKeywordSequence.

This currently will place data into :attr:_namedRefs`, :attr:_ed`, :attr:_nd`, and :attr:_pd`.

Parameters:

block (inpKeyword) –