Commit 4d41ae9f authored by Dmitry Yu. Naumov's avatar Dmitry Yu. Naumov
Browse files

[PL] IPWriter creation for internal state vars.

Similar to the secondary variables function but now for
the integration point writers.
parent 9ed70d74
......@@ -78,7 +78,56 @@ void solidMaterialInternalToSecondaryVariables(
add_secondary_variable(name, num_components, std::move(getIntPtValues));
}
}
template <typename LocalAssemblerInterface, typename AddIntegrationPointWriter,
int DisplacementDim>
void solidMaterialInternalVariablesToIntegrationPointWriter(
std::map<int, std::unique_ptr<MaterialLib::Solids::MechanicsBase<
DisplacementDim>>> const& solid_materials,
std::vector<std::unique_ptr<LocalAssemblerInterface>> const&
local_assemblers,
AddIntegrationPointWriter const& add_integration_point_writer)
{
// Collect the internal variables for all solid materials.
std::vector<typename MaterialLib::Solids::MechanicsBase<
DisplacementDim>::InternalVariable>
internal_variables;
for (auto const& solid_material : solid_materials)
{
auto const ivs = solid_material.second->getInternalVariables();
copy(begin(ivs), end(ivs), back_inserter(internal_variables));
}
// Create integration point writers for each of the internal variables.
for (auto const& internal_variable : internal_variables)
{
auto const& name = internal_variable.name;
auto const& fct = internal_variable.reference;
auto const n_components = internal_variable.num_components;
DBUG("Creating integration point writer for internal variable {:s}.",
name);
auto get_integration_point_data = [fct, n_components,
&local_assemblers]() {
// Result containing integration point data for each local
// assembler.
std::vector<std::vector<double>> result;
result.reserve(local_assemblers.size());
std::transform(begin(local_assemblers), end(local_assemblers),
back_inserter(result),
[fct, n_components](auto const& local_assembler) {
return local_assembler
->getMaterialStateVariableInternalState(
fct, n_components);
});
return result;
};
add_integration_point_writer(name, n_components,
get_integration_point_data);
}
}
} // namespace ProcessLib::Deformation
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment