[Bf-blender-cvs] [8f8e1dd] master: Code cleanup: Remove unused functions from implicit.c

Sergey Sharybin noreply at git.blender.org
Sun Nov 9 12:48:57 CET 2014


Commit: 8f8e1dd8f7c7afefc98e4f8be185e2af8c048827
Author: Sergey Sharybin
Date:   Sat Nov 1 03:26:50 2014 +0500
Branches: master
https://developer.blender.org/rB8f8e1dd8f7c7afefc98e4f8be185e2af8c048827

Code cleanup: Remove unused functions from implicit.c

Most of the unused functions were removed. Some of them were if-defed
because they are referenced from the code which was already if-defed.

Reviewers: lukastoenne, campbellbarton

Differential Revision: https://developer.blender.org/D868

===================================================================

M	source/blender/blenkernel/intern/implicit.c

===================================================================

diff --git a/source/blender/blenkernel/intern/implicit.c b/source/blender/blenkernel/intern/implicit.c
index 4cf9d52..9a8c32c 100644
--- a/source/blender/blenkernel/intern/implicit.c
+++ b/source/blender/blenkernel/intern/implicit.c
@@ -144,14 +144,6 @@ DO_INLINE void mul_fvector_S(float to[3], float from[3], float scalar)
 	to[1] = from[1] * scalar;
 	to[2] = from[2] * scalar;
 }
-/* simple cross product */
-/* STATUS: verified */
-DO_INLINE void cross_fvector(float to[3], float vectorA[3], float vectorB[3])
-{
-	to[0] = vectorA[1] * vectorB[2] - vectorA[2] * vectorB[1];
-	to[1] = vectorA[2] * vectorB[0] - vectorA[0] * vectorB[2];
-	to[2] = vectorA[0] * vectorB[1] - vectorA[1] * vectorB[0];
-}
 /* simple v^T * v product ("outer product") */
 /* STATUS: HAS TO BE verified (*should* work) */
 DO_INLINE void mul_fvectorT_fvector(float to[3][3], float vectorA[3], float vectorB[3])
@@ -337,6 +329,7 @@ DO_INLINE void initdiag_fmatrixS(float to[3][3], float aS)
 	to[2][2] = aS;
 }
 
+#if 0
 /* calculate determinant of 3x3 matrix */
 DO_INLINE float det_fmatrix(float m[3][3])
 {
@@ -371,6 +364,7 @@ DO_INLINE void inverse_fmatrix(float to[3][3], float from[3][3])
 	}
 
 }
+#endif
 
 /* 3x3 matrix multiplied by a scalar */
 /* STATUS: verified */
@@ -398,14 +392,6 @@ DO_INLINE void mul_fmatrix_fvector(float *to, float matrix[3][3], float from[3])
 	to[1] = dot_v3v3(matrix[1], from);
 	to[2] = dot_v3v3(matrix[2], from);
 }
-/* 3x3 matrix multiplied by a 3x3 matrix */
-/* STATUS: verified */
-DO_INLINE void mul_fmatrix_fmatrix(float to[3][3], float matrixA[3][3], float matrixB[3][3])
-{
-	mul_fvector_fmatrix(to[0], matrixA[0], matrixB);
-	mul_fvector_fmatrix(to[1], matrixA[1], matrixB);
-	mul_fvector_fmatrix(to[2], matrixA[2], matrixB);
-}
 /* 3x3 matrix addition with 3x3 matrix */
 DO_INLINE void add_fmatrix_fmatrix(float to[3][3], float matrixA[3][3], float matrixB[3][3])
 {
@@ -413,27 +399,6 @@ DO_INLINE void add_fmatrix_fmatrix(float to[3][3], float matrixA[3][3], float ma
 	VECADD(to[1], matrixA[1], matrixB[1]);
 	VECADD(to[2], matrixA[2], matrixB[2]);
 }
-/* 3x3 matrix add-addition with 3x3 matrix */
-DO_INLINE void addadd_fmatrix_fmatrix(float to[3][3], float matrixA[3][3], float matrixB[3][3])
-{
-	VECADDADD(to[0], matrixA[0], matrixB[0]);
-	VECADDADD(to[1], matrixA[1], matrixB[1]);
-	VECADDADD(to[2], matrixA[2], matrixB[2]);
-}
-/* 3x3 matrix sub-addition with 3x3 matrix */
-DO_INLINE void addsub_fmatrixS_fmatrixS(float to[3][3], float matrixA[3][3], float aS, float matrixB[3][3], float bS)
-{
-	VECADDSUBSS(to[0], matrixA[0], aS, matrixB[0], bS);
-	VECADDSUBSS(to[1], matrixA[1], aS, matrixB[1], bS);
-	VECADDSUBSS(to[2], matrixA[2], aS, matrixB[2], bS);
-}
-/* A -= B + C (3x3 matrix sub-addition with 3x3 matrix) */
-DO_INLINE void subadd_fmatrix_fmatrix(float to[3][3], float matrixA[3][3], float matrixB[3][3])
-{
-	VECSUBADD(to[0], matrixA[0], matrixB[0]);
-	VECSUBADD(to[1], matrixA[1], matrixB[1]);
-	VECSUBADD(to[2], matrixA[2], matrixB[2]);
-}
 /* A -= B*x + C*y (3x3 matrix sub-addition with 3x3 matrix) */
 DO_INLINE void subadd_fmatrixS_fmatrixS(float to[3][3], float matrixA[3][3], float aS, float matrixB[3][3], float bS)
 {
@@ -448,44 +413,9 @@ DO_INLINE void sub_fmatrix_fmatrix(float to[3][3], float matrixA[3][3], float ma
 	sub_v3_v3v3(to[1], matrixA[1], matrixB[1]);
 	sub_v3_v3v3(to[2], matrixA[2], matrixB[2]);
 }
-/* A += B - C (3x3 matrix add-subtraction with 3x3 matrix) */
-DO_INLINE void addsub_fmatrix_fmatrix(float to[3][3], float matrixA[3][3], float matrixB[3][3])
-{
-	VECADDSUB(to[0], matrixA[0], matrixB[0]);
-	VECADDSUB(to[1], matrixA[1], matrixB[1]);
-	VECADDSUB(to[2], matrixA[2], matrixB[2]);
-}
 /////////////////////////////////////////////////////////////////
 // special functions
 /////////////////////////////////////////////////////////////////
-/* a vector multiplied and added to/by a 3x3 matrix */
-DO_INLINE void muladd_fvector_fmatrix(float to[3], float from[3], float matrix[3][3])
-{
-	to[0] += matrix[0][0]*from[0] + matrix[1][0]*from[1] + matrix[2][0]*from[2];
-	to[1] += matrix[0][1]*from[0] + matrix[1][1]*from[1] + matrix[2][1]*from[2];
-	to[2] += matrix[0][2]*from[0] + matrix[1][2]*from[1] + matrix[2][2]*from[2];
-}
-/* 3x3 matrix multiplied and added  to/by a 3x3 matrix  and added to another 3x3 matrix */
-DO_INLINE void muladd_fmatrix_fmatrix(float to[3][3], float matrixA[3][3], float matrixB[3][3])
-{
-	muladd_fvector_fmatrix(to[0], matrixA[0], matrixB);
-	muladd_fvector_fmatrix(to[1], matrixA[1], matrixB);
-	muladd_fvector_fmatrix(to[2], matrixA[2], matrixB);
-}
-/* a vector multiplied and sub'd to/by a 3x3 matrix */
-DO_INLINE void mulsub_fvector_fmatrix(float to[3], float from[3], float matrix[3][3])
-{
-	to[0] -= matrix[0][0]*from[0] + matrix[1][0]*from[1] + matrix[2][0]*from[2];
-	to[1] -= matrix[0][1]*from[0] + matrix[1][1]*from[1] + matrix[2][1]*from[2];
-	to[2] -= matrix[0][2]*from[0] + matrix[1][2]*from[1] + matrix[2][2]*from[2];
-}
-/* 3x3 matrix multiplied and sub'd  to/by a 3x3 matrix  and added to another 3x3 matrix */
-DO_INLINE void mulsub_fmatrix_fmatrix(float to[3][3], float matrixA[3][3], float matrixB[3][3])
-{
-	mulsub_fvector_fmatrix(to[0], matrixA[0], matrixB);
-	mulsub_fvector_fmatrix(to[1], matrixA[1], matrixB);
-	mulsub_fvector_fmatrix(to[2], matrixA[2], matrixB);
-}
 /* 3x3 matrix multiplied+added by a vector */
 /* STATUS: verified */
 DO_INLINE void muladd_fmatrix_fvector(float to[3], float matrix[3][3], float from[3])
@@ -494,13 +424,6 @@ DO_INLINE void muladd_fmatrix_fvector(float to[3], float matrix[3][3], float fro
 	to[1] += dot_v3v3(matrix[1], from);
 	to[2] += dot_v3v3(matrix[2], from);
 }
-/* 3x3 matrix multiplied+sub'ed by a vector */
-DO_INLINE void mulsub_fmatrix_fvector(float to[3], float matrix[3][3], float from[3])
-{
-	to[0] -= dot_v3v3(matrix[0], from);
-	to[1] -= dot_v3v3(matrix[1], from);
-	to[2] -= dot_v3v3(matrix[2], from);
-}
 /////////////////////////////////////////////////////////////////
 
 ///////////////////////////
@@ -569,15 +492,6 @@ DO_INLINE void initdiag_bfmatrix(fmatrix3x3 *matrix, float m3[3][3])
 	}
 }
 
-/* multiply big matrix with scalar*/
-DO_INLINE void mul_bfmatrix_S(fmatrix3x3 *matrix, float scalar)
-{
-	unsigned int i = 0;
-	for (i = 0; i < matrix[0].vcount+matrix[0].scount; i++) {
-		mul_fmatrix_S(matrix[i].m, scalar);
-	}
-}
-
 /* SPARSE SYMMETRIC multiply big matrix with long vector*/
 /* STATUS: verified */
 DO_INLINE void mul_bfmatrix_lfvector( float (*to)[3], fmatrix3x3 *from, lfVector *fLongVector)
@@ -610,83 +524,6 @@ DO_INLINE void mul_bfmatrix_lfvector( float (*to)[3], fmatrix3x3 *from, lfVector
 	
 }
 
-/* SPARSE SYMMETRIC multiply big matrix with long vector (for diagonal preconditioner) */
-/* STATUS: verified */
-DO_INLINE void mul_prevfmatrix_lfvector( float (*to)[3], fmatrix3x3 *from, lfVector *fLongVector)
-{
-	unsigned int i = 0;
-	
-	for (i = 0; i < from[0].vcount; i++) {
-		mul_fmatrix_fvector(to[from[i].r], from[i].m, fLongVector[from[i].c]);
-	}
-}
-
-/* SPARSE SYMMETRIC add big matrix with big matrix: A = B + C*/
-DO_INLINE void add_bfmatrix_bfmatrix( fmatrix3x3 *to, fmatrix3x3 *from,  fmatrix3x3 *matrix)
-{
-	unsigned int i = 0;
-
-	/* process diagonal elements */
-	for (i = 0; i < matrix[0].vcount+matrix[0].scount; i++) {
-		add_fmatrix_fmatrix(to[i].m, from[i].m, matrix[i].m);
-	}
-
-}
-/* SPARSE SYMMETRIC add big matrix with big matrix: A += B + C */
-DO_INLINE void addadd_bfmatrix_bfmatrix( fmatrix3x3 *to, fmatrix3x3 *from,  fmatrix3x3 *matrix)
-{
-	unsigned int i = 0;
-
-	/* process diagonal elements */
-	for (i = 0; i < matrix[0].vcount+matrix[0].scount; i++) {
-		addadd_fmatrix_fmatrix(to[i].m, from[i].m, matrix[i].m);
-	}
-
-}
-/* SPARSE SYMMETRIC subadd big matrix with big matrix: A -= B + C */
-DO_INLINE void subadd_bfmatrix_bfmatrix( fmatrix3x3 *to, fmatrix3x3 *from,  fmatrix3x3 *matrix)
-{
-	unsigned int i = 0;
-
-	/* process diagonal elements */
-	for (i = 0; i < matrix[0].vcount+matrix[0].scount; i++) {
-		subadd_fmatrix_fmatrix(to[i].m, from[i].m, matrix[i].m);
-	}
-
-}
-/*  A = B - C (SPARSE SYMMETRIC sub big matrix with big matrix) */
-DO_INLINE void sub_bfmatrix_bfmatrix( fmatrix3x3 *to, fmatrix3x3 *from,  fmatrix3x3 *matrix)
-{
-	unsigned int i = 0;
-
-	/* process diagonal elements */
-	for (i = 0; i < matrix[0].vcount+matrix[0].scount; i++) {
-		sub_fmatrix_fmatrix(to[i].m, from[i].m, matrix[i].m);
-	}
-
-}
-/* SPARSE SYMMETRIC sub big matrix with big matrix S (special constraint matrix with limited entries) */
-DO_INLINE void sub_bfmatrix_Smatrix( fmatrix3x3 *to, fmatrix3x3 *from,  fmatrix3x3 *matrix)
-{
-	unsigned int i = 0;
-
-	/* process diagonal elements */
-	for (i = 0; i < matrix[0].vcount; i++) {
-		sub_fmatrix_fmatrix(to[matrix[i].c].m, from[matrix[i].c].m, matrix[i].m);
-	}
-
-}
-/* A += B - C (SPARSE SYMMETRIC addsub big matrix with big matrix) */
-DO_INLINE void addsub_bfmatrix_bfmatrix( fmatrix3x3 *to, fmatrix3x3 *from,  fmatrix3x3 *matrix)
-{
-	unsigned int i = 0;
-
-	/* process diagonal elements */
-	for (i = 0; i < matrix[0].vcount+matrix[0].scount; i++) {
-		addsub_fmatrix_fmatrix(to[i].m, from[i].m, matrix[i].m);
-	}
-
-}
 /* SPARSE SYMMETRIC sub big matrix with big matrix*/
 /* A -= B * float + C * float --> for big matrix */
 /* VERIFIED */
@@ -958,6 +795,7 @@ static int  cg_filtered(lfVector *ldV, fmatrix3x3 *lA, lfVector *lB, lfVector *z
 	return conjgrad_loopcount<conjgrad_looplimit;  // true means we reached desired accuracy in given time - ie stable
 }
 
+#if 0
 // block diagonalizer
 DO_INLINE void BuildPPinv(fmatrix3x3 *lA, fmatrix3x3 *P, fmatrix3x3 *Pinv)
 {
@@ -972,7 +810,6 @@ DO_INLINE void BuildPPinv(fmatrix3x3 *lA, fmatrix3x3 *P, fmatrix3x3 *Pinv)
 		
 	}
 }
-#if 0
 /*
 // version 1.3
 static int cg_filtered_pre(lfVector *dv, fmatrix3x3 *lA, lfVector *lB, lfVector *z, fmatrix3x3 *S, fmatrix3x3 *P, fmatrix3x3 *Pinv)
@@ -1146,30 +983,6 @@ static int cg_filtered_pre(lfVector *dv, fmatrix3x3 *lA, lfVector *lB, lfVector
 }
 #endif
 
-// outer product is NOT cross product!!!
-DO_INLINE void dfdx_spring_type1(float to[3][3], float extent[3], float length, float L, float dot, float k)
-{
-	// dir is unit length direction, rest is spring's restlength, k is spring constant.
-	// re

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list