Commit 4d6d89cd authored by Nicolas Vuaille's avatar Nicolas Vuaille

Add molecule filters

 * Add following filters ComputeMoleculeBonds (available in parallel),
 ** PointSetToMolecule, DistributePointCloud, AppendMolecule, MoleculeToLines
 * Add corresponding tests
 * Fix error with molecule in spreadsheet view
parent c4757f3c
......@@ -147,6 +147,13 @@
<Proxy group="filters" name="SPHDatasetInterpolator" />
</Category>
<Category name="Chemistry" menu_label="Chemistry">
<Proxy group="filters" name="AppendMolecule"/>
<Proxy group="filters" name="ComputeMoleculeBonds"/>
<Proxy group="filters" name="MoleculeToLines"/>
<Proxy group="filters" name="PointSetToMolecule"/>
</Category>
<Proxy group="filters" name="AggregateDataSet" />
<Proxy group="filters" name="AppendArcLength" />
<Proxy group="filters" name="AddFieldArrays" />
......@@ -185,6 +192,7 @@
<Proxy group="filters" name="DecimatePolyline" />
<Proxy group="filters" name="Delaunay2D" />
<Proxy group="filters" name="Delaunay3D" />
<Proxy group="filters" name="DistributePointSet"/>
<Proxy group="filters" name="ElevationFilter" />
<Proxy group="filters" name="EvenlySpacedStreamlines2D" />
<Proxy group="filters" name="ExtractBlock" />
......
......@@ -51,6 +51,7 @@ paraview_test_load_data(""
dualSphereAnimation.clone.pvd
dualSphereAnimation.pvd
iron_protein.vtk
linesPolydata.vtk
LoadState.pvsm
LoadStateDialog.pvsm
minimal.nii
......@@ -63,6 +64,7 @@ paraview_test_load_data(""
NE2_ps_bath.png
non_convex_polygon.vtu
office.binary.vtk
pointSet.vtk
porphyrin.cml
PropertyLink.pvsm
quadraticTetra01.vtu
......@@ -304,6 +306,7 @@ list(APPEND TESTS_WITH_BASELINES
${CMAKE_CURRENT_SOURCE_DIR}/AccentuatedFilename.xml
${CMAKE_CURRENT_SOURCE_DIR}/AMReXParticlesReader.xml
${CMAKE_CURRENT_SOURCE_DIR}/Annotations.xml
${CMAKE_CURRENT_SOURCE_DIR}/ConvertToMolecule.xml
${CMAKE_CURRENT_SOURCE_DIR}/CopyPasteProperties.xml
${CMAKE_CURRENT_SOURCE_DIR}/CTHAMRBaseline.xml
${CMAKE_CURRENT_SOURCE_DIR}/CTHAMRClip.xml
......@@ -381,6 +384,8 @@ list(APPEND TESTS_WITH_BASELINES
${CMAKE_CURRENT_SOURCE_DIR}/LoadStateChooseFiles.xml
${CMAKE_CURRENT_SOURCE_DIR}/LoadStateUseExisting.xml
${CMAKE_CURRENT_SOURCE_DIR}/LoadSaveStateVolume.xml
${CMAKE_CURRENT_SOURCE_DIR}/MoleculeBonds.xml
${CMAKE_CURRENT_SOURCE_DIR}/MoleculeToLines.xml
${CMAKE_CURRENT_SOURCE_DIR}/MultiBlockAttributes1.xml
${CMAKE_CURRENT_SOURCE_DIR}/MultiBlockInspector.xml
${CMAKE_CURRENT_SOURCE_DIR}/MultiBlockSingleBlock.xml
......@@ -546,6 +551,16 @@ if (PARAVIEW_USE_MPI)
#${CMAKE_CURRENT_SOURCE_DIR}/UseDataPartitions.xml
)
# DistributePoints is only tested in non-built-in mode.
add_client_server_tests("pvcs"
BASELINE_DIR ${PARAVIEW_TEST_BASELINE_DIR}
TEST_SCRIPTS ${CMAKE_CURRENT_SOURCE_DIR}/DistributePoints.xml
)
add_client_render_server_tests("pvcrs"
BASELINE_DIR ${PARAVIEW_TEST_BASELINE_DIR}
TEST_SCRIPTS ${CMAKE_CURRENT_SOURCE_DIR}/DistributePoints.xml
)
# Volume rendering seems to work better in serial
set (UseDataPartitions_FORCE_SERIAL TRUE)
# This test requires a parallel partition to make sense so we
......
<?xml version="1.0" ?>
<pqevents>
<pqevent object="pqClientMainWindow/MainControlsToolbar/actionOpenData" command="activate" arguments="" />
<pqevent object="pqClientMainWindow/FileOpenDialog" command="filesSelected" arguments="$PARAVIEW_DATA_ROOT/linesPolydata.vtk" />
<pqevent object="pqClientMainWindow/propertiesDock/propertiesPanel/Accept" command="activate" arguments="" />
<pqevent object="pqClientMainWindow/menubar" command="activate" arguments="menuFilters" />
<pqevent object="pqClientMainWindow/menubar/menuFilters/Chemistry" command="activate" arguments="PointSetToMolecule" />
<pqcheck object="pqClientMainWindow/propertiesDock/propertiesPanel/scrollArea/qt_scrollarea_viewport/scrollAreaWidgetContents/PropertiesFrame/ProxyPanel/ConvertLinesIntoBonds/CheckBox" property="checked" arguments="true" />
<pqevent object="pqClientMainWindow/propertiesDock/propertiesPanel/Accept" command="activate" arguments="" />
<pqcompareview object="pqClientMainWindow/centralwidget/MultiViewWidget/CoreWidget/qt_tabwidget_stackedwidget/MultiViewWidget1/Frame.0/CentralWidgetFrame/Viewport" baseline="$PARAVIEW_DATA_ROOT/Baseline/ConvertToMoleculeBonds.png" threshold="5" />
<pqevent object="pqClientMainWindow/1QTabBar1" command="set_tab_with_text" arguments="Properties" />
<pqevent object="pqClientMainWindow/propertiesDock/propertiesPanel/scrollArea/qt_scrollarea_viewport/scrollAreaWidgetContents/PropertiesFrame/ProxyPanel/ConvertLinesIntoBonds/CheckBox" command="set_boolean" arguments="false" />
<pqevent object="pqClientMainWindow/propertiesDock/propertiesPanel/Accept" command="activate" arguments="" />
</pqevents>
<?xml version="1.0" ?>
<pqevents>
<pqevent object="pqClientMainWindow/MainControlsToolbar/actionOpenData" command="activate" arguments="" />
<pqevent object="pqClientMainWindow/FileOpenDialog" command="filesSelected" arguments="$PARAVIEW_DATA_ROOT/pointSet.vtk" />
<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="DistributePointSet" />
<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="ProcessIdScalars" />
<pqevent object="pqClientMainWindow/propertiesDock/propertiesPanel/Accept" command="activate" arguments="" />
<pqevent object="pqClientMainWindow/menubar/menuFilters/pqProxyGroupMenuManager0/Glyph" command="activate" arguments="" />
<pqevent object="pqClientMainWindow/propertiesDock/propertiesPanel/scrollArea/qt_scrollarea_viewport/scrollAreaWidgetContents/PropertiesFrame/ProxyPanel/Source/ProxySelectionWidget/comboBox" command="activated" arguments="Sphere" />
<pqevent object="pqClientMainWindow/propertiesDock/propertiesPanel/scrollArea/qt_scrollarea_viewport/scrollAreaWidgetContents/PropertiesFrame/ProxyPanel/Vectors/ComboBox" command="activated" arguments="None" />
<pqevent object="pqClientMainWindow/propertiesDock/propertiesPanel/scrollArea/qt_scrollarea_viewport/scrollAreaWidgetContents/PropertiesFrame/ProxyPanel/GlyphMode/ComboBox" command="activated" arguments="All Points" />
<pqcheck object="pqClientMainWindow/propertiesDock/propertiesPanel/scrollArea/qt_scrollarea_viewport/scrollAreaWidgetContents/PropertiesFrame/ProxyPanel/Scalars/ComboBox" property="currentText" arguments="ProcessId" />
<pqevent object="pqClientMainWindow/propertiesDock/propertiesPanel/Accept" command="activate" arguments="" />
</pqevents>
<?xml version="1.0" ?>
<pqevents>
<pqevent object="pqClientMainWindow/MainControlsToolbar/actionOpenData" command="activate" arguments="" />
<pqevent object="pqClientMainWindow/FileOpenDialog" command="filesSelected" arguments="$PARAVIEW_DATA_ROOT/pointSet.vtk" />
<pqevent object="pqClientMainWindow/propertiesDock/propertiesPanel/Accept" command="activate" arguments="" />
<pqevent object="pqClientMainWindow/menubar" command="activate" arguments="menuFilters" />
<pqevent object="pqClientMainWindow/menubar/menuFilters/Chemistry" command="activate" arguments="PointSetToMolecule" />
<pqevent object="pqClientMainWindow/propertiesDock/propertiesPanel/Accept" command="activate" arguments="" />
<pqevent object="pqClientMainWindow/menubar" command="activate" arguments="menuFilters" />
<pqevent object="pqClientMainWindow/menubar/menuFilters/Chemistry" command="activate" arguments="ComputeMoleculeBonds" />
<pqcheck object="pqClientMainWindow/propertiesDock/propertiesPanel/scrollArea/qt_scrollarea_viewport/scrollAreaWidgetContents/PropertiesFrame/ProxyPanel/IsToleranceAbsolute/CheckBox" property="checked" arguments="true" />
<pqcheck object="pqClientMainWindow/propertiesDock/propertiesPanel/scrollArea/qt_scrollarea_viewport/scrollAreaWidgetContents/PropertiesFrame/ProxyPanel/Tolerance/LineEdit0" property="text" arguments="0.45" />
<pqevent object="pqClientMainWindow/propertiesDock/propertiesPanel/Accept" command="activate" arguments="" />
<pqevent object="pqClientMainWindow/propertiesDock/propertiesPanel/scrollArea/qt_scrollarea_viewport/scrollAreaWidgetContents/PropertiesFrame/ProxyPanel/Tolerance/LineEdit0" command="set_string" arguments="0.9" />
<pqevent object="pqClientMainWindow/propertiesDock/propertiesPanel/Accept" command="activate" arguments="" />
<pqevent object="pqClientMainWindow/propertiesDock/propertiesPanel/scrollArea/qt_scrollarea_viewport/scrollAreaWidgetContents/PropertiesFrame/ProxyPanel/IsToleranceAbsolute/CheckBox" command="set_boolean" arguments="false" />
<pqevent object="pqClientMainWindow/propertiesDock/propertiesPanel" command="mousePress" arguments="1,1,0,54,34" />
<pqevent object="pqClientMainWindow/propertiesDock/propertiesPanel" command="mouseRelease" arguments="1,0,0,54,34" />
<pqevent object="pqClientMainWindow/propertiesDock/propertiesPanel/Accept" command="activate" arguments="" />
<pqevent object="pqClientMainWindow/propertiesDock/propertiesPanel/scrollArea/qt_scrollarea_viewport/scrollAreaWidgetContents/PropertiesFrame/ProxyPanel/Tolerance/LineEdit0" command="set_string" arguments="1" />
<pqevent object="pqClientMainWindow/propertiesDock/propertiesPanel/scrollArea/qt_scrollarea_viewport/scrollAreaWidgetContents/PropertiesFrame/ProxyPanel/Tolerance/LineEdit0" command="set_string" arguments="1." />
<pqevent object="pqClientMainWindow/propertiesDock/propertiesPanel/scrollArea/qt_scrollarea_viewport/scrollAreaWidgetContents/PropertiesFrame/ProxyPanel/Tolerance/LineEdit0" command="set_string" arguments="1.3" />
<pqevent object="pqClientMainWindow/propertiesDock/propertiesPanel/Accept" command="activate" arguments="" />
</pqevents>
<?xml version="1.0" ?>
<pqevents>
<pqevent object="pqClientMainWindow/MainControlsToolbar/actionOpenData" command="activate" arguments="" />
<pqevent object="pqClientMainWindow/FileOpenDialog" command="filesSelected" arguments="$PARAVIEW_DATA_ROOT/porphyrin.cml" />
<pqevent object="pqClientMainWindow/propertiesDock/propertiesPanel/Accept" command="activate" arguments="" />
<pqevent object="pqClientMainWindow/menubar" command="activate" arguments="menuFilters" />
<pqevent object="pqClientMainWindow/menubar/menuFilters/Chemistry" command="activate" arguments="MoleculeToLines" />
<pqevent object="pqClientMainWindow/propertiesDock/propertiesPanel/Accept" command="activate" arguments="" />
</pqevents>
......@@ -407,6 +407,7 @@ if (PARAVIEW_ENABLE_PDAL)
endif()
if (PARAVIEW_USE_MPI)
list (APPEND _vtk_mpi_modules vtkDomainsParallelChemistry)
list (APPEND _vtk_modules ${_vtk_mpi_modules})
endif()
......
......@@ -164,6 +164,7 @@
{ "class":"vtkCellDataToPointData" },
{ "class":"vtkFeatureEdges" },
{ "class":"vtkImageAppend" },
{ "class":"vtkMoleculeAppend" },
{ "class":"vtkPointDataToCellData" },
{ "class":"vtkProbeFilter" },
{ "class":"vtkQuadricClustering" },
......@@ -346,6 +347,7 @@
{ "path":"ParaViewCore/ServerManager/SMApplication/Resources/filters.xml",
"proxies":[
"Append",
"AppendMolecule",
"AppendPolyData",
"FeatureEdges",
"PointDataToCellData",
......
# Add molecule algorithms
* Add filters for molecule:
- a simple bond perceiver (also available in parallel)
- a converter from point set to molecule
- a converter from molecule to polydata
- a filter to append one or more molecules into a single one
It also add a filter to distribute point set over MPI processes.
......@@ -127,7 +127,7 @@ int vtkMoleculeRepresentation::ProcessViewRequest(
{
vtkPVRenderView::SetGeometryBounds(inInfo, this->DataBounds, this->Actor->GetMatrix());
vtkPVRenderView::SetPiece(inInfo, this, this->CacheKeeper->GetOutput());
vtkPVRenderView::SetDeliverToClientAndRenderingProcesses(inInfo, this, true, false);
vtkPVRenderView::SetDeliverToClientAndRenderingProcesses(inInfo, this, true, true);
}
else if (request_type == vtkPVView::REQUEST_RENDER())
{
......
......@@ -16988,5 +16988,171 @@ source.</Documentation>
</IntVectorProperty>
<!-- End vtkHyperTreeGridPlaneCutter-->
</SourceProxy>
<!-- ==================================================================== -->
<SourceProxy name="PointSetToMolecule" class="vtkPointSetToMoleculeFilter" label="Convert Into Molecule">
<Documentation
long_help="Convert a point set into a molecule."
short_help="Convert a point set into a molecule.">
Convert a point set into a molecule. Every point of the input becomes an atom
of the output molecule. It needs a point array containing the atomic numbers.
</Documentation>
<InputProperty
name="Input"
command="SetInputConnection">
<ProxyGroupDomain name="groups">
<Group name="sources"/>
<Group name="filters"/>
</ProxyGroupDomain>
<DataTypeDomain name="input_type">
<DataType value="vtkPointSet"/>
</DataTypeDomain>
<InputArrayDomain attribute_type="point"
name="input_array"
number_of_components="1"/>
</InputProperty>
<StringVectorProperty command="SetInputArrayToProcess"
element_types="0 0 0 0 2"
label="Atomic Numbers"
name="SelectInputScalars"
number_of_elements="5">
<ArrayListDomain attribute_type="Scalars"
input_domain_name="input_array"
name="array_list">
<RequiredProperties>
<Property function="Input"
name="Input" />
</RequiredProperties>
</ArrayListDomain>
<Documentation>This property indicates the name of the scalar array
corresponding to atomic numbers.</Documentation>
</StringVectorProperty>
<IntVectorProperty command="SetConvertLinesIntoBonds"
default_values="1"
name="ConvertLinesIntoBonds"
number_of_elements="1">
<BooleanDomain name="bool" />
<Documentation
short_help="Specify if line cells are converted into bonds."
long_help="Specify if line cells are converted into bonds.">
This property determines if the lines (cell of type VTK_LINE) are converted into bonds.
</Documentation>
</IntVectorProperty>
<!-- End PointSetToMolecule -->
</SourceProxy>
<!-- ==================================================================== -->
<SourceProxy name="MoleculeToLines" class="vtkMoleculeToLinesFilter" label="Molecule To Lines">
<Documentation
long_help="Convert a molecule into lines."
short_help="Convert a molecule into lines.">
Convert a molecule into lines. Each atom of the input becomes a point of the output polydata, each bond a line.
</Documentation>
<InputProperty
name="Input"
command="SetInputConnection">
<ProxyGroupDomain name="groups">
<Group name="sources"/>
<Group name="filters"/>
</ProxyGroupDomain>
<DataTypeDomain name="input_type">
<DataType value="vtkMolecule"/>
</DataTypeDomain>
</InputProperty>
<!-- End MoleculeToLines -->
</SourceProxy>
<!-- ==================================================================== -->
<SourceProxy name="AppendMolecule" class="vtkMoleculeAppend" label="Append Molecule">
<Documentation
long_help="Appends one or more molecules into a single molecule."
short_help="Append molecules into a single molecule.">
Appends one or more molecules into a single molecule. It also appends the associated atom data and edge data.
Note that input data arrays should match (same number of arrays with same names in each input)
</Documentation>
<InputProperty clean_command="RemoveAllInputs"
command="AddInputConnection"
multiple_input="1"
name="Input">
<ProxyGroupDomain name="groups">
<Group name="sources"/>
<Group name="filters"/>
</ProxyGroupDomain>
<DataTypeDomain name="input_type">
<DataType value="vtkMolecule"/>
</DataTypeDomain>
</InputProperty>
<!-- End AppendMolecule -->
</SourceProxy>
<!-- ==================================================================== -->
<SourceProxy name="ComputeMoleculeBonds" class="vtkSimpleBondPerceiver" label="Compute Molecule Bonds">
<Documentation
long_help="Compute the bonds of a molecule based on interatomic distance only."
short_help="Compute the bonds of a molecule.">
Compute the bonds of a molecule. If the
interatomic distance is less than the sum of the two atom's covalent radii
(and a tolerance), a single bond is added.
This algorithm does not consider valences, hybridization, aromaticity, or
anything other than atomic separations. It will not produce anything other
than single bonds.
</Documentation>
<InputProperty
name="Input"
command="SetInputConnection">
<ProxyGroupDomain name="groups">
<Group name="sources"/>
<Group name="filters"/>
</ProxyGroupDomain>
<DataTypeDomain name="input_type">
<DataType value="vtkMolecule"/>
</DataTypeDomain>
</InputProperty>
<DoubleVectorProperty command="SetTolerance"
default_values="0.45"
name="Tolerance"
number_of_elements="1"
panel_visibility="advanced">
<DoubleRangeDomain name="scalar_range" />
<Documentation
short_help="Tolerance on covalent radius size">
This property determines the tolerance to apply on covalent radius.
</Documentation>
</DoubleVectorProperty>
<IntVectorProperty command="SetIsToleranceAbsolute"
default_values="1"
name="IsToleranceAbsolute"
number_of_elements="1">
<BooleanDomain name="bool" />
<Documentation
short_help="Specify if Tolerance is absolute or relative to radius."
long_help="Specify if Tolerance is absolute (addition) or relative (multiplication) to radius.">
This property determines if the tolerance is absolute (value is added to radius and should be positive)
or not (value multiplied with radius and should be greater than 1).
</Documentation>
</IntVectorProperty>
<!-- End ComputeMoleculeBonds -->
</SourceProxy>
<!-- ==================================================================== -->
<SourceProxy name="DistributePointSet"
class="vtkDistributedPointCloudFilter"
multiprocess_support="multiple_processes"
label="Distribute Points">
<Documentation
long_help="Fairly distribute point set into spatially contiguous regions."
short_help="Distribute points.">
This filter fairly distributes points over processes into contiguous spatial regions.
The output is the same type as input, but it does not contain any cell.
Distribution is done using a Kd-tree.
</Documentation>
<InputProperty
name="Input"
command="SetInputConnection">
<ProxyGroupDomain name="groups">
<Group name="sources"/>
<Group name="filters"/>
</ProxyGroupDomain>
<DataTypeDomain name="input_type">
<DataType value="vtkPointSet"/>
</DataTypeDomain>
</InputProperty>
</SourceProxy>
<!-- End DistributePointCloud -->
</ProxyGroup>
</ServerManagerConfiguration>
......@@ -6662,11 +6662,6 @@
</PropertyGroup>
</ExposedProperties>
</SubProxy>
<SubProxy>
<Proxy name="SelectionRepresentation"
proxygroup="representations"
proxyname="SelectionRepresentation" />
</SubProxy>
</PVRepresentationProxy>
<!-- =================================================================== -->
......
......@@ -21,6 +21,8 @@
#include "vtkGraph.h"
#include "vtkImageAppend.h"
#include "vtkImageData.h"
#include "vtkMolecule.h"
#include "vtkMoleculeAppend.h"
#include "vtkMultiProcessController.h"
#include "vtkMultiProcessStream.h"
#include "vtkNew.h"
......@@ -154,6 +156,10 @@ bool vtkMultiProcessControllerHelper::MergePieces(
appender = vtkStructuredGridAppend::New();
;
}
else if (vtkMolecule::SafeDownCast(result))
{
appender = vtkMoleculeAppend::New();
}
else if (vtkGraph::SafeDownCast(result))
{
vtkGenericWarningMacro("Support for vtkGraph has been depreciated.") return false;
......@@ -176,12 +182,17 @@ bool vtkMultiProcessControllerHelper::MergePieces(
for (iter = pieces.begin(); iter != pieces.end(); ++iter)
{
vtkDataSet* ds = vtkDataSet::SafeDownCast(iter->GetPointer());
if (ds && ds->GetNumberOfPoints() == 0)
{
// skip empty pieces.
continue;
}
vtkMolecule* mol = vtkMolecule::SafeDownCast(iter->GetPointer());
if (mol && mol->GetNumberOfAtoms() == 0)
{
continue;
}
vtkNew<vtkTrivialProducer> tp;
tp->SetOutput(iter->GetPointer());
appender->AddInputConnection(0, tp->GetOutputPort());
......
......@@ -121,6 +121,14 @@ int vtkBlockDeliveryPreprocessor::RequestData(
vtkDataObject* inputDO = vtkDataObject::GetData(inputVector[0], 0);
vtkDataObject* outputDO = vtkDataObject::GetData(outputVector, 0);
// For some reasons, upstream pipeline can produce vtkDataObject
// instead of a derived type (such case use to appear with vtkMolecule)
// In this case, data is 'empty' and there is nothing to process.
if (!strcmp(inputDO->GetClassName(), "vtkDataObject"))
{
return 1;
}
vtkSmartPointer<vtkAttributeDataToTableFilter> adtf =
vtkSmartPointer<vtkAttributeDataToTableFilter>::New();
adtf->SetInputData(inputDO);
......
9980fcd1e8831827342eb0d78db66ddb
1b3062a499725f453230e561c231efcf
9f6384077db77f700db1663bdc135771
ea071f1d02c1e609639445b1643072fa
a75ff6426dc8f3b9daec7a8cb4d20f03
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