IncludeKeyword¶
This class is used to manage include files of the KeyFile.
-
class
qd.cae.dyna.
IncludeKeyword
¶ - Attributes
field_size
field_size
position
Notes —– Line index of the
Keyword
.
Methods
align
Type of alignment for comment names and fields:
append_line
(line)- Parameters
get_card_valueByIndex
(iCard, iField[, …])- Parameters
get_card_valueByName
(name[, field_size])- Parameters
- Returns
get_keyword_name
()- Returns
get_line
()- Parameters
get_lines
()- Returns
has_long_fields
()- Returns
insert_line
(iLine, line)- Parameters
load
()Notes
reformat_all
([skip_cards])- Parameters
reformat_field
(iCard, iField[, field_size, …])- Parameters
remove_line
(iLine)- Parameters
set_card_valueByDict
(fields[, field_size])- Parameters
set_card_valueByIndex
(iCard, iField, value)- Parameters
set_card_valueByName
(name, value[, field_size])- Parameters
set_line
(iLine, line)- Parameters
set_lines
(lines)- Parameters
switch_field_size
([skip_cards])- Parameters
-
get_includes
()¶ - Returns
- includeslist of KeyFile
list of loaded keyfiles
Notes
Returns all loaded keyfiles belonging to this include keyword.
Examples
>>> kf = KeyFile("path/to/keyfile", load_includes=True) >>> # get the first include keyword >>> kw = kf["*INCLUDE"][0] >>> len( kw.get_includes() ) 1
-
load
()¶ Notes
This function iterates through the lines of the keyword, and loads every include defined. In the process, the filepath of every loaded include is removed from the line buffer.
To check if the class searches the correct include directories,
KeyFile.get_include_dirs
can be used.If the parent
KeyFile
usesparse_mesh=True
, then also the includes mesh will be parsed, but the mesh will be loaded into the parents database and not the includes for consistency.Examples
>>> kf = KeyFile() >>> kw = kf.add_keyword("*INCLUDE") >>> kw.append_line("path/to/my/include") >>> kw.load() >>> len( kw.get_includes() ) 1 >>> # one can also get all includes from the KeyFile directly >>> len( kf.get_includes() ) 1