AGX Dynamics 2.38.0.2
Loading...
Searching...
No Matches
SparseMatrixRepSabre.h
Go to the documentation of this file.
1/*
2Copyright 2007-2024. Algoryx Simulation AB.
3
4All AGX source code, intellectual property, documentation, sample code,
5tutorials, scene files and technical white papers, are copyrighted, proprietary
6and confidential material of Algoryx Simulation AB. You may not download, read,
7store, distribute, publish, copy or otherwise disseminate, use or expose this
8material unless having a written signed agreement with Algoryx Simulation AB, or having been
9advised so by Algoryx Simulation AB for a time limited evaluation, or having purchased a
10valid commercial license from Algoryx Simulation AB.
11
12Algoryx Simulation AB disclaims all responsibilities for loss or damage caused
13from using this software, unless otherwise stated in written agreements with
14Algoryx Simulation AB.
15*/
16
17#ifndef AGX_SPARSEMATRIXREPSABRE_H
18#define AGX_SPARSEMATRIXREPSABRE_H
19
20#include <agx/config/AGX_USE_HDF5.h>
21#include <agx/SparseMatrix.h>
22#include <agxSabre/Sabre.h>
23#include <agxSabre/SabreData.h>
24
25namespace agx
26{
27
29 {
30 public:
31 // constructor
33
34 // Optional constructor that takes compressed matrix as input
35 SparseMatrixRepSabre( size_t* blkSizes, size_t numBlocks, size_t i, size_t j, size_t nnz, int* r, int* c, double* data );
36
37 // destructor
39
40 virtual agx::Real* getBlock(int i, int j, bool& writeTransposed, unsigned int& ld) override;
41
42 virtual void reset() override;
43
44 virtual void factor() override;
45 virtual void solve( agx::Real* ) override;
46 virtual size_t unitSolve( agx::Real*, int startRow = -1 ) override;
47
48 virtual void multiply( const agx::Real* x, agx::Real* r ) override;
49 virtual void multiplyAdd( const agx::Real* x, agx::Real* r ) override;
50 virtual void multiplyAdd( const agx::Real& alpha, const agx::Real* x, const agx::Real& beta, agx::Real* r ) override;
51
52 virtual void setLogicalStructure( size_t n, const unsigned int* pointers, const unsigned int* indices, const unsigned int* dimensions, const int* flags, unsigned int numThreads ) override;
53
54 virtual agx::Bool getRow( agx::UInt rowNumber, const agx::RealValarray& signs, agx::RealValarray& retRow ) const override;
55 virtual agx::Bool getColumn( agx::UInt colNumber, agx::RealValarray& retCol, agx::Bool& signFlip ) const override;
56
57 virtual agx::UInt getBlockPermutedStartRowIndex( agx::UInt blockIndex ) const override;
58 virtual agx::UInt permuteRowIndex( agx::UInt rowIndex ) const override;
59 virtual agx::UInt invPermuteRowIndex( agx::UInt permutedRowIndex ) const override;
60
61 virtual unsigned int getNumRows() const override;
62 virtual unsigned int getNumColumns() const override;
63
64 virtual void print() const override;
65
66 virtual void setNumBodies(size_t num) override;
67
68 #if AGX_USE_HDF5()
69 virtual bool saveH5(void* group, const agx::String& name ) const override;
70 virtual bool loadH5(void* group, const agx::String& name ) override;
71 #endif
72
73 virtual agx::Real getFactorTime() const override { return m_data.getFactorTime(); }
74 virtual agx::Real getSolveTime() const override { return m_data.getSolveTime(); }
75
76 agxSabre::SabreData<agx::Real>& getSabreData() { return m_data; }
77 const agxSabre::SabreData<agx::Real>& getSabreData() const { return m_data; }
78
79 private:
80 agxSabre::Sabre m_sabre;
81 agxSabre::SabreData<agx::Real> m_data;
82 };
83
84}
85
86#endif
virtual void setLogicalStructure(size_t n, const unsigned int *pointers, const unsigned int *indices, const unsigned int *dimensions, const int *flags, unsigned int numThreads) override
virtual void multiply(const agx::Real *x, agx::Real *r) override
virtual agx::Real getSolveTime() const override
virtual agx::Real * getBlock(int i, int j, bool &writeTransposed, unsigned int &ld) override
SparseMatrixRepSabre(size_t *blkSizes, size_t numBlocks, size_t i, size_t j, size_t nnz, int *r, int *c, double *data)
virtual void reset() override
virtual agx::Bool getColumn(agx::UInt colNumber, agx::RealValarray &retCol, agx::Bool &signFlip) const override
const agxSabre::SabreData< agx::Real > & getSabreData() const
virtual agx::Real getFactorTime() const override
virtual void factor() override
virtual void multiplyAdd(const agx::Real &alpha, const agx::Real *x, const agx::Real &beta, agx::Real *r) override
virtual agx::Bool getRow(agx::UInt rowNumber, const agx::RealValarray &signs, agx::RealValarray &retRow) const override
virtual agx::UInt getBlockPermutedStartRowIndex(agx::UInt blockIndex) const override
virtual agx::UInt invPermuteRowIndex(agx::UInt permutedRowIndex) const override
virtual size_t unitSolve(agx::Real *, int startRow=-1) override
virtual unsigned int getNumRows() const override
virtual unsigned int getNumColumns() const override
virtual void solve(agx::Real *) override
virtual void setNumBodies(size_t num) override
agxSabre::SabreData< agx::Real > & getSabreData()
virtual void print() const override
virtual agx::UInt permuteRowIndex(agx::UInt rowIndex) const override
virtual void multiplyAdd(const agx::Real *x, agx::Real *r) override
SparseMatrixRep.
virtual bool loadH5(void *group, const agx::String &name)
virtual bool saveH5(void *group, const agx::String &name) const
The agx namespace contains the dynamics/math part of the AGX Dynamics API.
bool Bool
Definition Integer.h:40
uint64_t UInt
Definition Integer.h:27
double Real
Definition Real.h:42
std::valarray< agx::Real > RealValarray
For this module, vectors are defined using valarray.