------------------------------------------------------------------------------
| 791 | |
| 792 | //------------------------------------------------------------------------------ |
| 793 | void vtkAVSucdReader::ReadNodeData(vtkUnstructuredGrid* output, const idMapping& nodeMap) |
| 794 | { |
| 795 | int i, j, n; |
| 796 | float* ptr; |
| 797 | vtkDebugMacro(<< "Begin of ReadNodeData()\n"); |
| 798 | if (this->BinaryFile) |
| 799 | { |
| 800 | for (i = 0; i < this->NumberOfNodeComponents; i++) |
| 801 | { |
| 802 | if (this->PointDataArraySelection->GetArraySetting(i)) |
| 803 | { |
| 804 | vtkFloatArray* scalars = vtkFloatArray::New(); |
| 805 | scalars->SetNumberOfComponents(this->NodeDataInfo[i].veclen); |
| 806 | scalars->SetNumberOfTuples(this->NumberOfNodes); |
| 807 | scalars->SetName(PointDataArraySelection->GetArrayName(i)); |
| 808 | this->FileStream->seekg(this->NodeDataInfo[i].foffset, ios::beg); |
| 809 | ptr = scalars->GetPointer(0); |
| 810 | this->ReadFloatBlock(this->NumberOfNodes * this->NodeDataInfo[i].veclen, ptr); |
| 811 | |
| 812 | output->GetPointData()->AddArray(scalars); |
| 813 | if (!output->GetPointData()->GetScalars()) |
| 814 | { |
| 815 | output->GetPointData()->SetScalars(scalars); |
| 816 | } |
| 817 | scalars->Delete(); |
| 818 | } |
| 819 | } |
| 820 | // |
| 821 | // Don't know how to use the information below, so skip reading it |
| 822 | // int *node_active_list = new int[this->NumberOfNodeFields]; |
| 823 | // this->ReadIntArray(node_active_list, this->NumberOfNodeFields); |
| 824 | // delete [] node_active_list; |
| 825 | // |
| 826 | } // end of binary read |
| 827 | else |
| 828 | { |
| 829 | float value; |
| 830 | char buf1[128], c = '\0', buf2[128]; |
| 831 | |
| 832 | *(this->FileStream) >> this->NumberOfNodeComponents; |
| 833 | this->NodeDataInfo = new DataInfo[this->NumberOfNodeComponents]; |
| 834 | for (i = 0; i < this->NumberOfNodeComponents; i++) |
| 835 | { |
| 836 | *(this->FileStream) >> this->NodeDataInfo[i].veclen; |
| 837 | } |
| 838 | this->FileStream->get(c); // one more newline to catch |
| 839 | |
| 840 | vtkFloatArray** scalars = new vtkFloatArray*[this->NumberOfNodeComponents]; |
| 841 | for (i = 0; i < this->NumberOfNodeComponents; i++) |
| 842 | { |
| 843 | j = 0; |
| 844 | while (this->FileStream->get(c) && c != ',') |
| 845 | { |
| 846 | buf1[j++] = c; |
| 847 | } |
| 848 | buf1[j] = '\0'; |
| 849 | // finish here to read the line |
| 850 | this->FileStream->get(buf2, 128, '\n'); |
no test coverage detected