inpKeywordSequence¶
Module Contents¶
- class inpKeywordSequence.inpKeywordSequence(iterable=None, parentBlock=None)¶
Bases:
listAn
inpKeywordSequenceinherits fromlist, but it has some additional enhancements to make it more useful toinpRW. Mainly, aninpKeywordSequenceautomatically builds a reference to certain important information from eachinpKeywordinstance placed into theinpKeywordSequence, and it has a a function which the maininpRWinstance can call to retrieve this information from the maininpKeywordSequence, 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
inpKeywordSequenceobject, which inherits from the list type. It’s main purpose is to holdinpKeywordobjects, and it provides convenient methods for gathering important information from certain keyword blocks and making it available to theinpRWinstance.Creating a string representation of this class will create a useful summary of the keyword lines for each block, along with the
pathto the block, and the same information for thesuboptionsof each block ifprintSubBlocks= True.For most users, the details of this class can be ignored. Simply create
inpKeywordobjects 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 theinpKeywordSequenceifinpRWis on the correct insertion loop (specified by_keywordsDelayPlacingData) when the keyword block is added to theinpKeywordSequence.This class is also setup to pull these attributes from the same attributes from child
inpKeywordSequencesviamergeSuboptionsGlobalData().- Parameters:
iterable (list) – A sequence of
inpKeywordblocks with which to pre-populate theinpKeywordSequence. Defaults to []parentBlock (inpKeyword) – If the
inpKeywordSequenceinstance is thesuboptionsattribute of ainpKeywordblock, parentBlock should be set to thisinpKeywordblock. This is currently referenced only to report the path to access the :class:~inpKeywordSequence` instance. Defaults to None.
- parentBlock¶
This will be None if the
inpKeywordSequenceis thekeywordsattribute, else it will refer to theinpKeywordblock for which this item is thesuboptionsattribute.- Type:
- printSubBlocks¶
If False, generating a string of this
inpKeywordSequencewill generate a string for each block in this sequence, along with thepathto each block. If True, thesuboptionsfor each block will also be fully expanded and represented.- Type:
- _nd¶
Stores the nodal data for all keyword blocks in this
inpKeywordSequence, including that in thesuboptionsof blocks in this sequence. The user should interact withnd, which this attribute will eventually feed.- Type:
- _ed¶
Stores the element data for all keyword blocks in this
inpKeywordSequence, including that in thesuboptionsof blocks in this sequence. The user should interact withed, which this attribute will eventually feed.- Type:
- _pd¶
Stores the *PARAMETER data for all keyword blocks in this
inpKeywordSequence, including that in thesuboptionsof blocks in this sequence. The user should interact withpd, which this attribute will eventually feed.- Type:
- _namedRefs¶
Stores the named reference definitions for all keyword blocks in this
inpKeywordSequence, including that in thesuboptionsof blocks in this sequence. The user should interact withnamedRefs, which this attribute will eventually feed.- Type:
- _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:
- _grandchildBlocks¶
contains the number of suboptions keyword blocks in each child block with suboptions.
- Type:
- 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 toself.parentInp._delayedPlaceBlocks[loop], and it will also be inserted into theinpKeywordSequence.- Parameters:
x (inpKeyword) – The
inpKeywordinstance to append.place (bool) – If True, call
_placeInpItemsToUpdate()before appending x. Defaults to True.loop (int) – If place is False, loop must be specified. x will be appended to
self.parentInp._delayedPlaceBlocks[loop].
- extend(iterable, place=True, loop=None)¶
Extends the
inpKeywordSequenceby appending all the items from iterable.If place = True, will call
self._placeInpItemsToUpdate(x) for x in iterablebefore running list.extend. If place = False, each item in iterable will be appended toself.parentInp._delayedPlaceBlocks[loop], and they will also be inserted into theinpKeywordSequence.- Parameters:
iterable (list) – A sequence of
inpKeywordinstances with which to extend theinpKeywordSequence.place (bool) – If True, call
_placeInpItemsToUpdate()before inserting iterable. Defaults to True.loop (int) – If place is False, loop must be specified. Each item in iterable will be appended to
self.parentInp._delayedPlaceBlocks[loop].
- insert(i, x, place=True, loop=None)¶
Inserts x into the
inpKeywordSequenceat position i.If place = True, will call
self._placeInpItemsToUpdate(x)before running list.insert. If place = False, x will be appended toself.parentInp._delayedPlaceBlocks[loop], and it will also be inserted into theinpKeywordSequence.- Parameters:
i (int) – The index of the element before which to insert.
x (inpKeyword) – The
inpKeywordinstance to insert.place (bool) – If True, call
_placeInpItemsToUpdate()before inserting x. Defaults to True.loop (int) – If place is False, loop must be specified. x will be appended to
self.parentInp._delayedPlaceBlocks[loop].
- mergeSuboptionsGlobalData()¶
This function will add the contents of
_nd,_ed,_pd,_namedRefs, and_delayedPlaceBlocksfrom thesuboptionsof every block in theinpKeywordSequencerecursively.
- _placeInpItemsToUpdate(block)¶
This function will place all items from
block._inpItemsToUpdateinto the appropriate attribute of theinpKeywordSequence.This currently will place data into :attr:_namedRefs`, :attr:_ed`, :attr:_nd`, and :attr:_pd`.
- Parameters:
block (inpKeyword) –