MDX Tutorial
Coding Conventions
The MDX libraries are written in C using an object-based style.
An example:
The
Step library
offers a "class" (struct)
Step
along with "methods" (functions) that act on
a
Step
"object" (struct instantiation).
The members of a
Step
object should not be accessed directly.
Instead its state is supplied directly by the methods and
through the use of "helper objects"
(structs whose members should be set)
StepParam
and
StepSystem
.
Class: | Step
- perform time stepping |
---|---|
Helpers: | StepParam
- supplies configuration data(configured once before simulation begins) |
StepSystem
- supplies data for system(initial trajectories provided, then updates to position, velocity, and force arrays) |
|
Methods: | int step_init(Step *, StepParam *)
|
void step_done(Step *)
|
|
int step_compute(Step *, StepSystem *,
int32 numsteps)
|
|
int step_find_reductions(Step *, StepSystem *)
|
|
int step_set_random_velocities(Step *, StepSystem *)
|
|
int step_remove_com_motion(Step *, StepSystem *)
|
Note the naming conventions:
Step
StepParam
- user-supplied configuration dataStepSystem
- user-accessible state data- function names begin with "
step_
" and pass explicit "this" pointer (Step *
) as first parameter
The other libraries similarly follow these conventions.