SOFA API  1a4bb3e7
Open source framework for multi-physics simuation
sofa::linearalgebra::BaseMatrix::BlockAccessor Class Reference

#include <BaseMatrix.h>

Protected Attributes

BaseMatrixmatrix
 
InternalBlockAccessor internal
 

Public Member Functions

 ~BlockAccessor ()
 
 BlockAccessor (const BlockAccessor &b)
 
void operator= (const BlockAccessor &b)
 
Index getRow () const
 
Index getCol () const
 
const BaseMatrixgetMatrix () const
 
BaseMatrixgetMatrix ()
 
bool isValid () const
 
SReal element (Index i, Index j) const
 Read the value of the element at row i, column j within this block (using 0-based indices) More...
 
void set (Index i, Index j, double v)
 Write the value of the element at row i, column j within this block (using 0-based indices) More...
 
void add (Index i, Index j, double v)
 Add v to the existing value of the element at row i, column j within this block (using 0-based indices) More...
 
const floatelements (float *dest) const
 Read all values from this block into given float buffer, or return the pointer to the data if the in-memory format is compatible. More...
 
const double * elements (double *dest) const
 Read all values from this block into given double buffer, or return the pointer to the data if the in-memory format is compatible. More...
 
const int * elements (int *dest) const
 Read all values from this block into given int buffer, or return the pointer to the data if the in-memory format is compatible. More...
 
void set (const float *src)
 Set all values of this block from the given float buffer. More...
 
void set (const double *src)
 Set all values of this block from the given double buffer. More...
 
void set (const int *src)
 Set all values of this block from the given int buffer. More...
 
void add (const float *src)
 Add to all values of this block from the given float buffer. More...
 
void add (const double *src)
 Add to all values of this block from the given double buffer. More...
 
void add (const int *src)
 Add to all values of this block from the given int buffer. More...
 
const floatprepareAdd (float *buffer)
 
void finishAdd (const float *buffer)
 
const double * prepareAdd (double *buffer)
 
void finishAdd (const double *buffer)
 
const int * prepareAdd (int *buffer)
 
void finishAdd (const int *buffer)
 

Protected Member Functions

 BlockAccessor ()
 
 BlockAccessor (BaseMatrix *matrix, Index row, Index col, void *internalPtr)
 
 BlockAccessor (BaseMatrix *matrix, Index row, Index col, Index internalData)
 

Friends

class BaseMatrix
 
class BlockConstAccessor
 
class ColBlockConstIterator
 

Attribute details

◆ internal

InternalBlockAccessor sofa::linearalgebra::BaseMatrix::BlockAccessor::internal
protected

◆ matrix

BaseMatrix* sofa::linearalgebra::BaseMatrix::BlockAccessor::matrix
protected

Constructor details

◆ BlockAccessor() [1/4]

sofa::linearalgebra::BaseMatrix::BlockAccessor::BlockAccessor ( )
inlineprotected

◆ BlockAccessor() [2/4]

sofa::linearalgebra::BaseMatrix::BlockAccessor::BlockAccessor ( BaseMatrix matrix,
Index  row,
Index  col,
void *  internalPtr 
)
inlineprotected

◆ BlockAccessor() [3/4]

sofa::linearalgebra::BaseMatrix::BlockAccessor::BlockAccessor ( BaseMatrix matrix,
Index  row,
Index  col,
Index  internalData 
)
inlineprotected

◆ ~BlockAccessor()

sofa::linearalgebra::BaseMatrix::BlockAccessor::~BlockAccessor ( )
inline

◆ BlockAccessor() [4/4]

sofa::linearalgebra::BaseMatrix::BlockAccessor::BlockAccessor ( const BlockAccessor b)
inline

Function details

◆ add() [1/4]

void sofa::linearalgebra::BaseMatrix::BlockAccessor::add ( const double *  src)
inline

Add to all values of this block from the given double buffer.

◆ add() [2/4]

void sofa::linearalgebra::BaseMatrix::BlockAccessor::add ( const float src)
inline

Add to all values of this block from the given float buffer.

◆ add() [3/4]

void sofa::linearalgebra::BaseMatrix::BlockAccessor::add ( const int *  src)
inline

Add to all values of this block from the given int buffer.

◆ add() [4/4]

void sofa::linearalgebra::BaseMatrix::BlockAccessor::add ( Index  i,
Index  j,
double  v 
)
inline

Add v to the existing value of the element at row i, column j within this block (using 0-based indices)

◆ element()

SReal sofa::linearalgebra::BaseMatrix::BlockAccessor::element ( Index  i,
Index  j 
) const
inline

Read the value of the element at row i, column j within this block (using 0-based indices)

◆ elements() [1/3]

const double* sofa::linearalgebra::BaseMatrix::BlockAccessor::elements ( double *  dest) const
inline

Read all values from this block into given double buffer, or return the pointer to the data if the in-memory format is compatible.

◆ elements() [2/3]

const float* sofa::linearalgebra::BaseMatrix::BlockAccessor::elements ( float dest) const
inline

Read all values from this block into given float buffer, or return the pointer to the data if the in-memory format is compatible.

◆ elements() [3/3]

const int* sofa::linearalgebra::BaseMatrix::BlockAccessor::elements ( int *  dest) const
inline

Read all values from this block into given int buffer, or return the pointer to the data if the in-memory format is compatible.

◆ finishAdd() [1/3]

void sofa::linearalgebra::BaseMatrix::BlockAccessor::finishAdd ( const double *  buffer)
inline

Finalize an addition of double values to this block. The buffer must be the one returned by calling the prepareAdd method.

◆ finishAdd() [2/3]

void sofa::linearalgebra::BaseMatrix::BlockAccessor::finishAdd ( const float buffer)
inline

Finalize an addition of float values to this block. The buffer must be the one returned by calling the prepareAdd method.

◆ finishAdd() [3/3]

void sofa::linearalgebra::BaseMatrix::BlockAccessor::finishAdd ( const int *  buffer)
inline

Finalize an addition of int values to this block. The buffer must be the one returned by calling the prepareAdd method.

◆ getCol()

Index sofa::linearalgebra::BaseMatrix::BlockAccessor::getCol ( ) const
inline

◆ getMatrix() [1/2]

BaseMatrix* sofa::linearalgebra::BaseMatrix::BlockAccessor::getMatrix ( )
inline

◆ getMatrix() [2/2]

const BaseMatrix* sofa::linearalgebra::BaseMatrix::BlockAccessor::getMatrix ( ) const
inline

◆ getRow()

Index sofa::linearalgebra::BaseMatrix::BlockAccessor::getRow ( ) const
inline

◆ isValid()

bool sofa::linearalgebra::BaseMatrix::BlockAccessor::isValid ( ) const
inline

◆ operator=()

void sofa::linearalgebra::BaseMatrix::BlockAccessor::operator= ( const BlockAccessor b)
inline

◆ prepareAdd() [1/3]

const double* sofa::linearalgebra::BaseMatrix::BlockAccessor::prepareAdd ( double *  buffer)
inline

Prepare the addition of double values to this block. Return a pointer to a double buffer where values can be added. If the in-memory format of the matrix is incompatible, the provided buffer can be used, but the method must clear it before returning.

◆ prepareAdd() [2/3]

const float* sofa::linearalgebra::BaseMatrix::BlockAccessor::prepareAdd ( float buffer)
inline

Prepare the addition of float values to this block. Return a pointer to a float buffer where values can be added. If the in-memory format of the matrix is incompatible, the provided buffer can be used, but the method must clear it before returning.

◆ prepareAdd() [3/3]

const int* sofa::linearalgebra::BaseMatrix::BlockAccessor::prepareAdd ( int *  buffer)
inline

Prepare the addition of int values to this block. Return a pointer to a int buffer where values can be added. If the in-memory format of the matrix is incompatible, the provided buffer can be used, but the method must clear it before returning.

◆ set() [1/4]

void sofa::linearalgebra::BaseMatrix::BlockAccessor::set ( const double *  src)
inline

Set all values of this block from the given double buffer.

◆ set() [2/4]

void sofa::linearalgebra::BaseMatrix::BlockAccessor::set ( const float src)
inline

Set all values of this block from the given float buffer.

◆ set() [3/4]

void sofa::linearalgebra::BaseMatrix::BlockAccessor::set ( const int *  src)
inline

Set all values of this block from the given int buffer.

◆ set() [4/4]

void sofa::linearalgebra::BaseMatrix::BlockAccessor::set ( Index  i,
Index  j,
double  v 
)
inline

Write the value of the element at row i, column j within this block (using 0-based indices)

Related details

◆ BaseMatrix

friend class BaseMatrix
friend

◆ BlockConstAccessor

friend class BlockConstAccessor
friend

◆ ColBlockConstIterator

friend class ColBlockConstIterator
friend