Commit 1e26d400 authored by Timothee Chabat's avatar Timothee Chabat
Browse files

Simplify Plot Over Line ParaView users API

parent 51595d56
Pipeline #250936 waiting for manual action with stages
......@@ -123,62 +123,6 @@
</DoubleVectorProperty>
<!-- End ProbeLineLegacy -->
</SourceProxy>
<SourceProxy class="vtkLineSource"
label="Line"
name="SimpleLineSource">
<Documentation>Proxy to have an interactive widget controlling a line source
with a resolution of 1. Used for the PlotLine proxy.</Documentation>
<DoubleVectorProperty animateable="1"
command="SetPoint1"
default_values="0.0 0.0 0.0"
name="Point1"
number_of_elements="3"
panel_visibility="default">
<BoundsDomain default_mode="min"
mode="normal"
name="range">
<RequiredProperties>
<Property function="Input"
name="DummyInput" />
</RequiredProperties>
</BoundsDomain>
</DoubleVectorProperty>
<DoubleVectorProperty animateable="1"
command="SetPoint2"
default_values="0.0 0.0 0.0"
name="Point2"
number_of_elements="3"
panel_visibility="default">
<BoundsDomain default_mode="max"
mode="normal"
name="range">
<RequiredProperties>
<Property function="Input"
name="DummyInput" />
</RequiredProperties>
</BoundsDomain>
</DoubleVectorProperty>
<IntVectorProperty command="SetResolution"
default_values="1"
name="Resolution"
number_of_elements="1"
panel_visibility="never">
<IntRangeDomain min="1"
name="range" />
</IntVectorProperty>
<InputProperty is_internal="1" name="DummyInput" />
<PropertyGroup label="Line Parameters" panel_widget="InteractiveLine">
<!-- Necessary to have the interactive widget rendered -->
<Property function="Point1WorldPosition" name="Point1" />
<Property function="Point2WorldPosition" name="Point2" />
<Property function="Input" name="DummyInput" />
</PropertyGroup>
<Hints>
<ProxyList>
<Link name="DummyInput" with_property="Input" />
</ProxyList>
</Hints>
</SourceProxy>
<Proxy name="ProbeLineGenericProxy">
<InputProperty command="SetInputConnection"
name="Input">
......@@ -206,6 +150,11 @@
<Entry text="Sample Uniformly"
value="2" />
</EnumerationDomain>
<Documentation>
"Sample At Cell Boundaries" gives the most accurate plots by creating probing points at the cell borders.
"Sample At Segment Centers" provides one sample per probed cell located at the middle of the line intersecting the cell.
"Sample Uniformally" samples uniformally along the input line.
</Documentation>
</IntVectorProperty>
<IntVectorProperty command="SetLineResolution"
name="Resolution"
......@@ -229,13 +178,13 @@
<Documentation>When dealing with composite datasets, partial arrays are
common i.e. data-arrays that are not available in all of the blocks. By
default, this filter only passes those point and cell data-arrays that
are available in all the blocks i.e. partial array are removed. When
are available in all the blocks i.e. partial arrays are removed. When
PassPartialArrays is turned on, this behavior is changed to take a
union of all arrays present thus partial arrays are passed as well.
However, for composite dataset input, this filter still produces a
non-composite output. For all those locations in a block of where a
particular data array is missing, this filter uses vtkMath::Nan() for
double and float arrays, while 0 for all other types of arrays i.e int,
double and float arrays, and 0 for all other types of arrays i.e int,
char etc.</Documentation>
<BooleanDomain name="bool" />
</IntVectorProperty>
......@@ -245,7 +194,7 @@
number_of_elements="1"
panel_visibility="advanced">
<Documentation>
When set the input's cell data arrays are shallow copied to the output.
When set the input cell data arrays are shallow copied to the output.
</Documentation>
<BooleanDomain name="bool" />
</IntVectorProperty>
......@@ -255,7 +204,7 @@
number_of_elements="1"
panel_visibility="advanced">
<Documentation>
When set the input's point data arrays are shallow copied to the output.
When set the input point data arrays are shallow copied to the output.
</Documentation>
<BooleanDomain name="bool" />
</IntVectorProperty>
......@@ -266,7 +215,7 @@
panel_visibility="advanced">
<Documentation>
Set whether to pass the field-data arrays from the Input i.e. the input
providing the geometry to the output. On by default.
providing the geometry to the output.
</Documentation>
<BooleanDomain name="bool" />
</IntVectorProperty>
......@@ -277,7 +226,7 @@
panel_visibility="advanced">
<Documentation>
Set whether to compute the tolerance or to use a user provided
value. On by default.
value.
</Documentation>
<BooleanDomain name="bool" />
</IntVectorProperty>
......@@ -296,8 +245,14 @@
<Documentation>Set the tolerance to use for
vtkDataSet::FindCell</Documentation>
</DoubleVectorProperty>
<Hints>
<Visibility replace_input="0" />
<View type="XYChartView" also_show_in_current_view="1" />
<Plotable />
</Hints>
</Proxy>
</ProxyGroup>
<ProxyGroup name="filters">
<!-- ==================================================================== -->
<SourceProxy class="vtkPartitionBalancer"
......@@ -410,8 +365,6 @@
name="Tolerance"
number_of_elements="1"
panel_visibility="advanced">
<DoubleRangeDomain min="2.2204460492503131e-16"
name="range" />
<Hints>
<PropertyWidgetDecorator type="ShowWidgetDecorator">
<Property name="ComputeTolerance" function="boolean_invert" />
......@@ -427,6 +380,7 @@
</Hints>
<!-- End ProbePoint -->
</SourceProxy>
<!-- ==================================================================== -->
<CompoundSourceProxy label="Plot Over Line Legacy"
name="ProbeLineLegacy">
......@@ -483,14 +437,15 @@
proxy="AppendArcLength1" />
<!-- End ProbeLineLegacy -->
</CompoundSourceProxy>
<!-- ==================================================================== -->
<SourceProxy class="vtkProbeLineFilter"
base_proxygroup="internal_filters"
base_proxyname="ProbeLineGenericProxy"
label="Plot Over Custom Lines"
label="Plot Over Lines From Custom Source"
name="ProbeCustomLines">
<Documentation>The Plot Over Custom Lines filter samples the data set attributes
of the input data set at the points along multiple lines given by the source
<Documentation>The Plot Over Lines From Custom Source filter samples the dataset
attributes of the input data set at the points along multiple lines given by the source
dataset. The values of the point-centered variables along these lines will be
displayed in an XY Plot. This filter uses interpolation to determine the values
at the selected point, whether or not it lies at an input point. This filter
......@@ -500,7 +455,7 @@
per probed cells, and "Sample Uniformally" samples uniformally along the input
line.</Documentation>
<InputProperty command="SetSourceConnection"
name="ProbedLines">
name="Source">
<ProxyGroupDomain name="groups">
<Group name="sources" />
<Group name="filters" />
......@@ -513,62 +468,19 @@
the probing lines locations.</Documentation>
</InputProperty>
<IntVectorProperty command="SetAggregateAsPolyData"
default_values="1"
name="AggregateAsPolyData"
number_of_elements="1"
panel_visibility="never">
<Documentation>
Force ouput to be a multiblock when plotting over custom line(s).
</Documentation>
</IntVectorProperty>
<Hints>
<Visibility replace_input="0" />
<View type="XYChartView" also_show_in_current_view="1" />
<Plotable />
</Hints>
</SourceProxy>
<!-- ==================================================================== -->
<SourceProxy class="vtkProbeLineFilter"
base_proxygroup="internal_filters"
base_proxyname="ProbeLineGenericProxy"
label="Plot Over Line"
name="ProbeLine">
<Documentation>The Plot Over Custom Lines filter samples the data set attributes
of the input data set at the points a given line. The values of the point-centered
variables along that line will be displayed in an XY Plot. This filter uses
interpolation to determine the values at the selected point, whether or not it
lies at an input point. This filter operates on any type of data and produces a
polygonal output (a polyline). One can use different sampling patterns with this
filter. "Sample At Cell Boundaries" gives the most accurate plots, "Sample At
Segment Centers" provides one sample per probed cells, and "Sample Uniformally"
samples uniformally along the input line.</Documentation>
<InputProperty command="SetSourceConnection"
label="Probe Type"
name="Source"
panel_visibility="default">
<ProxyGroupDomain name="groups">
<Group name="sources" />
</ProxyGroupDomain>
<ProxyListDomain name="proxy_list">
<Proxy group="internal_filters"
name="SimpleLineSource" />
</ProxyListDomain>
</InputProperty>
<IntVectorProperty command="SetAggregateAsPolyData"
default_values="1"
default_values="0"
name="AggregateAsPolyData"
number_of_elements="1"
panel_visibility="never">
<Documentation>
Force ouput to be a polydata when plotting over a single line.
If false then each result from an input line to probe results in a block in a
vtkMultiBlockDataSet. If true then each block is aggregated as a cell in a
single dataset and the output type of the filter becomes a vtkPolyData. Should
always be false for this filter.
</Documentation>
</IntVectorProperty>
<Hints>
<Visibility replace_input="0" />
<View type="XYChartView" also_show_in_current_view="1" />
<Plotable />
</Hints>
</SourceProxy>
<!-- ==================================================================== -->
<SourceProxy class="vtkPProbeFilter"
label="Legacy Resample With Dataset"
......
#==========================================================================
#
# Program: ParaView
#
# Copyright (c) 2005-2008 Sandia Corporation, Kitware Inc.
# All rights reserved.
#
# ParaView is a free software; you can redistribute it and/or modify it
# under the terms of the ParaView license version 1.2.
#
# See License_v1.2.txt for the full ParaView license.
# A copy of this license can be obtained by contacting
# Kitware Inc.
# 28 Corporate Drive
# Clifton Park, NY 12065
# USA
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
#==========================================================================
set(classes
vtkPVProbeLineFilter)
vtk_module_add_module(ParaView::VTKExtensionsFiltersParallelDIY2
CLASSES ${classes})
paraview_add_server_manager_xmls(
XMLS Resources/parallel_diy_filters.xml)
<ServerManagerConfiguration>
<ProxyGroup name="filters">
<SourceProxy class="vtkPVProbeLineFilter"
base_proxygroup="internal_filters"
base_proxyname="ProbeLineGenericProxy"
label="Plot Over Line"
name="ProbeLine">
<Documentation>The Plot Over Line filter samples the dataset attributes of the
input dataset at the points of a given line. The values of the point-centered
variables along that line will be displayed in an XY Plot. This filter uses
interpolation to determine the values at the selected point, whether or not it
lies at an input point. This filter operates on any type of data and produces a
polygonal output (a polyline). One can use different sampling patterns with this
filter. "Sample At Cell Boundaries" gives the most accurate plots, "Sample At
Segment Centers" provides one sample per probed cell, and "Sample Uniformally"
samples uniformally along the input line.</Documentation>
<DoubleVectorProperty animateable="1"
command="SetPoint1"
default_values="0.0 0.0 0.0"
name="Point1"
number_of_elements="3">
<BoundsDomain default_mode="min"
mode="normal"
name="range">
<RequiredProperties>
<Property function="Input"
name="Input" />
</RequiredProperties>
</BoundsDomain>
<Documentation>This property controls the coordinates of the first
endpoint of the line.</Documentation>
</DoubleVectorProperty>
<DoubleVectorProperty animateable="1"
command="SetPoint2"
default_values="0.0 0.0 0.0"
name="Point2"
number_of_elements="3">
<BoundsDomain default_mode="max"
mode="normal"
name="range">
<RequiredProperties>
<Property function="Input"
name="Input" />
</RequiredProperties>
</BoundsDomain>
<Documentation>This property controls the coordinates of the second
endpoint of the line.</Documentation>
</DoubleVectorProperty>
<PropertyGroup label="Line Parameters" panel_widget="InteractiveLine">
<Property function="Point1WorldPosition" name="Point1" />
<Property function="Point2WorldPosition" name="Point2" />
</PropertyGroup>
</SourceProxy>
</ProxyGroup>
</ServerManagerConfiguration>
NAME
ParaView::VTKExtensionsFiltersParallelDIY2
LIBRARY_NAME
vtkPVVTKExtensionsFiltersParallelDIY2
GROUPS
PARAVIEW_CANONICAL
KIT
ParaView::CoreKit
DEPENDS
VTK::CommonCore
VTK::CommonDataModel
VTK::CommonExecutionModel
VTK::FiltersGeneral
VTK::FiltersParallelDIY2
PRIVATE_DEPENDS
VTK::ParallelCore
TEST_LABELS
ParaView
/*=========================================================================
Program: ParaView
Module: vtkPVProbeLineFilter.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 "vtkPVProbeLineFilter.h"
#include "vtkDemandDrivenPipeline.h"
#include "vtkInformation.h"
#include "vtkInformationVector.h"
#include "vtkLineSource.h"
#include "vtkObjectFactory.h"
#include "vtkProbeLineFilter.h"
vtkStandardNewMacro(vtkPVProbeLineFilter);
//----------------------------------------------------------------------------
vtkPVProbeLineFilter::vtkPVProbeLineFilter()
{
this->LineSource->SetResolution(1);
this->Prober->SetAggregateAsPolyData(true);
this->Prober->SetSourceConnection(this->LineSource->GetOutputPort());
}
//----------------------------------------------------------------------------
int vtkPVProbeLineFilter::RequestData(
vtkInformation*, vtkInformationVector** inputVector, vtkInformationVector* outputVector)
{
// Check inputs / ouputs
vtkInformation* inputInfo = inputVector[0]->GetInformationObject(0);
vtkInformation* outInfo = outputVector->GetInformationObject(0);
if (!outInfo || !inputInfo)
{
vtkErrorMacro("Missing input or output information");
return 0;
}
vtkDataObject* input = inputInfo->Get(vtkDataObject::DATA_OBJECT());
vtkPolyData* output = vtkPolyData::SafeDownCast(outInfo->Get(vtkDataObject::DATA_OBJECT()));
if (!output || !input)
{
vtkErrorMacro("Missing input or output object");
return 0;
}
this->LineSource->SetPoint1(this->Point1);
this->LineSource->SetPoint2(this->Point2);
this->Prober->SetLineResolution(this->LineResolution);
this->Prober->SetPassCellArrays(this->PassCellArrays);
this->Prober->SetPassPointArrays(this->PassPointArrays);
this->Prober->SetPassFieldArrays(this->PassFieldArrays);
this->Prober->SetPassPartialArrays(this->PassPartialArrays);
this->Prober->SetTolerance(this->Tolerance);
this->Prober->SetComputeTolerance(this->ComputeTolerance);
this->Prober->SetSamplingPattern(this->SamplingPattern);
this->Prober->SetInputData(input);
this->Prober->Update();
output->ShallowCopy(this->Prober->GetOutputDataObject(0));
return 1;
}
//----------------------------------------------------------------------------
int vtkPVProbeLineFilter::FillInputPortInformation(int port, vtkInformation* info)
{
switch (port)
{
case 0:
info->Set(vtkAlgorithm::INPUT_REQUIRED_DATA_TYPE(), "vtkDataSet");
info->Append(vtkAlgorithm::INPUT_REQUIRED_DATA_TYPE(), "vtkCompositeDataSet");
return 1;
default:
return 0;
}
}
//----------------------------------------------------------------------------
void vtkPVProbeLineFilter::PrintSelf(ostream& os, vtkIndent indent)
{
switch (this->SamplingPattern)
{
case vtkProbeLineFilter::SAMPLE_LINE_AT_CELL_BOUNDARIES:
os << indent << "SamplingPattern: SAMPLE_LINE_AT_CELL_BOUNDARIES" << endl;
break;
case vtkProbeLineFilter::SAMPLE_LINE_AT_SEGMENT_CENTERS:
os << indent << "SamplingPattern: SAMPLE_LINE_AT_SEGMENT_CENTERS" << endl;
break;
case vtkProbeLineFilter::SAMPLE_LINE_UNIFORMLY:
os << indent << "SamplingPattern: SAMPLE_LINE_UNIFORMLY" << endl;
break;
default:
os << indent << "SamplingPattern: UNDEFINED" << endl;
break;
}
os << indent << "LineResolution: " << this->LineResolution << endl;
os << indent << "PassPartialArrays: " << this->PassPartialArrays << endl;
os << indent << "PassCellArrays: " << this->PassCellArrays << endl;
os << indent << "PassPointArrays: " << this->PassPointArrays << endl;
os << indent << "PassFieldArrays: " << this->PassFieldArrays << endl;
os << indent << "ComputeTolerance: " << this->ComputeTolerance << endl;
os << indent << "Tolerance: " << this->Tolerance << endl;
}
/*=========================================================================
Program: ParaView
Module: vtkPVProbeLineFilter.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.
=========================================================================*/
/**
* @class vtkPVProbeLineFilter
* @brief Filter to simplify probe line usage when probing over a simple line.
*
* Internal Paraview filters for API backward compatibilty and ease of use.
* Internally build a line source as well as a vtkProbeLineFilter and exposes
* their properties.
*/
#ifndef vtkPVProbeLineFilter_h
#define vtkPVProbeLineFilter_h
#include "vtkNew.h" // needed for internal filters
#include "vtkPVVTKExtensionsFiltersParallelDIY2Module.h" //needed for exports
#include "vtkPolyDataAlgorithm.h"
class vtkLineSource;
class vtkProbeLineFilter;
class VTKPVVTKEXTENSIONSFILTERSPARALLELDIY2_EXPORT vtkPVProbeLineFilter
: public vtkPolyDataAlgorithm
{
public:
static vtkPVProbeLineFilter* New();
vtkTypeMacro(vtkPVProbeLineFilter, vtkPolyDataAlgorithm);
void PrintSelf(ostream& os, vtkIndent indent) override;
///@{
/**
* Shallow copy the input cell data arrays to the output.
* Off by default.
*/
vtkSetMacro(PassCellArrays, bool);
vtkBooleanMacro(PassCellArrays, bool);
vtkGetMacro(PassCellArrays, bool);
///@}
///@{
/**
* Shallow copy the input point data arrays to the output
* Off by default.
*/
vtkSetMacro(PassPointArrays, bool);
vtkBooleanMacro(PassPointArrays, bool);
vtkGetMacro(PassPointArrays, bool);
///@}
///@{
/**
* Set whether to pass the field-data arrays from the Input i.e. the input
* providing the geometry to the output. On by default.
*/
vtkSetMacro(PassFieldArrays, bool);
vtkBooleanMacro(PassFieldArrays, bool);
vtkGetMacro(PassFieldArrays, bool);
///@}
///@{
/**
* Set the tolerance used to compute whether a point in the
* source is in a cell of the input. This value is only used
* if ComputeTolerance is off.
*/
vtkSetMacro(Tolerance, double);
vtkGetMacro(Tolerance, double);
///@}
///@{
/**
* Set whether to use the Tolerance field or precompute the tolerance.
* When on, the tolerance will be computed and the field
* value is ignored. On by default.
*/
vtkSetMacro(ComputeTolerance, bool);
vtkBooleanMacro(ComputeTolerance, bool);
vtkGetMacro(ComputeTolerance, bool);
///@}
///@{
/**
* When dealing with composite datasets, partial arrays are common i.e.
* data-arrays that are not available in all of the blocks. By default, this
* filter only passes those point and cell data-arrays that are available in
* all the blocks i.e. partial array are removed. When PassPartialArrays is
* turned on, this behavior is changed to take a union of all arrays present
* thus partial arrays are passed as well. However, for composite dataset
* input, this filter still produces a non-composite output. For all those
* locations in a block of where a particular data array is missing, this
* filter uses vtkMath::Nan() for double and float arrays, while 0 for all
* other types of arrays i.e int, char etc.
*/
vtkSetMacro(PassPartialArrays, bool);
vtkGetMacro(PassPartialArrays, bool);
vtkBooleanMacro(PassPartialArrays, bool);
///@}
///@{
/**
* Setter and getter for `SamplingPattern` (values to be taken from the enumeration
* vtkProbeLineFilter::SamplingPattern).
*/
vtkGetMacro(SamplingPattern, int);
vtkSetClampMacro(SamplingPattern, int, 0, 2);
///@}
///@{
/**
* Setter and getter for `LineResolution`. This attribute is only used if sampling