34{
36
37 if (argc < 3)
39
40
41 GetPot command_line (argc, argv);
42
43 std::string matfile, rhsfile;
44 if (command_line.search(1, "-m"))
45 matfile = command_line.next(matfile);
46 else
48
49 if (command_line.search(1, "-r"))
50 rhsfile = command_line.next(rhsfile);
51 else
53
55
56 LOG_CALL("mat.read()", "main", mat->read(matfile));
57
58 libMesh::out <<
"Loaded " << mat->m() <<
" by " << mat->n() <<
59 " matrix " << matfile << std::endl;
60
63
64 LOG_CALL("rhs.read()", "main", rhs->read_matlab(rhsfile));
65
67 " vector " << rhsfile << std::endl;
68
69 solution->init(rhs->size(), rhs->local_size());
70
72
74 if (command_line.search(1, "-t"))
75 tol = command_line.next(tol);
76
77 unsigned int n_iters = 1e3;
78 if (command_line.search(1, "-n"))
79 n_iters = command_line.next(n_iters);
80
81 auto [iters, res] = solver->solve(*mat, *solution, *rhs, tol, n_iters);
82
83 libMesh::out <<
"Finished in " << iters <<
" iterations with " << res
84 << " residual " << std::endl;
85
86 return 0;
87}
The LibMeshInit class, when constructed, initializes the dependent libraries (e.g.
static std::unique_ptr< LinearSolver< T > > build(const libMesh::Parallel::Communicator &comm_in, const SolverPackage solver_package=libMesh::default_solver_package())
Builds a LinearSolver using the linear solver package specified by solver_package.
static std::unique_ptr< NumericVector< T > > build(const Parallel::Communicator &comm, SolverPackage solver_package=libMesh::default_solver_package(), ParallelType parallel_type=AUTOMATIC)
Builds a NumericVector on the processors in communicator comm using the linear solver package specifi...
static std::unique_ptr< SparseMatrix< T > > build(const Parallel::Communicator &comm, const SolverPackage solver_package=libMesh::default_solver_package(), const MatrixBuildType matrix_build_type=MatrixBuildType::AUTOMATIC)
Builds a SparseMatrix<T> using the linear solver package specified by solver_package.
void usage(const std::string &prog_name)
void init(triangulateio &t)
Initializes the fields of t to nullptr/0 as necessary.
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real