mirror of
https://github.com/PixarAnimationStudios/OpenSubdiv
synced 2024-11-09 22:00:06 +00:00
Bug fix and method addition to Far::internal::SparseMatrix:
- fixed error in Copy() causing compilation failure on instantiation - added new Swap() method analogous to std::vector::swap()
This commit is contained in:
parent
debc323f06
commit
86dd8cc912
@ -29,6 +29,8 @@
|
||||
|
||||
#include "../vtr/array.h"
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
|
||||
namespace OpenSubdiv {
|
||||
namespace OPENSUBDIV_VERSION {
|
||||
@ -91,6 +93,7 @@ public:
|
||||
// Modification methods
|
||||
void Resize(int numRows, int numColumns, int numNonZeroEntriesToReserve);
|
||||
void Copy(SparseMatrix const & srcMatrix);
|
||||
void Swap(SparseMatrix & otherMatrix);
|
||||
|
||||
void SetRowSize(int rowIndex, int size);
|
||||
|
||||
@ -169,10 +172,23 @@ SparseMatrix<REAL>::Copy(SparseMatrix const & src) {
|
||||
|
||||
_numElements = src._numElements;
|
||||
|
||||
_columns = src._elements;
|
||||
_columns = src._columns;
|
||||
_elements = src._elements;
|
||||
}
|
||||
|
||||
template <typename REAL>
|
||||
inline void
|
||||
SparseMatrix<REAL>::Swap(SparseMatrix & other) {
|
||||
|
||||
std::swap(_numRows, other._numRows);
|
||||
std::swap(_numColumns, other._numColumns);
|
||||
std::swap(_numElements, other._numElements);
|
||||
|
||||
_rowOffsets.swap(other._rowOffsets);
|
||||
_columns.swap(other._columns);
|
||||
_elements.swap(other._elements);
|
||||
}
|
||||
|
||||
} // end namespace Far
|
||||
|
||||
} // end namespace OPENSUBDIV_VERSION
|
||||
|
Loading…
Reference in New Issue
Block a user