Handle empty outputDir setting

The output dir must not be empty or else file names like "/FOO.INIT"
are generated which normally result in a segfault.
Get dimensions for Cartesian grids

For SPE1, the output writer must also support specifying the grid
via the D[XYZ]V keywords instead of relying on the SPECGRID keyword
Refactor common code into a function
Revert "Data copying takes an iterator"

The original rationale for commit c39d367 was to pass a pointer since
this was all we got from one of the APIs. However, just after the code
was changed to copy the data anyway since it would have to be converted
from double to float.

Reverting actually serves a purpose; as @bska pointed out, taking
&data[0] of an empty vector is undefined, whereas it now checks the
size and assert here (and not in the standard library) on that condition.
Correct number of elements taken from strided arrays

If we have a stride > 1, then we take fewer elements from the array;
the old code would fill in a bunch of unrelated data at the end.