Difference between revisions of "Material and State classes"
From Yade
Line 8: | Line 8: | ||
* rotational (ori, angVel, angAccel, inertia) variables |
* 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). |
+ | ''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 == |
== class Material == |
||
Line 16: | Line 16: | ||
− | = How to change your code = |
+ | == How to change your code == |
Search for physicalParameters and replace it |
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 state (e.g. ''b->physicalParameters->se3.position'' becomes ''b->state->pos'' or (same) ''b->state->se3.position''), or |
Revision as of 16:58, 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.
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.