Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Sofa/framework/Core/src/sofa/core/objectmodel/DataLink.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class SOFA_CORE_API DataLink final : public AbstractDataLink
public:

DataLink(T& owner) : m_owner{owner} { }
virtual ~DataLink() {}
~DataLink() = default;

T* getTarget() const
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -446,28 +446,28 @@ class CompressedRowSparseMatrixMechanical final // final is used to allow the co
/// @{

/// @return type of elements stored in this matrix
virtual ElementType getElementType() const override { return traits::getElementType(); }
ElementType getElementType() const override { return traits::getElementType(); }

/// @return size of elements stored in this matrix
virtual std::size_t getElementSize() const override { return sizeof(Real); }
std::size_t getElementSize() const override { return sizeof(Real); }

/// @return the category of this matrix
virtual MatrixCategory getCategory() const override { return MATRIX_SPARSE; }
MatrixCategory getCategory() const override { return MATRIX_SPARSE; }

/// @return the number of rows in each block, or 1 of there are no fixed block size
virtual Index getBlockRows() const override { return NL; }
Index getBlockRows() const override { return NL; }

/// @return the number of columns in each block, or 1 of there are no fixed block size
virtual Index getBlockCols() const override { return NC; }
Index getBlockCols() const override { return NC; }

/// @return the number of rows of blocks
virtual Index bRowSize() const override{ return this->rowBSize(); }
Index bRowSize() const override{ return this->rowBSize(); }

/// @return the number of columns of blocks
virtual Index bColSize() const override { return this->colBSize(); }
Index bColSize() const override { return this->colBSize(); }

/// @return the width of the band on each side of the diagonal (only for band matrices)
virtual Index getBandWidth() const override { return NC-1; }
Index getBandWidth() const override { return NC-1; }

/// @}

Expand Down Expand Up @@ -641,23 +641,23 @@ class CompressedRowSparseMatrixMechanical final // final is used to allow the co
/// @{

protected:
virtual void bAccessorDelete(const InternalBlockAccessor* /*b*/) const override {}
virtual void bAccessorCopy(InternalBlockAccessor* /*b*/) const override {}
virtual SReal bAccessorElement(const InternalBlockAccessor* b, Index i, Index j) const override
void bAccessorDelete(const InternalBlockAccessor* /*b*/) const override {}
void bAccessorCopy(InternalBlockAccessor* /*b*/) const override {}
SReal bAccessorElement(const InternalBlockAccessor* b, Index i, Index j) const override
{
//return element(b->row * getBlockRows() + i, b->col * getBlockCols() + j);
Index index = b->data;
const Block& data = (index >= 0) ? this->colsValue[index] : this->btemp[-index-1].value;
return static_cast<SReal>(traits::v(data, i, j));
}
virtual void bAccessorSet(InternalBlockAccessor* b, Index i, Index j, double v) override
void bAccessorSet(InternalBlockAccessor* b, Index i, Index j, double v) override
{
//set(b->row * getBlockRows() + i, b->col * getBlockCols() + j, v);
Index index = b->data;
Block& data = (index >= 0) ? this->colsValue[index] : this->btemp[-index-1].value;
traits::vset(data, i, j, static_cast<Real>(v) );
}
virtual void bAccessorAdd(InternalBlockAccessor* b, Index i, Index j, double v) override
void bAccessorAdd(InternalBlockAccessor* b, Index i, Index j, double v) override
{
//add(b->row * getBlockRows() + i, b->col * getBlockCols() + j, v);
Index index = b->data;
Expand All @@ -675,15 +675,15 @@ class CompressedRowSparseMatrixMechanical final // final is used to allow the co
buffer[l*NC+c] = static_cast<T>(traits::v(data, l, c));
return buffer;
}
virtual const float* bAccessorElements(const InternalBlockAccessor* b, float* buffer) const override
const float* bAccessorElements(const InternalBlockAccessor* b, float* buffer) const override
{
return bAccessorElementsCSRImpl<float>(b, buffer);
}
virtual const double* bAccessorElements(const InternalBlockAccessor* b, double* buffer) const override
const double* bAccessorElements(const InternalBlockAccessor* b, double* buffer) const override
{
return bAccessorElementsCSRImpl<double>(b, buffer);
}
virtual const int* bAccessorElements(const InternalBlockAccessor* b, int* buffer) const override
const int* bAccessorElements(const InternalBlockAccessor* b, int* buffer) const override
{
return bAccessorElementsCSRImpl<int>(b, buffer);
}
Expand All @@ -697,15 +697,15 @@ class CompressedRowSparseMatrixMechanical final // final is used to allow the co
for (Index c=0; c < (Index)NC; ++c)
traits::vset(data, l, c, static_cast<Real>(buffer[l*NC+c]) );
}
virtual void bAccessorSet(InternalBlockAccessor* b, const float* buffer) override
void bAccessorSet(InternalBlockAccessor* b, const float* buffer) override
{
bAccessorSetCSRImpl<float>(b, buffer);
}
virtual void bAccessorSet(InternalBlockAccessor* b, const double* buffer) override
void bAccessorSet(InternalBlockAccessor* b, const double* buffer) override
{
bAccessorSetCSRImpl<double>(b, buffer);
}
virtual void bAccessorSet(InternalBlockAccessor* b, const int* buffer) override
void bAccessorSet(InternalBlockAccessor* b, const int* buffer) override
{
bAccessorSetCSRImpl<int>(b, buffer);
}
Expand All @@ -719,23 +719,23 @@ class CompressedRowSparseMatrixMechanical final // final is used to allow the co
for (Index c=0; c < (Index)NC; ++c)
traits::vadd(data, l, c,static_cast<Real>(buffer[l*NC+c]) );
}
virtual void bAccessorAdd(InternalBlockAccessor* b, const float* buffer) override
void bAccessorAdd(InternalBlockAccessor* b, const float* buffer) override
{
bAccessorAddCSRImpl<float>(b, buffer);
}
virtual void bAccessorAdd(InternalBlockAccessor* b, const double* buffer) override
void bAccessorAdd(InternalBlockAccessor* b, const double* buffer) override
{
bAccessorAddCSRImpl<double>(b, buffer);
}
virtual void bAccessorAdd(InternalBlockAccessor* b, const int* buffer) override
void bAccessorAdd(InternalBlockAccessor* b, const int* buffer) override
{
bAccessorAddCSRImpl<int>(b, buffer);
}

public:

/// Get read access to a block
virtual BlockConstAccessor blockGet(Index i, Index j) const
BlockConstAccessor blockGet(Index i, Index j) const
{
if constexpr (Policy::AutoCompress) const_cast<Matrix*>(this)->compress(); /// \warning this violates the const-ness of the method !

Expand All @@ -753,7 +753,7 @@ class CompressedRowSparseMatrixMechanical final // final is used to allow the co
}

/// Get write access to a block
virtual BlockAccessor blockGetW(Index i, Index j)
BlockAccessor blockGetW(Index i, Index j)
{
if constexpr (Policy::AutoCompress) compress();

Expand All @@ -771,7 +771,7 @@ class CompressedRowSparseMatrixMechanical final // final is used to allow the co
}

/// Get write access to a block, possibly creating it
virtual BlockAccessor blockCreate(Index i, Index j)
BlockAccessor blockCreate(Index i, Index j)
{
Index rowId = Index(i * this->rowIndex.size() / this->nBlockRow);
if (this->sortedFind(this->rowIndex, i, rowId))
Expand All @@ -792,35 +792,35 @@ class CompressedRowSparseMatrixMechanical final // final is used to allow the co
}

protected:
virtual void itCopyColBlock(InternalColBlockIterator* /*it*/) const override {}
virtual void itDeleteColBlock(const InternalColBlockIterator* /*it*/) const override {}
virtual void itAccessColBlock(InternalColBlockIterator* it, BlockConstAccessor* b) const override
void itCopyColBlock(InternalColBlockIterator* /*it*/) const override {}
void itDeleteColBlock(const InternalColBlockIterator* /*it*/) const override {}
void itAccessColBlock(InternalColBlockIterator* it, BlockConstAccessor* b) const override
{
Index index = it->data;
setMatrix(b);
getInternal(b)->row = it->row;
getInternal(b)->data = index;
getInternal(b)->col = this->colsIndex[index];
}
virtual void itIncColBlock(InternalColBlockIterator* it) const override
void itIncColBlock(InternalColBlockIterator* it) const override
{
Index index = it->data;
++index;
it->data = index;
}
virtual void itDecColBlock(InternalColBlockIterator* it) const override
void itDecColBlock(InternalColBlockIterator* it) const override
{
Index index = it->data;
--index;
it->data = index;
}
virtual bool itEqColBlock(const InternalColBlockIterator* it, const InternalColBlockIterator* it2) const override
bool itEqColBlock(const InternalColBlockIterator* it, const InternalColBlockIterator* it2) const override
{
Index index = it->data;
Index index2 = it2->data;
return index == index2;
}
virtual bool itLessColBlock(const InternalColBlockIterator* it, const InternalColBlockIterator* it2) const override
bool itLessColBlock(const InternalColBlockIterator* it, const InternalColBlockIterator* it2) const override
{
Index index = it->data;
Index index2 = it2->data;
Expand All @@ -829,7 +829,7 @@ class CompressedRowSparseMatrixMechanical final // final is used to allow the co

public:
/// Get the iterator corresponding to the beginning of the given row of blocks
virtual ColBlockConstIterator bRowBegin(Index ib) const override
ColBlockConstIterator bRowBegin(Index ib) const override
{
if constexpr (Policy::AutoCompress) const_cast<Matrix*>(this)->compress(); /// \warning this violates the const-ness of the method !
Index rowId = Index(ib * this->rowIndex.size() / this->nBlockRow);
Expand All @@ -842,7 +842,7 @@ class CompressedRowSparseMatrixMechanical final // final is used to allow the co
}

/// Get the iterator corresponding to the end of the given row of blocks
virtual ColBlockConstIterator bRowEnd(Index ib) const override
ColBlockConstIterator bRowEnd(Index ib) const override
{
if constexpr (Policy::AutoCompress) const_cast<Matrix*>(this)->compress(); /// \warning this violates the const-ness of the method !
Index rowId = Index(ib * this->rowIndex.size() / this->nBlockRow);
Expand All @@ -855,7 +855,7 @@ class CompressedRowSparseMatrixMechanical final // final is used to allow the co
}

/// Get the iterators corresponding to the beginning and end of the given row of blocks
virtual std::pair<ColBlockConstIterator, ColBlockConstIterator> bRowRange(Index ib) const override
std::pair<ColBlockConstIterator, ColBlockConstIterator> bRowRange(Index ib) const override
{
if constexpr (Policy::AutoCompress) const_cast<Matrix*>(this)->compress(); /// \warning this violates the const-ness of the method !
Index rowId = Index(ib * this->rowIndex.size() / this->nBlockRow);
Expand All @@ -871,28 +871,28 @@ class CompressedRowSparseMatrixMechanical final // final is used to allow the co


protected:
virtual void itCopyRowBlock(InternalRowBlockIterator* /*it*/) const override {}
virtual void itDeleteRowBlock(const InternalRowBlockIterator* /*it*/) const override {}
virtual Index itAccessRowBlock(InternalRowBlockIterator* it) const override
void itCopyRowBlock(InternalRowBlockIterator* /*it*/) const override {}
void itDeleteRowBlock(const InternalRowBlockIterator* /*it*/) const override {}
Index itAccessRowBlock(InternalRowBlockIterator* it) const override
{
Index rowId = it->data[0];
return this->rowIndex[rowId];
}
virtual ColBlockConstIterator itBeginRowBlock(InternalRowBlockIterator* it) const override
ColBlockConstIterator itBeginRowBlock(InternalRowBlockIterator* it) const override
{
Index rowId = it->data[0];
Index row = this->rowIndex[rowId];
Index index = this->rowBegin[rowId];
return createColBlockConstIterator(row, index);
}
virtual ColBlockConstIterator itEndRowBlock(InternalRowBlockIterator* it) const override
ColBlockConstIterator itEndRowBlock(InternalRowBlockIterator* it) const override
{
Index rowId = it->data[0];
Index row = this->rowIndex[rowId];
Index index2 = this->rowBegin[rowId+1];
return createColBlockConstIterator(row, index2);
}
virtual std::pair<ColBlockConstIterator, ColBlockConstIterator> itRangeRowBlock(InternalRowBlockIterator* it) const override
std::pair<ColBlockConstIterator, ColBlockConstIterator> itRangeRowBlock(InternalRowBlockIterator* it) const override
{
Index rowId = it->data[0];
Index row = this->rowIndex[rowId];
Expand All @@ -902,25 +902,25 @@ class CompressedRowSparseMatrixMechanical final // final is used to allow the co
createColBlockConstIterator(row, index2));
}

virtual void itIncRowBlock(InternalRowBlockIterator* it) const override
void itIncRowBlock(InternalRowBlockIterator* it) const override
{
Index rowId = it->data[0];
++rowId;
it->data[0] = rowId;
}
virtual void itDecRowBlock(InternalRowBlockIterator* it) const override
void itDecRowBlock(InternalRowBlockIterator* it) const override
{
Index rowId = it->data[0];
--rowId;
it->data[0] = rowId;
}
virtual bool itEqRowBlock(const InternalRowBlockIterator* it, const InternalRowBlockIterator* it2) const override
bool itEqRowBlock(const InternalRowBlockIterator* it, const InternalRowBlockIterator* it2) const override
{
Index rowId = it->data[0];
Index rowId2 = it2->data[0];
return rowId == rowId2;
}
virtual bool itLessRowBlock(const InternalRowBlockIterator* it, const InternalRowBlockIterator* it2) const override
bool itLessRowBlock(const InternalRowBlockIterator* it, const InternalRowBlockIterator* it2) const override
{
Index rowId = it->data[0];
Index rowId2 = it2->data[0];
Expand All @@ -929,21 +929,21 @@ class CompressedRowSparseMatrixMechanical final // final is used to allow the co

public:
/// Get the iterator corresponding to the beginning of the rows of blocks
virtual RowBlockConstIterator bRowsBegin() const override
RowBlockConstIterator bRowsBegin() const override
{
if constexpr (Policy::AutoCompress) const_cast<Matrix*>(this)->compress(); /// \warning this violates the const-ness of the method !
return createRowBlockConstIterator(0, 0);
}

/// Get the iterator corresponding to the end of the rows of blocks
virtual RowBlockConstIterator bRowsEnd() const override
RowBlockConstIterator bRowsEnd() const override
{
if constexpr (Policy::AutoCompress) const_cast<Matrix*>(this)->compress(); /// \warning this violates the const-ness of the method !
return createRowBlockConstIterator(Index(this->rowIndex.size()), 0);
}

/// Get the iterators corresponding to the beginning and end of the given row of blocks
virtual std::pair<RowBlockConstIterator, RowBlockConstIterator> bRowsRange() const override
std::pair<RowBlockConstIterator, RowBlockConstIterator> bRowsRange() const override
{
if constexpr (Policy::AutoCompress) const_cast<Matrix*>(this)->compress(); /// \warning this violates the const-ness of the method !
return std::make_pair(createRowBlockConstIterator(0, 0),
Expand Down