From 8abb45fd212b067b83d6d16d180d8ee4d83a36d3 Mon Sep 17 00:00:00 2001 From: Irlan <-> Date: Sun, 27 May 2018 02:44:01 -0300 Subject: [PATCH] clean up --- include/bounce/dynamics/cloth/sparse_mat33.h | 62 -------------------- 1 file changed, 62 deletions(-) diff --git a/include/bounce/dynamics/cloth/sparse_mat33.h b/include/bounce/dynamics/cloth/sparse_mat33.h index 48f54b5..e192b3d 100644 --- a/include/bounce/dynamics/cloth/sparse_mat33.h +++ b/include/bounce/dynamics/cloth/sparse_mat33.h @@ -151,66 +151,4 @@ inline b3DenseVec3 operator*(const b3SparseMat33& A, const b3DenseVec3& v) return result; } -inline void b3Add(b3SparseMat33& out, b3SparseMat33& A, const b3SparseMat33& B) -{ - B3_ASSERT(A.M == B.M); - B3_ASSERT(A.N == B.N); - - B3_ASSERT(A.M == out.M); - B3_ASSERT(A.N == out.N); - - // out = A - for (u32 i = 0; i < A.valueCount; ++i) - { - out.values[i] = A.values[i]; - out.cols[i] = A.cols[i]; - } - out.valueCount = A.valueCount; - - for (u32 i = 0; i < A.M + 1; ++i) - { - out.row_ptrs[i] = A.row_ptrs[i]; - } - - // out += B - for (u32 i = 0; i < B.M; ++i) - { - for (u32 row_ptr_B = B.row_ptrs[i]; row_ptr_B < B.row_ptrs[i + 1]; ++row_ptr_B) - { - u32 col_B = B.cols[row_ptr_B]; - - // Does A has a non-zero element that exist in B? - u32 row_ptr_A = A.row_ptrs[i]; - while (row_ptr_A != A.row_ptrs[i + 1]) - { - u32 col_A = A.cols[row_ptr_A]; - - if (col_A > col_B) - { - break; - } - - ++row_ptr_A; - } - - u32 col_A = A.cols[row_ptr_A]; - - if (col_A == col_B) - { - out.values[col_A] += B.values[col_B]; - } - else - { - out.values[out.valueCount] = B.values[col_B]; - out.cols[out.valueCount] = col_B; - ++out.valueCount; - - out.row_ptrs[i + 1] = out.row_ptrs[(i + 1) - 1] + col_A; - } - } - } - - B3_ASSERT(out.valueCount <= A.N); -} - #endif \ No newline at end of file