AGXDynamics  2.35.0.3
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,
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::IndexSet::EQUALITY
@ EQUALITY
Definition: IndexSet.h:47
agx::IndexSet::Ipair::Ipair
Ipair(UInt globalIndex, UInt localIndex)
Definition: IndexSet.h:35
Vector.h
agx::IndexSet::~IndexSet
~IndexSet()
agx::Vector< Ipair >
agx::IndexSet::IndexType
IndexType
Definition: IndexSet.h:45
agx::IndexSet::FREE
@ FREE
Definition: IndexSet.h:48
agx::Int
int32_t Int
Definition: Integer.h:35
agx::IndexSet::Ipair::local
UInt local
Definition: IndexSet.h:37
agx::IndexSet::IVector
IntValarray IVector
Definition: IndexSet.h:41
agx::IndexSet::BVector
BoolValarray BVector
Definition: IndexSet.h:42
agx_valarray_types.h
agx
The agx namespace contains the dynamics/math part of the AGX Dynamics API.
Definition: AddedMassInteraction.h:22
agx::IntValarray
std::valarray< agx::Int > IntValarray
Definition: agx_valarray_types.h:28
agx::IndexSet::resize
void resize(agx::UInt n)
agx::IndexSet::Ipair::global
UInt global
Definition: IndexSet.h:36
agx::IndexSet::IGNORE_INDEX
@ IGNORE_INDEX
Definition: IndexSet.h:51
agx::IndexSet::hasIgnoredIndices
bool hasIgnoredIndices() const
agx::IndexSet::update
void update(const agx::SparseRangeReal &bounds)
agx::IndexSet::reset
void reset(const agx::SparseRangeReal &bounds)
agx::IndexSet::Ipair
Definition: IndexSet.h:33
agx::IndexSet
Definition: IndexSet.h:30
agx::IndexSet::IndexSet
IndexSet()
agx::IndexSet::operator()
agx::Int & operator()(agx::UInt i)
Definition: IndexSet.h:84
agx::UInt
uint32_t UInt
Definition: Integer.h:34
agx::IndexSet::hash
uint32_t hash()
agx::IndexSet::getFull
const agx::IndexSet::IVector & getFull() const
agx::IndexSet::LOWER
@ LOWER
Definition: IndexSet.h:49
agx::BoolValarray
std::valarray< agx::Bool > BoolValarray
Data type used for selecting sub-matrices.
Definition: agx_valarray_types.h:32
agx::IndexSet::getIndexSet
const agx::IndexSet::IVector & getIndexSet() const
agx::IndexSet::IxSet
agx::Vector< Ipair > IxSet
Definition: IndexSet.h:39
agx::IndexSet::UPPER
@ UPPER
Definition: IndexSet.h:50
agx::IndexSet::getAtBounds
const agx::IndexSet::IxSet & getAtBounds() const
AGX_FORCE_INLINE
#define AGX_FORCE_INLINE
Definition: macros.h:58
agx::SparseRangeReal
Essentially a sparse array of bounds.
Definition: SparseTypes.h:73