Rename nstack to narena, change it and pstack to count bytes.

PiperOrigin-RevId: 561066311
Change-Id: I4d0e645e6c254dd906bfc42159e0e99149a7c6c8
This commit is contained in:
Saran Tunyasuvunakool
2023-08-29 10:12:46 -07:00
committed by Copybara-Service
parent b979a26b10
commit daa2ac7f8b
22 changed files with 162 additions and 117 deletions
+1 -1
View File
@@ -450,7 +450,7 @@ compilation.
:at:`nstack`: :at-val:`int, "-1"` |nbsp| |nbsp| |nbsp| (legacy)
This is a deprecated legacy attribute. In versions prior to 2.3.0, it determined the maximum size of the
:ref:`stack <siStack>`. After version 2.3.0, if :at:`nstack` is specified, then the size of ``mjData.arena`` is
:ref:`stack <siStack>`. After version 2.3.0, if :at:`nstack` is specified, then the size of ``mjData.narena`` is
``nstack * sizeof(mjtNum)`` bytes, plus an additional space for the constraint solver. Specifying both :at:`nstack`
and :at:`memory` leads to an error.
+2
View File
@@ -39,6 +39,8 @@ General
#. Added the flag :ref:`invdiscrete<option-flag-invdiscrete>`, which enables discrete-time inverse dynamics for all
:ref:`integrators<option-integrator>` other than ``RK4``. See the flag documentation for more details.
#. Renamed the function ``mj_stackAlloc`` to ``mj_stackAllocNum``.
#. Renamed the ``nstack`` field in ``mjModel`` and ``mjData`` to ``narena``. Changed ``narena``, ``pstack``, and
``maxuse_stack`` to count number of bytes rather than number of ``mjtNum``s.
Python bindings
^^^^^^^^^^^^^^^
+5 -5
View File
@@ -124,8 +124,8 @@ struct mjSolverStat_ { // per-iteration solver statistics
typedef struct mjSolverStat_ mjSolverStat;
struct mjData_ {
// constant sizes
int nstack; // number of mjtNums that can fit in the arena+stack space
int nbuffer; // size of main buffer in bytes
size_t narena; // size of the arena in bytes (inclusive of the stack)
size_t nbuffer; // size of main buffer in bytes
int nplugin; // number of plugin instances
// stack pointer
@@ -135,7 +135,7 @@ struct mjData_ {
size_t parena; // first available byte in arena
// memory utilization stats
int maxuse_stack; // maximum stack allocation
size_t maxuse_stack; // maximum stack allocation
size_t maxuse_arena; // maximum arena allocation
int maxuse_con; // maximum number of contacts
int maxuse_efc; // maximum number of scalar constraints
@@ -881,12 +881,12 @@ struct mjModel_ {
int nemax; // number of potential equality-constraint rows
int njmax; // number of available rows in constraint Jacobian
int nconmax; // number of potential contacts in contact list
int nstack; // number of fields in mjData stack
int nuserdata; // number of extra fields in mjData
int nsensordata; // number of fields in sensor data vector
int npluginstate; // number of fields in plugin state vector
int nbuffer; // number of bytes in buffer
size_t narena; // number of bytes in the mjData arena (inclusive of stack)
size_t nbuffer; // number of bytes in buffer
// ------------------------------- options and statistics