Refactor constraint island representation.
Required for constraint solver islanding.
Replace linked lists with `island_{dof,efc}_{num,adr,ind}`, corresponding to the standard `{rownnz,rowadr,colind}` sparse matrix representation. By effectively defining two sparse matrix structures of dimensions `nisland x nv` and `nisland x nefc`, respectively, this representation is more conducive to reuse of existing sparse matrix utility functions, while being cache-friendlier by making sequential indices adjacent in memory.
PiperOrigin-RevId: 559704957
Change-Id: I919362cbef0d5fe5acc4aa2bb4ffb17eee8223a2
This commit is contained in:
committed by
Copybara-Service
parent
b92a9d599c
commit
1dad5993f0
+44
-42
@@ -565,54 +565,56 @@
|
||||
X( mjContact, contact, MJ_D(ncon), 1 )
|
||||
|
||||
// array fields of mjData that are used in the primal problem
|
||||
#define MJDATA_ARENA_POINTERS_PRIMAL \
|
||||
X( int, efc_type, MJ_D(nefc), 1) \
|
||||
X( int, efc_id, MJ_D(nefc), 1) \
|
||||
X( int, efc_J_rownnz, MJ_D(nefc), 1) \
|
||||
X( int, efc_J_rowadr, MJ_D(nefc), 1) \
|
||||
X( int, efc_J_rowsuper, MJ_D(nefc), 1) \
|
||||
X( int, efc_J_colind, MJ_D(nnzJ), 1) \
|
||||
X( int, efc_JT_rownnz, MJ_M(nv), 1) \
|
||||
X( int, efc_JT_rowadr, MJ_M(nv), 1) \
|
||||
X( int, efc_JT_rowsuper, MJ_M(nv), 1) \
|
||||
X( int, efc_JT_colind, MJ_D(nnzJ), 1) \
|
||||
X( mjtNum, efc_J, MJ_D(nnzJ), 1) \
|
||||
X( mjtNum, efc_JT, MJ_D(nnzJ), 1) \
|
||||
X( mjtNum, efc_pos, MJ_D(nefc), 1) \
|
||||
X( mjtNum, efc_margin, MJ_D(nefc), 1) \
|
||||
X( mjtNum, efc_frictionloss, MJ_D(nefc), 1) \
|
||||
X( mjtNum, efc_diagApprox, MJ_D(nefc), 1) \
|
||||
X( mjtNum, efc_KBIP, MJ_D(nefc), 4) \
|
||||
X( mjtNum, efc_D, MJ_D(nefc), 1) \
|
||||
X( mjtNum, efc_R, MJ_D(nefc), 1) \
|
||||
X( int, tendon_efcadr, MJ_M(ntendon), 1) \
|
||||
X( mjtNum, efc_vel, MJ_D(nefc), 1) \
|
||||
X( mjtNum, efc_aref, MJ_D(nefc), 1) \
|
||||
X( mjtNum, efc_b, MJ_D(nefc), 1) \
|
||||
X( mjtNum, efc_force, MJ_D(nefc), 1) \
|
||||
X( int, efc_state, MJ_D(nefc), 1)
|
||||
#define MJDATA_ARENA_POINTERS_PRIMAL \
|
||||
X( int, efc_type, MJ_D(nefc), 1 ) \
|
||||
X( int, efc_id, MJ_D(nefc), 1 ) \
|
||||
X( int, efc_J_rownnz, MJ_D(nefc), 1 ) \
|
||||
X( int, efc_J_rowadr, MJ_D(nefc), 1 ) \
|
||||
X( int, efc_J_rowsuper, MJ_D(nefc), 1 ) \
|
||||
X( int, efc_J_colind, MJ_D(nnzJ), 1 ) \
|
||||
X( int, efc_JT_rownnz, MJ_M(nv), 1 ) \
|
||||
X( int, efc_JT_rowadr, MJ_M(nv), 1 ) \
|
||||
X( int, efc_JT_rowsuper, MJ_M(nv), 1 ) \
|
||||
X( int, efc_JT_colind, MJ_D(nnzJ), 1 ) \
|
||||
X( mjtNum, efc_J, MJ_D(nnzJ), 1 ) \
|
||||
X( mjtNum, efc_JT, MJ_D(nnzJ), 1 ) \
|
||||
X( mjtNum, efc_pos, MJ_D(nefc), 1 ) \
|
||||
X( mjtNum, efc_margin, MJ_D(nefc), 1 ) \
|
||||
X( mjtNum, efc_frictionloss, MJ_D(nefc), 1 ) \
|
||||
X( mjtNum, efc_diagApprox, MJ_D(nefc), 1 ) \
|
||||
X( mjtNum, efc_KBIP, MJ_D(nefc), 4 ) \
|
||||
X( mjtNum, efc_D, MJ_D(nefc), 1 ) \
|
||||
X( mjtNum, efc_R, MJ_D(nefc), 1 ) \
|
||||
X( int, tendon_efcadr, MJ_M(ntendon), 1 ) \
|
||||
X( mjtNum, efc_vel, MJ_D(nefc), 1 ) \
|
||||
X( mjtNum, efc_aref, MJ_D(nefc), 1 ) \
|
||||
X( mjtNum, efc_b, MJ_D(nefc), 1 ) \
|
||||
X( mjtNum, efc_force, MJ_D(nefc), 1 ) \
|
||||
X( int, efc_state, MJ_D(nefc), 1 )
|
||||
|
||||
// array fields of mjData that are used in the dual problem
|
||||
#define MJDATA_ARENA_POINTERS_DUAL \
|
||||
X( int, efc_AR_rownnz, MJ_D(nefc), 1 ) \
|
||||
X( int, efc_AR_rowadr, MJ_D(nefc), 1 ) \
|
||||
X( int, efc_AR_colind, MJ_D(nefc), MJ_D(nefc) ) \
|
||||
X( mjtNum, efc_AR, MJ_D(nefc), MJ_D(nefc) )
|
||||
#define MJDATA_ARENA_POINTERS_DUAL \
|
||||
X( int, efc_AR_rownnz, MJ_D(nefc), 1 ) \
|
||||
X( int, efc_AR_rowadr, MJ_D(nefc), 1 ) \
|
||||
X( int, efc_AR_colind, MJ_D(nefc), MJ_D(nefc) ) \
|
||||
X( mjtNum, efc_AR, MJ_D(nefc), MJ_D(nefc) )
|
||||
|
||||
// array fields of mjData that are used for constraint islands
|
||||
#define MJDATA_ARENA_POINTERS_ISLAND \
|
||||
X( int, island_dofadr, MJ_D(nisland), 1 ) \
|
||||
X( int, island_efcadr, MJ_D(nisland), 1 ) \
|
||||
X( int, dof_island, MJ_M(nv), 1 ) \
|
||||
X( int, dof_islandnext, MJ_M(nv), 1 ) \
|
||||
X( int, efc_island, MJ_D(nefc), 1 ) \
|
||||
X( int, efc_islandnext, MJ_D(nefc), 1 )
|
||||
#define MJDATA_ARENA_POINTERS_ISLAND \
|
||||
X( int, dof_island, MJ_M(nv), 1 ) \
|
||||
X( int, island_dofnum, MJ_D(nisland), 1 ) \
|
||||
X( int, island_dofadr, MJ_D(nisland), 1 ) \
|
||||
X( int, island_dofind, MJ_M(nv), 1 ) \
|
||||
X( int, efc_island, MJ_D(nefc), 1 ) \
|
||||
X( int, island_efcnum, MJ_D(nisland), 1 ) \
|
||||
X( int, island_efcadr, MJ_D(nisland), 1 ) \
|
||||
X( int, island_efcind, MJ_D(nefc), 1 )
|
||||
|
||||
// array fields of mjData that live in d->arena
|
||||
#define MJDATA_ARENA_POINTERS \
|
||||
MJDATA_ARENA_POINTERS_CONTACT \
|
||||
MJDATA_ARENA_POINTERS_PRIMAL \
|
||||
MJDATA_ARENA_POINTERS_DUAL \
|
||||
#define MJDATA_ARENA_POINTERS \
|
||||
MJDATA_ARENA_POINTERS_CONTACT \
|
||||
MJDATA_ARENA_POINTERS_PRIMAL \
|
||||
MJDATA_ARENA_POINTERS_DUAL \
|
||||
MJDATA_ARENA_POINTERS_ISLAND
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user