Material and State classes

From Yade

Revision as of 16:57, 21 November 2009 by Eudoxos (talk | contribs) (Created page with 'New classes Material and State replace PhysicalParameters, which used to contain both motion-related information as well as material. All old code that was not reviewed after th…')
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

New classes Material and State replace PhysicalParameters, which used to contain both motion-related information as well as material.

All old code that was not reviewed after this change is guarded with YADE_REQUIRE_FEATURE(physpar). Note that compilation with 'physpar' feature is not really possible.

class State

should contain all body-specific physical variables that might change during simulation. The base State class contains

  • linear (pos, vel, accel, mass) variable
  • rotational (ori, angVel, angAccel, inertia) variables

State::se3 is internally referenced by State::pos and State::ori, and can be used to pass both position and orientation to some function (frequent in older yade code).

class Material

should contain all material parameters that can be shared among bodies (in the future). Material::density is defined in the base class. Additionally, two derived classes exist now:

  • ElasticMat (adds young)
  • GranularMat (adds poisson and frictionAngle)


How to change your code

Search for physicalParameters and replace it by state (e.g. b->physicalParameters->se3.position becomes b->state->pos or (same) b->state->se3.position) or by material (e.g. static_cast<BodyMacroParameters>(b->physicalParameters)->young becomes static_cast<ElasticMat>(b->material)->young).