-- FreeFem++ v4.14 (mer. 06 mars 2024 16:59:04 CET - git v4.14-1-g2b2052ae) file : commandline_test.edp Load: lg_fem lg_mesh lg_mesh3 eigenvalue 1 : // commandline.edp 2 : // 3 : // Discussion: 4 : // 5 : // This example simply illustrates how FreeFem++ can read commandline input. 6 : // 7 : // Licensing: 8 : // 9 : // This code is distributed under the MIT license. 10 : // 11 : // Modified: 12 : // 13 : // 24 May 2020 14 : // 15 : // Author: 16 : // 17 : // John Chrispell, Jason Howell. 18 : // This version by John Burkardt. 19 : // 20 : // Reference: 21 : // 22 : // John Chrispell, Jason Howell, 23 : // Finite Element Approximation of Partial Differential Equations 24 : // Using FreeFem++, or, How I Learned to Stop Worrying and Love 25 : // Numerical Analysis. 26 : // 27 : // Frederic Hecht, 28 : // New development in FreeFem++, 29 : // Journal of Numerical Mathematics, 30 : // Volume 20, Number 3-4, 2012, pages 251-265. 31 : // 32 : cout << "\n"; 33 : cout << "commandline_test():\n"; 34 : cout << " FreeFem++ version.\n"; 35 : cout << " Read values of nx, ny from the user.\n"; 36 : // 37 : // Set some parameters. 38 : // 39 : real d = 2.0; 40 : real xx; 41 : real yy; 42 : // 43 : // Speak to the user: 44 : // 45 : cout << "Enter the number of X and Y data points desired: ... : " << endl; 46 : // 47 : // Listen to the user input. 48 : // 49 : int nx; 50 : int ny; 51 : cin >> nx >> ny; 52 : // 53 : // Report the values. 54 : // 55 : cout << "Using nx = " << nx << " and ny = " << ny << "\n"; 56 : // 57 : // F: a function. 58 : // 59 : func f = sin ( d * pi * x ) * cos ( ( d + 1.0 ) * pi * y ); 60 : // 61 : // Print a table of F(X,Y). 62 : // 63 : for ( int j = 0; j < ny; j++ ) 64 : { 65 : yy = real ( j ) / real ( ny - 1 ); 66 : for ( int i = 0; i < nx; i++ ) 67 : { 68 : xx = real ( i ) / real ( nx - 1 ); 69 : cout << f ( xx, yy ) << " "; 70 : } 71 : cout << endl; 72 : } 73 : // 74 : // Terminate. 75 : // 76 : cout << "\n"; 77 : cout << "commandline_test():\n"; 78 : cout << " Normal end of execution.\n"; 79 : 80 : exit ( 0 ); 81 : sizestack + 1024 =1128 ( 104 ) commandline_test(): FreeFem++ version. Read values of nx, ny from the user. Enter the number of X and Y data points desired: Using nx = 5 and ny = 4 0 1 1.22465e-16 -1 -2.44929e-16 -0 -1 -1.22465e-16 1 2.44929e-16 0 1 1.22465e-16 -1 -2.44929e-16 -0 -1 -1.22465e-16 1 2.44929e-16 commandline_test(): Normal end of execution. current line = 80 exit(0) err code 0 , mpirank 0 CodeAlloc : nb ptr 3892, size :517232 mpirank: 0 Ok: Normal End