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

Method RequestDataObject

IO/Parallel/vtkPDataSetReader.cxx:106–186  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

104
105//------------------------------------------------------------------------------
106int vtkPDataSetReader::RequestDataObject(
107 vtkInformation* request, vtkInformationVector** inputVector, vtkInformationVector* outputVector)
108{
109
110 istream* file;
111 char* block;
112 char* param;
113 char* value;
114 int type;
115
116 // Start reading the meta-data pvtk file.
117 file = this->OpenFile(this->FileName);
118 if (file == nullptr)
119 {
120 return 0;
121 }
122
123 type = this->ReadXML(file, &block, &param, &value);
124 if (type == 1 && strcmp(block, "File") == 0)
125 {
126 this->ReadPVTKFileInformation(file, request, inputVector, outputVector);
127 this->VTKFileFlag = 0;
128 }
129 else if (type == 4 && strncmp(value, "# vtk DataFile Version", 22) == 0)
130 {
131 // This is a vtk file not a PVTK file.
132 this->ReadVTKFileInformation(request, inputVector, outputVector);
133 this->VTKFileFlag = 1;
134 }
135 else
136 {
137 vtkErrorMacro("This does not look like a VTK file: " << this->FileName);
138 }
139
140 delete file;
141 file = nullptr;
142
143 vtkInformation* info = outputVector->GetInformationObject(0);
144 vtkDataSet* output = vtkDataSet::SafeDownCast(info->Get(vtkDataObject::DATA_OBJECT()));
145
146 if (output && output->GetDataObjectType() == this->DataType)
147 {
148 return 1;
149 }
150
151 vtkDataSet* newOutput = nullptr;
152 switch (this->DataType)
153 {
154 case VTK_POLY_DATA:
155 newOutput = vtkPolyData::New();
156 break;
157 case VTK_UNSTRUCTURED_GRID:
158 newOutput = vtkUnstructuredGrid::New();
159 break;
160 case VTK_STRUCTURED_GRID:
161 newOutput = vtkStructuredGrid::New();
162 break;
163 case VTK_RECTILINEAR_GRID:

Callers 1

ProcessRequestMethod · 0.45

Calls 11

OpenFileMethod · 0.95
ReadXMLMethod · 0.95
GetInformationObjectMethod · 0.80
GetDataObjectTypeMethod · 0.80
DeleteMethod · 0.65
NewFunction · 0.50
GetMethod · 0.45
GetClassNameMethod · 0.45
SetMethod · 0.45

Tested by

no test coverage detected