PxSimulationStatistics.h
Go to the documentation of this file.
1 //
2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions
4 // are met:
5 // * Redistributions of source code must retain the above copyright
6 // notice, this list of conditions and the following disclaimer.
7 // * Redistributions in binary form must reproduce the above copyright
8 // notice, this list of conditions and the following disclaimer in the
9 // documentation and/or other materials provided with the distribution.
10 // * Neither the name of NVIDIA CORPORATION nor the names of its
11 // contributors may be used to endorse or promote products derived
12 // from this software without specific prior written permission.
13 //
14 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
15 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
17 // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
18 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
19 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
20 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
21 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
22 // OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
24 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 //
26 // Copyright (c) 2008-2021 NVIDIA Corporation. All rights reserved.
27 // Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved.
28 // Copyright (c) 2001-2004 NovodeX AG. All rights reserved.
29 
30 
31 #ifndef PX_SIMULATION_STATISTICS
32 #define PX_SIMULATION_STATISTICS
33 
37 #include "foundation/PxAssert.h"
38 #include "PxPhysXConfig.h"
39 #include "geometry/PxGeometry.h"
40 
41 #if !PX_DOXYGEN
42 namespace physx
43 {
44 #endif
45 
52 {
53 public:
54 
60  {
65 
75 
82 
88  eTRIGGER_PAIRS
89  };
90 
91 
92 //objects:
97 
104 
112 
117 
125 
132 
138 
143 
148 
149 //solver:
154 
159 
164 
169 
170 //broadphase:
177  {
178  return nbBroadPhaseAdds;
179  }
180 
187  {
188  return nbBroadPhaseRemoves;
189  }
190 
191 //collisions:
206  {
207  PX_ASSERT_WITH_MESSAGE( (pairType >= eDISCRETE_CONTACT_PAIRS) &&
208  (pairType <= eTRIGGER_PAIRS),
209  "Invalid pairType in PxSimulationStatistics::getRbPairStats");
210 
212  {
213  PX_ASSERT(false);
214  return 0;
215  }
216 
217  PxU32 nbPairs = 0;
218  switch(pairType)
219  {
220  case eDISCRETE_CONTACT_PAIRS:
221  nbPairs = nbDiscreteContactPairs[g0][g1];
222  break;
223  case eCCD_PAIRS:
224  nbPairs = nbCCDPairs[g0][g1];
225  break;
226  case eMODIFIED_CONTACT_PAIRS:
227  nbPairs = nbModifiedContactPairs[g0][g1];
228  break;
229  case eTRIGGER_PAIRS:
230  nbPairs = nbTriggerPairs[g0][g1];
231  break;
232  }
233  return nbPairs;
234  }
235 
240 
246 
251 
256 
261 
266 
271 
276 
278  nbActiveConstraints (0),
279  nbActiveDynamicBodies (0),
280  nbActiveKinematicBodies (0),
281  nbStaticBodies (0),
282  nbDynamicBodies (0),
283  nbKinematicBodies (0),
284  nbAggregates (0),
285  nbArticulations (0),
286  nbAxisSolverConstraints (0),
287  compressedContactSize (0),
288  requiredContactConstraintMemory (0),
289  peakConstraintMemory (0),
290  nbDiscreteContactPairsTotal (0),
291  nbDiscreteContactPairsWithCacheHits (0),
292  nbDiscreteContactPairsWithContacts (0),
293  nbNewPairs (0),
294  nbLostPairs (0),
295  nbNewTouches (0),
296  nbLostTouches (0),
297  nbPartitions (0)
298  {
299  nbBroadPhaseAdds = 0;
300  nbBroadPhaseRemoves = 0;
301 
302  for(PxU32 i=0; i < PxGeometryType::eGEOMETRY_COUNT; i++)
303  {
304  for(PxU32 j=0; j < PxGeometryType::eGEOMETRY_COUNT; j++)
305  {
306  nbDiscreteContactPairs[i][j] = 0;
307  nbModifiedContactPairs[i][j] = 0;
308  nbCCDPairs[i][j] = 0;
309  nbTriggerPairs[i][j] = 0;
310  }
311  }
312 
313  for(PxU32 i=0; i < PxGeometryType::eGEOMETRY_COUNT; i++)
314  {
315  nbShapes[i] = 0;
316  }
317  }
318 
319 
320  //
321  // We advise to not access these members directly. Use the provided accessor methods instead.
322  //
323 //broadphase:
326 
327 //collisions:
332 };
333 
334 #if !PX_DOXYGEN
335 } // namespace physx
336 #endif
337 
339 #endif
Definition: GuContactBuffer.h:37
PxU32 nbArticulations
Number of articulations in the scene.
Definition: PxSimulationStatistics.h:147
PxU32 compressedContactSize
The size (in bytes) of the compressed contact stream in the current simulation step.
Definition: PxSimulationStatistics.h:158
PxU32 getRbPairStats(RbPairStatsType pairType, PxGeometryType::Enum g0, PxGeometryType::Enum g1) const
Get number of shape collision pairs of a certain type processed for the current simulation step...
Definition: PxSimulationStatistics.h:205
PxU32 nbStaticBodies
Number of static bodies for the current simulation step.
Definition: PxSimulationStatistics.h:116
PxU32 requiredContactConstraintMemory
The total required size (in bytes) of the contact constraints in the current simulation step...
Definition: PxSimulationStatistics.h:163
PX_FORCE_INLINE PxU32 getNbBroadPhaseRemoves() const
Get number of broadphase volumes removed for the current simulation step.
Definition: PxSimulationStatistics.h:186
Class used to retrieve statistics for a simulation step.
Definition: PxSimulationStatistics.h:51
Shape pairs processed as swept integration pairs for the current simulation step. ...
Definition: PxSimulationStatistics.h:74
PX_FORCE_INLINE PxU32 getNbBroadPhaseAdds() const
Get number of broadphase volumes added for the current simulation step.
Definition: PxSimulationStatistics.h:176
#define PX_FORCE_INLINE
Definition: PxPreprocessor.h:351
PxU32 nbAggregates
Number of aggregates in the scene.
Definition: PxSimulationStatistics.h:142
PxU32 nbLostTouches
Number of lost touches from NP this frame.
Definition: PxSimulationStatistics.h:270
PxU32 nbDiscreteContactPairsWithCacheHits
Total number of (non CCD) pairs for which contacts are successfully cached (<=nbDiscreteContactPairsT...
Definition: PxSimulationStatistics.h:245
PxU32 nbActiveDynamicBodies
Number of active dynamic bodies for the current simulation step.
Definition: PxSimulationStatistics.h:103
internal use only!
Definition: PxGeometry.h:62
PxU32 nbDynamicBodies
Number of dynamic bodies for the current simulation step.
Definition: PxSimulationStatistics.h:124
PxU32 nbKinematicBodies
Number of kinematic bodies for the current simulation step.
Definition: PxSimulationStatistics.h:131
PxU32 nbBroadPhaseRemoves
Definition: PxSimulationStatistics.h:325
PxU32 peakConstraintMemory
The peak amount of memory (in bytes) that was allocated for constraints (this includes joints) in the...
Definition: PxSimulationStatistics.h:168
Shape pairs processed with user contact modification enabled for the current simulation step...
Definition: PxSimulationStatistics.h:81
PxU32 nbNewPairs
Number of new pairs found by BP this frame.
Definition: PxSimulationStatistics.h:255
PxU32 nbActiveConstraints
Number of active PxConstraint objects (joints etc.) for the current simulation step.
Definition: PxSimulationStatistics.h:96
PxU32 nbNewTouches
Number of new touches found by NP this frame.
Definition: PxSimulationStatistics.h:265
PxU32 nbPartitions
Number of partitions used by the solver this frame.
Definition: PxSimulationStatistics.h:275
PxU32 nbDiscreteContactPairsTotal
Total number of (non CCD) pairs reaching narrow phase.
Definition: PxSimulationStatistics.h:239
Enum
Definition: PxGeometry.h:53
PxU32 nbBroadPhaseAdds
Definition: PxSimulationStatistics.h:324
RbPairStatsType
Different types of rigid body collision pair statistics.
Definition: PxSimulationStatistics.h:59
PxSimulationStatistics()
Definition: PxSimulationStatistics.h:277
PxU32 nbDiscreteContactPairsWithContacts
Total number of (non CCD) pairs for which at least 1 contact was generated (<=nbDiscreteContactPairsT...
Definition: PxSimulationStatistics.h:250
#define PX_ASSERT_WITH_MESSAGE(condition, message)
Definition: PxAssert.h:61
PxU32 nbActiveKinematicBodies
Number of active kinematic bodies for the current simulation step.
Definition: PxSimulationStatistics.h:111
#define PX_ASSERT(exp)
Definition: PxAssert.h:59
PxU32 nbLostPairs
Number of lost pairs from BP this frame.
Definition: PxSimulationStatistics.h:260
uint32_t PxU32
Definition: Px.h:48
Shape pairs processed as discrete contact pairs for the current simulation step.
Definition: PxSimulationStatistics.h:64
PxU32 nbAxisSolverConstraints
The number of 1D axis constraints(joints+contact) present in the current simulation step...
Definition: PxSimulationStatistics.h:153