------------------------------------------------------------------------------
| 958 | |
| 959 | //------------------------------------------------------------------------------ |
| 960 | int vtkExodusIIReaderPrivate::AssembleOutputCellMaps(vtkIdType vtkNotUsed(timeStep), int otyp, |
| 961 | int obj, BlockSetInfoType* bsinfop, vtkUnstructuredGrid* output) |
| 962 | { |
| 963 | (void)obj; |
| 964 | // Don't create arrays for deselected objects |
| 965 | if (!output || !bsinfop->Status) |
| 966 | { |
| 967 | return 1; |
| 968 | } |
| 969 | |
| 970 | // Ignore invalid otyp values (sets cannot have maps, only blocks). |
| 971 | int mtyp = this->GetMapTypeFromObjectType(otyp); |
| 972 | std::map<int, std::vector<MapInfoType>>::iterator mmi = this->MapInfo.find(mtyp); |
| 973 | if (mmi == this->MapInfo.end()) |
| 974 | { |
| 975 | return 1; |
| 976 | } |
| 977 | |
| 978 | vtkCellData* cd = output->GetCellData(); |
| 979 | // For each map defined on objects of the same type as our output, |
| 980 | // look for ones that are turned on (Status != 0). |
| 981 | std::vector<MapInfoType>::iterator mi; |
| 982 | int midx = 0; |
| 983 | for (mi = mmi->second.begin(); mi != mmi->second.end(); ++mi, ++midx) |
| 984 | { |
| 985 | if (!mi->Status) |
| 986 | continue; |
| 987 | |
| 988 | vtkDataArray* src = this->GetCacheOrRead(vtkExodusIICacheKey(-1, mmi->first, 0, midx)); |
| 989 | if (!src) |
| 990 | continue; |
| 991 | |
| 992 | if (otyp == vtkExodusIIReader::ELEM_BLOCK) |
| 993 | { |
| 994 | if (bsinfop->Size == src->GetNumberOfTuples() && bsinfop->FileOffset == 1 && |
| 995 | this->BlockInfo[otyp].size() == 1) |
| 996 | { |
| 997 | cd->AddArray(src); |
| 998 | } |
| 999 | else |
| 1000 | { |
| 1001 | // Create the array and copy the applicable subset from the map |
| 1002 | vtkIdTypeArray* arr = vtkIdTypeArray::New(); |
| 1003 | arr->SetName(mi->Name.c_str()); |
| 1004 | arr->SetNumberOfComponents(1); |
| 1005 | arr->SetNumberOfTuples(bsinfop->Size); |
| 1006 | std::copy_n(vtkIdTypeArray::FastDownCast(src)->GetPointer(bsinfop->FileOffset - 1), |
| 1007 | bsinfop->Size, arr->GetPointer(0)); |
| 1008 | cd->AddArray(arr); |
| 1009 | arr->FastDelete(); |
| 1010 | } |
| 1011 | } |
| 1012 | else |
| 1013 | { |
| 1014 | // FIXME: We have a set (no maps are defined on sets but we could determine |
| 1015 | // map values given the set generators) or an edge/face block (unclear |
| 1016 | // whether maps are useful/possible on these block types). |
| 1017 | } |
no test coverage detected