-- FreeFem++ v4.14 (mer. 06 mars 2024 16:59:04 CET - git v4.14-1-g2b2052ae) file : plot_test.edp Load: lg_fem lg_mesh lg_mesh3 eigenvalue 1 : // plot_test.edp 2 : // 3 : // Discussion: 4 : // 5 : // The "CMM=string" argument on the plot command prints a comment string 6 : // as part of the plot. 7 : // 8 : // Licensing: 9 : // 10 : // This code is distributed under the MIT license. 11 : // 12 : // Modified: 13 : // 14 : // 21 June 2015 15 : // 16 : cout << "\n"; 17 : cout << "plot_test():\n"; 18 : cout << " FreeFem++ version\n"; 19 : cout << " Test features of the plot() function\n"; 20 : // 21 : // n: number of nodes in each spatial direction. 22 : // 23 : int n = 16; 24 : // 25 : // h: spacing between nodes. 26 : // 27 : real h = 1.0 / n; 28 : // 29 : // Th: the triangulation of the unit square. 30 : // 31 : mesh Th = square ( n, n ); 32 : // 33 : // Plot the mesh. 34 : // 35 : plot ( Th, 36 : ps = "mesh.ps", 37 : cmm = "the mesh" ); 38 : // 39 : // Define Vh, the finite element space. 40 : // Here, "P1" requests piecewise linear functions. 41 : // 42 : fespace Vh ( Th, P2 ); 43 : // 44 : // We can plot any function, defined over the mesh. 45 : // 46 : Vh u = sin(5*pi*x*(1-x)) * sin(4*pi*y*(1-y)); 47 : // 48 : // Plot U with fill, value, grey options. 49 : // 50 : // Note that the "grey" option does not seem to work correctly. 51 : // "false" actually gives grey scale (3 times out of 4) wherease 52 : // "true" does not. 53 : // 54 : plot ( u, fill = false, value = false, grey = false, 55 : ps = "plot000.ps", 56 : cmm = "fill=false, value=false, grey=false" ); 57 : 58 : plot ( u, fill = false, value = false, grey = true, 59 : ps = "plot001.ps", 60 : cmm = "fill=false, value=false, grey=true" ); 61 : 62 : plot ( u, fill = false, value = true, grey = false, 63 : ps = "plot010.ps", 64 : cmm = "fill=false, value=true, grey=false" ); 65 : 66 : plot ( u, fill = false, value = true, grey = true, 67 : ps = "plot011.ps", 68 : cmm = "fill=false, value=true, grey=true" ); 69 : 70 : plot ( u, fill = true, value = false, grey = false, 71 : ps = "plot100.ps", 72 : cmm = "fill=true, value=false, grey=false" ); 73 : 74 : plot ( u, fill = true, value = false, grey = true, 75 : ps = "plot101.ps", 76 : cmm = "fill=true, value=false, grey=true" ); 77 : 78 : plot ( u, fill = true, value = true, grey = false, 79 : ps = "plot110.ps", 80 : cmm = "fill=true, value=true, grey=false" ); 81 : 82 : plot ( u, fill = true, value = true, grey = true, 83 : ps = "plot111.ps", 84 : cmm = "fill=true, value=true, grey=true" ); 85 : // 86 : // Now define a vector field. 87 : // 88 : Vh ux = 5*pi*(1-2*x)*cos(5*pi*x*(1-x)) * sin(4*pi*y*(1-y)); 89 : Vh uy = sin(5*pi*x*(1-x)) * 4*pi&(1-2*y)*cos(4*pi*y*(1-y)); 90 : // 91 : // The documentation claims that "coef" controls the arrow size. 92 : // IT DOESNT. 93 : // 94 : plot ( [ ux, uy ], nbarrow = 10, coef = 0.125, 95 : ps = "vector.ps", 96 : cmm = "vector field" ); 97 : // 98 : // Terminate. 99 : // 100 : cout << "\n"; 101 : cout << "plot_test():\n"; 102 : cout << " Normal end of execution.\n"; 103 : 104 : exit ( 0 ); 105 : sizestack + 1024 =5000 ( 3976 ) plot_test(): FreeFem++ version Test features of the plot() function -- Square mesh : nb vertices =289 , nb triangles = 512 , nb boundary edges 64 plot_test(): Normal end of execution. current line = 104 exit(0) err code 0 , mpirank 0 CodeAlloc : nb ptr 4000, size :524728 mpirank: 0 Ok: Normal End