← Back to team overview

yade-dev team mailing list archive

Re: [yade dev] About blocked rotation

 

> However, it seems that, doing so, I can only manage 1 DOF as
> blockedDOFs is a bitmask which can be chosen between these values:
Well, read http://en.wikipedia.org/wiki/Bitmask and
http://en.wikipedia.org/wiki/Bitwise_operation. Precisely because it is
a bitmask, you have to set bits that correspond to RX, RY, RZ if you
need to block just those, i.e. (8 & 16 & 32), which is binary 0b111000
(in python) and that is decimal 56.

In yade moreover, try writing State.blockedDOFs? and enter, which will
give you 
https://www.yade-dem.org/sphinx/yade.wrapper.html#yade.wrapper.State.blockedDOFs
and that reveals a simpler way that I put back then just for people that
don't want to know what bitmask is, and that lest you say

state.blockedDOFs=['rx','ry','rz]

as well, which is the same as

state.blockedDOFs=56

which is the same as

state.blockedDOFs=(8 & 16 & 32)

which is the same as

state.blockedDOFs=0b111000

Prefer the 'rx','ry','rz' way, though, since those numbers are
implementation detail and would break your code if that changed. It
makes also the code more readable, obviously.

Cheers, Vaclav






Follow ups

References