Read compact labelListList which has offsets and data
| 3982 | |
| 3983 | // Read compact labelListList which has offsets and data |
| 3984 | void vtkFoamEntryValue::ReadCompactLabelListList(vtkFoamIOobject& io) |
| 3985 | { |
| 3986 | if (io.IsAsciiFormat()) |
| 3987 | { |
| 3988 | this->ReadLabelListList(io); |
| 3989 | return; |
| 3990 | } |
| 3991 | |
| 3992 | this->SetStreamOption(io); |
| 3993 | const bool use64BitLabels = io.IsLabel64(); |
| 3994 | |
| 3995 | this->LabelListListPtr = vtkCellArray::New(); |
| 3996 | if (use64BitLabels) |
| 3997 | { |
| 3998 | this->LabelListListPtr->Use64BitStorage(); |
| 3999 | } |
| 4000 | else |
| 4001 | { |
| 4002 | this->LabelListListPtr->Use32BitStorage(); |
| 4003 | } |
| 4004 | this->Superclass::Type = vtkFoamToken::LABELLISTLIST; |
| 4005 | for (int arrayI = 0; arrayI < 2; arrayI++) |
| 4006 | { |
| 4007 | vtkFoamToken currToken; |
| 4008 | currToken.SetStreamOption(io); |
| 4009 | if (!io.Read(currToken)) |
| 4010 | { |
| 4011 | throw vtkFoamError() << "Unexpected EOF"; |
| 4012 | } |
| 4013 | if (currToken.IsLabel()) |
| 4014 | { |
| 4015 | vtkTypeInt64 listLen = currToken.To<vtkTypeInt64>(); |
| 4016 | if (listLen < 0) |
| 4017 | { |
| 4018 | throw vtkFoamError() << "Illegal negative list length: " << listLen; |
| 4019 | } |
| 4020 | |
| 4021 | vtkDataArray* array = |
| 4022 | (arrayI == 0 ? this->Superclass::LabelListListPtr->GetOffsetsArray() |
| 4023 | : this->Superclass::LabelListListPtr->GetConnectivityArray()); |
| 4024 | array->SetNumberOfValues(static_cast<vtkIdType>(listLen)); |
| 4025 | |
| 4026 | if (listLen > 0) |
| 4027 | { |
| 4028 | // Non-empty (binary) list - only read parentheses only when size > 0 |
| 4029 | |
| 4030 | io.ReadExpecting('('); // Begin list |
| 4031 | if (use64BitLabels) |
| 4032 | { |
| 4033 | io.Read(reinterpret_cast<unsigned char*>( |
| 4034 | vtkAOSDataArrayTemplate<vtkTypeInt64>::FastDownCast(array)->GetPointer(0)), |
| 4035 | static_cast<vtkTypeInt64>(listLen * array->GetDataTypeSize())); |
| 4036 | } |
| 4037 | else |
| 4038 | { |
| 4039 | io.Read(reinterpret_cast<unsigned char*>( |
| 4040 | vtkAOSDataArrayTemplate<vtkTypeInt32>::FastDownCast(array)->GetPointer(0)), |
| 4041 | static_cast<vtkTypeInt64>(listLen * array->GetDataTypeSize())); |
no test coverage detected