Material and State classes

From Yade

About

  • 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 possible.
  • PhysicalActionDamper{Engine,Unit}, PhysicalActionApplier{Engine,Unit}, State{MetaEngine,EngineUnit} were removed in the process of those changes, along with their derived classes (CundallNonViscousDamping etc).
  • Lot of code is already converted to these new classes: e.g. TriaxialTest and everything that depends on it.
  • InteractionPhysicsMetaEngine now dispatches on Body::material types (instead of Body::physicalParameters types). Only a few engines are converted (SimpleElasticRelationships, for instance).
  • most parameters were shortened for readability (velocity→vel,angularVelocity→angVel,acceleration→accel,angularAcceleration→angAccel)

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). All data members are initialized to zeros, no need to do that again.

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).

depending on what kind of data you access.

Moreover, you'll have also to suppress the line

#include<yade/pkg-common/RigidBodyParameters.hpp> (or something like that, which includes the physicalParameters) and to replace it by :

#include<yade/core/State.hpp>