visit
visit copied to clipboard
Wrong max and min in vtkDataSet->GetScalarRange()
See the min and max for this pseudocolor plot:
When I go to write this data out as obj, the texture coordinates are wrong because the data range given by vtkDataSet->GetScalarRange()
is wrong. See the following code snippet and printouts:
Code from here: https://github.com/visit-dav/visit/blob/develop/src/avt/FileWriter/avtDatasetFileWriter.C#L378
vtkDataSet *activeDS = ds;
...
double range[2];
activeDS->GetScalarRange(range);
std::cout << "range[0]: " << range[0] << std::endl;
std::cout << "range[1]: " << range[1] << std::endl;
Yields:
range[0]: 0
range[1]: 4.9557
The max looks right, but the min is wrong. Does anyone know how to fix this, or why this might be happening?
On further inspection, it looks like the scalar range it gives is correct, as there are data values in the vtkDataSet
that are 0. That is the problem that should be addressed, as variable d
of curv3d.silo
should not have any values that are 0.
@markcmiller86 looked the silo file and it doesn't contain any zeroes, so it must be getting added during processing in VisIt.
This looks to be a bug with VTK. vtkCellDataToPointData
is used to convert the zonal variable d
to a nodal variable to write it to OBJ; after the transformation, zeros are present. This should be investigated inside of VTK.
Taking out of reviewed state so we can discuss whether or not to keep this open now that the downstream issue this caused has been addressed in #19301
@JustinPrivitera I just tried with 3.4RC and develop, added logic to avtDatasetFileWriter::WriteOBJFile to call GetScalarRange both before the use of vtkCellDataToPointData and after, and it, and got the same values for both: range before c2dpd: 2.03471 4.9557 range after c2dpd: 2.03471 4.9557
I opened curv3d.silo, created a Pseudocolor plot of 'd' , Clicked Draw, then exported database as WavefrontOBJ. (didn't enable any of the write options).
I didn't check if the export was correct, but the range looks good.
Is there another way to reproduce?
I'm seeing the same thing. That is fascinating. I wonder if things have changed with VTK since last November? I think we can close this ticket then.
If you'd like I can remove this note in the code:
// Compute the range here since VTK cannot be trusted to get the extents
// right after transforming from cell data to point data.
// See https://github.com/visit-dav/visit/issues/19028
or you can, just let me know.
If you'd like I can remove this note in the code:
Be my guest
removing the note here #19705
closing as discussed