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:
Yuval Tassa
2023-08-24 03:48:10 -07:00
committed by Copybara-Service
parent b92a9d599c
commit 1dad5993f0
11 changed files with 248 additions and 188 deletions
+39 -18
View File
@@ -4339,20 +4339,6 @@ STRUCTS: Mapping[str, StructDecl] = dict([
),
doc='first efc address involving tendon; -1: none (ntendon x 1)', # pylint: disable=line-too-long
),
StructFieldDecl(
name='island_dofadr',
type=PointerType(
inner_type=ValueType(name='int'),
),
doc='address of first dof in island (nisland x 1)', # pylint: disable=line-too-long
),
StructFieldDecl(
name='island_efcadr',
type=PointerType(
inner_type=ValueType(name='int'),
),
doc='address of first constraint in island (nisland x 1)', # pylint: disable=line-too-long
),
StructFieldDecl(
name='dof_island',
type=PointerType(
@@ -4361,11 +4347,25 @@ STRUCTS: Mapping[str, StructDecl] = dict([
doc='island id of this dof; -1: none (nv x 1)', # pylint: disable=line-too-long
),
StructFieldDecl(
name='dof_islandnext',
name='island_dofnum',
type=PointerType(
inner_type=ValueType(name='int'),
),
doc='address of next dof in island; -1: last or none (nv x 1)', # pylint: disable=line-too-long
doc='number of dofs in island (nisland x 1)', # pylint: disable=line-too-long
),
StructFieldDecl(
name='island_dofadr',
type=PointerType(
inner_type=ValueType(name='int'),
),
doc='start address in island_dofind (nisland x 1)', # pylint: disable=line-too-long
),
StructFieldDecl(
name='island_dofind',
type=PointerType(
inner_type=ValueType(name='int'),
),
doc='island dof indices; -1: none (nv x 1)', # pylint: disable=line-too-long
),
StructFieldDecl(
name='efc_island',
@@ -4375,11 +4375,25 @@ STRUCTS: Mapping[str, StructDecl] = dict([
doc='island id of this constraint (nefc x 1)', # pylint: disable=line-too-long
),
StructFieldDecl(
name='efc_islandnext',
name='island_efcnum',
type=PointerType(
inner_type=ValueType(name='int'),
),
doc='address of next constraint in island; -1: last (nefc x 1)', # pylint: disable=line-too-long
doc='number of constraints in island (nisland x 1)', # pylint: disable=line-too-long
),
StructFieldDecl(
name='island_efcadr',
type=PointerType(
inner_type=ValueType(name='int'),
),
doc='start address in island_efcind (nisland x 1)', # pylint: disable=line-too-long
),
StructFieldDecl(
name='island_efcind',
type=PointerType(
inner_type=ValueType(name='int'),
),
doc='island constraint indices (nefc x 1)', # pylint: disable=line-too-long
),
StructFieldDecl(
name='efc_AR_rownnz',
@@ -6536,6 +6550,13 @@ STRUCTS: Mapping[str, StructDecl] = dict([
),
doc='',
),
StructFieldDecl(
name='island_dofind',
type=PointerType(
inner_type=ValueType(name='int'),
),
doc='',
),
StructFieldDecl(
name='dof_island',
type=PointerType(