PxSimulationStatistics.h

Go to the documentation of this file.
00001 // This code contains NVIDIA Confidential Information and is disclosed to you
00002 // under a form of NVIDIA software license agreement provided separately to you.
00003 //
00004 // Notice
00005 // NVIDIA Corporation and its licensors retain all intellectual property and
00006 // proprietary rights in and to this software and related documentation and
00007 // any modifications thereto. Any use, reproduction, disclosure, or
00008 // distribution of this software and related documentation without an express
00009 // license agreement from NVIDIA Corporation is strictly prohibited.
00010 //
00011 // ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES
00012 // NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO
00013 // THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT,
00014 // MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE.
00015 //
00016 // Information and code furnished is believed to be accurate and reliable.
00017 // However, NVIDIA Corporation assumes no responsibility for the consequences of use of such
00018 // information or for any infringement of patents or other rights of third parties that may
00019 // result from its use. No license is granted by implication or otherwise under any patent
00020 // or patent rights of NVIDIA Corporation. Details are subject to change without notice.
00021 // This code supersedes and replaces all information previously supplied.
00022 // NVIDIA Corporation products are not authorized for use as critical
00023 // components in life support devices or systems without express written approval of
00024 // NVIDIA Corporation.
00025 //
00026 // Copyright (c) 2008-2018 NVIDIA Corporation. All rights reserved.
00027 // Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved.
00028 // Copyright (c) 2001-2004 NovodeX AG. All rights reserved.  
00029 
00030 
00031 #ifndef PX_SIMULATION_STATISTICS
00032 #define PX_SIMULATION_STATISTICS
00033 
00037 #include "PxPhysXConfig.h"
00038 #include "foundation/PxAssert.h"
00039 #include "geometry/PxGeometry.h"
00040 
00041 #if !PX_DOXYGEN
00042 namespace physx
00043 {
00044 #endif
00045 
00051 class PxSimulationStatistics
00052 {
00053 public:
00054 
00059     enum RbPairStatsType
00060     {
00064         eDISCRETE_CONTACT_PAIRS,
00065 
00074         eCCD_PAIRS,
00075 
00081         eMODIFIED_CONTACT_PAIRS,
00082 
00088         eTRIGGER_PAIRS
00089     };
00090 
00091 
00092 //objects:
00096     PxU32   nbActiveConstraints;
00097 
00103     PxU32   nbActiveDynamicBodies;
00104 
00111     PxU32   nbActiveKinematicBodies;
00112 
00116     PxU32   nbStaticBodies;
00117 
00123     PxU32   nbDynamicBodies;
00124 
00129     PxU32   nbShapes[PxGeometryType::eGEOMETRY_COUNT];
00130 
00134     PxU32   nbAggregates;
00135     
00139     PxU32   nbArticulations;
00140 
00141 //solver:
00145     PxU32   nbAxisSolverConstraints;
00146 
00150     PxU32   compressedContactSize;
00151 
00155     PxU32   requiredContactConstraintMemory;
00156 
00160     PxU32   peakConstraintMemory;
00161 
00162 //broadphase:
00168     PX_FORCE_INLINE PxU32 getNbBroadPhaseAdds() const
00169     {
00170         return nbBroadPhaseAdds;
00171     }
00172 
00178     PX_FORCE_INLINE PxU32 getNbBroadPhaseRemoves() const
00179     {
00180         return nbBroadPhaseRemoves;
00181     }
00182 
00183 //collisions:
00197     PxU32 getRbPairStats(RbPairStatsType pairType, PxGeometryType::Enum g0, PxGeometryType::Enum g1) const
00198     {
00199         PX_ASSERT_WITH_MESSAGE( (pairType >= eDISCRETE_CONTACT_PAIRS) &&
00200                                 (pairType <= eTRIGGER_PAIRS),
00201                                 "Invalid pairType in PxSimulationStatistics::getRbPairStats");
00202 
00203         if (g0 >= PxGeometryType::eGEOMETRY_COUNT || g1 >= PxGeometryType::eGEOMETRY_COUNT)
00204         {
00205             PX_ASSERT(false);
00206             return 0;
00207         }
00208 
00209         PxU32 nbPairs = 0;
00210         switch(pairType)
00211         {
00212             case eDISCRETE_CONTACT_PAIRS:
00213                 nbPairs = nbDiscreteContactPairs[g0][g1];
00214                 break;
00215             case eCCD_PAIRS:
00216                 nbPairs = nbCCDPairs[g0][g1];
00217                 break;
00218             case eMODIFIED_CONTACT_PAIRS:
00219                 nbPairs = nbModifiedContactPairs[g0][g1];
00220                 break;
00221             case eTRIGGER_PAIRS:
00222                 nbPairs = nbTriggerPairs[g0][g1];
00223                 break;
00224         }
00225         return nbPairs;
00226     }
00227 
00231     PxU32   nbDiscreteContactPairsTotal;
00232 
00237     PxU32   nbDiscreteContactPairsWithCacheHits;
00238 
00242     PxU32   nbDiscreteContactPairsWithContacts;
00243 
00247     PxU32   nbNewPairs;
00248 
00252     PxU32   nbLostPairs;
00253 
00257     PxU32   nbNewTouches;
00258 
00262     PxU32   nbLostTouches;
00263 
00267     PxU32   nbPartitions;
00268 
00269     PxSimulationStatistics() :
00270         nbActiveConstraints                 (0),
00271         nbActiveDynamicBodies               (0),
00272         nbActiveKinematicBodies             (0),
00273         nbStaticBodies                      (0),
00274         nbDynamicBodies                     (0),
00275         nbAggregates                        (0),
00276         nbArticulations                     (0),
00277         nbAxisSolverConstraints             (0),
00278         compressedContactSize               (0),
00279         requiredContactConstraintMemory     (0),
00280         peakConstraintMemory                (0),
00281         nbDiscreteContactPairsTotal         (0),
00282         nbDiscreteContactPairsWithCacheHits (0),
00283         nbDiscreteContactPairsWithContacts  (0),
00284         nbNewPairs                          (0),
00285         nbLostPairs                         (0),
00286         nbNewTouches                        (0),
00287         nbLostTouches                       (0),
00288         nbPartitions                        (0)
00289     {
00290         nbBroadPhaseAdds = 0;
00291         nbBroadPhaseRemoves = 0;
00292 
00293         for(PxU32 i=0; i < PxGeometryType::eGEOMETRY_COUNT; i++)
00294         {
00295             for(PxU32 j=0; j < PxGeometryType::eGEOMETRY_COUNT; j++)
00296             {
00297                 nbDiscreteContactPairs[i][j] = 0;
00298                 nbModifiedContactPairs[i][j] = 0;
00299                 nbCCDPairs[i][j] = 0;
00300                 nbTriggerPairs[i][j] = 0;
00301             }
00302         }
00303 
00304         for(PxU32 i=0; i < PxGeometryType::eGEOMETRY_COUNT; i++)
00305         {
00306             nbShapes[i] = 0;
00307         }
00308     }
00309 
00310 
00311     //
00312     // We advise to not access these members directly. Use the provided accessor methods instead.
00313     //
00314 //broadphase:
00315     PxU32   nbBroadPhaseAdds;
00316     PxU32   nbBroadPhaseRemoves;
00317 
00318 //collisions:
00319     PxU32   nbDiscreteContactPairs[PxGeometryType::eGEOMETRY_COUNT][PxGeometryType::eGEOMETRY_COUNT];
00320     PxU32   nbCCDPairs[PxGeometryType::eGEOMETRY_COUNT][PxGeometryType::eGEOMETRY_COUNT];
00321     PxU32   nbModifiedContactPairs[PxGeometryType::eGEOMETRY_COUNT][PxGeometryType::eGEOMETRY_COUNT];
00322     PxU32   nbTriggerPairs[PxGeometryType::eGEOMETRY_COUNT][PxGeometryType::eGEOMETRY_COUNT];
00323 };
00324 
00325 #if !PX_DOXYGEN
00326 } // namespace physx
00327 #endif
00328 
00330 #endif


Copyright © 2008-2018 NVIDIA Corporation, 2701 San Tomas Expressway, Santa Clara, CA 95050 U.S.A. All rights reserved. www.nvidia.com