Difference between revisions of "Material and State classes"
From Yade
Line 1: | Line 1: | ||
− | New classes Material and State replace PhysicalParameters, which used to contain both motion-related information as well as material |
+ | * 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. |
||
== class State == |
== class State == |
Revision as of 17:01, 21 November 2009
- 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.
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.