------------------------------------------------------------------------------
| 885 | |
| 886 | //------------------------------------------------------------------------------ |
| 887 | void 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); |
no test coverage detected