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-2018 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 "PxPhysXConfig.h"
38 #include "foundation/PxAssert.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 
124 
130 
135 
140 
141 //solver:
146 
151 
156 
161 
162 //broadphase:
169  {
170  return nbBroadPhaseAdds;
171  }
172 
179  {
180  return nbBroadPhaseRemoves;
181  }
182 
183 //collisions:
198  {
199  PX_ASSERT_WITH_MESSAGE( (pairType >= eDISCRETE_CONTACT_PAIRS) &&
200  (pairType <= eTRIGGER_PAIRS),
201  "Invalid pairType in PxSimulationStatistics::getRbPairStats");
202 
204  {
205  PX_ASSERT(false);
206  return 0;
207  }
208 
209  PxU32 nbPairs = 0;
210  switch(pairType)
211  {
212  case eDISCRETE_CONTACT_PAIRS:
213  nbPairs = nbDiscreteContactPairs[g0][g1];
214  break;
215  case eCCD_PAIRS:
216  nbPairs = nbCCDPairs[g0][g1];
217  break;
218  case eMODIFIED_CONTACT_PAIRS:
219  nbPairs = nbModifiedContactPairs[g0][g1];
220  break;
221  case eTRIGGER_PAIRS:
222  nbPairs = nbTriggerPairs[g0][g1];
223  break;
224  }
225  return nbPairs;
226  }
227 
232 
238 
243 
248 
253 
258 
263 
268 
270  nbActiveConstraints (0),
271  nbActiveDynamicBodies (0),
272  nbActiveKinematicBodies (0),
273  nbStaticBodies (0),
274  nbDynamicBodies (0),
275  nbAggregates (0),
276  nbArticulations (0),
277  nbAxisSolverConstraints (0),
278  compressedContactSize (0),
279  requiredContactConstraintMemory (0),
280  peakConstraintMemory (0),
281  nbDiscreteContactPairsTotal (0),
282  nbDiscreteContactPairsWithCacheHits (0),
283  nbDiscreteContactPairsWithContacts (0),
284  nbNewPairs (0),
285  nbLostPairs (0),
286  nbNewTouches (0),
287  nbLostTouches (0),
288  nbPartitions (0)
289  {
290  nbBroadPhaseAdds = 0;
291  nbBroadPhaseRemoves = 0;
292 
293  for(PxU32 i=0; i < PxGeometryType::eGEOMETRY_COUNT; i++)
294  {
295  for(PxU32 j=0; j < PxGeometryType::eGEOMETRY_COUNT; j++)
296  {
297  nbDiscreteContactPairs[i][j] = 0;
298  nbModifiedContactPairs[i][j] = 0;
299  nbCCDPairs[i][j] = 0;
300  nbTriggerPairs[i][j] = 0;
301  }
302  }
303 
304  for(PxU32 i=0; i < PxGeometryType::eGEOMETRY_COUNT; i++)
305  {
306  nbShapes[i] = 0;
307  }
308  }
309 
310 
311  //
312  // We advise to not access these members directly. Use the provided accessor methods instead.
313  //
314 //broadphase:
317 
318 //collisions:
323 };
324 
325 #if !PX_DOXYGEN
326 } // namespace physx
327 #endif
328 
330 #endif
Definition: GuContactBuffer.h:37
PxU32 nbArticulations
Number of articulations in the scene.
Definition: PxSimulationStatistics.h:139
PxU32 compressedContactSize
The size (in bytes) of the compressed contact stream in the current simulation step.
Definition: PxSimulationStatistics.h:150
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:197
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:155
PX_FORCE_INLINE PxU32 getNbBroadPhaseRemoves() const
Get number of broadphase volumes removed for the current simulation step.
Definition: PxSimulationStatistics.h:178
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:168
#define PX_FORCE_INLINE
Definition: PxPreprocessor.h:364
PxU32 nbAggregates
Number of aggregates in the scene.
Definition: PxSimulationStatistics.h:134
PxU32 nbLostTouches
Number of lost touches from NP this frame.
Definition: PxSimulationStatistics.h:262
PxU32 nbDiscreteContactPairsWithCacheHits
Total number of (non CCD) pairs for which contacts are successfully cached (<=nbDiscreteContactPairsT...
Definition: PxSimulationStatistics.h:237
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:123
PxU32 nbBroadPhaseRemoves
Definition: PxSimulationStatistics.h:316
PxU32 peakConstraintMemory
The peak amount of memory (in bytes) that was allocated for constraints (this includes joints) in the...
Definition: PxSimulationStatistics.h:160
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:247
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:257
PxU32 nbPartitions
Number of partitions used by the solver this frame.
Definition: PxSimulationStatistics.h:267
PxU32 nbDiscreteContactPairsTotal
Total number of (non CCD) pairs reaching narrow phase.
Definition: PxSimulationStatistics.h:231
Enum
Definition: PxGeometry.h:53
PxU32 nbBroadPhaseAdds
Definition: PxSimulationStatistics.h:315
RbPairStatsType
Different types of rigid body collision pair statistics.
Definition: PxSimulationStatistics.h:59
PxSimulationStatistics()
Definition: PxSimulationStatistics.h:269
PxU32 nbDiscreteContactPairsWithContacts
Total number of (non CCD) pairs for which at least 1 contact was generated (<=nbDiscreteContactPairsT...
Definition: PxSimulationStatistics.h:242
#define PX_ASSERT_WITH_MESSAGE(condition, message)
Definition: PxAssert.h:63
PxU32 nbActiveKinematicBodies
Number of active kinematic bodies for the current simulation step.
Definition: PxSimulationStatistics.h:111
#define PX_ASSERT(exp)
Definition: PxAssert.h:61
PxU32 nbLostPairs
Number of lost pairs from BP this frame.
Definition: PxSimulationStatistics.h:252
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:145