We are working on creating a new output system for MOOSE. This change will give us more control over the Exodus output.
Enable ability to have _output_variables empty in ExodusII_IO
The functionality is something we definitely should have, but the API seems kind of awkward. What if we default _output_variables to some non-empty-vector value (maybe a vector with one empty string?) to represent the default "output all variables" behavior? Then to output no variables, you'd just have to do the intuitive thing: exii_io.set_output_variables(empty_vector).
I had a version that set a flag when set_output_variables is called. If it is called then _output_variables is allowed to remain empty; otherwise, it populated the list. I did not use this method because it changes the current behavior of libMesh. This eliminates the need for the allow_empty_output_variables(), but changes the basic behavior.
If you prefer this, I will change it, that is what I prefer.
The previous version changes the current behavior only in one case, right? The case where someone calls "set_output_variables(empty_vector)"? I appreciate trying to avoid any changes to the current behavior, but when the current behavior contradicts what our documentation says, I think it's worth considering, especially if it's also what you prefer.
The only trouble with your other version I can see is that there'd be no way to change the IO state back to outputting all variables. That's easily worked around in application code (or easily fixed with a documented "magic" state or new API), though, and it's only slightly worse than in the current libMesh (and in this PR), where the only way to restore that state is an undocumented (no, worse, a contradicts-the-documentation) hack.
What about adding a second optional boolean argument to set_output_variables method that could disable the flag I am talking about?. For example: set_output_variables(std::vectorstd::string my_vector, bool allow_empty = true)
That sounds good to me.