// Location: // // http://people.sc.fsu.edu/~jburkardt/examples/chrispell_freefem++/square_mesh.edp // // Discussion: // // This example simply shows how to define: // // 1) a mesh on the unit square; // 2) a mesh on an arbitrary (coordinate aligned) rectangle; // 3) a mesh on the L-shaped region. // // Licensing: // // This code is distributed under the GNU LGPL license. // // Modified: // // 25 January 2015 // // Reference: // // John Chrispell, Jason Howell, // Finite Element Approximation of Partial Differential Equations // Using FreeFem++, or, How I Learned to Stop Worrying and Love // Numerical Analysis. // // Frederic Hecht, // New development in FreeFem++, // Journal of Numerical Mathematics, // Volume 20, Number 3-4, 2012, pages 251-265. // // // #1: Mesh on the unit square [0,1] x [0,1]. // int n1 = 30; mesh Th1 = square ( n1, n1 ); plot ( Th1, ps = "square_mesh01.ps" ); // // #2: Mesh on an arbitrary square [X0,X1]x[Y0,Y1]. // int m2 = 20; int n2 = 10; real x0 = 100.0; real x1 = 110.0; real y0 = 5.0; real y1 = 10.0; mesh Th2 = square ( m2, n2, [ x0 + ( x1 - x0 ) * x, y0 + ( y1 - y0 ) * y ] ); plot ( Th2, ps = "square_mesh02.ps" ); // // #3: Mesh on the L shaped region [0,1]x[0,1] - [0.5,1.0]x[0.5,1.0]. // int n3 = 20; mesh Th3 = square ( n3, n3 ); Th3 = trunc ( Th3, x < 0.5 | y < 0.5 ); plot ( Th3, ps = "square_mesh03.ps" );