AGXDynamics  2.31.1.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
SparseTypes.h
Go to the documentation of this file.
1 /*
2 Copyright 2007-2021. 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  {
39  };
40 
43  };
44 
46  : IndexedRangeReal( idx,
47  rr,
49  {
50  }
51 
52  IndexedRangeReal( agx::UInt idx, agx::RangeReal rr, Trace trace )
53  : index( idx ),
54  range( rr ),
55  trace( trace )
56  {
57  }
58 
62 
63  private:
64  friend class Vector<IndexedRangeReal>;
66  : IndexedRangeReal( agx::InvalidIndex,
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 
119  agx::Bool isBoundedByNlCallback( agx::UInt row, agx::UInt searchDepth ) const;
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 }
bool Bool
Definition: Integer.h:48
int save_hdf5(void *group, const agx::String &name) const
write the array to an hdf5 stream, here disguised as the void * pointer
agx::RangeReal range
Definition: SparseTypes.h:60
AGXCORE_EXPORT const InvalidIndexStruct InvalidIndex
agx::Bool isBoundedByNlCallback(agx::UInt row, agx::UInt searchDepth) const
agx::UInt getScopePermutedMatrixRow() const
IndexedRangeReal(agx::UInt idx, agx::RangeReal rr)
Definition: SparseTypes.h:45
Interface class for solver callbacks.
Definition: NlmcpCallback.h:34
Essentially a sparse array of bounds.
Definition: SparseTypes.h:73
uint32_t UInt
Definition: Integer.h:34
void beginNlAddScope(agx::UInt permutedMatrixRow, agx::UInt iterativeRow)
Begin scope where NlmcpCallback instances are added given permuted matrix row.
const NlmcpCallbacks & getCallbacks() const
SparseRangeReal()
Default constructor.
agx::UInt endNlAddScope()
End &#39;add new nl-callbacks&#39; scope.
agx::UInt getScopeIterativeRow() const
void sort()
Sort given &#39;index&#39; in IndexedRangeReal and updates indices of added nl-callbacks. ...
int load_hdf5(void *group, const agx::String &name)
read the array from an hdf5 stream, here disguised as the void * pointer
agx::Bool add(agx::NlmcpCallback *callback, agx::UInt localRow, agx::UInt numRows)
Add nl-callback to receive callbacks during solves.
Data type to bind an index and ranges associated with it.
Definition: SparseTypes.h:29