// Discussion: // // Generate meshes using the square() command. // // Location: // // http://people.sc.fsu.edu/~jburkardt/freefem_src/square_test/square_test.edp // // Licensing: // // This code is distributed under the MIT license. // // Modified: // // 25 May 2020 // // Author: // // John Burkardt // // 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. // cout << "\n"; cout << "square_test\n"; cout << " FreeFem++ version\n"; cout << " Test the square() function for meshing a square region.\n"; // // Mesh a square on [0,1]x[0,1] into 5 by 5 elements. // mesh Th1 = square ( 5, 5 ); plot ( Th1, wait = true, ps = "square_test1_mesh.ps" ); // // Mesh a square on [0,1]x[0,1] into 4 by 5 elements. // mesh Th2 = square ( 4, 5 ); plot ( Th2, wait = true, ps = "square_test2_mesh.ps" ); // // Mesh a square on [4,10]x[5,12] into 5 by 10 elements. // mesh Th3 = square ( 5, 10, [4.0+x,10+2*y] ); plot ( Th3, wait = true, ps = "square_test3_mesh.ps" ); // // Mesh a square on [-1,+1]x[-1,+1] into 10 by 10 elements, // using a nonlinear transform. // mesh Th4 = square ( 10, 10, [ cos(pi*x), cos(pi*y) ] ); plot ( Th4, wait = true, ps = "square_test4_mesh.ps" ); // // Mesh on the L shaped region [0,1]x[0,1] - [0.5,1.0]x[0.5,1.0]. // int n5 = 20; mesh Th5 = square ( n5, n5 ); Th5 = trunc ( Th5, x < 0.6 | y < 0.4 ); plot ( Th5, ps = "square_test5_mesh.ps" ); // // Terminate. // cout << "\n"; cout << "square_test:\n"; cout << " Normal end of execution.\n"; exit ( 0 );