MCPcopy Create free account
hub / github.com/Kitware/VTK / GetAttributes

Function GetAttributes

Common/DataModel/vtkDataSetAttributesFieldList.cxx:253–276  ·  view source on GitHub ↗

* 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. */

Source from the content-addressed store, hash-verified

251 * all inputs consistently.
252 */
253std::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
278template <typename Container, typename ForwardIt, typename UnaryPredicate>
279void remove_if(Container& cont, ForwardIt first, ForwardIt second, UnaryPredicate p)

Callers 2

GetLegacyFieldForIndexFunction · 0.70
CopyAllocateMethod · 0.70

Calls 4

fillFunction · 0.50
transformFunction · 0.50
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected