Put check for n > 1 AbstractDim in codegen

Wasn't clear how to do the comparison technically correctly, although
the workaround was probably fine.  This is cleaner though.

I didn't test the generated code for correct results from the solver,
just checked that the code generates and in case of C compiles.