| 1035 | std::vector<std::tuple<std::string, Ioss::Field::BasicType, int>> Fields; |
| 1036 | |
| 1037 | vtkNodeBlock(vtkPartitionedDataSetCollection* pdc, const std::string& name, |
| 1038 | vtkMultiProcessController* controller, vtkIOSSWriter* writer) |
| 1039 | : vtkGroupingEntity(writer) |
| 1040 | , DataSets(vtkCompositeDataSet::GetDataSets<vtkDataSet>(pdc)) |
| 1041 | , Name(name) |
| 1042 | { |
| 1043 | this->IdsRaw.reserve(this->DataSets.size()); |
| 1044 | |
| 1045 | std::set<int32_t> id_set; |
| 1046 | for (auto& ds : this->DataSets) |
| 1047 | { |
| 1048 | auto* gids = vtkIdTypeArray::SafeDownCast(ds->GetPointData()->GetGlobalIds()); |
| 1049 | if (!gids && ds->GetNumberOfPoints() != 0) |
| 1050 | { |
| 1051 | throw std::runtime_error("point global IDs missing."); |
| 1052 | } |
| 1053 | |
| 1054 | const auto numPoints = ds->GetNumberOfPoints(); |
| 1055 | if (gids) |
| 1056 | { |
| 1057 | assert(gids->GetNumberOfTuples() == numPoints); |
| 1058 | } |
| 1059 | |
| 1060 | this->Ids.reserve(this->Ids.size() + numPoints); |
| 1061 | this->IdsRaw.emplace_back(); |
| 1062 | this->IdsRaw.back().reserve(numPoints); |
| 1063 | const vtkIdType gidOffset = writer->GetOffsetGlobalIds() ? 1 : 0; |
| 1064 | for (vtkIdType cc = 0; cc < numPoints; ++cc) |
| 1065 | { |
| 1066 | const auto gid = gids->GetValue(cc); |
| 1067 | if (id_set.insert(gid).second) |
| 1068 | { |
| 1069 | this->Ids.push_back(gid + gidOffset); |
| 1070 | this->IdsRaw.back().push_back(cc); |
| 1071 | } |
| 1072 | } |
| 1073 | } |
| 1074 | |
| 1075 | assert(this->DataSets.size() == this->IdsRaw.size()); |
| 1076 | this->Fields = ::GetFields(vtkDataObject::POINT, writer->GetChooseFieldsToWrite(), |
| 1077 | writer->GetNodeBlockFieldSelection(), pdc, controller); |
| 1078 | } |
| 1079 | |
| 1080 | vtkIOSSWriter::EntityType GetEntityType() const override |
| 1081 | { |
nothing calls this directly
no test coverage detected