Skip to content

Scripting Cheatsheet

Stephen Berry edited this page Jul 12, 2016 · 2 revisions

This section covers the registered functions and types in Ascent's implementation of ChaiScript and how to use them when scripting.

Timing

  • dt (time step)
  • dt_base (base time step)
  • t_end (simulation end time)

Module

Module variables

  • module_id

Module functions

  • run()
  • run(const double dt, const double t_end);

Link

Link functions

  • module (provides access to contained module)
  • name(const std::string& id);

Variable assignment via "module"

link_name.module.x = 2.0;


Eigen Linear Algebra

Vectors

All are equivalent to Eigen type names, simply without the Eigen namespace.

  • Vector2d
  • Vector3d
  • Vector4d
  • VectorXd

Constructing a vector in script

var x = Vector3d(0.0, 1.0, 2.0);

Vector functions

    • (multiplication with scalars)
  • dot (dot product)
  • cross (cross product)

Example

var result = vec0.cross(vec1);

Matrices

  • MatrixXd

Matrix functions

    • (multiplication with scalars and vectors)