15#include <range/v3/algorithm/all_of.hpp>
16#include <range/v3/algorithm/any_of.hpp>
17#include <range/v3/view/transform.hpp>
35 std::string
const& property_name,
36 PT new_property_value,
37 int restrict_to_material_id,
45 ERR(
"Values of the PropertyVector are not assigned to cells.");
49 auto const* material_ids =
52 if (restrict_to_material_id != -1 && !material_ids)
55 "Restriction of resetting a property in a polygonal region "
56 "requires that a MaterialIDs data array is available in the "
60 auto has_element_required_material_id = [&](
int const element_id)
62 return restrict_to_material_id == -1 ||
63 (*material_ids)[element_id] == restrict_to_material_id;
68 auto is_node_outside = [&outside](std::size_t
const node_id)
69 {
return outside[node_id]; };
74 return any_of ? ranges::all_of(ids, is_node_outside)
75 : ranges::any_of(ids, is_node_outside);
80 return !is_element_outside(e) &&
81 has_element_required_material_id(e.getID());
85 {
return is_valid_element(*e) ? new_property_value : (*pv)[e->getID()]; };
87 auto values = mesh.
getElements() | ranges::views::transform(compute_value);
89 pv->assign(values.begin(), values.end());
Definition of the Element class.
Definition of the GEOObjects class.
void ERR(fmt::format_string< Args... > fmt, Args &&... args)
Definition of the Mesh class.
Definition of the Node class.
Definition of the Polygon class.
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)
Definition of readMeshFromFile function.