-- FreeFem++ v4.14 (mer. 06 mars 2024 16:59:04 CET - git v4.14-1-g2b2052ae) file : cloud.edp Load: lg_fem lg_mesh lg_mesh3 eigenvalue 1 : // cloud.edp 2 : // 3 : // Discussion: 4 : // 5 : // The file "cloud_points.txt" lists points that define the boundary. 6 : // 7 : // Create the corresponding region and mesh it. 8 : // 9 : // Licensing: 10 : // 11 : // This code is distributed under the MIT license. 12 : // 13 : // Modified: 14 : // 15 : // 02 August 2015 16 : // 17 : // Author: 18 : // 19 : // John Burkardt 20 : // 21 : // Reference: 22 : // 23 : // Alessandra Agostini, Chiara Piazzola, 24 : // Mesh Generation with FreeFem++ and Triangle, 25 : // Master's degree presentation, 26 : // University of Verona, 2014. 27 : // 28 : cout << "\n"; 29 : cout << "cloud():\n"; 30 : cout << " FreeFem++ version.\n"; 31 : cout << " Read a file of point coordinates that outline a ... : region.\n"; 32 : cout << " Create the region and mesh it.\n"; 33 : // 34 : // Attach the file as input. 35 : // 36 : string filename = "cloud_points.txt"; 37 : 38 : ifstream file ( filename ); 39 : cout << "\n"; 40 : cout << "Reading data from '" << filename << "'\n"; 41 : // 42 : // nn: the number of points. 43 : // 44 : int nn = 0; 45 : file >> nn; 46 : cout << " Number of nodes = "<< nn << endl; 47 : // 48 : // Gxx, Gyy: the X and Y coordinates of the boundary. 49 : // 50 : real[int] Gxx(nn); 51 : real[int] Gyy(nn); 52 : for ( int i = 0; i < nn; i++ ) 53 : { 54 : file >> Gxx[i] >> Gyy[i]; 55 : } 56 : // 57 : // List the nodes. 58 : // 59 : cout << "\n"; 60 : cout << " Boundary nodes:\n"; 61 : cout << "\n"; 62 : for ( int i = 0; i < nn; i++ ) 63 : { 64 : cout << " " << i 65 : << " " << Gxx[i] 66 : << " " << Gyy[i] << endl; 67 : } 68 : // 69 : // Gsup: the border defined by the points. 70 : // All points get label 1. 71 : // 72 : border Gsup ( t = 0, nn - 1 ) 73 : { 74 : int i = min ( int ( t ), Gxx.n - 2 ); 75 : real t1 = t - i; 76 : x = Gxx[i] * ( 1.0 - ( t - i ) ) + Gxx[i+1] * ( t - i ); 77 : y = Gyy[i] * ( 1.0 - ( t - i ) ) + Gyy[i+1] * ( t - i ); 78 : label = 1; 79 : } 80 : plot ( Gsup ( nn * 1 ), wait = true, ps = "cloud_border.ps" ); 81 : // 82 : // Th: the mesh. 83 : // 84 : mesh Th = buildmesh ( Gsup ( nn * 1 ) ); 85 : // 86 : // Plot the mesh. 87 : 88 : // 89 : plot ( Th, wait = true, ps = "cloud_mesh.ps" ); 90 : // 91 : // Solve a problem on this mesh. 92 : // 93 : // Vh: the finite element space on mesh Vh, with piecewise linear polynomials. 94 : // 95 : fespace Vh ( Th, P1 ); 96 : // 97 : // u: trial function 98 : // 99 : Vh u; 100 : // 101 : // v: test function. 102 : // 103 : Vh v; 104 : // 105 : // Define and solve the problem. 106 : // The boundary condition is associated with the points labeled 1. 107 : // 108 : solve Problem1 ( u, v ) = 109 : int2d ( Th ) ( dx(u) * dx(v) + dy(u) * dy(v) ) 110 : + int2d ( Th ) ( -v ) 111 : + on ( 1, u = 0.0 ); 112 : // 113 : // Plot the solution. 114 : // 115 : plot ( u, wait = true, ps = "cloud_uh.ps" ); 116 : // 117 : // Terminate. 118 : // 119 : cout << "\n"; 120 : cout << "cloud():\n"; 121 : cout << " Normal end of execution.\n"; 122 : 123 : exit ( 0 ); 124 : 125 : sizestack + 1024 =2008 ( 984 ) cloud(): FreeFem++ version. Read a file of point coordinates that outline a region. Create the region and mesh it. Reading data from 'cloud_points.txt' Number of nodes = 43 Boundary nodes: 0 255 9 1 280 17 2 294 57 3 291 97 4 278 137 5 248 173 6 275 197 7 281 237 8 264 277 9 244 295 10 274 329 11 286 369 12 286 409 13 261 446 14 221 447 15 220 485 16 221 525 17 207 565 18 167 585 19 127 581 20 99 547 21 99 507 22 110 469 23 70 482 24 30 461 25 15 421 26 12 381 27 19 341 28 43 301 29 76 283 30 36 257 31 11 217 32 17 177 33 55 155 34 79 155 35 69 115 36 78 75 37 114 43 38 154 53 39 173 93 40 187 74 41 215 34 42 255 9 -- mesh: Nb of Triangles = 207, Nb of Vertices 126 -- Solve : min 2.16675e-28 max 5323.03 cloud(): Normal end of execution. current line = 123 exit(0) err code 0 , mpirank 0 CodeAlloc : nb ptr 4049, size :525776 mpirank: 0 Ok: Normal End