int main() { int Error = 0; Error += test_vec(); Error += test_mat(); return Error; }
int main(int argc, char* argv[]){ int nrows = 300; int ncols = 300; int rank = 4; int numIter = 10; double tau = 1.5*nrows; double delta = 1.4; double tol = 0.1; // terrible choice of value, but this isn't implemented yet anyways char* file_out = "test.txt"; int ku = 3; // Number of unknown values. int omega_c[] = {0, 5, 7}; // places of unknown values. int kn = (nrows*ncols)-ku; // Number of known values. int omega[kn]; // places of known values. create_omega(omega_c, ku, omega, kn, nrows*ncols); double *Y = alloc_array_z(nrows, ncols); double *Z = alloc_array_z(nrows, ncols); double *dummyMatrix = alloc_array_z(nrows, ncols); double *dummy2 = alloc_array_z(nrows,ncols); double *M = test_mat(rank, nrows, ncols); printf("Number of elements in matrix : %d\n",nrows*ncols); // Number of threads to use. // Run ./a.out 3 for three threads. int num_of_threads = atoi(argv[1]); printf("Asked for %d threads\n", num_of_threads); omp_set_num_threads(num_of_threads); printf("Elapsed time : %1.4f sec\n", runBenchmark( 'P', nrows, ncols, rank, ku, omega_c, kn, omega, numIter, tol, file_out, tau, delta, Y, Z, M, dummyMatrix, dummy2)); printf("RMSE : %1.2g\n", RMSE2(M, Z, omega_c, ku)); // Cleaning up free_array(Y); free_array(M); free_array(dummy2); free_array(Z); free_array(dummyMatrix); return 0; }
int main(int argc, char **args) { if (argc < 3) error("Not enough parameters."); char *type = args[1]; Mesh mesh; H3DReader mesh_loader; if (!mesh_loader.load(args[2], &mesh)) error("Loading mesh file '%s'\n", args[2]); if (strcmp(type, "sln") == 0) { // Testing on Exact solution which always gives the same value (values from Solution may differ by epsilon) ExactSolution ex_sln(&mesh, exact_solution); output.out(&ex_sln, "U"); } else if (strcmp(type, "vec-sln") == 0) { // Testing on Exact solution which always gives the same value (values from Solution may differ by epsilon) ExactSolution ex_sln(&mesh, exact_vec_solution); output.out(&ex_sln, "U"); } else if (strcmp(type, "3sln") == 0) { // Testing on Exact solution which always gives the same value (values from Solution may differ by epsilon) ExactSolution ex_sln0(&mesh, exact_solution0); ExactSolution ex_sln1(&mesh, exact_solution1); ExactSolution ex_sln2(&mesh, exact_solution2); output.out(&ex_sln0, &ex_sln1, &ex_sln2, "U"); } else if (strcmp(type, "ord") == 0) { Ord3 order; if (mesh.elements[1]->get_mode() == HERMES_MODE_HEX) order = Ord3(2, 3, 4); else if (mesh.elements[1]->get_mode() == HERMES_MODE_TET) order = Ord3(3); else error(HERMES_ERR_NOT_IMPLEMENTED); H1Space space(&mesh, bc_types, essential_bc_values, order); #if defined GMSH output.out_orders_gmsh(&space, "orders_gmsh"); #elif defined VTK output.out_orders_vtk(&space, "orders_vtk"); #endif } else if (strcmp(type, "bc") == 0) { #if defined GMSH output.out_bc_gmsh(&mesh); #elif defined VTK output.out_bc_vtk(&mesh); #endif } else if (strcmp(type, "mat") == 0) { StiffMatrix mat; test_mat(&mesh, mat); output.out(&mat); } else if (strcmp(type, "mm") == 0) { test_mm(&mesh); } return 0; }
int main(int argc, char **args) { set_verbose(false); if (argc < 3) error("Not enough parameters"); char *type = args[1]; Mesh mesh; Mesh3DReader mesh_loader; if (!mesh_loader.load(args[2], &mesh)) error("Loading mesh file '%s'\n", args[2]); if (strcmp(type, "sln") == 0) { // Testing on Exact solution which always gives the same value (values from Solution may differ by epsilon) ExactSolution ex_sln(&mesh, exact_solution); output.out(&ex_sln, "U"); } else if (strcmp(type, "vec-sln") == 0) { // Testing on Exact solution which always gives the same value (values from Solution may differ by epsilon) ExactSolution ex_sln(&mesh, exact_vec_solution); output.out(&ex_sln, "U"); } else if (strcmp(type, "3sln") == 0) { // Testing on Exact solution which always gives the same value (values from Solution may differ by epsilon) ExactSolution ex_sln0(&mesh, exact_solution0); ExactSolution ex_sln1(&mesh, exact_solution1); ExactSolution ex_sln2(&mesh, exact_solution2); output.out(&ex_sln0, &ex_sln1, &ex_sln2, "U"); } else if (strcmp(type, "ord") == 0) { H1ShapesetLobattoHex shapeset; H1Space space(&mesh, &shapeset); space.set_bc_types(bc_types); space.set_essential_bc_values(essential_bc_values); order3_t order; if (mesh.elements[1]->get_mode() == MODE_HEXAHEDRON) order = order3_t(2, 3, 4); else if (mesh.elements[1]->get_mode() == MODE_TETRAHEDRON) order = order3_t(3); else error(H3D_ERR_NOT_IMPLEMENTED); space.set_uniform_order(order); output.out_orders(&space, "orders"); } else if (strcmp(type, "bc") == 0) { output.out_bc(&mesh); } else if (strcmp(type, "mat") == 0) { StiffMatrix mat; test_mat(&mesh, mat); output.out(&mat); } else if (strcmp(type, "mm") == 0) { test_mm(&mesh); } return 0; }