AGX Dynamics  2.37.3.2
IndexSet.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 #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,
52  };
53 
54  public:
55  IndexSet();
56  IndexSet( agx::UInt n );
57 
58  ~IndexSet();
59 
60  void resize( agx::UInt n );
61 
62  void reset( const agx::SparseRangeReal& bounds );
63 
64  void update( const agx::SparseRangeReal& bounds );
65 
66  const agx::IndexSet::IxSet& getAtBounds() const;
67 
68  const agx::IndexSet::IVector& getFull() const;
69  const agx::IndexSet::IVector& getIndexSet() const;
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 }
agx::Int & operator()(agx::UInt i)
Definition: IndexSet.h:84
std::valarray< agx::Bool > BoolValarray
Data type used for selecting sub-matrices.
BoolValarray BVector
Definition: IndexSet.h:42
std::valarray< agx::Int > IntValarray
IntValarray IVector
Definition: IndexSet.h:41
void reset(const agx::SparseRangeReal &bounds)
int32_t Int
Definition: Integer.h:35
const agx::IndexSet::IxSet & getAtBounds() const
#define AGX_FORCE_INLINE
Definition: Object.h:59
void update(const agx::SparseRangeReal &bounds)
Ipair(UInt globalIndex, UInt localIndex)
Definition: IndexSet.h:35
Essentially a sparse array of bounds.
Definition: SparseTypes.h:73
uint32_t UInt
Definition: Integer.h:34
The agx namespace contains the dynamics/math part of the AGX Dynamics API.
agx::Vector< Ipair > IxSet
Definition: IndexSet.h:39
void resize(agx::UInt n)
uint32_t hash()
const agx::IndexSet::IVector & getIndexSet() const
bool hasIgnoredIndices() const
const agx::IndexSet::IVector & getFull() const