Data arrays with no mesh reference
It's easy to introduce the following bug:
VertexData<double> x;
x[v] = 1.23;
Two possible resolutions:
- Don't allow a data array to be declared without a reference to a mesh (i.e., don't provide an empty constructor).
- Include assertions in debug mode that check for a mesh reference.
Agreed that it's an easy bug! Done it many times myself.
Don't allow a data array to be declared without a reference to a mesh (i.e., don't provide an empty constructor).
Perhaps it would encourage better coding habits if we forced initialization, but I'd push back initially on this one. I find it super useful for these to be default-constructible so they can be used as value members in classes without initialization, or left as empty when unused in function calls.
Include assertions in debug mode that check for a mesh reference.
These assertions already exist! Perhaps something is up with the build system if those assertions aren't firing for you?