1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
|
.. _template_siconos_driver:
C++ template for siconos driver
===============================
.. highlight:: c++
.. code::
// Header file
#include <SiconosKernel.h>
using namespace std;
// main program
int main(int argc, char* argv[])
{
// Exception handling
try
{
// == User-defined parameters ==
// ================= Creation of the model =======================
// == Creation of the NonSmoothDynamicalSystem ==
// -- DynamicalSystem(s) --
// -- Interaction --
// - Relations -
// - NonSmoothLaw -
// -- NonSmoothDynamicalSystem --
// == Creation of the Simulation ==
// -- TimeDiscretisation --
// -- Simulation (time stepping or event-driven)
// -- OneStepIntegrator --
// -- OneStepNSProblem --
// ================================= Computation =================================
// --- Time loop ---
}
// == Catch exceptions ==
catch(SiconosException e)
{cout << e.report() << endl;}
catch(...)
{cout << "Exception caught in mySample.cpp" << endl;}
// == get elapsed time ==
cout << "Computation Time " << time.elapsed() << endl;
}
|