[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [12509] branches/pynodes: merge r12453: 12505 from trunk

Nathan Letwory jesterking at letwory.net
Wed Nov 7 07:10:27 CET 2007


Revision: 12509
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=12509
Author:   jesterking
Date:     2007-11-07 07:10:27 +0100 (Wed, 07 Nov 2007)

Log Message:
-----------
merge r12453:12505 from trunk

Modified Paths:
--------------
    branches/pynodes/CMakeLists.txt
    branches/pynodes/extern/bFTGL/src/FTVectoriser.cpp
    branches/pynodes/intern/opennl/extern/ONL_opennl.h
    branches/pynodes/intern/opennl/intern/opennl.c
    branches/pynodes/projectfiles_vc7/blender/nodes/nodes.vcproj
    branches/pynodes/source/blender/blenkernel/BKE_bad_level_calls.h
    branches/pynodes/source/blender/blenkernel/BKE_mesh.h
    branches/pynodes/source/blender/blenkernel/bad_level_call_stubs/stubs.c
    branches/pynodes/source/blender/blenkernel/intern/DerivedMesh.c
    branches/pynodes/source/blender/blenkernel/intern/armature.c
    branches/pynodes/source/blender/blenkernel/intern/ipo.c
    branches/pynodes/source/blender/blenkernel/intern/material.c
    branches/pynodes/source/blender/blenkernel/intern/mesh.c
    branches/pynodes/source/blender/blenkernel/intern/modifier.c
    branches/pynodes/source/blender/blenlib/BLI_arithb.h
    branches/pynodes/source/blender/blenlib/intern/arithb.c
    branches/pynodes/source/blender/blenloader/intern/readfile.c
    branches/pynodes/source/blender/blenloader/intern/writefile.c
    branches/pynodes/source/blender/include/BIF_meshlaplacian.h
    branches/pynodes/source/blender/include/BIF_transform.h
    branches/pynodes/source/blender/makesdna/DNA_curve_types.h
    branches/pynodes/source/blender/makesdna/DNA_ipo_types.h
    branches/pynodes/source/blender/makesdna/DNA_modifier_types.h
    branches/pynodes/source/blender/python/BPY_interface.c
    branches/pynodes/source/blender/python/api2_2x/Armature.c
    branches/pynodes/source/blender/python/api2_2x/Geometry.c
    branches/pynodes/source/blender/python/api2_2x/doc/Geometry.py
    branches/pynodes/source/blender/src/buttons_editing.c
    branches/pynodes/source/blender/src/drawipo.c
    branches/pynodes/source/blender/src/drawobject.c
    branches/pynodes/source/blender/src/editaction.c
    branches/pynodes/source/blender/src/editmesh_lib.c
    branches/pynodes/source/blender/src/editnla.c
    branches/pynodes/source/blender/src/editseq.c
    branches/pynodes/source/blender/src/header_action.c
    branches/pynodes/source/blender/src/header_nla.c
    branches/pynodes/source/blender/src/meshlaplacian.c
    branches/pynodes/source/blender/src/parametrizer.c
    branches/pynodes/source/blender/src/transform.c
    branches/pynodes/source/blender/src/transform_conversions.c
    branches/pynodes/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_GLExtensionManager.cpp

Modified: branches/pynodes/CMakeLists.txt
===================================================================
--- branches/pynodes/CMakeLists.txt	2007-11-07 00:28:45 UTC (rev 12508)
+++ branches/pynodes/CMakeLists.txt	2007-11-07 06:10:27 UTC (rev 12509)
@@ -240,7 +240,11 @@
   SET(OPENEXR ${LIBDIR}/openexr)
   SET(OPENEXR_INC ${OPENEXR}/include ${OPENEXR}/include/IlmImf ${OPENEXR}/include/Iex ${OPENEXR}/include/Imath)
   SET(OPENEXR_LIB Iex Half IlmImf Imath IlmThread)
+  IF (MSVC80)
+  SET(OPENEXR_LIBPATH ${OPENEXR}/lib_vs2005)
+  ELSE (MSVC80)
   SET(OPENEXR_LIBPATH ${OPENEXR}/lib_msvc)
+  ENDIF(MSVC80)
   
   SET(QUICKTIME ${LIBDIR}/QTDevWin)
   SET(QUICKTIME_INC ${QUICKTIME}/CIncludes)

Modified: branches/pynodes/extern/bFTGL/src/FTVectoriser.cpp
===================================================================
--- branches/pynodes/extern/bFTGL/src/FTVectoriser.cpp	2007-11-07 00:28:45 UTC (rev 12508)
+++ branches/pynodes/extern/bFTGL/src/FTVectoriser.cpp	2007-11-07 06:10:27 UTC (rev 12509)
@@ -5,8 +5,12 @@
 #define CALLBACK
 #endif
 
-#ifdef __APPLE_CC__    
-    typedef GLvoid (*GLUTesselatorFunction)(...);
+#if defined(__APPLE_CC__) 
+    #if __APPLE_CC__ >= 5465
+        typedef GLvoid (*GLUTesselatorFunction)();
+    #else
+        typedef GLvoid (*GLUTesselatorFunction)(...);
+    #endif
 #elif defined( __mips ) || defined( __linux__ ) || defined( __FreeBSD__ ) || defined( __OpenBSD__ ) || defined( __sun ) || defined (__CYGWIN__)
     typedef GLvoid (*GLUTesselatorFunction)();
 #elif defined ( WIN32)

Modified: branches/pynodes/intern/opennl/extern/ONL_opennl.h
===================================================================
--- branches/pynodes/intern/opennl/extern/ONL_opennl.h	2007-11-07 00:28:45 UTC (rev 12508)
+++ branches/pynodes/intern/opennl/extern/ONL_opennl.h	2007-11-07 06:10:27 UTC (rev 12509)
@@ -79,21 +79,17 @@
 
 #define NL_SYSTEM  0x0
 #define NL_MATRIX  0x1
-#define NL_ROW     0x2
 
 /* Solver Parameters */
 
-#define NL_SOLVER           0x100
-#define NL_NB_VARIABLES     0x101
-#define NL_LEAST_SQUARES    0x102
-#define NL_SYMMETRIC        0x106
-#define NL_ERROR            0x108
+#define NL_SOLVER              0x100
+#define NL_NB_VARIABLES        0x101
+#define NL_LEAST_SQUARES       0x102
+#define NL_SYMMETRIC           0x106
+#define NL_ERROR               0x108
+#define NL_NB_ROWS             0x110
+#define NL_NB_RIGHT_HAND_SIDES 0x112 /* 4 max */
 
-/* Row parameters */
-
-#define NL_RIGHT_HAND_SIDE 0x500
-#define NL_ROW_SCALING     0x501
-
 /* Contexts */
 
 NLContext nlNewContext(void);
@@ -106,9 +102,6 @@
 void nlSolverParameterf(NLenum pname, NLfloat param);
 void nlSolverParameteri(NLenum pname, NLint param);
 
-void nlRowParameterf(NLenum pname, NLfloat param);
-void nlRowParameteri(NLenum pname, NLint param);
-
 void nlGetBooleanv(NLenum pname, NLboolean* params);
 void nlGetFloatv(NLenum pname, NLfloat* params);
 void nlGetIntergerv(NLenum pname, NLint* params);
@@ -119,8 +112,8 @@
 
 /* Variables */
 
-void nlSetVariable(NLuint index, NLfloat value);
-NLfloat nlGetVariable(NLuint index);
+void nlSetVariable(NLuint rhsindex, NLuint index, NLfloat value);
+NLfloat nlGetVariable(NLuint rhsindex, NLuint index);
 void nlLockVariable(NLuint index);
 void nlUnlockVariable(NLuint index);
 NLboolean nlVariableIsLocked(NLuint index);
@@ -129,15 +122,17 @@
 
 void nlBegin(NLenum primitive);
 void nlEnd(NLenum primitive);
-void nlCoefficient(NLuint index, NLfloat value);
 
-/* Setting random elements matrix/vector - not supported for
-   least squares! */
+/* Setting elements in matrix/vector */
 
 void nlMatrixAdd(NLuint row, NLuint col, NLfloat value);
-void nlRightHandSideAdd(NLuint index, NLfloat value);
-void nlRightHandSideSet(NLuint index, NLfloat value);
+void nlRightHandSideAdd(NLuint rhsindex, NLuint index, NLfloat value);
+void nlRightHandSideSet(NLuint rhsindex, NLuint index, NLfloat value);
 
+/* Multiply */
+
+void nlMatrixMultiply(NLfloat *x, NLfloat *y);
+
 /* Solve */
 
 void nlPrintMatrix(void);

Modified: branches/pynodes/intern/opennl/intern/opennl.c
===================================================================
--- branches/pynodes/intern/opennl/intern/opennl.c	2007-11-07 00:28:45 UTC (rev 12508)
+++ branches/pynodes/intern/opennl/intern/opennl.c	2007-11-07 06:10:27 UTC (rev 12509)
@@ -207,10 +207,6 @@
 	c->size++;
 }
 
-static void __nlRowColumnZero(__NLRowColumn* c) {
-	c->size = 0;
-}
-
 static void __nlRowColumnClear(__NLRowColumn* c) {
 	c->size	 = 0;
 	c->capacity = 0;
@@ -432,13 +428,62 @@
 	}
 }
 
+/* ****************** Routines for least squares ******************* */
+
+static void __nlSparseMatrix_square(
+	__NLSparseMatrix* AtA, __NLSparseMatrix *A
+) {
+	NLuint m = A->m;
+	NLuint n = A->n;
+	NLuint i, j0, j1;
+	__NLRowColumn *Ri = NULL;
+	__NLCoeff *c0 = NULL, *c1 = NULL;
+	float value;
+
+	__nlSparseMatrixConstruct(AtA, n, n, A->storage);
+
+	for(i=0; i<m; i++) {
+		Ri = &(A->row[i]);
+
+		for(j0=0; j0<Ri->size; j0++) {
+			c0 = &(Ri->coeff[j0]);
+			for(j1=0; j1<Ri->size; j1++) {
+				c1 = &(Ri->coeff[j1]);
+
+				value = c0->value*c1->value;
+				__nlSparseMatrixAdd(AtA, c0->index, c1->index, value);
+			}
+		}
+	}
+}
+
+static void __nlSparseMatrix_transpose_mult_rows(
+	__NLSparseMatrix* A, NLfloat* x, NLfloat* y
+) {
+	NLuint m = A->m;
+	NLuint n = A->n;
+	NLuint i,ij;
+	__NLRowColumn* Ri = NULL;
+	__NLCoeff* c = NULL;
+
+	__NL_CLEAR_ARRAY(NLfloat, y, n);
+
+	for(i=0; i<m; i++) {
+		Ri = &(A->row[i]);
+		for(ij=0; ij<Ri->size; ij++) {
+			c = &(Ri->coeff[ij]);
+			y[c->index] += c->value * x[i];
+		}
+	}
+}
+
 /************************************************************************************/
 /* NLContext data structure */
 
 typedef void(*__NLMatrixFunc)(float* x, float* y);
 
 typedef struct {
-	NLfloat  value;
+	NLfloat  value[4];
 	NLboolean locked;
 	NLuint	index;
 	__NLRowColumn *a;
@@ -447,32 +492,32 @@
 #define __NL_STATE_INITIAL				0
 #define __NL_STATE_SYSTEM				1
 #define __NL_STATE_MATRIX				2
-#define __NL_STATE_ROW					3
-#define __NL_STATE_MATRIX_CONSTRUCTED	4
-#define __NL_STATE_SYSTEM_CONSTRUCTED	5
-#define __NL_STATE_SYSTEM_SOLVED		7
+#define __NL_STATE_MATRIX_CONSTRUCTED	3
+#define __NL_STATE_SYSTEM_CONSTRUCTED	4
+#define __NL_STATE_SYSTEM_SOLVED		5
 
 typedef struct {
-	NLenum		   state;
-	NLuint		   n;
+	NLenum			state;
+	NLuint			n;
+	NLuint			m;
 	__NLVariable*	variable;
 	NLfloat*		b;
+	NLfloat*		Mtb;
 	__NLSparseMatrix M;
-	__NLRowColumn	af;
-	__NLRowColumn	al;
+	__NLSparseMatrix MtM;
 	NLfloat*		x;
-	NLfloat		 right_hand_side;
-	NLuint		   nb_variables;
-	NLuint		   current_row;
+	NLuint			nb_variables;
+	NLuint			nb_rows;
 	NLboolean		least_squares;
 	NLboolean		symmetric;
+	NLuint			nb_rhs;
 	NLboolean		solve_again;
 	NLboolean		alloc_M;
-	NLboolean		alloc_af;
-	NLboolean		alloc_al;
+	NLboolean		alloc_MtM;
 	NLboolean		alloc_variable;
 	NLboolean		alloc_x;
 	NLboolean		alloc_b;
+	NLboolean		alloc_Mtb;
 	NLfloat			error;
 	__NLMatrixFunc	matrix_vector_prod;
 
@@ -494,8 +539,8 @@
 NLContext nlNewContext(void) {
 	__NLContext* result	  = __NL_NEW(__NLContext);
 	result->state			= __NL_STATE_INITIAL;
-	result->right_hand_side  = 0.0;
 	result->matrix_vector_prod = __nlMatrixVectorProd_default;
+	result->nb_rhs = 1;
 	nlMakeCurrent(result);
 	return result;
 }
@@ -512,12 +557,9 @@
 	if(context->alloc_M) {
 		__nlSparseMatrixDestroy(&context->M);
 	}
-	if(context->alloc_af) {
-		__nlRowColumnDestroy(&context->af);
+	if(context->alloc_MtM) {
+		__nlSparseMatrixDestroy(&context->MtM);
 	}
-	if(context->alloc_al) {
-		__nlRowColumnDestroy(&context->al);
-	}
 	if(context->alloc_variable) {
 		for(i=0; i<context->nb_variables; i++) {
 			if(context->variable[i].a) {
@@ -529,6 +571,9 @@
 	if(context->alloc_b) {
 		__NL_DELETE_ARRAY(context->b);
 	}
+	if(context->alloc_Mtb) {
+		__NL_DELETE_ARRAY(context->Mtb);
+	}
 	if(context->alloc_x) {
 		__NL_DELETE_ARRAY(context->x);
 	}
@@ -569,12 +614,19 @@
 		__nl_assert(param > 0);
 		__nlCurrentContext->nb_variables = (NLuint)param;
 	} break;
+	case NL_NB_ROWS: {
+		__nl_assert(param > 0);
+		__nlCurrentContext->nb_rows = (NLuint)param;
+	} break;
 	case NL_LEAST_SQUARES: {
 		__nlCurrentContext->least_squares = (NLboolean)param;
 	} break;
 	case NL_SYMMETRIC: {
 		__nlCurrentContext->symmetric = (NLboolean)param;		
-	}
+	} break;
+	case NL_NB_RIGHT_HAND_SIDES: {
+		__nlCurrentContext->nb_rhs = (NLuint)param;
+	} break;
 	default: {
 		__nl_assert_not_reached;
 	} break;
@@ -588,36 +640,25 @@
 		__nl_assert(param > 0);
 		__nlCurrentContext->nb_variables = (NLuint)param;
 	} break;
+	case NL_NB_ROWS: {
+		__nl_assert(param > 0);
+		__nlCurrentContext->nb_rows = (NLuint)param;
+	} break;
 	case NL_LEAST_SQUARES: {
 		__nlCurrentContext->least_squares = (NLboolean)param;
 	} break;
 	case NL_SYMMETRIC: {
 		__nlCurrentContext->symmetric = (NLboolean)param;		
-	}
+	} break;
+	case NL_NB_RIGHT_HAND_SIDES: {
+		__nlCurrentContext->nb_rhs = (NLuint)param;
+	} break;
 	default: {
 		__nl_assert_not_reached;
 	} break;
 	}
 }
 
-void nlRowParameterf(NLenum pname, NLfloat param) {
-	__nlCheckState(__NL_STATE_MATRIX);
-	switch(pname) {
-	case NL_RIGHT_HAND_SIDE: {
-		__nlCurrentContext->right_hand_side = param;
-	} break;
-	}
-}
-
-void nlRowParameteri(NLenum pname, NLint param) {
-	__nlCheckState(__NL_STATE_MATRIX);
-	switch(pname) {
-	case NL_RIGHT_HAND_SIDE: {
-		__nlCurrentContext->right_hand_side = (NLfloat)param;
-	} break;
-	}
-}
-
 void nlGetBooleanv(NLenum pname, NLboolean* params) {
 	switch(pname) {
 	case NL_LEAST_SQUARES: {
@@ -637,6 +678,9 @@
 	case NL_NB_VARIABLES: {
 		*params = (NLfloat)(__nlCurrentContext->nb_variables);
 	} break;
+	case NL_NB_ROWS: {
+		*params = (NLfloat)(__nlCurrentContext->nb_rows);
+	} break;
 	case NL_LEAST_SQUARES: {
 		*params = (NLfloat)(__nlCurrentContext->least_squares);
 	} break;
@@ -657,6 +701,9 @@
 	case NL_NB_VARIABLES: {
 		*params = (NLint)(__nlCurrentContext->nb_variables);
 	} break;
+	case NL_NB_ROWS: {
+		*params = (NLint)(__nlCurrentContext->nb_rows);
+	} break;
 	case NL_LEAST_SQUARES: {
 		*params = (NLint)(__nlCurrentContext->least_squares);
 	} break;
@@ -700,16 +747,16 @@
 /************************************************************************************/
 /* Get/Set Lock/Unlock variables */
 
-void nlSetVariable(NLuint index, NLfloat value) {
+void nlSetVariable(NLuint rhsindex, NLuint index, NLfloat value) {
 	__nlCheckState(__NL_STATE_SYSTEM);
 	__nl_parano_range_assert(index, 0, __nlCurrentContext->nb_variables - 1);
-	__nlCurrentContext->variable[index].value = value;	

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list