AGX Dynamics  2.37.3.2
ContactZoneManager.h
Go to the documentation of this file.
1 /*
2 Copyright 2007-2024. Algoryx Simulation AB.
3 
4 All AGX source code, intellectual property, documentation, sample code,
5 tutorials, scene files and technical white papers, are copyrighted, proprietary
6 and confidential material of Algoryx Simulation AB. You may not download, read,
7 store, distribute, publish, copy or otherwise disseminate, use or expose this
8 material unless having a written signed agreement with Algoryx Simulation AB, or having been
9 advised so by Algoryx Simulation AB for a time limited evaluation, or having purchased a
10 valid commercial license from Algoryx Simulation AB.
11 
12 Algoryx Simulation AB disclaims all responsibilities for loss or damage caused
13 from using this software, unless otherwise stated in written agreements with
14 Algoryx Simulation AB.
15 */
16 
17 #ifndef AGX_CONTACTZONEMANAGER_H
18 #define AGX_CONTACTZONEMANAGER_H
19 
20 #include <agx/Random.h>
21 #include <agx/Vec3.h>
22 #include <agx/Vec4.h>
28 
29 #include "Util.h"
30 #include "Common.h"
31 
32 
33 namespace agx { namespace Physics { namespace HierarchicalGrid {
34 
35  // typedef agx::HashTable<agx::Vec3i, agx::Physics::HierarchicalGrid::ContactZonePtr, agx::HashFn< agx::Vec3i >, agxData::BufferProxyAllocator> ContactZoneTable;
36  // typedef agx::HashTable<agx::UInt64, agx::Physics::HierarchicalGrid::ContactZoneDependencyPtr, agx::HashFn< agx::UInt64 >, agxData::BufferProxyAllocator> ZoneDependencyTable;
37 
39  {
40  public:
42  CellData& cell,
43  ContactZoneData& zone,
44  ContactZoneDependencyData& dependency,
45  GridTierData& gridTier,
46  // ContactZoneTable& zoneTable,
47  // ZoneDependencyTable& zoneDependencyTable,
48  UInt contactZoneAccumulationLevel,
49  ContactZonePtr& iterationStartZone,
50  ContactZonePtr& iterationEndZone
51  );
52 
54 
55  ContactZoneInstance getContactZone(Index cellIndex1, Index cellIndex2);
56 
57  ContactZonePtr createInternalZone(Index cellIndex, Index tierIndex);
58  ContactZonePtr createFaceZone(const Vec3i& id, Index tierIndex);
59  ContactZonePtr createEdgeZone(const Vec3i& id, Index tierIndex);
60  ContactZonePtr createCornerZone(const Vec3i& id, Index tierIndex);
61  ContactZonePtr createBoundaryZone(const Vec3i& id, Index tierIndex);
62 
64 
65 
66  // Automatically called by destructor
68 
69  private:
70  // void addDependency(ContactZonePtr parent, ContactZonePtr child);
71  // void removeDependency(ContactZonePtr parent, ContactZonePtr child);
72  // void addChildDependenciesToCorner(ContactZonePtr parent, const Vec3i& cornerId);
73  // void addChildDependenciesToEdge(ContactZonePtr parent, const Vec3i& edgeId);
74  // void addParentDependenciesToInternal(ContactZonePtr child, const Vec3i& internalId);
75  // void addParentDependenciesToEdge(ContactZonePtr child, const Vec3i& edgeId);
76  // void removeRedundantDependencies(ContactZonePtr zone);
77 
78  ContactZonePtr createZone(const Vec3i& id, ZoneCategory zoneType, Index tierIndex);
79 
80  // To calm the compiler
81  ContactZoneManager& operator=(const ContactZoneManager&) { return *this; }
82 
83  Vec4f generateRandomColor();
84 
85  private:
86  CellData& m_cell;
87  ContactZoneData& m_zone;
88  ContactZoneDependencyData& m_dependency;
89  GridTierData& m_gridTier;
90  // ContactZoneTable& m_zoneTable;
91  // ZoneDependencyTable& m_zoneDependencyTable;
92  UInt m_contactZoneAccumulationLevel;
93 
94  // The following two members are used only if CALCULATE_INCREMENTAL_DEPENDENCIES in
95  // the .cpp file is none-zero, which it usually isn't.
96  #ifdef __clang__
97  # pragma clang diagnostic push
98  # pragma clang diagnostic ignored "-Wunused-private-field"
99  #endif
100  ContactZonePtr& m_iterationStartZone;
101  ContactZonePtr& m_iterationEndZone;
102  #ifdef __clang__
103  # pragma clang diagnostic pop
104  #endif
105 
106  Vector<ContactZoneDependencyPtr> m_removedDependencies;
107 
108  UniformReal32Generator m_randomGenerator;
109  };
110 
111 
112 
113 
114 }}}
115 
116 
117 #endif /* AGX_CONTACTZONEMANAGER_H */
Pointer to a entity instance of type Physics.HierarchicalGrid.ContactZone.
A class holding 4 dimensional vectors and providing basic arithmetic.
Definition: Vec4Template.h:34
ContactZoneManager(CellData &cell, ContactZoneData &zone, ContactZoneDependencyData &dependency, GridTierData &gridTier, UInt contactZoneAccumulationLevel, ContactZonePtr &iterationStartZone, ContactZonePtr &iterationEndZone)
ContactZonePtr createCornerZone(const Vec3i &id, Index tierIndex)
ContactZonePtr createEdgeZone(const Vec3i &id, Index tierIndex)
Type-specific Array used for fast access into the data held by a Buffer.
Definition: agxData.h:30
ContactZoneInstance getContactZone(Index cellIndex1, Index cellIndex2)
ContactZonePtr createBoundaryZone(const Vec3i &id, Index tierIndex)
Templated vector class.
Definition: Vector.h:52
uint32_t UInt
Definition: Integer.h:34
The agx namespace contains the dynamics/math part of the AGX Dynamics API.
UInt32 Index
Definition: Integer.h:52
ContactZonePtr createInternalZone(Index cellIndex, Index tierIndex)
ContactZonePtr createFaceZone(const Vec3i &id, Index tierIndex)
void removeZones(agxData::Array< ContactZonePtr > &emptyZones)
ZoneCategory
The 27 internal zones are following categories (box features) and counts: Internal: 1 Face: 6 Edge: 1...