open-lasso-python / lasso-python

Home of the open-source CAE library lasso-python 🐍
BSD 3-Clause "New" or "Revised" License
50 stars 12 forks source link

Title2 in d3plot header #53

Closed MatthieuDebray closed 2 months ago

MatthieuDebray commented 2 months ago

According to Lasso D3plot_header documentation, there an optional 2nd title store in header.title2 But, it seems to not stored when we wrote the d3plot. Does this 2nd title is define in d3plot format ? My objective was to store some additional string info inside the D3plot (not obliged to be in the title) Thanks for help

MatthieuDebray commented 2 months ago

Writing Issue found : in d3plot.py on function _write_header_part_contact_interface_titles

line :if "title2" in self.header.title2 should be replaced by something like : if self.header.title2 and isinstance(self.header.title2,str):

Nevertheless, I would propose a new function to retrieve header and geometry data without loading all d3plot We can read just the header using : header = D3plotHeader(d3plotFile) But this header will not get title2 as it's read later by _parse_geometry What would be the best way to do this?

codie3611 commented 2 months ago
MatthieuDebray commented 2 months ago

Hello Codie, Thanks for tips, doing that : d3plot = D3plot(d3plotFile,buffered_reading=True,state_filter=[0,],state_array_filter=[])it's fast to get title2. I put a check for string, because if somebody do this title2 = 1. Maybe it's not needed if after your code will not expect a string.

codie3611 commented 2 months ago

It is python so while it is tempting to verify this I do not recommend it. This is within the domain of "you will get punched in the face if you do something very silly".