AGX Dynamics  2.35.0.1
SparseTypes.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 #include <agx/Vector.h>
20 #include <agx/NlmcpCallback.h>
21 
22 namespace agx
23 {
25 
30  {
31  struct Trace
32  {
33  enum Buffer
34  {
38  UNKNOWN
39  };
40 
43  };
44 
46  : IndexedRangeReal( idx,
47  rr,
49  {
50  }
51 
53  : index( idx ),
54  range( rr ),
55  trace( trace )
56  {
57  }
58 
62 
63  private:
64  friend class Vector<IndexedRangeReal>;
67  RangeReal() )
68  {
69  }
70  };
71 
73  class SparseRangeReal : public Vector<IndexedRangeReal>
74  {
75  public:
80 
88  agx::Bool add( agx::NlmcpCallback* callback, agx::UInt localRow, agx::UInt numRows );
89 
95  void beginNlAddScope( agx::UInt permutedMatrixRow, agx::UInt iterativeRow );
96 
103 
108 
113 
120 
125  void sort();
126 
130  const NlmcpCallbacks& getCallbacks() const;
131 
132  public:
134  int save_hdf5(void *group, const agx::String & name) const;
136  int save_hdf5(const agx::String & filename , const agx::String & name) const;
138  int load_hdf5(void *group, const agx::String & name);
140  int load_hdf5(const agx::String & filename , const agx::String & name);
141 
142  private:
143  struct NlAddScopeData
144  {
145  NlAddScopeData()
146  : directRow( agx::InvalidIndex ),
147  iterativeRow( agx::InvalidIndex ),
148  numCallbacks( agx::InvalidIndex )
149  {
150  }
151 
152  agx::UInt directRow;
153  agx::UInt iterativeRow;
154  agx::UInt numCallbacks;
155  };
156 
157  private:
158  agx::NlmcpCallbacks m_nlCallbacks;
159  NlAddScopeData m_nlAddScopeData;
160  };
161 }
Interface class for solver callbacks.
Definition: NlmcpCallback.h:43
Essentially a sparse array of bounds.
Definition: SparseTypes.h:74
agx::UInt getScopePermutedMatrixRow() const
void beginNlAddScope(agx::UInt permutedMatrixRow, agx::UInt iterativeRow)
Begin scope where NlmcpCallback instances are added given permuted matrix row.
int save_hdf5(void *group, const agx::String &name) const
write the array to an hdf5 stream, here disguised as the void * pointer
SparseRangeReal()
Default constructor.
agx::Bool add(agx::NlmcpCallback *callback, agx::UInt localRow, agx::UInt numRows)
Add nl-callback to receive callbacks during solves.
agx::UInt getScopeIterativeRow() const
agx::Bool isBoundedByNlCallback(agx::UInt row, agx::UInt searchDepth) const
void sort()
Sort given 'index' in IndexedRangeReal and updates indices of added nl-callbacks.
int load_hdf5(const agx::String &filename, const agx::String &name)
read the array to file in hdf5 format, with given name.
agx::UInt endNlAddScope()
End 'add new nl-callbacks' scope.
int save_hdf5(const agx::String &filename, const agx::String &name) const
write the array to file in hdf5 format, with given name.
const NlmcpCallbacks & getCallbacks() const
int load_hdf5(void *group, const agx::String &name)
read the array from an hdf5 stream, here disguised as the void * pointer
The agx namespace contains the dynamics/math part of the AGX Dynamics API.
bool Bool
Definition: Integer.h:48
uint32_t UInt
Definition: Integer.h:34
AGXCORE_EXPORT const InvalidIndexStruct InvalidIndex
Data type to bind an index and ranges associated with it.
Definition: SparseTypes.h:30
IndexedRangeReal(agx::UInt idx, agx::RangeReal rr)
Definition: SparseTypes.h:45
agx::RangeReal range
Definition: SparseTypes.h:60
IndexedRangeReal(agx::UInt idx, agx::RangeReal rr, Trace trace)
Definition: SparseTypes.h:52