AGX Dynamics  2.35.0.1
IndexSet.h
Go to the documentation of this file.
1 /*
2 Copyright 2007-2022. 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 #pragma once
18 
19 #ifdef _MSC_VER
20 # pragma warning(disable: 4714) // Disable warnings about not able to __forceinline
21 #endif
22 
23 #include <agx/Vector.h>
24 #include <agx/agx_valarray_types.h>
25 
26 namespace agx
27 {
28  class SparseRangeReal;
29 
30  class IndexSet
31  {
32  public:
33  struct Ipair
34  {
35  Ipair( UInt globalIndex, UInt localIndex ) : global( globalIndex ), local( localIndex ) {}
38  };
40 
43 
44  public:
45  enum IndexType
46  {
47  EQUALITY = -1,
48  FREE = 0,
49  LOWER = 2,
50  UPPER = 4,
51  IGNORE_INDEX = 8
52  };
53 
54  public:
57 
59 
60  void resize( agx::UInt n );
61 
62  void reset( const agx::SparseRangeReal& bounds );
63 
64  void update( const agx::SparseRangeReal& bounds );
65 
67 
70 
72  agx::Int operator() ( agx::UInt i ) const;
73 
74  bool hasIgnoredIndices() const;
75 
76  uint32_t hash();
77 
78  private:
79  IVector m_full;
80  IVector m_ix;
81  mutable IxSet m_bag;
82  };
83 
85  {
86  return m_ix[i];
87  }
88 
90  {
91  return m_ix[i];
92  }
93 }
const agx::IndexSet::IVector & getFull() const
const agx::IndexSet::IVector & getIndexSet() const
BoolValarray BVector
Definition: IndexSet.h:42
uint32_t hash()
agx::Vector< Ipair > IxSet
Definition: IndexSet.h:39
bool hasIgnoredIndices() const
IntValarray IVector
Definition: IndexSet.h:41
void resize(agx::UInt n)
const agx::IndexSet::IxSet & getAtBounds() const
void update(const agx::SparseRangeReal &bounds)
IndexSet(agx::UInt n)
agx::Int & operator()(agx::UInt i)
Definition: IndexSet.h:84
void reset(const agx::SparseRangeReal &bounds)
Essentially a sparse array of bounds.
Definition: SparseTypes.h:74
#define AGX_FORCE_INLINE
Definition: macros.h:58
The agx namespace contains the dynamics/math part of the AGX Dynamics API.
std::valarray< agx::Int > IntValarray
int32_t Int
Definition: Integer.h:35
uint32_t UInt
Definition: Integer.h:34
std::valarray< agx::Bool > BoolValarray
Data type used for selecting sub-matrices.
Ipair(UInt globalIndex, UInt localIndex)
Definition: IndexSet.h:35