235 #define MBC_F(mbc)                      ((mbc)->mbcr.flags) 
  236 #define MBC_F_GET(mbc, f)               (MBC_F(mbc) & (f)) 
  237 #define MBC_F_SET(mbc, f)               (MBC_F(mbc) |= (f)) 
  238 #define MBC_F_RESET(mbc, f)             (MBC_F(mbc) &= ~(f)) 
  240 #define MBC_F_REF_NODE(mbc)             MBC_F_GET(mbc, MBC_REF_NODE) 
  241 #define MBC_F_LABELS(mbc)               MBC_F_GET(mbc, MBC_LABELS) 
  242 #define MBC_F_ACCELS(mbc)               MBC_F_GET(mbc, MBC_ACCELS) 
  243 #define MBC_F_ROT(mbc)                  MBC_F_GET(mbc, MBC_ROT_MASK) 
  244 #define MBC_F_ROT_THETA(mbc)            MBC_F_GET(mbc, MBC_ROT_THETA) 
  245 #define MBC_F_ROT_MAT(mbc)              MBC_F_GET(mbc, MBC_ROT_MAT) 
  246 #define MBC_F_ROT_EULER_123(mbc)        MBC_F_GET(mbc, MBC_ROT_EULER_123) 
  247 #define MBC_U_REF_NODE_ROT_2_ROT(u)     (((u) & MBC_REF_NODE_ROT_MASK) >> 4) 
  248 #define MBC_U_ROT_2_REF_NODE_ROT(u)     (((u) & MBC_ROT_MASK) << 4) 
  249 #define MBC_F_ROT_REF_NODE(mbc)         MBC_U_REF_NODE_ROT_2_ROT(MBC_F_GET((mbc), MBC_REF_NODE_ROT_MASK)) 
  250 #define MBC_F_REF_NODE_ROT(mbc)         MBC_F_GET(mbc, MBC_REF_NODE_ROT_MASK) 
  252 #define MBC_F_SET_REF_NODE(mbc)         MBC_F_SET(mbc, MBC_REF_NODE) 
  253 #define MBC_F_SET_LABELS(mbc)           MBC_F_SET(mbc, MBC_LABELS) 
  254 #define MBC_F_SET_ACCELS(mbc)           MBC_F_SET(mbc, MBC_ACCELS) 
  255 #define MBC_F_SET_ROT_THETA(mbc)        MBC_F_SET(mbc, MBC_ROT_THETA) 
  256 #define MBC_F_SET_ROT_MAT(mbc)          MBC_F_SET(mbc, MBC_ROT_MAT) 
  257 #define MBC_F_SET_ROT_EULER_123(mbc)    MBC_F_SET(mbc, MBC_ROT_EULER_123) 
  262                 char            char_r_ptr[(2 + 2) * 
sizeof(uint32_t) + (3 + 9 + 3 + 3 + 3 + 3 + 3 + 3) * 
sizeof(
double)];
 
  263                 uint32_t        uint32_t_r_ptr[(2 + 2) + (3 + 9 + 3 + 3 + 3 + 3 + 3 + 3) * 
sizeof(double) / 
sizeof(uint32_t)];
 
  264                 double          double_r_ptr[(2 + 2) * 
sizeof(uint32_t) / 
sizeof(double) + (3 + 9 + 3 + 3 + 3 + 3 + 3 + 3) * 
sizeof(double)];
 
  281 #define MBC_R_PTR(mbc, type, off)       ((off) < 0 ? NULL : ((type *)&((mbc)->mbcr.r_ptr.type ## _r_ptr[(off)]))) 
  282 #define MBC_R_K_LABEL(mbc)              (MBC_R_PTR((mbc), uint32_t, (mbc)->mbcr.r_k_label)[0]) 
  283 #define MBC_R_X(mbc)                    (MBC_R_PTR((mbc), double, (mbc)->mbcr.r_k_x)) 
  284 #define MBC_R_THETA(mbc)                (MBC_R_PTR((mbc), double, (mbc)->mbcr.r_k_theta)) 
  285 #define MBC_R_R(mbc)                    (MBC_R_PTR((mbc), double, (mbc)->mbcr.r_k_r)) 
  286 #define MBC_R_EULER_123(mbc)            (MBC_R_PTR((mbc), double, (mbc)->mbcr.r_k_euler_123)) 
  287 #define MBC_R_XP(mbc)                   (MBC_R_PTR((mbc), double, (mbc)->mbcr.r_k_xp)) 
  288 #define MBC_R_OMEGA(mbc)                (MBC_R_PTR((mbc), double, (mbc)->mbcr.r_k_omega)) 
  289 #define MBC_R_XPP(mbc)                  (MBC_R_PTR((mbc), double, (mbc)->mbcr.r_k_xpp)) 
  290 #define MBC_R_OMEGAP(mbc)               (MBC_R_PTR((mbc), double, (mbc)->mbcr.r_k_omegap)) 
  291 #define MBC_R_D_LABEL(mbc)              (MBC_R_PTR((mbc), uint32_t, (mbc)->mbcr.r_d_label)[0]) 
  292 #define MBC_R_F(mbc)                    (MBC_R_PTR((mbc), double, (mbc)->mbcr.r_d_f)) 
  293 #define MBC_R_M(mbc)                    (MBC_R_PTR((mbc), double, (mbc)->mbcr.r_d_m)) 
  294 #define MBC_R_KINEMATICS_SIZE(mbc)      ((mbc)->mbcr.k_size) 
  295 #define MBC_R_DYNAMICS_SIZE(mbc)        ((mbc)->mbcr.d_size) 
  296 #define MBC_R_SIZE(mbc)                 (MBC_R_KINEMATICS_SIZE(mbc) + MBC_R_DYNAMICS_SIZE(mbc)) 
  297 #define MBC_R_KINEMATICS(mbc)           ((void *)(mbc)->mbcr.r_ptr.char_r_ptr) 
  298 #define MBC_R_DYNAMICS(mbc)             ((void *)(MBC_R_KINEMATICS(mbc) + MBC_R_KINEMATICS_SIZE(mbc))) 
  362 #define MBC_N_K_LABELS(mbc)             ((mbc)->n_k_labels) 
  363 #define MBC_N_X(mbc)                    ((mbc)->n_k_x) 
  364 #define MBC_N_THETA(mbc)                ((mbc)->n_k_theta) 
  365 #define MBC_N_R(mbc)                    ((mbc)->n_k_r) 
  366 #define MBC_N_EULER_123(mbc)            ((mbc)->n_k_euler_123) 
  367 #define MBC_N_XP(mbc)                   ((mbc)->n_k_xp) 
  368 #define MBC_N_OMEGA(mbc)                ((mbc)->n_k_omega) 
  369 #define MBC_N_XPP(mbc)                  ((mbc)->n_k_xpp) 
  370 #define MBC_N_OMEGAP(mbc)               ((mbc)->n_k_omegap) 
  371 #define MBC_N_D_LABELS(mbc)             ((mbc)->n_d_labels) 
  372 #define MBC_N_F(mbc)                    ((mbc)->n_d_f) 
  373 #define MBC_N_M(mbc)                    ((mbc)->n_d_m) 
  374 #define MBC_N_KINEMATICS_SIZE(mbc)      ((mbc)->k_size) 
  375 #define MBC_N_DYNAMICS_SIZE(mbc)        ((mbc)->d_size) 
  376 #define MBC_N_KINEMATICS(mbc)           ((void *)(mbc)->n_ptr) 
  377 #define MBC_N_DYNAMICS(mbc)             ((void *)(MBC_N_KINEMATICS(mbc) + MBC_N_KINEMATICS_SIZE(mbc))) 
  378 #define MBC_N_SIZE(mbc)                 (MBC_N_KINEMATICS_SIZE(mbc) + MBC_N_DYNAMICS_SIZE(mbc)) 
  407         unsigned labels, 
unsigned rot, 
unsigned accels);
 
  516 #define MBC_Q(mbc)                      (&(mbc)->m[0]) 
  517 #define MBC_QP(mbc)                     (&(mbc)->m[(mbc)->modes]) 
  518 #define MBC_P(mbc)                      (&(mbc)->m[2*(mbc)->modes]) 
  519 #define MBC_M_KINEMATICS(mbc)           MBC_Q((mbc)) 
  520 #define MBC_M_DYNAMICS(mbc)             MBC_P((mbc)) 
  521 #define MBC_M_KINEMATICS_SIZE(mbc)      (2*(mbc)->modes*sizeof(double)) 
  522 #define MBC_M_DYNAMICS_SIZE(mbc)        ((mbc)->modes*sizeof(double)) 
  523 #define MBC_M_SIZE(mbc)                 (3*(mbc)->modes*sizeof(double)) 
int mbc_nodal_negotiate_response(mbc_nodal_t *mbc)
Unused. 
int mbc_nodal_get_motion(mbc_nodal_t *mbc)
Get nodal motion from peer. 
nodal stuff (partially opaque). 
int mbc_modal_destroy(mbc_modal_t *mbc)
Destroy modal data. 
int mbc_nodal_init(mbc_nodal_t *mbc, unsigned refnode, unsigned nodes, unsigned labels, unsigned rot, unsigned accels)
Initialize nodal data. 
int mbc_modal_negotiate_response(mbc_modal_t *mbc)
Unused. 
int mbc_modal_negotiate_request(mbc_modal_t *mbc)
Negotiate modal data. 
int mbc_modal_init(mbc_modal_t *mbc, int refnode, unsigned modes)
Initialize modal data. 
int mbc_put_cmd(mbc_t *mbc)
Opaque. 
Connection data structure (partially opaque) 
int mbc_nodal_put_forces(mbc_nodal_t *mbc, int last)
Put forces to peer. 
int mbc_get_cmd(mbc_t *mbc)
Opaque. 
int mbc_unix_init(mbc_t *mbc, const char *path)
Initialize communication using "unix" socket. 
int mbc_check_cmd(mbc_t *mbc)
Opaque. 
int mbc_nodal_negotiate_request(mbc_nodal_t *mbc)
Negotiate nodal data. 
int mbc_inet_init(mbc_t *mbc, const char *host, short unsigned port)
Initialize communication using "inet" socket. 
MBCType
Parameters used to control the communication type and fields. 
int mbc_modal_get_motion(mbc_modal_t *mbc)
Get modal motion from peer. 
Nodal stuff (partially opaque). 
Reference node (AKA "rigid") stuff (partially opaque). 
int mbc_nodal_destroy(mbc_nodal_t *mbc)
Destroy nodal data. 
int mbc_modal_put_forces(mbc_modal_t *mbc, int last)
Put forces to peer.