Commit 881d763f authored by Utkarsh Ayachit's avatar Utkarsh Ayachit

Adding support for point interpolation filters.

Adds support for point interpolation filters: vtkPointInterpolator and
vtkSPHInterpolator.

Currently, users can pick plane to interpolate on. The plane is provided
by vtkBoundedPlaneSource (a new plane source) that generate a polydata
for a plane bounded by a bounding box.
parent 0f808b50
Pipeline #10582 passed with stage
......@@ -118,6 +118,11 @@
<Proxy group="filters" name="EnvironmentAnnotation" />
</Category>
<Category name="Point Interpolation" menu_label="Point Interpolation">
<Proxy group="filters" name="PointInterpolator" />
<Proxy group="filters" name="SPHInterpolator" />
</Category>
<Proxy group="filters" name="AddFieldArrays" />
<Proxy group="filters" name="ImageDataToAMR" />
<Proxy group="filters" name="UniformGridPartitioner" />
......
......@@ -262,6 +262,7 @@ list(APPEND TESTS_WITH_BASELINES
${CMAKE_CURRENT_SOURCE_DIR}/PlotOverTimeAutoApply.xml
${CMAKE_CURRENT_SOURCE_DIR}/PolygonCellSelection.xml
${CMAKE_CURRENT_SOURCE_DIR}/PolygonPointSelection.xml
${CMAKE_CURRENT_SOURCE_DIR}/PointInterpolator.xml
${CMAKE_CURRENT_SOURCE_DIR}/ProbePicking.xml
${CMAKE_CURRENT_SOURCE_DIR}/PropertyConversion.xml
${CMAKE_CURRENT_SOURCE_DIR}/PropertyConversion1.xml
......@@ -388,6 +389,10 @@ if (PARAVIEW_USE_MPI)
)
set(CGNSReader-5blocks_cgns_DISABLE_CRS TRUE)
endif()
# PointInterpolator only works in non-distributed modes.
set(PointInterpolator_DISABLE_CRS TRUE)
set(PointInterpolator_DISABLE_CS TRUE)
endif()
if(PARAVIEW_ENABLE_PYTHON)
list(APPEND TESTS_WITH_BASELINES
......
<?xml version="1.0" ?>
<pqevents>
<pqevent object="pqClientMainWindow/MainControlsToolbar/1QToolButton0" command="activate" arguments="" />
<pqevent object="pqClientMainWindow/FileOpenDialog" command="filesSelected" arguments="$PARAVIEW_DATA_ROOT/disk_out_ref.ex2" />
<pqevent object="pqClientMainWindow/propertiesDock/propertiesPanel/scrollArea/qt_scrollarea_viewport/scrollAreaWidgetContents/PropertiesFrame/ProxyPanel/ArrayStatus/SelectionWidget/1QHeaderView0" command="mousePress" arguments="1,1,0,0,0,0" />
<pqevent object="pqClientMainWindow/propertiesDock/propertiesPanel/scrollArea/qt_scrollarea_viewport/scrollAreaWidgetContents/PropertiesFrame/ProxyPanel/ArrayStatus/SelectionWidget/1QHeaderView0" command="mouseRelease" arguments="1,0,0,0,0,0" />
<pqevent object="pqClientMainWindow/propertiesDock/propertiesPanel/Accept" command="activate" arguments="" />
<pqevent object="pqClientMainWindow/cameraToolbar/1QToolButton4" command="activate" arguments="" />
<pqevent object="pqClientMainWindow/menubar" command="activate" arguments="menuFilters" />
<pqevent object="pqClientMainWindow/menubar/menuFilters/Point Interpolation" command="activate" arguments="PointInterpolator" />
<pqevent object="pqClientMainWindow/propertiesDock/propertiesPanel/scrollArea/qt_scrollarea_vcontainer/1QScrollBar0" command="mousePress" arguments="1,1,0,9,66" />
<pqevent object="pqClientMainWindow/propertiesDock/propertiesPanel/scrollArea/qt_scrollarea_vcontainer/1QScrollBar0" command="mouseMove" arguments="1,0,0,17,133" />
<pqevent object="pqClientMainWindow/propertiesDock/propertiesPanel/scrollArea/qt_scrollarea_vcontainer/1QScrollBar0" command="mouseRelease" arguments="1,0,0,17,133" />
<pqevent object="pqClientMainWindow/propertiesDock/propertiesPanel/scrollArea/qt_scrollarea_viewport/scrollAreaWidgetContents/PropertiesFrame/ProxyPanel/Source/ProxySelectionWidget/frame/ChosenProxyWidget/InteractivePlane/useYNormal" command="activate" arguments="" />
<pqevent object="pqClientMainWindow/propertiesDock/propertiesPanel/scrollArea/qt_scrollarea_viewport/scrollAreaWidgetContents/PropertiesFrame/ProxyPanel/Source/ProxySelectionWidget/frame/ChosenProxyWidget/InteractivePlane/useZNormal" command="activate" arguments="" />
<pqevent object="pqClientMainWindow/propertiesDock/propertiesPanel/scrollArea/qt_scrollarea_viewport/scrollAreaWidgetContents/PropertiesFrame/ProxyPanel/Source/ProxySelectionWidget/frame/ChosenProxyWidget/InteractivePlane/useYNormal" command="activate" arguments="" />
<pqevent object="pqClientMainWindow/cameraToolbar/1QToolButton5" command="activate" arguments="" />
<pqevent object="pqClientMainWindow/propertiesDock/propertiesPanel/Accept" command="activate" arguments="" />
<pqevent object="pqClientMainWindow/variableToolbar/actionScalarBarVisibility" command="set_boolean" arguments="false" />
<pqevent object="pqClientMainWindow/variableToolbar/displayColor/Variables" command="set_string" arguments="Temp" />
<pqevent object="pqClientMainWindow/variableToolbar/displayColor/Variables" command="set_string" arguments="Pres" />
<pqevent object="pqClientMainWindow/propertiesDock/propertiesPanel/scrollArea/qt_scrollarea_viewport/scrollAreaWidgetContents/PropertiesFrame/ProxyPanel/Source/ProxySelectionWidget/frame/ChosenProxyWidget/InteractivePlane/show3DWidget" command="set_boolean" arguments="false" />
<pqevent object="pqClientMainWindow/cameraToolbar/1QToolButton0" command="activate" arguments="" />
<pqevent object="pqClientMainWindow/menubar" command="activate" arguments="menuTools" />
<pqevent object="pqClientMainWindow/menubar/menuTools" command="activate" arguments="actionTesting_Window_Size" />
<pqevent object="pqClientMainWindow/cameraToolbar/1QToolButton0" command="activate" arguments="" />
</pqevents>
......@@ -349,6 +349,9 @@ set(_vtk_modules
vtkPVAnimation
# Needed for animation support.
vtkPVVTKExtensionsPoints
# Needed for SPH filters.
)
if("${VTK_RENDERING_BACKEND}" STREQUAL "OpenGL")
......
set(Module_SRCS
vtkBoundedPlaneSource.cxx
)
vtk_module_library(${vtk-module} ${Module_SRCS})
vtk_module(vtkPVVTKExtensionsPoints
DEPENDS
vtkFiltersPoints
PRIVATE_DEPENDS
vtkFiltersCore
KIT
vtkPVExtensions
)
set_property(GLOBAL PROPERTY
vtkPVVTKExtensionsPoints_SERVERMANAGER_XMLS
${CMAKE_CURRENT_LIST_DIR}/points.xml
)
This diff is collapsed.
/*=========================================================================
Program: ParaView
Module: vtkBoundedPlaneSource.cxx
Copyright (c) Kitware, Inc.
All rights reserved.
See Copyright.txt or http://www.paraview.org/HTML/Copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notice for more information.
=========================================================================*/
#include "vtkBoundedPlaneSource.h"
#include "vtkBoundingBox.h"
#include "vtkFlyingEdgesPlaneCutter.h"
#include "vtkImageData.h"
#include "vtkNew.h"
#include "vtkObjectFactory.h"
#include "vtkPlane.h"
#include "vtkPolyData.h"
vtkStandardNewMacro(vtkBoundedPlaneSource);
//----------------------------------------------------------------------------
vtkBoundedPlaneSource::vtkBoundedPlaneSource()
{
this->SetNumberOfInputPorts(0);
this->SetNumberOfOutputPorts(1);
this->Center[0] = this->Center[1] = this->Center[2] = 0.0;
this->Normal[0] = this->Normal[1] = 0.0;
this->Normal[1] = 1.0;
this->Resolution = 100;
}
//----------------------------------------------------------------------------
vtkBoundedPlaneSource::~vtkBoundedPlaneSource()
{
}
//----------------------------------------------------------------------------
int vtkBoundedPlaneSource::RequestData(
vtkInformation *, vtkInformationVector **, vtkInformationVector *outputVector)
{
vtkPolyData* output = vtkPolyData::GetData(outputVector, 0);
vtkBoundingBox bbox (this->BoundingBox);
if (!bbox.IsValid())
{
vtkErrorMacro("Invalid bounding box specified. Please choose a valid BoundingBox.");
return 0;
}
vtkNew<vtkImageData> image;
image->SetExtent(0, this->Resolution-1,
0, this->Resolution-1,
0, this->Resolution-1);
double lengths[3];
bbox.GetLengths(lengths);
double origin[3];
bbox.GetMinPoint(origin[0], origin[1], origin[2]);
image->SetOrigin(origin);
image->SetSpacing(lengths[0] / this->Resolution,
lengths[1] / this->Resolution,
lengths[2] / this->Resolution);
image->AllocateScalars(VTK_CHAR, 1);
// this, alas, is needed since vtkFlyingEdgesPlaneCutter cannot work without
// scalars.
vtkNew<vtkPlane> plane;
plane->SetOrigin(this->Center);
plane->SetNormal(this->Normal);
vtkNew<vtkFlyingEdgesPlaneCutter> cutter;
cutter->SetPlane(plane.Get());
cutter->SetInputDataObject(image.Get());
cutter->ComputeNormalsOff();
cutter->InterpolateAttributesOff();
cutter->Update();
output->CopyStructure(cutter->GetOutput(0));
return 1;
}
//----------------------------------------------------------------------------
void vtkBoundedPlaneSource::PrintSelf(ostream& os, vtkIndent indent)
{
this->Superclass::PrintSelf(os, indent);
os << indent << "Center: "
<< this->Center[0] << ", " << this->Center[1] << ", " << this->Center[2] << endl;
os << indent << "Normal: "
<< this->Normal[0] << ", " << this->Normal[1] << ", " << this->Normal[2] << endl;
os << indent << "BoundingBox: "
<< this->BoundingBox[0] << ", " << this->BoundingBox[1] << ", " << this->BoundingBox[2] << ", "
<< this->BoundingBox[3] << ", " << this->BoundingBox[4] << ", " << this->BoundingBox[5] << endl;
os << indent << "Resolution: " << this->Resolution << endl;
}
/*=========================================================================
Program: ParaView
Module: vtkBoundedPlaneSource.h
Copyright (c) Kitware, Inc.
All rights reserved.
See Copyright.txt or http://www.paraview.org/HTML/Copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notice for more information.
=========================================================================*/
// .NAME vtkBoundedPlaneSource - a plane source bounded by a bounding box.
// .SECTION Description
// vtkBoundedPlaneSource is a simple planar polydata generator that produces a
// plane by intersecting a bounding box by a plane (specified by center and
// normal).
#ifndef vtkBoundedPlaneSource_h
#define vtkBoundedPlaneSource_h
#include "vtkPolyDataAlgorithm.h"
#include "vtkPVVTKExtensionsPointsModule.h" // for export macro
class VTKPVVTKEXTENSIONSPOINTS_EXPORT vtkBoundedPlaneSource : public vtkPolyDataAlgorithm
{
public:
static vtkBoundedPlaneSource* New();
vtkTypeMacro(vtkBoundedPlaneSource, vtkPolyDataAlgorithm);
void PrintSelf(ostream& os, vtkIndent indent);
// Description:
// Get/Set the center for the plane. Note that if the center is outside the
// specified bounds, this source will produce empty poly data.
vtkSetVector3Macro(Center, double);
vtkGetVector3Macro(Center, double);
// Description:
// Get/Set the normal for the plane.
vtkSetVector3Macro(Normal, double);
vtkGetVector3Macro(Normal, double);
// Description:
// Get/Set the bounding box for the plane.
vtkSetVector6Macro(BoundingBox, double);
vtkGetVector6Macro(BoundingBox, double);
// Description:
// Specify the resolution of the plane.
vtkSetClampMacro(Resolution, int, 1, VTK_INT_MAX);
vtkGetMacro(Resolution, int);
//BTX
protected:
vtkBoundedPlaneSource();
~vtkBoundedPlaneSource();
virtual int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *);
double Center[3];
double Normal[3];
double BoundingBox[6];
int Resolution;
private:
vtkBoundedPlaneSource(const vtkBoundedPlaneSource&); // Not implemented
void operator=(const vtkBoundedPlaneSource&); // Not implemented
//ETX
};
#endif
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