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

Function plot_P2_fill

plugin/seq/plotPDF.cpp:3102–3373  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3100 t1 = t1_next;
3101 t2 = t2_next;
3102
3103 } while(level <= nbfill);
3104
3105 return;
3106}
3107
3108void plot_P2_fill( std::stringstream &Content, const Fem2D::Mesh &Th, const KN<double> &f_P2_,
3109 const KNM<double> &palette,
3110 const int sizex, const int sizey, const double scale, const double ar,
3111 const double x0, const double y0, const double y1,
3112 const int marginl, const int marginb,
3113 const double textfontsize, const bool monochrome,
3114 const bool legend, const int prec, const bool logscale,
3115 const double withmesh,
3116 const long nbfill, const KN<double> *const frange )
3117{
3118 const double EPS = 1e-10;
3119
3120 //------------------------------
3121 // borders to plot
3122 //------------------------------
3123 const double tmp_fmax = (frange)? (*frange)[1]: f_P2_.max();
3124 const double tmp_fmin = (frange)? (*frange)[0]: f_P2_.min();
3125 const double tmp_df = (logscale)?
3126 pow( tmp_fmax/tmp_fmin, static_cast<double>(1)/nbfill ):
3127 (tmp_fmax - tmp_fmin)/nbfill;
3128
3129 std::vector<double> border_val;
3130 if( logscale && (tmp_fmin > 0) ){
3131
3132 border_val.push_back( tmp_fmin );
3133 for(int m = 1; m <= nbfill; m++)
3134 border_val.push_back( border_val[m-1] * tmp_df );
3135
3136 } else {
3137
3138 if( logscale )
3139 std::cout << "plotPDF(): logscale for non-positive values.\n";
3140
3141 for(int m = 0; m <= nbfill; m++)
3142 border_val.push_back( m*tmp_df + tmp_fmin );
3143 }
3144
3145 // considering wider range, since min/max of P2 element are not
3146 // attained at vertices of triangles.
3147 const double fmax = (logscale)? tmp_fmax*tmp_df: tmp_fmax + tmp_df;
3148 const double fmin = (logscale)? tmp_fmin/tmp_df: tmp_fmin - tmp_df;
3149
3150 std::stringstream &st = Content;
3151 st.str("");
3152
3153 //------------------------------
3154 // element(triangle)-wise process
3155 //------------------------------
3156 st << "q\n";
3157 st << "1 0 0 1 " << PLOTPDFVAR::PADDING+marginl << " " << PLOTPDFVAR::PADDING+marginb << " cm\n";
3158
3159 const int NQ = 6; // number of unknowns in quadratic polynomial

Callers 1

operator()Method · 0.85

Calls 15

findQuadraticPolynomialFunction · 0.85
findCanonicalFormFunction · 0.85
P2_fill_linearFunction · 0.85
transformTriangleFunction · 0.85
findZerosFunction · 0.85
trackParabolaFunction · 0.85
trackEllipseFunction · 0.85
trackHyperbolaFunction · 0.85
splitByBorderFunction · 0.85
invTransformCubicBzeirsFunction · 0.85
findFillValueFunction · 0.85
setrgbcolorFunction · 0.85

Tested by

no test coverage detected