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

Method RequestData

IO/XML/vtkXMLCompositeDataWriter.cxx:160–234  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

158
159//------------------------------------------------------------------------------
160int vtkXMLCompositeDataWriter::RequestData(
161 vtkInformation*, vtkInformationVector** inputVector, vtkInformationVector*)
162{
163 vtkInformation* inInfo = inputVector[0]->GetInformationObject(0);
164
165 this->InputInformation = inInfo;
166
167 vtkCompositeDataSet* compositeData =
168 vtkCompositeDataSet::SafeDownCast(inInfo->Get(vtkDataObject::DATA_OBJECT()));
169 if (!compositeData)
170 {
171 vtkErrorMacro("No hierarchical input has been provided. Cannot write");
172 this->InputInformation = nullptr;
173 return 0;
174 }
175
176 // Create writers for each input.
177 this->CreateWriters(compositeData);
178
179 this->SetErrorCode(vtkErrorCode::NoError);
180
181 // Make sure we have a file to write.
182 if (!this->Stream && !this->FileName)
183 {
184 vtkErrorMacro("Writer called with no FileName set.");
185 this->SetErrorCode(vtkErrorCode::NoFileNameError);
186 this->InputInformation = nullptr;
187 return 0;
188 }
189
190 // We are just starting to write. Do not call
191 // UpdateProgressDiscrete because we want a 0 progress callback the
192 // first time.
193 this->UpdateProgress(0);
194
195 // Initialize progress range to entire 0..1 range.
196 float wholeProgressRange[2] = { 0.f, 1.f };
197 this->SetProgressRange(wholeProgressRange, 0, 1);
198
199 // Prepare file prefix for creation of internal file names.
200 this->SplitFileName();
201
202 float progressRange[2] = { 0.f, 0.f };
203 this->GetProgressRange(progressRange);
204
205 // Create the subdirectory for the internal files.
206 std::string subdir = this->Internal->FilePath;
207 subdir += this->Internal->FilePrefix;
208 this->MakeDirectory(subdir.c_str());
209
210 this->Internal->Root = vtkSmartPointer<vtkXMLDataElement>::New();
211 this->Internal->Root->SetName(compositeData->GetClassName());
212
213 int writerIdx = 0;
214 if (!this->WriteComposite(compositeData, this->Internal->Root, writerIdx))
215 {
216 this->RemoveWrittenFiles(subdir.c_str());
217 return 0;

Callers 1

ProcessRequestMethod · 0.95

Calls 15

CreateWritersMethod · 0.95
SplitFileNameMethod · 0.95
MakeDirectoryMethod · 0.95
RemoveWrittenFilesMethod · 0.95
GetInformationObjectMethod · 0.80
NewFunction · 0.50
GetMethod · 0.45
UpdateProgressMethod · 0.45
SetProgressRangeMethod · 0.45
GetProgressRangeMethod · 0.45
c_strMethod · 0.45

Tested by

no test coverage detected