Shape and topology optimization for elliptic boundary value problems using a piecewise constant level set method