Comment 5 for bug 1487424

Revision history for this message
Parcly Taxel (parclytaxel-deactivatedaccount) wrote :

And then I realised something. Look at the problematic code:

if (V[0].isZero(0) && V[1].isZero(0))
        return Piecewise<D2<SBasis> >(D2<SBasis>(Linear(1),SBasis()));

Suppose V is a zero D2<SBasis> object of order greater than one. Since isZero() does not check whether an SBasis is of order one – whereas empty() of the old code does – the program will return an SBasis object of order one. Therefore the order of the SBasis may be changed here, which goes against the intent of the unitVector() function this code resides in (to return a D2<SBasis> of the same order). Ha!