OpenNL: significantly simplify code using Eigen / STL.
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -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++)
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user