Commit 115d91a1 authored by Yohann Bearzi's avatar Yohann Bearzi Committed by Kitware Robot
Browse files

Merge topic 'resample2htg-2D-crash-fix'

59dc96af

 Resample to htg: 2D bug fix
Acked-by: Kitware Robot's avatarKitware Robot <kwrobot@kitware.com>
Acked-by: Cory Quammen's avatarCory Quammen <cory.quammen@kitware.com>
Merge-request: !5074
parents 573cb8d2 59dc96af
Pipeline #240389 failed with stages
in 218 minutes and 7 seconds
4946dff4c1b0834d6c0a0e56ddd74e5373de6db903e205e3a5b1b1664892453caa992bed452fd787ea892e753cd53953d66a39d9f89467faba82a89d08b6a247
572f8b3cc54eae3bcf814712334e9aebaaee7b4ff8b72b2cb5d7bf1202cc139ca876b719401db649b810ef82b76e2e600ffd73cac44b3ddc991646b668911a6e
dd4883518f640e4a8d9b1ebb33e6b0eb03ced48452e40f983f26af01e9e99aa3a3104c17be96f60c9c3c81cfc5a74498b786fb098e35aba3688594ce4296ab20
2d576a39114c01c05d4931362b9792917167259a1202ba6b5003e5438919537c724a4ddc3465da28b47f2af09ad208820f52f9eb658b45d9950154a4bea8f55a
381e334dbf93bedb5d5daa7ca57171d00c6c3ba2a5fbd6d8a819affb81763454e5cc075b108662a1c8e50f69f5b5b25e8515587b0ea56398b3ea1dd1a27d5cd8
......@@ -407,6 +407,9 @@ ExternalData_Expand_Arguments(ParaViewData _
"DATA{${CMAKE_CURRENT_SOURCE_DIR}/../Data/Baseline/RenderNanGUIColor.png}"
"DATA{${CMAKE_CURRENT_SOURCE_DIR}/../Data/Baseline/RenderNanPresetColor.png}"
"DATA{${CMAKE_CURRENT_SOURCE_DIR}/../Data/Baseline/ResampleToHyperTreeGridBranching_3.png}"
"DATA{${CMAKE_CURRENT_SOURCE_DIR}/../Data/Baseline/ResampleToHyperTreeGrid2DX.png}"
"DATA{${CMAKE_CURRENT_SOURCE_DIR}/../Data/Baseline/ResampleToHyperTreeGrid2DY.png}"
"DATA{${CMAKE_CURRENT_SOURCE_DIR}/../Data/Baseline/ResampleToHyperTreeGrid2DZ.png}"
"DATA{${CMAKE_CURRENT_SOURCE_DIR}/../Data/Baseline/ResampleWithDataset_A.png}"
"DATA{${CMAKE_CURRENT_SOURCE_DIR}/../Data/Baseline/ResampleWithDataset_B.png}"
"DATA{${CMAKE_CURRENT_SOURCE_DIR}/../Data/Baseline/ResampleWithDataset_C.png}"
......@@ -1711,8 +1714,7 @@ list(APPEND TESTS_WITHOUT_BASELINES
# ResampleToHyperTreeGrid only works in client mode
paraview_add_client_tests(
BASELINE_DIR ${PARAVIEW_TEST_BASELINE_DIR}
TEST_SCRIPTS ResampleToHyperTreeGridBranching_3.xml
TEST_SCRIPTS ResampleToHyperTreeGrid.xml
)
paraview_add_client_tests(
......
<?xml version="1.0" ?>
<pqevents>
<pqevent object="pqClientMainWindow/menubar" command="activate" arguments="menuTools" />
<pqevent object="pqClientMainWindow/menubar/menuTools" command="activate" arguments="actionTesting_Window_Size" />
<pqevent object="pqClientMainWindow/menubar" command="activate" arguments="menuTools" />
<pqevent object="pqClientMainWindow/menubar/menuTools" command="activate" arguments="actionManage_Plugins" />
<pqevent object="pqClientMainWindow/PluginManagerDialog/splitter/localGroup/localPlugins" command="setCurrent" arguments="vtkPVInitializerPlugin" />
<pqevent object="pqClientMainWindow/PluginManagerDialog/splitter/localGroup/localPlugins" command="setCurrent" arguments="HyperTreeGridADR" />
<pqevent object="pqClientMainWindow/PluginManagerDialog/splitter/localGroup/loadSelected_Local" command="activate" arguments="" />
<pqevent object="pqClientMainWindow/PluginManagerDialog/buttonBox/1QPushButton0" command="activate" arguments="" />
<pqevent object="pqClientMainWindow/MainControlsToolbar/actionOpenData" command="activate" arguments="" />
<pqevent object="pqClientMainWindow/FileOpenDialog" command="filesSelected" arguments="$PARAVIEW_DATA_ROOT/Testing/Data/disk_out_ref.ex2" />
<pqevent object="pqClientMainWindow/propertiesDock/propertiesPanel/Accept" command="activate" arguments="" />
<pqevent object="pqClientMainWindow/menubar" command="activate" arguments="menuFilters" />
<pqevent object="pqClientMainWindow/menubar/menuFilters/Alphabetical" command="activate" arguments="ResampleToHyperTreeGrid" />
<pqevent object="pqClientMainWindow/propertiesDock/propertiesPanel/scrollArea/qt_scrollarea_viewport/scrollAreaWidgetContents/PropertiesFrame/ProxyPanel/MaxDepth/LineEdit0" command="set_string" arguments="5" />
<pqevent object="pqClientMainWindow/propertiesDock/propertiesPanel/scrollArea/qt_scrollarea_viewport/scrollAreaWidgetContents/PropertiesFrame/ProxyPanel/BranchFactor/ComboBox" command="activated" arguments="3" />
<pqevent object="pqClientMainWindow/propertiesDock/propertiesPanel/scrollArea/qt_scrollarea_viewport/scrollAreaWidgetContents/PropertiesFrame/ProxyPanel/ExtrapolatePointData/CheckBox" command="set_boolean" arguments="true" />
<pqevent object="pqClientMainWindow/propertiesDock/propertiesPanel/Accept" command="activate" arguments="" />
<pqevent object="pqClientMainWindow/variableToolbar/displayColor/Variables" command="activated" arguments="ash3_measure" />
<pqevent object="pqClientMainWindow/variableToolbar/actionScalarBarVisibility" command="set_boolean" arguments="false" />
<pqevent object="pqClientMainWindow/cameraToolbar/actionPositiveX" command="activate" arguments="" />
<pqcompareview object="pqClientMainWindow/centralwidget/MultiViewWidget/CoreWidget/qt_tabwidget_stackedwidget/MultiViewWidget1/Container/Frame.0/CentralWidgetFrame/Viewport" baseline="$PARAVIEW_DATA_ROOT/Clients/ParaView/Testing/Data/Baseline/ResampleToHyperTreeGridBranching_3.png" width="300" height="300" />
<pqevent object="pqClientMainWindow/pipelineBrowserDock/pipelineBrowser" command="mousePress" arguments="1,1,0,9,10,/0:0/0:0/0:1" />
<pqevent object="pqClientMainWindow/pipelineBrowserDock/pipelineBrowser" command="mouseRelease" arguments="1,0,0,9,10,/0:0/0:0/0:1" />
<pqevent object="pqClientMainWindow/pipelineBrowserDock/pipelineBrowser" command="mousePress" arguments="1,1,0,47,8,/0:0/0:0" />
<pqevent object="pqClientMainWindow/pipelineBrowserDock/pipelineBrowser" command="mouseRelease" arguments="1,0,0,47,8,/0:0/0:0" />
<pqevent object="pqClientMainWindow/menubar/menuFilters/pqProxyGroupMenuManager0/Cut" command="activate" arguments="" />
<pqevent object="pqClientMainWindow/propertiesDock/propertiesPanel/scrollArea/qt_scrollarea_viewport/scrollAreaWidgetContents/PropertiesFrame/ProxyPanel/CutFunction/ProxySelectionWidget/frame/ChosenProxyWidget/InteractivePlane/useXNormal" command="activate" arguments="" />
<pqevent object="pqClientMainWindow/propertiesDock/propertiesPanel/Accept" command="activate" arguments="" />
<pqevent object="pqClientMainWindow/menubar" command="activate" arguments="menuFilters" />
<pqevent object="pqClientMainWindow/menubar/menuFilters/Alphabetical" command="activate" arguments="ResampleToHyperTreeGrid" />
<pqevent object="pqClientMainWindow/propertiesDock/propertiesPanel/scrollArea/qt_scrollarea_viewport/scrollAreaWidgetContents/PropertiesFrame/ProxyPanel/MaxDepth/LineEdit0" command="set_string" arguments="5" />
<pqevent object="pqClientMainWindow/propertiesDock/propertiesPanel/scrollArea/qt_scrollarea_viewport/scrollAreaWidgetContents/PropertiesFrame/ProxyPanel/Dimensions/LineEdit0" command="set_string" arguments="1" />
<pqevent object="pqClientMainWindow/propertiesDock/propertiesPanel/scrollArea/qt_scrollarea_viewport/scrollAreaWidgetContents/PropertiesFrame/ProxyPanel/ExtrapolatePointData/CheckBox" command="set_boolean" arguments="true" />
<pqevent object="pqClientMainWindow/propertiesDock/propertiesPanel/Accept" command="activate" arguments="" />
<pqevent object="pqClientMainWindow/variableToolbar/displayColor/Variables" command="activated" arguments="ash3_measure" />
<pqevent object="pqClientMainWindow/variableToolbar/actionScalarBarVisibility" command="set_boolean" arguments="false" />
<pqevent object="pqClientMainWindow/cameraToolbar/actionNegativeX" command="activate" arguments="" />
<pqcompareview object="pqClientMainWindow/centralwidget/MultiViewWidget/CoreWidget/qt_tabwidget_stackedwidget/MultiViewWidget1/Container/Frame.0/CentralWidgetFrame/Viewport" baseline="$PARAVIEW_DATA_ROOT/Clients/ParaView/Testing/Data/Baseline/ResampleToHyperTreeGrid2DX.png" width="300" height="300" />
<pqevent object="pqClientMainWindow/pipelineBrowserDock/pipelineBrowser" command="mousePress" arguments="1,1,0,11,9,/0:0/0:0/1:0/0:1" />
<pqevent object="pqClientMainWindow/pipelineBrowserDock/pipelineBrowser" command="mouseRelease" arguments="1,0,0,11,9,/0:0/0:0/1:0/0:1" />
<pqevent object="pqClientMainWindow/pipelineBrowserDock/pipelineBrowser" command="mousePress" arguments="1,1,0,63,11,/0:0/0:0" />
<pqevent object="pqClientMainWindow/pipelineBrowserDock/pipelineBrowser" command="mouseRelease" arguments="1,0,0,63,11,/0:0/0:0" />
<pqevent object="pqClientMainWindow/menubar/menuFilters/pqProxyGroupMenuManager0/Cut" command="activate" arguments="" />
<pqevent object="pqClientMainWindow/propertiesDock/propertiesPanel/scrollArea/qt_scrollarea_viewport/scrollAreaWidgetContents/PropertiesFrame/ProxyPanel/CutFunction/ProxySelectionWidget/frame/ChosenProxyWidget/InteractivePlane/useYNormal" command="activate" arguments="" />
<pqevent object="pqClientMainWindow/propertiesDock/propertiesPanel/Accept" command="activate" arguments="" />
<pqevent object="pqClientMainWindow/menubar" command="activate" arguments="menuFilters" />
<pqevent object="pqClientMainWindow/menubar/menuFilters/Alphabetical" command="activate" arguments="ResampleToHyperTreeGrid" />
<pqevent object="pqClientMainWindow/propertiesDock/propertiesPanel/scrollArea/qt_scrollarea_viewport/scrollAreaWidgetContents/PropertiesFrame/ProxyPanel/MaxDepth/LineEdit0" command="set_string" arguments="5" />
<pqevent object="pqClientMainWindow/propertiesDock/propertiesPanel/scrollArea/qt_scrollarea_viewport/scrollAreaWidgetContents/PropertiesFrame/ProxyPanel/PointDataArrays/ArraySelectionWidget/1QHeaderView0/qt_scrollarea_viewport" command="mouseWheel" arguments="120,0,0,35,14" />
<pqevent object="pqClientMainWindow/propertiesDock/propertiesPanel/scrollArea/qt_scrollarea_viewport/scrollAreaWidgetContents/PropertiesFrame/ProxyPanel/Dimensions/LineEdit1" command="set_string" arguments="1" />
<pqevent object="pqClientMainWindow/propertiesDock/propertiesPanel/scrollArea/qt_scrollarea_viewport/scrollAreaWidgetContents/PropertiesFrame/ProxyPanel/ExtrapolatePointData/CheckBox" command="set_boolean" arguments="true" />
<pqevent object="pqClientMainWindow/propertiesDock/propertiesPanel/Accept" command="activate" arguments="" />
<pqevent object="pqClientMainWindow/variableToolbar/displayColor/Variables" command="activated" arguments="ash3_measure" />
<pqevent object="pqClientMainWindow/cameraToolbar/actionPositiveY" command="activate" arguments="" />
<pqevent object="pqClientMainWindow/variableToolbar/actionScalarBarVisibility" command="set_boolean" arguments="false" />
<pqcompareview object="pqClientMainWindow/centralwidget/MultiViewWidget/CoreWidget/qt_tabwidget_stackedwidget/MultiViewWidget1/Container/Frame.0/CentralWidgetFrame/Viewport" baseline="$PARAVIEW_DATA_ROOT/Clients/ParaView/Testing/Data/Baseline/ResampleToHyperTreeGrid2DY.png" width="300" height="300" />
<pqevent object="pqClientMainWindow/pipelineBrowserDock/pipelineBrowser" command="mousePress" arguments="1,1,0,14,8,/0:0/0:0/2:0/0:1" />
<pqevent object="pqClientMainWindow/pipelineBrowserDock/pipelineBrowser" command="mouseRelease" arguments="1,0,0,14,8,/0:0/0:0/2:0/0:1" />
<pqevent object="pqClientMainWindow/pipelineBrowserDock/pipelineBrowser" command="mousePress" arguments="1,1,0,27,13,/0:0/0:0" />
<pqevent object="pqClientMainWindow/pipelineBrowserDock/pipelineBrowser" command="mouseRelease" arguments="1,0,0,27,13,/0:0/0:0" />
<pqevent object="pqClientMainWindow/menubar/menuFilters/pqProxyGroupMenuManager0/Cut" command="activate" arguments="" />
<pqevent object="pqClientMainWindow/propertiesDock/propertiesPanel/scrollArea/qt_scrollarea_viewport/scrollAreaWidgetContents/PropertiesFrame/ProxyPanel/CutFunction/ProxySelectionWidget/frame/ChosenProxyWidget/InteractivePlane/useZNormal" command="activate" arguments="" />
<pqevent object="pqClientMainWindow/propertiesDock/propertiesPanel/Accept" command="activate" arguments="" />
<pqevent object="pqClientMainWindow/menubar" command="activate" arguments="menuFilters" />
<pqevent object="pqClientMainWindow/menubar/menuFilters/Alphabetical" command="activate" arguments="ResampleToHyperTreeGrid" />
<pqevent object="pqClientMainWindow/propertiesDock/propertiesPanel/scrollArea/qt_scrollarea_viewport/scrollAreaWidgetContents/PropertiesFrame/ProxyPanel/MaxDepth/LineEdit0" command="set_string" arguments="5" />
<pqevent object="pqClientMainWindow/propertiesDock/propertiesPanel/scrollArea/qt_scrollarea_viewport/scrollAreaWidgetContents/PropertiesFrame/ProxyPanel/Dimensions/LineEdit2" command="set_string" arguments="1" />
<pqevent object="pqClientMainWindow/propertiesDock/propertiesPanel/scrollArea/qt_scrollarea_viewport/scrollAreaWidgetContents/PropertiesFrame/ProxyPanel/ExtrapolatePointData/CheckBox" command="set_boolean" arguments="true" />
<pqevent object="pqClientMainWindow/propertiesDock/propertiesPanel/Accept" command="activate" arguments="" />
<pqevent object="pqClientMainWindow/cameraToolbar/qt_toolbar_ext_button" command="set_boolean" arguments="true" />
<pqevent object="pqClientMainWindow/cameraToolbar/actionNegativeZ" command="activate" arguments="" />
<pqevent object="pqClientMainWindow/variableToolbar/displayColor/Variables" command="activated" arguments="ash3_measure" />
<pqevent object="pqClientMainWindow/variableToolbar/actionScalarBarVisibility" command="set_boolean" arguments="false" />
<pqcompareview object="pqClientMainWindow/centralwidget/MultiViewWidget/CoreWidget/qt_tabwidget_stackedwidget/MultiViewWidget1/Container/Frame.0/CentralWidgetFrame/Viewport" baseline="$PARAVIEW_DATA_ROOT/Clients/ParaView/Testing/Data/Baseline/ResampleToHyperTreeGrid2DZ.png" width="300" height="300" />
</pqevents>
<?xml version="1.0" ?>
<pqevents>
<pqevent object="pqClientMainWindow/menubar/menuTools" command="activate" arguments="actionTesting_Window_Size" />
<pqevent object="pqClientMainWindow/menubar" command="activate" arguments="menuTools" />
<pqevent object="pqClientMainWindow/menubar/menuTools" command="activate" arguments="actionManage_Plugins" />
<pqevent object="pqClientMainWindow/PluginManagerDialog/splitter/localGroup/localPlugins" command="setCurrent" arguments="vtkPVInitializerPlugin" />
......@@ -9,6 +8,8 @@
<pqevent object="pqClientMainWindow/PluginManagerDialog/buttonBox/1QPushButton0" command="activate" arguments="" />
<pqevent object="pqClientMainWindow/MainControlsToolbar/actionOpenData" command="activate" arguments="" />
<pqevent object="pqClientMainWindow/FileOpenDialog" command="filesSelected" arguments="$PARAVIEW_DATA_ROOT/Testing/Data/disk_out_ref.ex2" />
<pqevent object="pqClientMainWindow/menubar/menuTools" command="activate" arguments="actionTesting_Window_Size" />
<pqevent object="pqClientMainWindow/menubar" command="activate" arguments="menuTools" />
<pqevent object="pqClientMainWindow/propertiesDock/propertiesPanel/scrollArea/qt_scrollarea_viewport/scrollAreaWidgetContents/PropertiesFrame/ProxyPanel/ArrayStatus/SelectionWidget" command="setCheckState" arguments="3.0,2" />
<pqevent object="pqClientMainWindow/propertiesDock/propertiesPanel/scrollArea/qt_scrollarea_viewport/scrollAreaWidgetContents/PropertiesFrame/ProxyPanel/ArrayStatus/SelectionWidget" command="setCurrent" arguments="4.0" />
<pqevent object="pqClientMainWindow/propertiesDock/propertiesPanel/scrollArea/qt_scrollarea_viewport/scrollAreaWidgetContents/PropertiesFrame/ProxyPanel/ArrayStatus/SelectionWidget" command="setCheckState" arguments="4.0,2" />
......@@ -24,8 +25,12 @@
<pqevent object="pqClientMainWindow/propertiesDock/propertiesPanel/scrollArea/qt_scrollarea_viewport/scrollAreaWidgetContents/PropertiesFrame/ProxyPanel/ArrayStatus/SelectionWidget" command="setCheckState" arguments="9.0,0" />
<pqevent object="pqClientMainWindow/propertiesDock/propertiesPanel/scrollArea/qt_scrollarea_viewport/scrollAreaWidgetContents/PropertiesFrame/ProxyPanel/ArrayStatus/SelectionWidget" command="setCheckState" arguments="9.0,2" />
<pqevent object="pqClientMainWindow/propertiesDock/propertiesPanel/Accept" command="activate" arguments="" />
<pqevent object="pqClientMainWindow/menubar/menuFilters/pqProxyGroupMenuManager0/Cut" command="activate" arguments="" />
<pqevent object="pqClientMainWindow/propertiesDock/propertiesPanel/scrollArea/qt_scrollarea_viewport/scrollAreaWidgetContents/PropertiesFrame/ProxyPanel/CutFunction/ProxySelectionWidget/frame/ChosenProxyWidget/InteractivePlane/useXNormal" command="activate" arguments="" />
<pqevent object="pqClientMainWindow/propertiesDock/propertiesPanel/Accept" command="activate" arguments="" />
<pqevent object="pqClientMainWindow/menubar" command="activate" arguments="menuFilters" />
<pqevent object="pqClientMainWindow/menubar/menuFilters/Alphabetical" command="activate" arguments="ResampleToHyperTreeGrid" />
<pqevent object="pqClientMainWindow/propertiesDock/propertiesPanel/scrollArea/qt_scrollarea_viewport/scrollAreaWidgetContents/PropertiesFrame/ProxyPanel/Dimensions/LineEdit0" command="set_string" arguments="1" />
<pqevent object="pqClientMainWindow/propertiesDock/propertiesPanel/scrollArea/qt_scrollarea_viewport/scrollAreaWidgetContents/PropertiesFrame/ProxyPanel/MaxDepth/LineEdit0" command="set_string" arguments="5" />
<pqevent object="pqClientMainWindow/propertiesDock/propertiesPanel/scrollArea/qt_scrollarea_viewport/scrollAreaWidgetContents/PropertiesFrame/ProxyPanel/UseMax/CheckBox" command="set_boolean" arguments="false" />
<pqevent object="pqClientMainWindow/propertiesDock/propertiesPanel/scrollArea/qt_scrollarea_viewport/scrollAreaWidgetContents/PropertiesFrame/ProxyPanel/UseMin/CheckBox" command="set_boolean" arguments="false" />
......
......@@ -213,14 +213,16 @@ int vtkResampleToHyperTreeGrid::RequestData(
output->Initialize();
output->SetBranchFactor(this->BranchFactor);
int dims[3] = { this->Dimensions[0] < 1 ? 1 : this->Dimensions[0],
this->Dimensions[1] < 1 ? 1 : this->Dimensions[1],
this->Dimensions[2] < 1 ? 1 : this->Dimensions[2] };
// Setting the point locations for the hyper tree grid
{
vtkNew<vtkDoubleArray> coords;
coords->SetNumberOfValues(this->Dimensions[0]);
double step = this->Dimensions[0] > 1
? (this->Bounds[1] - this->Bounds[0]) / (this->Dimensions[0] - 1)
: 0.0;
for (int i = 0; i < this->Dimensions[0]; ++i)
coords->SetNumberOfValues(dims[0]);
double step = dims[0] > 1 ? (this->Bounds[1] - this->Bounds[0]) / (dims[0] - 1) : 0.0;
for (int i = 0; i < dims[0]; ++i)
{
coords->SetValue(i, this->Bounds[0] + step * i);
}
......@@ -229,11 +231,9 @@ int vtkResampleToHyperTreeGrid::RequestData(
{
vtkNew<vtkDoubleArray> coords;
coords->SetNumberOfValues(this->Dimensions[1]);
double step = this->Dimensions[1] > 1
? (this->Bounds[3] - this->Bounds[2]) / (this->Dimensions[1] - 1)
: 0.0;
for (int i = 0; i < this->Dimensions[1]; ++i)
coords->SetNumberOfValues(dims[1]);
double step = dims[1] > 1 ? (this->Bounds[3] - this->Bounds[2]) / (dims[1] - 1) : 0.0;
for (int i = 0; i < dims[1]; ++i)
{
coords->SetValue(i, this->Bounds[2] + step * i);
}
......@@ -242,18 +242,16 @@ int vtkResampleToHyperTreeGrid::RequestData(
{
vtkNew<vtkDoubleArray> coords;
coords->SetNumberOfValues(this->Dimensions[2]);
double step = this->Dimensions[2] > 1
? (this->Bounds[5] - this->Bounds[4]) / (this->Dimensions[2] - 1)
: 0.0;
for (int i = 0; i < this->Dimensions[2]; ++i)
coords->SetNumberOfValues(dims[2]);
double step = dims[2] > 1 ? (this->Bounds[5] - this->Bounds[4]) / (dims[2] - 1) : 0.0;
for (int i = 0; i < dims[2]; ++i)
{
coords->SetValue(i, this->Bounds[4] + step * i);
}
output->SetZCoordinates(coords);
}
output->SetDimensions(this->Dimensions);
output->SetDimensions(dims);
output->GetCellDims(this->CellDims);
// Setting up a few useful values during the pipeline
......@@ -1042,18 +1040,24 @@ void vtkResampleToHyperTreeGrid::CreateGridOfMultiResolutionGrids(
}
}
vtkIdType i = std::floor<vtkIdType>(std::min<double>((point[0] - this->Bounds[0]) /
(this->Bounds[1] - this->Bounds[0]) * this->CellDims[0] *
this->MaxResolutionPerTree,
this->MaxResolutionPerTree * this->CellDims[0] - 1)),
j = std::floor<vtkIdType>(std::min<double>((point[1] - this->Bounds[2]) /
(this->Bounds[3] - this->Bounds[2]) * this->CellDims[1] *
this->MaxResolutionPerTree,
this->MaxResolutionPerTree * this->CellDims[1] - 1)),
k = std::floor<vtkIdType>(std::min<double>((point[2] - this->Bounds[4]) /
(this->Bounds[5] - this->Bounds[4]) * this->CellDims[2] *
this->MaxResolutionPerTree,
this->MaxResolutionPerTree * this->CellDims[2] - 1));
vtkIdType i = this->CellDims[0] == 1
? 0
: std::floor<vtkIdType>(
std::min<double>((point[0] - this->Bounds[0]) / (this->Bounds[1] - this->Bounds[0]) *
this->CellDims[0] * this->MaxResolutionPerTree,
this->MaxResolutionPerTree * this->CellDims[0] - 1)),
j = this->CellDims[1] == 1
? 0
: std::floor<vtkIdType>(std::min<double>((point[1] - this->Bounds[2]) /
(this->Bounds[3] - this->Bounds[2]) * this->CellDims[1] *
this->MaxResolutionPerTree,
this->MaxResolutionPerTree * this->CellDims[1] - 1)),
k = this->CellDims[2] == 1
? 0
: std::floor<vtkIdType>(std::min<double>((point[2] - this->Bounds[4]) /
(this->Bounds[5] - this->Bounds[4]) * this->CellDims[2] *
this->MaxResolutionPerTree,
this->MaxResolutionPerTree * this->CellDims[2] - 1));
// We bijectively convert the local coordinates within a hyper tree grid to an integer to
// pass
......@@ -1417,24 +1421,33 @@ void vtkResampleToHyperTreeGrid::CreateGridOfMultiResolutionGrids(
// If it it, we forbid subdivision with GridElement::CanSubdivide
vtkCell* cell = dataSet->GetCell(cellId);
double* cellBounds = cell->GetBounds();
vtkIdType imin = static_cast<vtkIdType>((cellBounds[0] - this->Bounds[0]) *
this->CellDims[0] / (this->Bounds[1] - this->Bounds[0])),
imax =
static_cast<vtkIdType>(((cellBounds[1] - this->Bounds[0]) * this->CellDims[0] /
(this->Bounds[1] - this->Bounds[0])) *
(1.0 - VTK_DBL_EPSILON)),
jmin = static_cast<vtkIdType>((cellBounds[2] - this->Bounds[2]) *
this->CellDims[1] / (this->Bounds[3] - this->Bounds[2])),
jmax =
static_cast<vtkIdType>(((cellBounds[3] - this->Bounds[2]) * this->CellDims[1] /
(this->Bounds[3] - this->Bounds[2])) *
(1.0 - VTK_DBL_EPSILON)),
kmin = static_cast<vtkIdType>((cellBounds[4] - this->Bounds[4]) *
this->CellDims[2] / (this->Bounds[5] - this->Bounds[4])),
kmax =
static_cast<vtkIdType>(((cellBounds[5] - this->Bounds[4]) * this->CellDims[2] /
(this->Bounds[5] - this->Bounds[4])) *
(1.0 - VTK_DBL_EPSILON));
vtkIdType imin = this->CellDims[0] == 1
? 0
: static_cast<vtkIdType>((cellBounds[0] - this->Bounds[0]) * this->CellDims[0] /
(this->Bounds[1] - this->Bounds[0])),
imax = this->CellDims[0] == 1
? 0
: static_cast<vtkIdType>(((cellBounds[1] - this->Bounds[0]) * this->CellDims[0] /
(this->Bounds[1] - this->Bounds[0])) *
(1.0 - VTK_DBL_EPSILON)),
jmin = this->CellDims[1] == 1
? 0
: static_cast<vtkIdType>((cellBounds[2] - this->Bounds[2]) * this->CellDims[1] /
(this->Bounds[3] - this->Bounds[2])),
jmax = this->CellDims[1] == 1
? 0
: static_cast<vtkIdType>(((cellBounds[3] - this->Bounds[2]) * this->CellDims[1] /
(this->Bounds[3] - this->Bounds[2])) *
(1.0 - VTK_DBL_EPSILON)),
kmin = this->CellDims[2] == 1
? 0
: static_cast<vtkIdType>((cellBounds[4] - this->Bounds[4]) * this->CellDims[2] /
(this->Bounds[5] - this->Bounds[4])),
kmax = this->CellDims[2] == 1
? 0
: static_cast<vtkIdType>(((cellBounds[5] - this->Bounds[4]) * this->CellDims[2] /
(this->Bounds[5] - this->Bounds[4])) *
(1.0 - VTK_DBL_EPSILON));
double hyperTreeBounds[6];
// For each hyper tree intersecting the bounding box
......@@ -1827,11 +1840,22 @@ void vtkResampleToHyperTreeGrid::SubdivideLeaves(vtkHyperTreeGridNonOrientedCurs
j * tree->GetBranchFactor() + jj, k * tree->GetBranchFactor() + kk, multiResolutionGrid);
cursor->ToParent();
if (++ii == tree->GetBranchFactor())
if (this->CellDims[0] != 1)
{
++ii;
}
if (ii == tree->GetBranchFactor() || this->CellDims[0] == 1)
{
if (++jj == tree->GetBranchFactor())
if (this->CellDims[1] != 1)
{
++kk;
++jj;
}
if (jj == tree->GetBranchFactor() || this->CellDims[1] == 1)
{
if (this->CellDims[2] != 1)
{
++kk;
}
jj = 0;
}
ii = 0;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment