Closed jeff-cohere closed 2 years ago
Note that this is consistent with the formulation we use in libCEED. Usually one does this in batches that fit conveniently in cache. I don't know if it's a bottleneck at present, but if the material models become expensive, we'll want them to vectorize. Note that some special functions (log1p
in our hyperelasticity work) are not vectorized by default with gcc/clang. (For log1p
in libCEED, we implemented a series expansion that delivers the necessary accuracy over reasonable input range, though one can also use libraries like SVML.)
@jedbrown has suggested in #195 that we modify the signature of the functions we have been using for material properties and boundary conditions to accept an array of input positions and populate an array of outputs. Specifically, we want to change from a "single-point evaluation" approach, e.g.
to a multi-point evaluation approach:
In the single-point approach,
f
is one of these functionstdy
is aTDy
object passed as the first argumentx
is a pointer to a 2- or 3-tuple of real numbers identifying a point in 2D or 3D spacev
is a pointer to a real value that stores the (scalar) value off
ctx
is an opaque pointer that stores any additional contextual information needed byf
The multi-point approach replaces
x
andv
withn
, an integer defining the number of points at which to evaluatef
X
, an array of2*n
or3*n
values definingn
2D or 3D points, with components stored adjacentlyV
, an array ofn
values that store each of then
values off
at the points given byX
This is a pretty easy thing to do and will probably buy us some performance.