sandialabs / seacas

The Sandia Engineering Analysis Code Access System (SEACAS) is a suite of preprocessing, postprocessing, translation, and utility applications supporting finite element analysis software using the Exodus database file format.
Other
131 stars 79 forks source link

EXODUS: Prototype to see if can speed up field metadata output #468

Closed gsjaardema closed 1 month ago

gsjaardema commented 1 month ago

Add exi_persist_redef and exi_persist_leavedef which will stay in netCDF define mode even though exi_redef and exi_leavedef are called.

exi_redef and exi_leavedef are wrappers around the netCDF nc_redef and nc_enddef calls that go in and out of defined mode.

If exi_persist_redef is called, it checks whether in define mode and if in persisted define mode. It will either go into define mode, or if already in persistent mode, it will increment a counter which is decremented on exi_persist_leavedef and if reaches a value of 1, it leaves persist define mode.

Note that currently, can only nest the calls up to 7 deep (unchecked) or the counter will wrap around. (Probably not that important to save space with a 3-wide bit field, but that is how it is currently).

This should speed up the ex_put_field_metadata and ex_put_multi_field_metadata calls since they write lots of attributes which move in and out of define mode.

Can also look at not writing empty attributes or defaulted attributes if it is still slow.