mirror of
https://gitlab.kitware.com/vtk/vtk-m
synced 2024-09-08 13:23:51 +00:00
Add #includes and explicitly identify the field name.
This commit is contained in:
parent
1bad28a3ec
commit
61522fde7b
@ -8,7 +8,9 @@
|
||||
// PURPOSE. See the above copyright notice for more information.
|
||||
//============================================================================
|
||||
|
||||
#include <cmath>
|
||||
#include <iostream>
|
||||
#include <vector>
|
||||
#include <vtkm/cont/DataSetBuilderUniform.h>
|
||||
#include <vtkm/io/ImageWriterPNG.h>
|
||||
|
||||
@ -38,7 +40,7 @@ int main()
|
||||
|
||||
vtkm::Vec4f v(1.0, 0.5, 0.0, 0.0);
|
||||
std::vector<vtkm::Vec4f> pixelValues(width * height, vtkm::Vec4f(0, 0, 0, 0));
|
||||
int iterates = 0;
|
||||
size_t iterates = 0;
|
||||
// We don't need more iterates than pixels of height,
|
||||
// by the pigeonhole principle.
|
||||
while (iterates++ < height)
|
||||
@ -54,9 +56,10 @@ int main()
|
||||
}
|
||||
}
|
||||
|
||||
ds.AddPointField("pixels", pixelValues);
|
||||
std::string colorFieldName = "pixels";
|
||||
ds.AddPointField(colorFieldName, pixelValues);
|
||||
std::string filename = "logistic.png";
|
||||
vtkm::io::ImageWriterPNG writer(filename);
|
||||
writer.WriteDataSet(ds);
|
||||
writer.WriteDataSet(ds, colorFieldName);
|
||||
std::cout << "Now open " << filename << "\n";
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user