next up previous
Next: Material Point Up: How To Implement a Previous: General Information

Data Structures

It is always important to plan how the simulation will be kept in a computer memory. For my purposes of simple simulation program I use two 'c style' structures which keeps informations about Point and Springs in a computer memory (see figure 2). Those structures keeps all needed informations about physics objects in the model.

Figure 2: Structures used in c version of the code.

All mesh points will be put into a one dimensional table:

    CPoint2d myPoints[NUMP];
where NUMP is a number of mesh points which will be created.

Also all springs will be put into a one dimensional table:

    CSpring myPoints[NUMS];

where NUMS is equal to a number of springs ( $NUMS = NUMP + 1$).


Maciej Matyka 2004-03-30