Put sparsity structures in mjModel, don't use them yet.
PiperOrigin-RevId: 795032051 Change-Id: I75c69e881980ff9c308acf00bb3a65f4b2ef12f5
This commit is contained in:
committed by
Copybara-Service
parent
f077fd00a9
commit
7eb13777f8
@@ -482,7 +482,9 @@ void mj_printFormattedModel(const mjModel* m, const char* filename, const char*
|
||||
const int* object_class;
|
||||
|
||||
#define X(type, name, num, sz) \
|
||||
if (&m->num == object_class && (strncmp(#name, "name_", 5) != 0) && sz > 0) { \
|
||||
if (&m->num == object_class && strncmp(#name, "name_", 5) && \
|
||||
strncmp(#name, "M_", 2) && strncmp(#name, "B_", 2) && \
|
||||
strncmp(#name, "D_", 2) && sz > 0) { \
|
||||
const char* format = _Generic(*m->name, \
|
||||
double: float_format, \
|
||||
float: float_format, \
|
||||
@@ -873,6 +875,35 @@ void mj_printFormattedModel(const mjModel* m, const char* filename, const char*
|
||||
|
||||
#undef X
|
||||
|
||||
// B sparse structure
|
||||
mj_printSparsity("B: body-dof matrix", m->nbody, m->nv, m->B_rowadr, NULL, m->B_rownnz, NULL,
|
||||
m->B_colind, fp);
|
||||
printArrayInt("B_ROWNNZ", 1, m->nbody, m->B_rownnz, fp);
|
||||
printArrayInt("B_ROWADR", 1, m->nbody, m->B_rowadr, fp);
|
||||
printArrayInt("B_COLIND", 1, m->nB, m->B_colind, fp);
|
||||
|
||||
// M sparse structure
|
||||
mj_printSparsity("M: reduced inertia matrix", m->nv, m->nv, m->M_rowadr, NULL, m->M_rownnz,
|
||||
NULL, m->M_colind, fp);
|
||||
printArrayInt("M_ROWNNZ", 1, m->nv, m->M_rownnz, fp);
|
||||
printArrayInt("M_ROWADR", 1, m->nv, m->M_rowadr, fp);
|
||||
printArrayInt("M_COLIND", 1, m->nC, m->M_colind, fp);
|
||||
printArrayInt("MAPM2M", 1, m->nC, m->mapM2M, fp);
|
||||
|
||||
// D sparse structure
|
||||
mj_printSparsity("D: dof-dof matrix", m->nv, m->nv,
|
||||
m->D_rowadr, m->D_diag, m->D_rownnz, NULL, m->D_colind, fp);
|
||||
printArrayInt("D_ROWNNZ", 1, m->nv, m->D_rownnz, fp);
|
||||
printArrayInt("D_ROWADR", 1, m->nv, m->D_rowadr, fp);
|
||||
printArrayInt("D_COLIND", 1, m->nD, m->D_colind, fp);
|
||||
printArrayInt("MAPM2D", 1, m->nD, m->mapM2D, fp);
|
||||
printArrayInt("MAPD2M", 1, m->nM, m->mapD2M, fp);
|
||||
|
||||
// signature
|
||||
fprintf(fp, "\nSIGNATURE\n");
|
||||
fprintf(fp, " %lu\n", (unsigned long) m->signature);
|
||||
fprintf(fp, "\n");
|
||||
|
||||
// BVHs
|
||||
fprintf(fp, "BVH:\n");
|
||||
fprintf(fp, " %-8s%-8s%-8s%-10s%-s\n","id", "depth", "nodeid", "child[0]" ,"child[1]");
|
||||
|
||||
Reference in New Issue
Block a user