ansys.dyna.core.lib.field_writer#

Functions#

check_field_type(field_type)

write_field_c(→ None)

write_field(→ None)

write_c_dataframe(→ None)

write_fields(→ None)

Write fields representing a line of a keyword to buf.

write_comment_line(→ None)

Writes the comment line to the buffer.

Module Contents#

ansys.dyna.core.lib.field_writer.check_field_type(field_type: type)[source]#
ansys.dyna.core.lib.field_writer.write_field_c(buf: IO[AnyStr], field_type: type, value: Any, width: int) None[source]#
ansys.dyna.core.lib.field_writer.write_field(buf: IO[AnyStr], field_type: type, value: Any, width: int) None[source]#
ansys.dyna.core.lib.field_writer.write_c_dataframe(buf: IO[AnyStr], fields: List[ansys.dyna.core.lib.field.Field], table: pandas.DataFrame, format: ansys.dyna.core.lib.format_type.format_type) None[source]#
ansys.dyna.core.lib.field_writer.write_fields(buf: IO[AnyStr], fields: List[ansys.dyna.core.lib.field.Field], values: List[Any] | None = None, format: ansys.dyna.core.lib.format_type.format_type | None = format_type.default) None[source]#

Write fields representing a line of a keyword to buf.

Use the fixed column offsets and width

Parameters:
buf: IO

buffer to write to

fields: List

fields to write

values: List

optional - list of values for the field. If not set, use the value property of each field. used by DuplicateCard

format: format_type

optional - format to write

>>> s=io.String()
>>> fields = [
… Field(“a”, int, 0, 10, 1),
… Field(“b”, str, 10, 10, “hello”)
… ]
>>> write_fields(s, fields)
>>> s.getvalue()
‘ 1 hello’
ansys.dyna.core.lib.field_writer.write_comment_line(buf: IO[AnyStr], fields: List[ansys.dyna.core.lib.field.Field], format: ansys.dyna.core.lib.format_type.format_type | None = format_type.default) None[source]#

Writes the comment line to the buffer.

Parameters:
buf: IO

buffer to write to

fields: List

fields to write

format: format_type

format to write in

>>> s=io.String()
>>> fields = [
… Field(“a”, int, 0, 10, 1),
… Field(“b”, str, 10, 10, “hello”)
… ]
>>> write_comment_line(s, fields)
>>> s.getvalue()
‘ a b’