MCPcopy Create free account
hub / github.com/FEniCS/dolfinx / HyperElasticProblem

Method HyperElasticProblem

cpp/demo/hyperelasticity/main.cpp:46–69  ·  view source on GitHub ↗

Constructor

Source from the content-addressed store, hash-verified

44public:
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()

Callers

nothing calls this directly

Calls 15

MatrixClass · 0.85
setFunction · 0.85
function_spacesMethod · 0.80
size_localMethod · 0.80
ghostsMethod · 0.80
size_globalMethod · 0.80
dataMethod · 0.80
create_matrixFunction · 0.50
dofmapMethod · 0.45
index_map_bsMethod · 0.45
commMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected