8#include <range/v3/algorithm/all_of.hpp>
9#include <range/v3/algorithm/any_of.hpp>
10#include <range/v3/view/transform.hpp>
28 std::string
const& property_name,
29 PT new_property_value,
30 int restrict_to_material_id,
38 ERR(
"Values of the PropertyVector are not assigned to cells.");
41 auto const* material_ids =
44 if (restrict_to_material_id != -1 && !material_ids)
47 "Restriction of resetting a property in a polygonal region "
48 "requires that a MaterialIDs data array is available in the "
52 auto has_element_required_material_id = [&](
int const element_id)
54 return restrict_to_material_id == -1 ||
55 (*material_ids)[element_id] == restrict_to_material_id;
60 auto is_node_outside = [&outside](std::size_t
const node_id)
61 {
return outside[node_id]; };
66 return any_of ? ranges::all_of(ids, is_node_outside)
67 : ranges::any_of(ids, is_node_outside);
72 return !is_element_outside(e) &&
73 has_element_required_material_id(e.getID());
77 {
return is_valid_element(*e) ? new_property_value : (*pv)[e->getID()]; };
79 pv->assign(mesh.
getElements() | ranges::views::transform(compute_value));
void ERR(fmt::format_string< Args... > fmt, Args &&... args)
std::vector< Node * > const & getNodes() const
Get the nodes-vector for the mesh.
std::vector< Element * > const & getElements() const
Get the element-vector for the mesh.
Properties & getProperties()
PropertyVector< T > const * getPropertyVector(std::string_view name) const
constexpr ranges::views::view_closure ids
For an element of a range view return its id.
PropertyVector< T > * getOrCreateMeshProperty(Mesh &mesh, std::string const &property_name, MeshItemType const item_type, int const number_of_components)