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

Method RequestData

IO/Chemistry/vtkGaussianCubeReader.cxx:54–237  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

52
53//------------------------------------------------------------------------------
54int vtkGaussianCubeReader::RequestData(vtkInformation* vtkNotUsed(request),
55 vtkInformationVector** vtkNotUsed(inputVector), vtkInformationVector* outputVector)
56{
57 vtkInformation* outInfo = outputVector->GetInformationObject(0);
58 vtkPolyData* output = vtkPolyData::SafeDownCast(outInfo->Get(vtkDataObject::DATA_OBJECT()));
59
60 FILE* fp;
61 char title[256];
62 char data_name[256];
63 double elements[16];
64 int JN1, N1N2, n1, n2, n3, i, j, k;
65 bool orbitalCubeFile = false;
66 int numberOfOrbitals;
67
68 // Output 0 (the default is the polydata)
69 // Output 1 will be the gridded Image data
70
71 vtkImageData* grid = this->GetGridOutput();
72
73 if (!this->FileName)
74 {
75 return 0;
76 }
77
78 if ((fp = vtksys::SystemTools::Fopen(this->FileName, "r")) == nullptr)
79 {
80 vtkErrorMacro(<< "File " << this->FileName << " not found");
81 return 0;
82 }
83
84 if (!fgets(title, 256, fp))
85 {
86 vtkErrorMacro("GaussianCubeReader error reading file: "
87 << this->FileName << " Premature EOF while reading title.");
88 fclose(fp);
89 return 0;
90 }
91
92 // TODO: SystemTools::Split should be replaced by a SystemTools::SplitN call
93 // which only splits up to N times as soon as it exists
94 std::vector<std::string> tokens;
95 vtksys::SystemTools::Split(title, tokens, ':');
96 if (tokens.size() > 2)
97 {
98 for (std::size_t token = 3; token < tokens.size(); ++token)
99 {
100 tokens[2] += ":" + tokens[token];
101 }
102 strcpy(data_name, tokens[2].c_str());
103 vtk::print(stderr, "label = {:s}\n", data_name);
104 }
105
106 if (!fgets(title, 256, fp))
107 {
108 vtkErrorMacro("GaussianCubeReader error reading file: "
109 << this->FileName << " Premature EOF while reading title.");
110 fclose(fp);
111 return 0;

Callers

nothing calls this directly

Calls 15

GetGridOutputMethod · 0.95
GetInformationObjectMethod · 0.80
SplitFunction · 0.50
printFunction · 0.50
GetMethod · 0.45
sizeMethod · 0.45
c_strMethod · 0.45
valuesMethod · 0.45
SetMatrixMethod · 0.45
InverseMethod · 0.45
ReadMoleculeMethod · 0.45
valueMethod · 0.45

Tested by

no test coverage detected