42 typedef std::pair<dealii::types::material_id, std::shared_ptr<Material<dim, Number>>> Pair;
43 typedef std::map<dealii::types::material_id, std::shared_ptr<Material<dim, Number>>> Materials;
45 MaterialHandler() : dof_index(0)
50 initialize(dealii::MatrixFree<dim, Number>
const & matrix_free,
51 unsigned int const dof_index,
52 unsigned int const quad_index,
53 std::shared_ptr<MaterialDescriptor const> material_descriptor,
54 bool const large_deformation)
56 this->dof_index = dof_index;
57 this->material_descriptor = material_descriptor;
59 for(
auto iter = material_descriptor->begin(); iter != material_descriptor->end(); ++iter)
61 dealii::types::material_id
id = iter->first;
62 std::shared_ptr<MaterialData> data = iter->second;
63 MaterialType type = data->type;
67 case MaterialType::Undefined:
69 AssertThrow(
false, dealii::ExcMessage(
"Material type is undefined."));
72 case MaterialType::StVenantKirchhoff:
74 std::shared_ptr<StVenantKirchhoffData<dim>> data_StVenantKirchhoff =
75 std::static_pointer_cast<StVenantKirchhoffData<dim>>(data);
76 material_map.insert(Pair(
id,
80 *data_StVenantKirchhoff,
84 case MaterialType::IncompressibleNeoHookean:
87 large_deformation ==
true,
89 "Incompressible Neo-Hookean material model defined for finite strain theory."));
91 std::shared_ptr<IncompressibleNeoHookeanData<dim>> data_IncompressibleNeoHookean =
92 std::static_pointer_cast<IncompressibleNeoHookeanData<dim>>(data);
96 matrix_free, dof_index, quad_index, *data_IncompressibleNeoHookean)));
101 AssertThrow(
false, dealii::ExcMessage(
"Specified material type is not implemented."));
109 reinit(dealii::MatrixFree<dim, Number>
const & matrix_free,
unsigned int const cell)
111 auto mid = matrix_free.get_cell_iterator(cell, 0, dof_index)->material_id();
114 for(
unsigned int v = 1; v < matrix_free.n_active_entries_per_cell_batch(cell); v++)
115 AssertThrow(mid == matrix_free.get_cell_iterator(cell, v)->material_id(),
116 dealii::ExcMessage(
"You have to categorize cells according to their materials!"));
119 material = material_map[mid];
122 std::shared_ptr<Material<dim, Number>>
129 unsigned int dof_index;
131 std::shared_ptr<MaterialDescriptor const> material_descriptor;
132 Materials material_map;
135 std::shared_ptr<Material<dim, Number>> material;