From 47ce2d7bef32a7f5de34ac3e0cfb8300a4e63cd9 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Sun, 22 Nov 2015 05:25:32 +0100 Subject: OpenNL: significantly simplify code using Eigen / STL. --- source/blender/bmesh/operators/bmo_smooth_laplacian.c | 2 +- source/blender/editors/armature/meshlaplacian.c | 6 +++--- source/blender/editors/armature/reeb.c | 2 +- source/blender/editors/uvedit/uvedit_parametrizer.c | 6 +++--- source/blender/modifiers/intern/MOD_laplaciandeform.c | 9 ++++----- source/blender/modifiers/intern/MOD_laplaciansmooth.c | 2 +- 6 files changed, 13 insertions(+), 14 deletions(-) (limited to 'source') diff --git a/source/blender/bmesh/operators/bmo_smooth_laplacian.c b/source/blender/bmesh/operators/bmo_smooth_laplacian.c index a250c716c16..661b1c21892 100644 --- a/source/blender/bmesh/operators/bmo_smooth_laplacian.c +++ b/source/blender/bmesh/operators/bmo_smooth_laplacian.c @@ -551,7 +551,7 @@ void bmo_smooth_laplacian_vert_exec(BMesh *bm, BMOperator *op) nlEnd(NL_MATRIX); nlEnd(NL_SYSTEM); - if (nlSolveAdvanced(NULL, NL_TRUE) ) { + if (nlSolve(NL_TRUE) ) { validate_solution(sys, usex, usey, usez, preserve_volume); } diff --git a/source/blender/editors/armature/meshlaplacian.c b/source/blender/editors/armature/meshlaplacian.c index d2dd0e474c0..956cbe25c3b 100644 --- a/source/blender/editors/armature/meshlaplacian.c +++ b/source/blender/editors/armature/meshlaplacian.c @@ -64,7 +64,7 @@ static void error(const char *str) { printf("error: %s\n", str); } /************************** Laplacian System *****************************/ struct LaplacianSystem { - NLContext context; /* opennl context */ + NLContext *context; /* opennl context */ int totvert, totface; @@ -341,7 +341,7 @@ int laplacian_system_solve(LaplacianSystem *sys) //nlPrintMatrix(); - return nlSolveAdvanced(NULL, NL_TRUE); + return nlSolve(NL_TRUE); } float laplacian_system_get_solution(int v) @@ -1438,7 +1438,7 @@ static void meshdeform_matrix_solve(MeshDeformModifierData *mmd, MeshDeformBind nlEnd(NL_MATRIX); nlEnd(NL_SYSTEM); - if (nlSolveAdvanced(NULL, NL_TRUE)) { + if (nlSolve(NL_TRUE)) { for (z = 0; z < mdb->size; z++) for (y = 0; y < mdb->size; y++) for (x = 0; x < mdb->size; x++) diff --git a/source/blender/editors/armature/reeb.c b/source/blender/editors/armature/reeb.c index f29d15ff416..e10ae4bcf3f 100644 --- a/source/blender/editors/armature/reeb.c +++ b/source/blender/editors/armature/reeb.c @@ -2628,7 +2628,7 @@ int weightToHarmonic(EditMesh *em, EdgeIndex *indexed_edges) nlEnd(NL_SYSTEM); - success = nlSolveAdvanced(NULL, NL_TRUE); + success = nlSolve(NL_TRUE); if (success) { rval = 1; diff --git a/source/blender/editors/uvedit/uvedit_parametrizer.c b/source/blender/editors/uvedit/uvedit_parametrizer.c index 00615f9bef7..cb387b4af22 100644 --- a/source/blender/editors/uvedit/uvedit_parametrizer.c +++ b/source/blender/editors/uvedit/uvedit_parametrizer.c @@ -193,7 +193,7 @@ typedef struct PChart { union PChartUnion { struct PChartLscm { - NLContext context; + NLContext *context; float *abf_alpha; PVert *pin1, *pin2; } lscm; @@ -2613,7 +2613,7 @@ static PBool p_abf_matrix_invert(PAbfSystem *sys, PChart *chart) nlEnd(NL_SYSTEM); - success = nlSolve(); + success = nlSolve(NL_FALSE); if (success) { for (f = chart->faces; f; f = f->nextlink) { @@ -3223,7 +3223,7 @@ static PBool p_chart_lscm_solve(PHandle *handle, PChart *chart) nlEnd(NL_SYSTEM); - if (nlSolveAdvanced(NULL, NL_TRUE)) { + if (nlSolve(NL_TRUE)) { p_chart_lscm_load_solution(chart); return P_TRUE; } diff --git a/source/blender/modifiers/intern/MOD_laplaciandeform.c b/source/blender/modifiers/intern/MOD_laplaciandeform.c index 8b0ca7f99fb..916f8b8a36d 100644 --- a/source/blender/modifiers/intern/MOD_laplaciandeform.c +++ b/source/blender/modifiers/intern/MOD_laplaciandeform.c @@ -399,7 +399,6 @@ static void laplacianDeformPreview(LaplacianSystem *sys, float (*vertexCos)[3]) sys->context = nlGetCurrent(); nlSolverParameteri(NL_NB_VARIABLES, n); - nlSolverParameteri(NL_SYMMETRIC, NL_FALSE); nlSolverParameteri(NL_LEAST_SQUARES, NL_TRUE); nlSolverParameteri(NL_NB_ROWS, n + na); nlSolverParameteri(NL_NB_RIGHT_HAND_SIDES, 3); @@ -434,7 +433,7 @@ static void laplacianDeformPreview(LaplacianSystem *sys, float (*vertexCos)[3]) } nlEnd(NL_MATRIX); nlEnd(NL_SYSTEM); - if (nlSolveAdvanced(NULL, NL_TRUE)) { + if (nlSolve(NL_TRUE)) { sys->has_solution = true; for (j = 1; j <= sys->repeat; j++) { @@ -451,7 +450,7 @@ static void laplacianDeformPreview(LaplacianSystem *sys, float (*vertexCos)[3]) nlEnd(NL_MATRIX); nlEnd(NL_SYSTEM); - if (!nlSolveAdvanced(NULL, NL_FALSE)) { + if (!nlSolve(NL_FALSE)) { sys->has_solution = false; break; } @@ -495,7 +494,7 @@ static void laplacianDeformPreview(LaplacianSystem *sys, float (*vertexCos)[3]) nlEnd(NL_MATRIX); nlEnd(NL_SYSTEM); - if (nlSolveAdvanced(NULL, NL_FALSE)) { + if (nlSolve(NL_FALSE)) { sys->has_solution = true; for (j = 1; j <= sys->repeat; j++) { nlBegin(NL_SYSTEM); @@ -510,7 +509,7 @@ static void laplacianDeformPreview(LaplacianSystem *sys, float (*vertexCos)[3]) } nlEnd(NL_MATRIX); nlEnd(NL_SYSTEM); - if (!nlSolveAdvanced(NULL, NL_FALSE)) { + if (!nlSolve(NL_FALSE)) { sys->has_solution = false; break; } diff --git a/source/blender/modifiers/intern/MOD_laplaciansmooth.c b/source/blender/modifiers/intern/MOD_laplaciansmooth.c index f04e092b39e..aef28d24a51 100644 --- a/source/blender/modifiers/intern/MOD_laplaciansmooth.c +++ b/source/blender/modifiers/intern/MOD_laplaciansmooth.c @@ -468,7 +468,7 @@ static void laplaciansmoothModifier_do( nlEnd(NL_MATRIX); nlEnd(NL_SYSTEM); - if (nlSolveAdvanced(NULL, NL_TRUE)) { + if (nlSolve(NL_TRUE)) { validate_solution(sys, smd->flag, smd->lambda, smd->lambda_border); } } -- cgit v1.2.3