MCPcopy Create free account
hub / github.com/FreeFem/FreeFem-sources / plot_P2_isoline_body

Function plot_P2_isoline_body

plugin/seq/plotPDF.cpp:2527–2698  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2525 // X' = - sqrt( a(Y')^2 + b )
2526 trackHyperbolaCore( Cy, Cx, -1, a, b, Zy_minus, Vy, Vx );
2527
2528 }
2529 return;
2530}
2531
2532void plot_P2_isoline_body( std::stringstream &Content, const Fem2D::Mesh &Th, const KN<double> &f_P2_,
2533 const std::vector<double> &isoline_val, const double cmin, const double cmax,
2534 const KNM<double> &palette, const double scale, const double ar,
2535 const double x0, const double y0,
2536 const int marginl, const int marginb,
2537 const bool monochrome, const bool logscale,
2538 const int NISOLINES, const double linewidth )
2539{
2540 const double EPS = 1e-10;
2541
2542 std::stringstream &st = Content;
2543
2544 const int NQ = 6; // number of coefficients in quadratic polynomial
2545 const int &nTriangles = Th.nt;
2546
2547 st << "q\n";
2548 st << linewidth << " w\n"; // setlinewidth
2549 st << "1 0 0 1 " << PLOTPDFVAR::PADDING+marginl << " " << PLOTPDFVAR::PADDING+marginb << " cm\n";
2550
2551 for(int k = 0; k < nTriangles; k++){
2552
2553 const int &v0 = Th(k,0); const int &v1 = Th(k,1); const int &v2 = Th(k,2);
2554
2555 const double vx[] = { Th(v0).x, Th(v1).x, Th(v2).x };
2556 const double vy[] = { Th(v0).y, Th(v1).y, Th(v2).y };
2557
2558 // f_P2[i] = phi(v[i]), f_P2[i+3] = phi(e[i]), i=0,1,2.
2559 const double *const f_P2 = f_P2_ + k*NQ;
2560 // in vector2flow
2561 //const double f_P2[NQ] = { f2[3*k], f2[3*k+1], f2[3*k+2], f2m[3*k], f2m[3*k+1], f2m[3*k+2] };
2562
2563 // quadratic polynomials : ax^2 + bxy + cy^2 + dx + ey + f
2564 double phi[ NQ ];
2565 const double &a = phi[0]; const double &b = phi[1]; const double &c = phi[2];
2566 const double &d = phi[3]; const double &e = phi[4]; const double &f = phi[5];
2567
2568 findQuadraticPolynomial(phi, vx, vy, f_P2);
2569
2570 const bool isLinear = (fabs(a) + fabs(b) + fabs(c) < EPS * (fabs(d)+fabs(e) + fabs(f)));
2571
2572 // normalize Quadratic Polynomial
2573 double PHI[9];
2574 findCanonicalForm( PHI, phi );
2575
2576 // PHI(X,Y) = lambda1*X*X + lambda2*Y*Y + D*X + E*Y + f
2577 // = lambda1 * (X + D/(2*lambda1))^2 + lambda2 * (Y + E/(2*lambda2))^2
2578 // + ( -D*D/(4*lambda1) - E*E/(4*lambda2) + f)
2579 // = lambda1*(X + D/(2*lambda1))^2 + lambda2*(Y + E/(2*lambda2))^2 + F
2580 const double &lambda1 = PHI[0]; const double &lambda2 = PHI[1];
2581 const double &D = PHI[6]; const double &E = PHI[7]; double &F = PHI[8];
2582
2583 // lambda1*X^2 + lambda2*Y^2 + D*X + E*Y + f = value,
2584 // if lambda2 == E == 0, then lambda1*X^2 + D*X + f = value, i.e. X=const

Callers 2

plot_P2_isolineFunction · 0.85
plot_vector2flowFunction · 0.85

Calls 13

findQuadraticPolynomialFunction · 0.85
findCanonicalFormFunction · 0.85
trackP1isolineFunction · 0.85
setrgbcolorFunction · 0.85
transformTriangleFunction · 0.85
findZerosFunction · 0.85
trackParabolaFunction · 0.85
trackEllipseFunction · 0.85
trackHyperbolaFunction · 0.85
invTransformCubicBzeirsFunction · 0.85
drawCubicBeziersFunction · 0.85
fabsFunction · 0.50

Tested by

no test coverage detected