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

Method ReadCellData

IO/Geometry/vtkAVSucdReader.cxx:887–973  ·  view source on GitHub ↗

------------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

885
886//------------------------------------------------------------------------------
887void vtkAVSucdReader::ReadCellData(vtkUnstructuredGrid* output, const idMapping& cellMap)
888{
889 int i, j, n;
890 float* ptr;
891 vtkDebugMacro(<< "Begin of ReadCellData()\n");
892 if (this->BinaryFile)
893 {
894 for (i = 0; i < this->NumberOfCellComponents; i++)
895 {
896 if (this->CellDataArraySelection->GetArraySetting(i))
897 {
898 vtkFloatArray* scalars = vtkFloatArray::New();
899 scalars->SetNumberOfComponents(this->CellDataInfo[i].veclen);
900 scalars->SetNumberOfTuples(this->NumberOfCells);
901 scalars->SetName(CellDataArraySelection->GetArrayName(i));
902 this->FileStream->seekg(this->CellDataInfo[i].foffset, ios::beg);
903 ptr = scalars->GetPointer(0);
904 this->ReadFloatBlock(this->NumberOfCells * this->CellDataInfo[i].veclen, ptr);
905
906 output->GetCellData()->AddArray(scalars);
907 if (!output->GetCellData()->GetScalars())
908 {
909 output->GetCellData()->SetScalars(scalars);
910 }
911 scalars->Delete();
912 }
913 }
914 } // end of binary read
915 else
916 {
917 float value;
918 char buf1[128], c = '\0', buf2[128];
919
920 *(this->FileStream) >> this->NumberOfCellComponents;
921 this->CellDataInfo = new DataInfo[this->NumberOfCellComponents];
922
923 for (i = 0; i < this->NumberOfCellComponents; i++)
924 {
925 *(this->FileStream) >> this->CellDataInfo[i].veclen;
926 }
927 this->FileStream->get(c); // one more newline to catch
928
929 vtkFloatArray** scalars = new vtkFloatArray*[this->NumberOfCellComponents];
930 for (i = 0; i < this->NumberOfCellComponents; i++)
931 {
932 j = 0;
933 while (this->FileStream->get(c) && c != ',')
934 {
935 buf1[j++] = c;
936 }
937 buf1[j] = '\0';
938 // finish here to read the line
939 this->FileStream->get(buf2, 128, '\n');
940 this->FileStream->get(c);
941
942 scalars[i] = vtkFloatArray::New();
943 scalars[i]->SetNumberOfComponents(this->CellDataInfo[i].veclen);
944 scalars[i]->SetNumberOfTuples(this->NumberOfCells);

Callers 1

ReadFileMethod · 0.95

Calls 15

ReadFloatBlockMethod · 0.95
SetScalarsMethod · 0.80
DeleteMethod · 0.65
NewFunction · 0.50
GetArraySettingMethod · 0.45
SetNumberOfComponentsMethod · 0.45
SetNumberOfTuplesMethod · 0.45
SetNameMethod · 0.45
GetArrayNameMethod · 0.45
GetPointerMethod · 0.45
AddArrayMethod · 0.45
GetCellDataMethod · 0.45

Tested by

no test coverage detected