dataPlot[k, 0] = simulation.nextTime()
    dataPlot[k, 1] = q[2]
    dataPlot[k, 2] = v[2]

    if (broadphase.collisionWorld().getDispatcher().getNumManifolds() > 0):
        if bouncingBox.nonSmoothDynamicalSystem().topology().\
          numberOfIndexSet() > 1:
            index1 = sk.interactions(simulation.indexSet(1))
            if (len(index1) == 4):
                dataPlot[k, 3] = norm(index1[0].lambda_(1)) + \
                norm(index1[1].lambda_(1)) + norm(index1[2].lambda_(1)) + \
                norm(index1[3].lambda_(1))

    k += 1
    simulation.nextStep()

#
# comparison with the reference file
#
from siconos.kernel import SimpleMatrix, getMatrix
from numpy.linalg import norm

ref = getMatrix(SimpleMatrix("result_dynamic.ref"))

print("norm(dataPlot - ref) = {0}".format(norm(dataPlot - ref)))
if (norm(dataPlot - ref) > 1e-11):
    print("Warning. The result is rather different from the reference file.")


#