Alternative for hasData

I recently ported code to precice 3 API. I noticed that hasData (along with hasMesh) was removed.

We found hasData useful. If hasData(var) gives true, we would read var from preCICE, otherwise use a provided data file or default value or something. We can disable coupling of a variable by removing it from the precice config and don’t need have our own config that needs to be changed. It was convenient to quickly try different setups, diagnose issues, without remembering to keep multiple configs in sync.

Is there an alternative we can use for this? We probably could use getDataDimension and catch the exception (I assume it throws? not clear from the documentation), but that feels wrong.

(I note that we may end up with an adapter config anyway for other reasons, so maybe this won’t matter. But even then this function could be useful, e.g. ignore the variable in the adapter config if it’s disabled in the precice config)