| 221 | }; |
| 222 | |
| 223 | std::multimap<std::string, FieldInfo> GetFields(vtkDataSetAttributes* dsa) |
| 224 | { |
| 225 | std::array<int, vtkDataSetAttributes::NUM_ATTRIBUTES> attribute_indices; |
| 226 | dsa->GetAttributeIndices(attribute_indices.data()); |
| 227 | |
| 228 | std::multimap<std::string, FieldInfo> fields; |
| 229 | const auto num_of_arrays = dsa->GetNumberOfArrays(); |
| 230 | for (int cc = 0; cc < num_of_arrays; ++cc) |
| 231 | { |
| 232 | auto finfo = FieldInfo::Create(dsa->GetAbstractArray(cc), cc); |
| 233 | |
| 234 | // setup attributes info. |
| 235 | std::array<bool, vtkDataSetAttributes::NUM_ATTRIBUTES> curattrs; |
| 236 | std::transform(attribute_indices.begin(), attribute_indices.end(), curattrs.begin(), |
| 237 | [cc](int idx) { return idx == cc; }); |
| 238 | |
| 239 | finfo.AttributeTypes.push_back(curattrs); |
| 240 | |
| 241 | fields.insert(std::make_pair(finfo.Name, std::move(finfo))); |
| 242 | } |
| 243 | return fields; |
| 244 | } |
| 245 | |
| 246 | /** |
| 247 | * returns a vector of FieldInfo* where the index is the attribute type and |
no test coverage detected