Constructor
| 44 | public: |
| 45 | /// Constructor |
| 46 | HyperElasticProblem(fem::Form<T>& L, fem::Form<T>& J, |
| 47 | const std::vector<fem::DirichletBC<T>>& bcs) |
| 48 | : _l(L), _j(J), _bcs(bcs.begin(), bcs.end()), |
| 49 | _b_vec(L.function_spaces()[0]->dofmap()->index_map, |
| 50 | L.function_spaces()[0]->dofmap()->index_map_bs()), |
| 51 | _matJ(la::petsc::Matrix(fem::petsc::create_matrix(J, "aij"), false)), |
| 52 | _solver(L.function_spaces()[0]->dofmap()->index_map->comm()) |
| 53 | { |
| 54 | auto map = L.function_spaces()[0]->dofmap()->index_map; |
| 55 | const int bs = L.function_spaces()[0]->dofmap()->index_map_bs(); |
| 56 | std::int32_t size_local = bs * map->size_local(); |
| 57 | |
| 58 | std::vector<PetscInt> ghosts(map->ghosts().begin(), map->ghosts().end()); |
| 59 | std::int64_t size_global = bs * map->size_global(); |
| 60 | VecCreateGhostBlockWithArray(map->comm(), bs, size_local, size_global, |
| 61 | ghosts.size(), ghosts.data(), |
| 62 | _b_vec.array().data(), &_b); |
| 63 | |
| 64 | // Create linear solver. Default to LU. |
| 65 | _solver.set_options_prefix("nls_solve_"); |
| 66 | la::petsc::options::set("nls_solve_ksp_type", "preonly"); |
| 67 | la::petsc::options::set("nls_solve_pc_type", "lu"); |
| 68 | _solver.set_from_options(); |
| 69 | } |
| 70 | |
| 71 | /// Destructor |
| 72 | virtual ~HyperElasticProblem() |
nothing calls this directly
no test coverage detected