// plot_test.edp // // Discussion: // // The "CMM=string" argument on the plot command prints a comment string // as part of the plot. // // Licensing: // // This code is distributed under the MIT license. // // Modified: // // 21 June 2015 // cout << "\n"; cout << "plot_test():\n"; cout << " FreeFem++ version\n"; cout << " Test features of the plot() function\n"; // // n: number of nodes in each spatial direction. // int n = 16; // // h: spacing between nodes. // real h = 1.0 / n; // // Th: the triangulation of the unit square. // mesh Th = square ( n, n ); // // Plot the mesh. // plot ( Th, ps = "mesh.ps", cmm = "the mesh" ); // // Define Vh, the finite element space. // Here, "P1" requests piecewise linear functions. // fespace Vh ( Th, P2 ); // // We can plot any function, defined over the mesh. // Vh u = sin(5*pi*x*(1-x)) * sin(4*pi*y*(1-y)); // // Plot U with fill, value, grey options. // // Note that the "grey" option does not seem to work correctly. // "false" actually gives grey scale (3 times out of 4) wherease // "true" does not. // plot ( u, fill = false, value = false, grey = false, ps = "plot000.ps", cmm = "fill=false, value=false, grey=false" ); plot ( u, fill = false, value = false, grey = true, ps = "plot001.ps", cmm = "fill=false, value=false, grey=true" ); plot ( u, fill = false, value = true, grey = false, ps = "plot010.ps", cmm = "fill=false, value=true, grey=false" ); plot ( u, fill = false, value = true, grey = true, ps = "plot011.ps", cmm = "fill=false, value=true, grey=true" ); plot ( u, fill = true, value = false, grey = false, ps = "plot100.ps", cmm = "fill=true, value=false, grey=false" ); plot ( u, fill = true, value = false, grey = true, ps = "plot101.ps", cmm = "fill=true, value=false, grey=true" ); plot ( u, fill = true, value = true, grey = false, ps = "plot110.ps", cmm = "fill=true, value=true, grey=false" ); plot ( u, fill = true, value = true, grey = true, ps = "plot111.ps", cmm = "fill=true, value=true, grey=true" ); // // Now define a vector field. // Vh ux = 5*pi*(1-2*x)*cos(5*pi*x*(1-x)) * sin(4*pi*y*(1-y)); Vh uy = sin(5*pi*x*(1-x)) * 4*pi&(1-2*y)*cos(4*pi*y*(1-y)); // // The documentation claims that "coef" controls the arrow size. // IT DOESNT. // plot ( [ ux, uy ], nbarrow = 10, coef = 0.125, ps = "vector.ps", cmm = "vector field" ); // // Terminate. // cout << "\n"; cout << "plot_test():\n"; cout << " Normal end of execution.\n"; exit ( 0 );