From e5d339ed99bd4b6cd213d4aecfba8a1af13f617d Mon Sep 17 00:00:00 2001 From: Matthias Hochsteger Date: Fri, 8 Jan 2021 08:30:47 +0100 Subject: [PATCH 1/4] Print function value on double click --- libsrc/visualization/mvdraw.hpp | 2 + libsrc/visualization/vsmesh.cpp | 68 ++++++++++++++++++++--------- libsrc/visualization/vssolution.cpp | 29 ++++++++++-- 3 files changed, 75 insertions(+), 24 deletions(-) diff --git a/libsrc/visualization/mvdraw.hpp b/libsrc/visualization/mvdraw.hpp index cae7c792..a39e3acd 100644 --- a/libsrc/visualization/mvdraw.hpp +++ b/libsrc/visualization/mvdraw.hpp @@ -209,6 +209,8 @@ namespace netgen void BuildBadelList(); void BuildIdentifiedList(); void BuildDomainSurfList(); + + bool Unproject (int px, int py, Point<3> &p); }; DLL_HEADER extern VisualSceneMesh vsmesh; diff --git a/libsrc/visualization/vsmesh.cpp b/libsrc/visualization/vsmesh.cpp index 10a56905..ee74c64a 100644 --- a/libsrc/visualization/vsmesh.cpp +++ b/libsrc/visualization/vsmesh.cpp @@ -3128,9 +3128,7 @@ namespace netgen - - - void VisualSceneMesh :: MouseDblClick (int px, int py) + bool VisualSceneMesh :: Unproject (int px, int py, Point<3> &p) { shared_ptr mesh = GetMesh(); @@ -3150,20 +3148,59 @@ namespace netgen int hy = viewport[3]-py; GLfloat pz; + + if(lock) + { + lock->UnLock(); + delete lock; + lock = NULL; + } + + if(pz>=1.0) + return false; // cout << "x, y = " << px << ", " << hy << endl; glReadPixels (px, hy, 1, 1, GL_DEPTH_COMPONENT, GL_FLOAT, &pz); // cout << "pz = " << pz << endl; gluUnProject(px, hy, pz, transformationmat, projection, viewport, &result[0], &result[1], &result[2]); - if (pz < 1.0) - cout << "point : " << result[0] << ", " << result[1] << ", " << result[2] << endl; - + p = Point<3>{result[0], result[1], result[2]}; + return true; + } - if (user_me_handler && pz < 1.0) + + void VisualSceneMesh :: MouseDblClick (int px, int py) + { + Point<3> p; + bool found_point = Unproject(px, py, p); + + if(selelement!=-1) { - if (selelement != -1) - user_me_handler -> DblClick (selelement-1, result[0], result[1], result[2]); + const Element2d & sel = GetMesh()->SurfaceElement(selelement); + + cout << "select element " << selelement + << " on face " << sel.GetIndex() << endl; + cout << "Nodes: "; + for (int i = 1; i <= sel.GetNP(); i++) + cout << sel.PNum(i) << " "; + cout << endl; + + cout << "selected point " << selpoint + << ", pos = " << GetMesh()->Point (selpoint) + << endl; + + cout << "seledge = " << seledge << endl; + + } + + if(found_point) + { + cout << "point : " << p << endl; + if (user_me_handler) + { + if (selelement != -1) + user_me_handler -> DblClick (selelement-1, p[0], p[1], p[2]); + } } selecttimestamp = NextTimeStamp(); @@ -3401,6 +3438,7 @@ namespace netgen if (vispar.clipping.enable) { + glEnable(GL_CLIP_PLANE0); Vec<3> n(clipplane[0], clipplane[1], clipplane[2]); double len = Abs(n); double mu = -clipplane[3] / (len*len); @@ -3473,23 +3511,12 @@ namespace netgen { const Element2d & sel = mesh->SurfaceElement(minname); - - cout << "select element " << minname - << " on face " << sel.GetIndex() << endl; - cout << "Nodes: "; - for (i = 1; i <= sel.GetNP(); i++) - cout << sel.PNum(i) << " "; - cout << endl; - selelement = minname; selface = mesh->SurfaceElement(minname).GetIndex(); locpi = (locpi % sel.GetNP()) + 1; selpoint2 = selpoint; selpoint = sel.PNum(locpi); - cout << "selected point " << selpoint - << ", pos = " << mesh->Point (selpoint) - << endl; for (i = 1; i <= mesh->GetNSeg(); i++) { @@ -3498,7 +3525,6 @@ namespace netgen (seg[1] == selpoint && seg[0] == selpoint2) ) { seledge = seg.edgenr; - cout << "seledge = " << seledge << endl; } } } diff --git a/libsrc/visualization/vssolution.cpp b/libsrc/visualization/vssolution.cpp index 25decb88..f65c1e77 100644 --- a/libsrc/visualization/vssolution.cpp +++ b/libsrc/visualization/vssolution.cpp @@ -4754,9 +4754,32 @@ namespace netgen void VisualSceneSolution :: MouseDblClick (int px, int py) { - vsmesh.SetClippingPlane(); - // vsmesh.BuildFilledList(); - vsmesh.MouseDblClick(px,py); + Point<3> p; + bool found_point = vsmesh.Unproject(px, py, p); + if(!found_point) + return; + + + if(selelement>0) // found a surface element (possibliy behind clipping plane), check if drawn point really is in this element + { + double lami[3]; + lami[0] = lami[1] = lami[2] = 0.0; + // Check if unprojected Point is close to surface element (eps of 1e-3 due to z-Buffer accuracy) + if(GetMesh()->PointContainedIn2DElement(p, lami, selelement, false) && fabs(lami[2])<1e-3) + { + double val; + GetSurfValue(soldata[scalfunction], selelement-1, -1, 1.0-lami[0]-lami[1], lami[0], scalcomp, val); + cout << "surface function value: " << val << endl; + } + // otherwise assume that the unprojected point is on the clipping plane -> find 3d element containing it + else if(auto el3d = GetMesh()->GetElementOfPoint( p, lami )) + { + double val; + GetValue(soldata[scalfunction], el3d-1, lami[0], lami[1], lami[2], scalcomp, val); + cout << "clipping plane value: " << val << endl; + } + + } } From 36aa8658b703d508daf97607e2bf73b4f69b91f1 Mon Sep 17 00:00:00 2001 From: Matthias Hochsteger Date: Wed, 13 Jan 2021 10:58:13 +0100 Subject: [PATCH 2/4] Print function names and surface/volume evaluation --- libsrc/visualization/vsmesh.cpp | 8 ++- libsrc/visualization/vssolution.cpp | 80 ++++++++++++++++++++++++----- 2 files changed, 73 insertions(+), 15 deletions(-) diff --git a/libsrc/visualization/vsmesh.cpp b/libsrc/visualization/vsmesh.cpp index ee74c64a..af7ea300 100644 --- a/libsrc/visualization/vsmesh.cpp +++ b/libsrc/visualization/vsmesh.cpp @@ -3156,10 +3156,14 @@ namespace netgen lock = NULL; } - if(pz>=1.0) - return false; // cout << "x, y = " << px << ", " << hy << endl; glReadPixels (px, hy, 1, 1, GL_DEPTH_COMPONENT, GL_FLOAT, &pz); + + if(pz>=1.0) + return false; + if(pz<=0.0) + return false; + // cout << "pz = " << pz << endl; gluUnProject(px, hy, pz, transformationmat, projection, viewport, &result[0], &result[1], &result[2]); diff --git a/libsrc/visualization/vssolution.cpp b/libsrc/visualization/vssolution.cpp index f65c1e77..c1c7555e 100644 --- a/libsrc/visualization/vssolution.cpp +++ b/libsrc/visualization/vssolution.cpp @@ -4759,24 +4759,78 @@ namespace netgen if(!found_point) return; + auto mesh = GetMesh(); + auto dim = mesh->GetDimension(); - if(selelement>0) // found a surface element (possibliy behind clipping plane), check if drawn point really is in this element + auto printScalValue = [](SolData & sol, int comp, double value) { - double lami[3]; - lami[0] = lami[1] = lami[2] = 0.0; - // Check if unprojected Point is close to surface element (eps of 1e-3 due to z-Buffer accuracy) - if(GetMesh()->PointContainedIn2DElement(p, lami, selelement, false) && fabs(lami[2])<1e-3) + if(sol.components>1) { - double val; - GetSurfValue(soldata[scalfunction], selelement-1, -1, 1.0-lami[0]-lami[1], lami[0], scalcomp, val); - cout << "surface function value: " << val << endl; + if(comp==0) + cout << "func(" << sol.name << ")"; + else + cout << sol.name << "["+ToString(comp)+"]"; } - // otherwise assume that the unprojected point is on the clipping plane -> find 3d element containing it - else if(auto el3d = GetMesh()->GetElementOfPoint( p, lami )) + else + cout << sol.name; + cout << " = " << value << endl; + }; + + if(selelement>0) // found a drawn point (clipping plane or surface element) + { + double lami[3] = {0.0, 0.0, 0.0}; + // Check if unprojected Point is close to surface element (eps of 1e-3 due to z-Buffer accuracy) + bool found_2del = false; + if(mesh->PointContainedIn2DElement(p, lami, selelement, false && fabs(lami[2])<1e-3)) { - double val; - GetValue(soldata[scalfunction], el3d-1, lami[0], lami[1], lami[2], scalcomp, val); - cout << "clipping plane value: " << val << endl; + // Found it, use coordinates of point projected to surface element + mesh->GetCurvedElements().CalcSurfaceTransformation({1.0-lami[0]-lami[1], lami[0]}, selelement-1, p); + found_2del = true; + } + cout << "Selected point " << p << " " << endl; + bool have_surf_scal_func = scalfunction!=-1 && soldata[scalfunction]->draw_surface && found_2del; + bool have_surf_vec_func = vecfunction!=-1 && soldata[vecfunction]->draw_surface && found_2del; + if(have_surf_scal_func || have_surf_vec_func) + { + cout << "Surface values:" << endl; + + if(have_surf_scal_func) + { + auto & sol = *soldata[scalfunction]; + double val; + GetSurfValue(&sol, selelement-1, -1, 1.0-lami[0]-lami[1], lami[0], scalcomp, val); + printScalValue(sol, scalcomp, val); + } + if(have_surf_vec_func) + { + auto & sol = *soldata[vecfunction]; + ArrayMem values(sol.components); + GetSurfValues(&sol, selelement-1, -1, 1.0-lami[0]-lami[1], lami[0], &values[0]); + cout << sol.name << " = " << values; + } + } + + bool have_vol_scal_func = scalfunction!=-1 && soldata[scalfunction]->draw_volume && !have_surf_scal_func; + bool have_vol_vec_func = vecfunction!=-1 && soldata[vecfunction]->draw_volume && !have_surf_vec_func; + // otherwise assume that the unprojected point is on the clipping plane -> find 3d element containing it + if(dim==3 && (have_vol_scal_func || have_vol_vec_func)) + if(auto el3d = mesh->GetElementOfPoint( p, lami )) + { + cout << "Volume values:" << endl; + if(have_vol_scal_func) + { + auto & sol = *soldata[scalfunction]; + double val; + GetValue(&sol, el3d-1, lami[0], lami[1], lami[2], scalcomp, val); + printScalValue(sol, scalcomp, val); + } + if(have_vol_vec_func) + { + auto & sol = *soldata[vecfunction]; + ArrayMem values(sol.components); + GetValues(&sol, el3d-1, lami[0], lami[1], lami[2], &values[0]); + cout << sol.name << " = " << values; + } } } From b7fab39876f0ecfb152f9b2a09c7bf787ec946e8 Mon Sep 17 00:00:00 2001 From: Christopher Lackner Date: Wed, 13 Jan 2021 13:24:38 +0100 Subject: [PATCH 3/4] formatting of vector and complex output on click --- libsrc/visualization/vssolution.cpp | 67 +++++++++++++++++++++++++---- 1 file changed, 59 insertions(+), 8 deletions(-) diff --git a/libsrc/visualization/vssolution.cpp b/libsrc/visualization/vssolution.cpp index c1c7555e..8bd43342 100644 --- a/libsrc/visualization/vssolution.cpp +++ b/libsrc/visualization/vssolution.cpp @@ -4762,7 +4762,13 @@ namespace netgen auto mesh = GetMesh(); auto dim = mesh->GetDimension(); - auto printScalValue = [](SolData & sol, int comp, double value) + auto formatComplex = [](double real, double imag) + { + return ToString(real) + (imag < 0 ? "" : "+") + ToString(imag) + "j"; + }; + + auto printScalValue = [&formatComplex] + (SolData & sol, int comp, double value, double imag=0., bool iscomplex=false) { if(sol.components>1) { @@ -4773,7 +4779,7 @@ namespace netgen } else cout << sol.name; - cout << " = " << value << endl; + cout << " = " << (iscomplex ? formatComplex(value, imag) : ToString(value)) << endl; }; if(selelement>0) // found a drawn point (clipping plane or surface element) @@ -4798,15 +4804,37 @@ namespace netgen { auto & sol = *soldata[scalfunction]; double val; - GetSurfValue(&sol, selelement-1, -1, 1.0-lami[0]-lami[1], lami[0], scalcomp, val); - printScalValue(sol, scalcomp, val); + double imag = 0; + int rcomponent = scalcomp; + int comp = scalcomp; + if(sol.iscomplex && rcomponent != 0) + { + rcomponent = 2 * ((rcomponent-1)/2) + 1; + GetSurfValue(&sol, selelement-1, -1, 1.0-lami[0]-lami[1], lami[0], rcomponent+1, imag); + comp = (scalcomp-1)/2 + 1; + } + GetSurfValue(&sol, selelement-1, -1, 1.0-lami[0]-lami[1], lami[0], rcomponent, val); + printScalValue(sol, comp, val, imag, sol.iscomplex && comp > 0); } if(have_surf_vec_func) { auto & sol = *soldata[vecfunction]; ArrayMem values(sol.components); GetSurfValues(&sol, selelement-1, -1, 1.0-lami[0]-lami[1], lami[0], &values[0]); - cout << sol.name << " = " << values; + if(sol.iscomplex) + { + cout << sol.name << " = ( " << formatComplex(values[0], values[1]); + for(int i = 2; i < values.Size(); i+=2) + cout << ", " << formatComplex(values[i], values[i+1]); + cout << " )" << endl; + } + else + { + cout << sol.name << " = ( " << values[0]; + for(int i = 1; i < values.Size(); i++) + cout << ", " << values[i]; + cout << " )" << endl; + } } } @@ -4821,15 +4849,38 @@ namespace netgen { auto & sol = *soldata[scalfunction]; double val; - GetValue(&sol, el3d-1, lami[0], lami[1], lami[2], scalcomp, val); - printScalValue(sol, scalcomp, val); + double imag = 0; + int rcomponent = scalcomp; + int comp = scalcomp; + if(sol.iscomplex && rcomponent != 0) + { + rcomponent = 2 * ((rcomponent-1)/2) + 1; + GetValue(&sol, el3d-1, lami[0], lami[1], lami[2], rcomponent+1, + imag); + comp = (scalcomp-1)/2 + 1; + } + GetValue(&sol, el3d-1, lami[0], lami[1], lami[2], rcomponent, val); + printScalValue(sol, comp, val, imag, sol.iscomplex && comp > 0); } if(have_vol_vec_func) { auto & sol = *soldata[vecfunction]; ArrayMem values(sol.components); GetValues(&sol, el3d-1, lami[0], lami[1], lami[2], &values[0]); - cout << sol.name << " = " << values; + if(sol.iscomplex) + { + cout << sol.name << " = ( " << formatComplex(values[0], values[1]); + for(int i = 2; i < values.Size(); i+=2) + cout << ", " << formatComplex(values[i], values[i+1]); + cout << " )" << endl; + } + else + { + cout << sol.name << " = ( " << values[0]; + for(int i = 1; i < values.Size(); i++) + cout << ", " << values[i]; + cout << " )" << endl; + } } } From e745d16c6d03c52d8df6f24253e5e9e63bda8a74 Mon Sep 17 00:00:00 2001 From: Matthias Hochsteger Date: Wed, 13 Jan 2021 16:48:16 +0100 Subject: [PATCH 4/4] manually cut view vector with clipping plane (more accurate, also working when visualizing clipping plane vectors) --- libsrc/visualization/vssolution.cpp | 213 ++++++++++++++++------------ 1 file changed, 121 insertions(+), 92 deletions(-) diff --git a/libsrc/visualization/vssolution.cpp b/libsrc/visualization/vssolution.cpp index 8bd43342..0af2f5ad 100644 --- a/libsrc/visualization/vssolution.cpp +++ b/libsrc/visualization/vssolution.cpp @@ -4754,11 +4754,6 @@ namespace netgen void VisualSceneSolution :: MouseDblClick (int px, int py) { - Point<3> p; - bool found_point = vsmesh.Unproject(px, py, p); - if(!found_point) - return; - auto mesh = GetMesh(); auto dim = mesh->GetDimension(); @@ -4782,108 +4777,142 @@ namespace netgen cout << " = " << (iscomplex ? formatComplex(value, imag) : ToString(value)) << endl; }; - if(selelement>0) // found a drawn point (clipping plane or surface element) + auto printVecValue = [&formatComplex] + (SolData & sol, FlatArray values) { - double lami[3] = {0.0, 0.0, 0.0}; - // Check if unprojected Point is close to surface element (eps of 1e-3 due to z-Buffer accuracy) - bool found_2del = false; - if(mesh->PointContainedIn2DElement(p, lami, selelement, false && fabs(lami[2])<1e-3)) + if(sol.iscomplex) { - // Found it, use coordinates of point projected to surface element - mesh->GetCurvedElements().CalcSurfaceTransformation({1.0-lami[0]-lami[1], lami[0]}, selelement-1, p); - found_2del = true; + cout << sol.name << " = ( " << formatComplex(values[0], values[1]); + for(int i = 2; i < values.Size(); i+=2) + cout << ", " << formatComplex(values[i], values[i+1]); + cout << " )" << endl; } - cout << "Selected point " << p << " " << endl; - bool have_surf_scal_func = scalfunction!=-1 && soldata[scalfunction]->draw_surface && found_2del; - bool have_surf_vec_func = vecfunction!=-1 && soldata[vecfunction]->draw_surface && found_2del; - if(have_surf_scal_func || have_surf_vec_func) + else { - cout << "Surface values:" << endl; + cout << sol.name << " = ( " << values[0]; + for(int i = 1; i < values.Size(); i++) + cout << ", " << values[i]; + cout << " )" << endl; + } + }; - if(have_surf_scal_func) + // Check if clipping plane is drawn at current mouse cursor position + if(dim==3 && clipsolution && vispar.clipping.enable) + { + GLint viewport[4]; + GLdouble projection[16]; + glGetDoublev(GL_PROJECTION_MATRIX, &projection[0]); + + glGetIntegerv(GL_VIEWPORT, &viewport[0]); + + int hy = viewport[3]-py; + + // manually intersect the view vector with the clipping plane (also working if clipping vectors are shown) + Point<3> p_clipping_plane; + gluUnProject(px, hy, 1.0, transformationmat, projection, viewport, + &p_clipping_plane[0], &p_clipping_plane[1], &p_clipping_plane[2]); + + Point<3> eye; + gluUnProject( (viewport[2]-viewport[0])/2 , (viewport[3]-viewport[1])/2, + 0.0, transformationmat, projection, viewport, &eye[0], &eye[1], &eye[2]); + + Vec<3> n{vispar.clipping.normal}; + n.Normalize(); + Vec<3> view = p_clipping_plane-eye; + + // check if we look at the clipping plane from the right direction + if(n*view > 1e-8) + { + double lam = vispar.clipping.dist - Vec<3>{eye}*n; + lam /= n*view; + p_clipping_plane = eye + lam*view; + + double lami[3]; + if(auto el3d = mesh->GetElementOfPoint( p_clipping_plane, lami )) { - auto & sol = *soldata[scalfunction]; - double val; - double imag = 0; - int rcomponent = scalcomp; - int comp = scalcomp; - if(sol.iscomplex && rcomponent != 0) + cout << endl << "Selected point " << p_clipping_plane << " on clipping plane" << endl; + + bool have_scal_func = scalfunction!=-1 && soldata[scalfunction]->draw_volume; + bool have_vec_func = vecfunction!=-1 && soldata[vecfunction]->draw_volume; + + if(have_scal_func) { - rcomponent = 2 * ((rcomponent-1)/2) + 1; - GetSurfValue(&sol, selelement-1, -1, 1.0-lami[0]-lami[1], lami[0], rcomponent+1, imag); - comp = (scalcomp-1)/2 + 1; + auto & sol = *soldata[scalfunction]; + double val; + double imag = 0; + int rcomponent = scalcomp; + int comp = scalcomp; + if(sol.iscomplex && rcomponent != 0) + { + rcomponent = 2 * ((rcomponent-1)/2) + 1; + GetValue(&sol, el3d-1, lami[0], lami[1], lami[2], rcomponent+1, + imag); + comp = (scalcomp-1)/2 + 1; + } + GetValue(&sol, el3d-1, lami[0], lami[1], lami[2], rcomponent, val); + printScalValue(sol, comp, val, imag, sol.iscomplex && comp > 0); } - GetSurfValue(&sol, selelement-1, -1, 1.0-lami[0]-lami[1], lami[0], rcomponent, val); - printScalValue(sol, comp, val, imag, sol.iscomplex && comp > 0); - } - if(have_surf_vec_func) - { - auto & sol = *soldata[vecfunction]; - ArrayMem values(sol.components); - GetSurfValues(&sol, selelement-1, -1, 1.0-lami[0]-lami[1], lami[0], &values[0]); - if(sol.iscomplex) + if(vecfunction!=-1 && soldata[vecfunction]->draw_volume) { - cout << sol.name << " = ( " << formatComplex(values[0], values[1]); - for(int i = 2; i < values.Size(); i+=2) - cout << ", " << formatComplex(values[i], values[i+1]); - cout << " )" << endl; - } - else - { - cout << sol.name << " = ( " << values[0]; - for(int i = 1; i < values.Size(); i++) - cout << ", " << values[i]; - cout << " )" << endl; + auto & sol = *soldata[vecfunction]; + ArrayMem values(sol.components); + GetValues(&sol, el3d-1, lami[0], lami[1], lami[2], &values[0]); + printVecValue(sol, values); } + return; } } + } - bool have_vol_scal_func = scalfunction!=-1 && soldata[scalfunction]->draw_volume && !have_surf_scal_func; - bool have_vol_vec_func = vecfunction!=-1 && soldata[vecfunction]->draw_volume && !have_surf_vec_func; - // otherwise assume that the unprojected point is on the clipping plane -> find 3d element containing it - if(dim==3 && (have_vol_scal_func || have_vol_vec_func)) - if(auto el3d = mesh->GetElementOfPoint( p, lami )) + // no point on clipping plane found -> continue searching for surface element + + Point<3> p; + bool found_point = vsmesh.Unproject(px, py, p); + if(!found_point) + return; + + if(selelement==0) + return; + + double lami[3] = {0.0, 0.0, 0.0}; + // Check if unprojected Point is close to surface element (eps of 1e-3 due to z-Buffer accuracy) + bool found_2del = false; + if(mesh->PointContainedIn2DElement(p, lami, selelement, false && fabs(lami[2])<1e-3)) + { + // Found it, use coordinates of point projected to surface element + mesh->GetCurvedElements().CalcSurfaceTransformation({1.0-lami[0]-lami[1], lami[0]}, selelement-1, p); + found_2del = true; + } + cout << endl << "Selected point " << p << " on surface" << endl; + + if(!found_2del) + return; + + bool have_scal_func = scalfunction!=-1 && soldata[scalfunction]->draw_surface; + bool have_vec_func = vecfunction!=-1 && soldata[vecfunction]->draw_surface; + + if(have_scal_func) + { + auto & sol = *soldata[scalfunction]; + double val; + double imag = 0; + int rcomponent = scalcomp; + int comp = scalcomp; + if(sol.iscomplex && rcomponent != 0) { - cout << "Volume values:" << endl; - if(have_vol_scal_func) - { - auto & sol = *soldata[scalfunction]; - double val; - double imag = 0; - int rcomponent = scalcomp; - int comp = scalcomp; - if(sol.iscomplex && rcomponent != 0) - { - rcomponent = 2 * ((rcomponent-1)/2) + 1; - GetValue(&sol, el3d-1, lami[0], lami[1], lami[2], rcomponent+1, - imag); - comp = (scalcomp-1)/2 + 1; - } - GetValue(&sol, el3d-1, lami[0], lami[1], lami[2], rcomponent, val); - printScalValue(sol, comp, val, imag, sol.iscomplex && comp > 0); - } - if(have_vol_vec_func) - { - auto & sol = *soldata[vecfunction]; - ArrayMem values(sol.components); - GetValues(&sol, el3d-1, lami[0], lami[1], lami[2], &values[0]); - if(sol.iscomplex) - { - cout << sol.name << " = ( " << formatComplex(values[0], values[1]); - for(int i = 2; i < values.Size(); i+=2) - cout << ", " << formatComplex(values[i], values[i+1]); - cout << " )" << endl; - } - else - { - cout << sol.name << " = ( " << values[0]; - for(int i = 1; i < values.Size(); i++) - cout << ", " << values[i]; - cout << " )" << endl; - } - } + rcomponent = 2 * ((rcomponent-1)/2) + 1; + GetSurfValue(&sol, selelement-1, -1, 1.0-lami[0]-lami[1], lami[0], rcomponent+1, imag); + comp = (scalcomp-1)/2 + 1; } - + GetSurfValue(&sol, selelement-1, -1, 1.0-lami[0]-lami[1], lami[0], rcomponent, val); + printScalValue(sol, comp, val, imag, sol.iscomplex && comp > 0); + } + if(have_vec_func) + { + auto & sol = *soldata[vecfunction]; + ArrayMem values(sol.components); + GetSurfValues(&sol, selelement-1, -1, 1.0-lami[0]-lami[1], lami[0], &values[0]); + printVecValue(sol, values); } }