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

Method ReadNonUniformList

IO/Geometry/vtkOpenFOAMReader.cxx:3643–3708  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3641// list to be present in the stream if the format is binary.
3642template <vtkFoamToken::tokenType listType, typename traitsT>
3643void vtkFoamEntryValue::ReadNonUniformList(vtkFoamIOobject& io)
3644{
3645 this->SetStreamOption(io);
3646
3647 vtkFoamToken currToken;
3648 currToken.SetStreamOption(io);
3649 if (!io.Read(currToken))
3650 {
3651 throw vtkFoamError() << "Unexpected EOF";
3652 }
3653 traitsT list;
3654 this->Superclass::Type = listType;
3655 this->Superclass::VtkObjectPtr = list.GetPointer();
3656 if (currToken.Is<vtkTypeInt64>())
3657 {
3658 const vtkTypeInt64 size = currToken.To<vtkTypeInt64>();
3659 if (size < 0)
3660 {
3661 throw vtkFoamError() << "List size must not be negative: size = " << size;
3662 }
3663 list->SetNumberOfTuples(size);
3664 if (io.IsAsciiFormat())
3665 {
3666 if (!io.Read(currToken))
3667 {
3668 throw vtkFoamError() << "Unexpected EOF";
3669 }
3670 // some objects have lists with only one element enclosed by {}
3671 // e. g. simpleFoam/pitzDaily3Blocks/constant/polyMesh/faceZones
3672 if (currToken == '{')
3673 {
3674 list.ReadUniformValues(io);
3675 io.ReadExpecting('}');
3676 return;
3677 }
3678 else if (currToken != '(')
3679 {
3680 throw vtkFoamError() << "Expected '(', found " << currToken;
3681 }
3682 list.ReadAsciiList(io);
3683 io.ReadExpecting(')');
3684 }
3685 else
3686 {
3687 if (size > 0)
3688 {
3689 // Non-empty (binary) list - only read parentheses only when size > 0
3690 io.ReadExpecting('(');
3691 list.ReadBinaryList(io);
3692 io.ReadExpecting(')');
3693 }
3694 }
3695 }
3696 else if (currToken == '(')
3697 {
3698 while (io.Read(currToken) && currToken != ')')
3699 {
3700 list.ReadValue(io, currToken);

Callers 2

ReadFieldMethod · 0.95
ReadMethod · 0.95

Calls 15

vtkFoamErrorClass · 0.85
Is<vtkTypeInt64>Method · 0.80
To<vtkTypeInt64>Method · 0.80
IsAsciiFormatMethod · 0.80
ReadExpectingMethod · 0.80
IsFloat64Method · 0.80
SetStreamOptionMethod · 0.45
ReadMethod · 0.45
GetPointerMethod · 0.45
SetNumberOfTuplesMethod · 0.45
ReadUniformValuesMethod · 0.45
ReadAsciiListMethod · 0.45

Tested by

no test coverage detected