libMesh/libmesh

Uniform serial data access to vector and tensor types

Closed this issue · 2 comments

In MOOSE we need to process a variety of different data types in a per-component way, for example to perform component-wise nodal patch recovery, or even just to unpack a 3x3 tensor into a set of 9 variables. This currently needs a lot of boilerplate code, treating each type separately because of the different index dimensions. It would be neato if we had a N* T<N>::data() method (returning a pointer or iterator to the first entry) and a size() method, or even fancier a begin and end method and whatever else is necessary to support ranged looping over the scalar entries of the type.

I think I can implement this to a range wrapper (like make_range)

The key point here is that this will allow me to write templated code that can loop over all components of any type. I'm adding this in MOOSE for now.