* returns a vector of FieldInfo* where the index is the attribute type and * value is the FieldInfo that will be flagged as that attribute type. * To determine this, we look at the AttributeTypes information accumulated for * inputs and mark an attribute as such only if its tagged as an attribute on * all inputs consistently. */
| 251 | * all inputs consistently. |
| 252 | */ |
| 253 | std::array<const detail::FieldInfo*, vtkDataSetAttributes::NUM_ATTRIBUTES> GetAttributes( |
| 254 | const std::multimap<std::string, FieldInfo>& mmap) |
| 255 | { |
| 256 | std::array<const detail::FieldInfo*, vtkDataSetAttributes::NUM_ATTRIBUTES> attrs; |
| 257 | std::fill(attrs.begin(), attrs.end(), nullptr); |
| 258 | for (auto& pair : mmap) |
| 259 | { |
| 260 | const FieldInfo* finfo = &pair.second; |
| 261 | |
| 262 | // check if this field is consistently marked as an attribute in all inputs. |
| 263 | std::array<bool, vtkDataSetAttributes::NUM_ATTRIBUTES> accumulated_attrs; |
| 264 | std::fill(accumulated_attrs.begin(), accumulated_attrs.end(), true); |
| 265 | for (const auto& inattrs : finfo->AttributeTypes) |
| 266 | { |
| 267 | std::transform(accumulated_attrs.begin(), accumulated_attrs.end(), inattrs.begin(), |
| 268 | accumulated_attrs.begin(), std::logical_and<>()); |
| 269 | } |
| 270 | |
| 271 | std::transform(attrs.begin(), attrs.end(), accumulated_attrs.begin(), attrs.begin(), |
| 272 | [&](const detail::FieldInfo* prev, bool isattr) |
| 273 | { return isattr && prev == nullptr ? finfo : prev; }); |
| 274 | } |
| 275 | return attrs; |
| 276 | } |
| 277 | |
| 278 | template <typename Container, typename ForwardIt, typename UnaryPredicate> |
| 279 | void remove_if(Container& cont, ForwardIt first, ForwardIt second, UnaryPredicate p) |
no test coverage detected