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

Method ReadCompactLabelListList

IO/Geometry/vtkOpenFOAMReader.cxx:3984–4052  ·  view source on GitHub ↗

Read compact labelListList which has offsets and data

Source from the content-addressed store, hash-verified

3982
3983// Read compact labelListList which has offsets and data
3984void 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()));

Callers 1

ReadFacesFileMethod · 0.80

Calls 15

ReadLabelListListMethod · 0.95
vtkFoamErrorClass · 0.85
IsAsciiFormatMethod · 0.80
Use64BitStorageMethod · 0.80
Use32BitStorageMethod · 0.80
To<vtkTypeInt64>Method · 0.80
GetConnectivityArrayMethod · 0.80
ReadExpectingMethod · 0.80
NewFunction · 0.50
FastDownCastFunction · 0.50
SetStreamOptionMethod · 0.45
IsLabel64Method · 0.45

Tested by

no test coverage detected