Refactor the computation of total nodes DOF.