[examples] new BouncingBall with new initialization process
@@ -92,13 +92,13 @@ int main(int argc, char* argv[])
// -------------
// --- Model ---
// -------------
- SP::Model bouncingBall(new Model(t0, T));
+ SP::NonSmoothDynamicalSystem bouncingBall(new NonSmoothDynamicalSystem(t0, T));
// add the dynamical system in the non smooth dynamical system
- bouncingBall->nonSmoothDynamicalSystem()->insertDynamicalSystem(ball);
+ bouncingBall->insertDynamicalSystem(ball);
// link the interaction and the dynamical system
- bouncingBall->nonSmoothDynamicalSystem()->link(inter, ball);
+ bouncingBall->link(inter, ball);
// ------------------
// --- Simulation ---
@@ -115,29 +115,14 @@ int main(int argc, char* argv[])
SP::OneStepNSProblem osnspb(new LCP());
// -- (4) Simulation setup with (1) (2) (3)
- SP::TimeStepping s(new TimeStepping(t, OSI, osnspb));
- s->associate(OSI,ball);
-
- s->setNonSmoothDynamicalSystemPtr(bouncingBall->nonSmoothDynamicalSystem());
-
- //bouncingBall->setSimulation(s);
+ SP::TimeStepping s(new TimeStepping(bouncingBall, t, OSI, osnspb));
// =========================== End of model definition ===========================
// ================================= Computation =================================
- // --- Simulation initialization ---
-
- cout << "====> Initialisation ..." << endl;
- bouncingBall->initialize();
- cout << "====> Initialisation END ..." << endl;
-
- // -- set the integrator for the ball --
-
-
-
- int N = ceil((T - t0) / h); // Number of time steps
+ int N = ceil((T - t0) / h)+10000; // Number of time steps
// --- Get the values to be plotted ---
// -> saved in a matrix dataPlot
@@ -175,6 +160,7 @@ int main(int argc, char* argv[])
s->nextStep();
++show_progress;
k++;
+
}
cout << "End of computation - Number of iterations done: " << k - 1 << endl;
cout << "Computation Time " << time.elapsed() << endl;
