ParaView-5.0.1: Added the source-tree to ThirdParty-dev and patched as described in the README file

Resolves bug-report http://bugs.openfoam.org/view.php?id=2098
This commit is contained in:
Henry Weller
2016-05-30 21:20:56 +01:00
parent 1cce60aa78
commit eba760a6d6
24640 changed files with 6366069 additions and 0 deletions

View File

@ -0,0 +1,93 @@
project(STPScriptGeneratorPlugin)
#--------------------------------------------------
# Find and Use ParaView
#--------------------------------------------------
INCLUDE_DIRECTORIES(${VTK_INCLUDE_DIRS})
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR}/Resources)
INCLUDE_DIRECTORIES(${ParaView_SOURCE_DIR}/Applications/ParaView)
INCLUDE_DIRECTORIES(${ParaView_BINARY_DIR}/Applications/ParaView)
# Plugins for ParaView that add support to export state for spatio-temporal
# parallelism
#------------------------------------------------------------------------------
SET (TP_SOURCES
pqTPActionsGroup.cxx
pqTPActionsGroup.h
pqTPExportStateWizard.cxx
pqTPExportStateWizard.h
pqTPPluginManager.cxx
pqTPPluginManager.h
)
SET (TP_MOC_SOURCES
pqTPExportStateWizard.h
pqTPActionsGroup.h
pqTPPluginManager.h
)
IF (PARAVIEW_QT_VERSION VERSION_GREATER "4")
SET (Qt5_FIND_COMPONENTS Widgets)
INCLUDE (ParaViewQt5)
QT5_WRAP_CPP(MOC_SRCS
${TP_MOC_SOURCES})
QT5_WRAP_UI(UI_SRCS
${UI_RESOURCES})
ELSE ()
INCLUDE (${QT_USE_FILE})
QT4_WRAP_CPP(MOC_SRCS
${TP_MOC_SOURCES})
QT4_WRAP_UI(UI_SRCS
${UI_RESOURCES})
ENDIF ()
#------------------------------------------------------------------------------
SET (PARAVIEW_PLUGIN_IFACES)
SET (PARAVIEW_PLUGIN_SRCS)
SET (PARAVIEW_PLUGIN_IFACES2)
SET (PARAVIEW_PLUGIN_SRCS2)
# This is a macro for adding QActionGroup subclasses automatically as toolbars.
ADD_PARAVIEW_ACTION_GROUP(
PARAVIEW_PLUGIN_IFACES
PARAVIEW_PLUGIN_SRCS
CLASS_NAME pqTPActionsGroup
GROUP_NAME "MenuBar/SpatioTemporal")
ADD_PARAVIEW_AUTO_START(
PARAVIEW_PLUGIN_IFACES2
PARAVIEW_PLUGIN_SRCS2
CLASS_NAME pqTPPluginManager)
ADD_CUSTOM_COMMAND(
OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/tp_export_py.cxx"
DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/tp_export.py"
COMMAND vtkEncodeString
ARGS "${CMAKE_CURRENT_BINARY_DIR}/tp_export_py.cxx"
"${CMAKE_CURRENT_SOURCE_DIR}/tp_export.py"
tp_export_py)
ADD_PARAVIEW_PLUGIN(
TemporalParallelismScriptGenerator
"0.1.0"
SERVER_MANAGER_XML Resources/servermanagertp.xml
GUI_INTERFACES
${PARAVIEW_PLUGIN_IFACES}
${PARAVIEW_PLUGIN_IFACES2}
GUI_SOURCES
${TP_SOURCES}
${MOC_SRCS}
${UI_RESOURCES}
${PARAVIEW_PLUGIN_SRCS}
${PARAVIEW_PLUGIN_SRCS2}
tp_export_py.cxx
)
IF (BUILD_TESTING AND BUILD_SHARED_LIBS)
include(ParaViewTestingMacros)
add_client_tests("pv"
LOAD_PLUGIN "TemporalParallelismScriptGenerator"
TEST_SCRIPTS ${CMAKE_CURRENT_SOURCE_DIR}/Testing/TemporalParallelism.xml )
ENDIF ()

View File

@ -0,0 +1,214 @@
<ServerManagerConfiguration>
<ProxyGroup name="filters">
<SourceProxy name="XMLPImageDataWriter" class="vtkPVNullSource"
label="Parallel Image Data Writer">
<InputProperty name="Input">
<ProxyGroupDomain name="groups">
<Group name="sources" />
<Group name="filters" />
</ProxyGroupDomain>
<DataTypeDomain name="input_type" composite_data_supported="0">
<DataType value="vtkImageData" />
</DataTypeDomain>
<Documentation>
The input.
</Documentation>
</InputProperty>
<StringVectorProperty name="FileName"
number_of_elements="1"
default_values="filename_%t.pvti">
</StringVectorProperty>
<Hints>
<!-- TODO: this doesn't work yet -->
<PipelineIcon name=":pqComponents/pqSave32.png" />
<!-- This will help us when exporting the script state -->
<WriterProxy group="writers" name="XMLPImageDataWriter" />
</Hints>
<!-- End of XMLPImageDataWriter -->
</SourceProxy>
<SourceProxy name="XMLPRectilinearGridWriter" class="vtkPVNullSource"
label="Parallel Rectilinear Grid Writer">
<InputProperty name="Input">
<ProxyGroupDomain name="groups">
<Group name="sources" />
<Group name="filters" />
</ProxyGroupDomain>
<DataTypeDomain name="input_type" composite_data_supported="0">
<DataType value="vtkRectilinearGrid" />
</DataTypeDomain>
<Documentation>
The input.
</Documentation>
</InputProperty>
<StringVectorProperty name="FileName"
number_of_elements="1"
default_values="filename_%t.pvtr">
</StringVectorProperty>
<Hints>
<!-- TODO: this doesn't work yet -->
<PipelineIcon name=":pqComponents/pqSave32.png" />
<!-- This will help us when exporting the script state -->
<WriterProxy group="writers" name="XMLPRectilinearGridWriter" />
</Hints>
<!-- End of XMLRectilinearGridWriter -->
</SourceProxy>
<SourceProxy name="XMLPStructuredGridWriter" class="vtkPVNullSource"
label="Parallel Structured Grid Writer">
<InputProperty name="Input">
<ProxyGroupDomain name="groups">
<Group name="sources" />
<Group name="filters" />
</ProxyGroupDomain>
<DataTypeDomain name="input_type">
<DataType value="vtkStructuredGrid" composite_data_supported="0"/>
</DataTypeDomain>
<Documentation>
The input.
</Documentation>
</InputProperty>
<StringVectorProperty name="FileName"
number_of_elements="1"
default_values="filename_%t.pvts">
</StringVectorProperty>
<Hints>
<!-- TODO: this doesn't work yet -->
<PipelineIcon name=":pqComponents/pqSave32.png" />
<!-- This will help us when exporting the script state -->
<WriterProxy group="writers" name="XMLPStructuredGridWriter" />
</Hints>
<!-- End of XMLPStructuredGridWriter -->
</SourceProxy>
<SourceProxy name="XMLPPolyDataWriter" class="vtkPVNullSource"
label="Parallel PolyData Writer">
<InputProperty name="Input">
<ProxyGroupDomain name="groups">
<Group name="sources" />
<Group name="filters" />
</ProxyGroupDomain>
<DataTypeDomain name="input_type" composite_data_supported="0">
<DataType value="vtkPolyData" />
</DataTypeDomain>
<Documentation>
The input.
</Documentation>
</InputProperty>
<StringVectorProperty name="FileName"
number_of_elements="1"
default_values="filename_%t.pvtp">
</StringVectorProperty>
<Hints>
<!-- TODO: this doesn't work yet -->
<PipelineIcon name=":pqComponents/pqSave32.png" />
<!-- This will help us when exporting the script state -->
<WriterProxy group="writers" name="XMLPPolyDataWriter" />
</Hints>
<!-- End of XMLPPolyDataWriter -->
</SourceProxy>
<SourceProxy name="XMLPUnstructuredGridWriter" class="vtkPVNullSource"
label="Parallel UnstructuredGrid Writer">
<InputProperty name="Input">
<ProxyGroupDomain name="groups">
<Group name="sources" />
<Group name="filters" />
</ProxyGroupDomain>
<DataTypeDomain name="input_type">
<DataType value="vtkUnstructuredGrid" composite_data_supported="0"/>
</DataTypeDomain>
<Documentation>
The input.
</Documentation>
</InputProperty>
<StringVectorProperty name="FileName"
number_of_elements="1"
default_values="filename_%t.pvtu">
</StringVectorProperty>
<Hints>
<!-- TODO: this doesn't work yet -->
<PipelineIcon name=":pqComponents/pqSave32.png" />
<!-- This will help us when exporting the script state -->
<WriterProxy group="writers" name="XMLPUnstructuredGridWriter" />
</Hints>
<!-- End of XMLPUnstructuredGridWriter -->
</SourceProxy>
<SourceProxy name="XMLMultiBlockDataWriter" class="vtkPVNullSource"
label="Parallel MultiBlockDataSet Writer">
<InputProperty name="Input">
<ProxyGroupDomain name="groups">
<Group name="sources" />
<Group name="filters" />
</ProxyGroupDomain>
<DataTypeDomain name="input_type">
<DataType value="vtkMultiBlockDataSet" />
</DataTypeDomain>
<Documentation>
The input.
</Documentation>
</InputProperty>
<StringVectorProperty name="FileName"
number_of_elements="1"
default_values="filename_%t.vtm">
</StringVectorProperty>
<Hints>
<!-- TODO: this doesn't work yet -->
<PipelineIcon name=":pqComponents/pqSave32.png" />
<!-- This will help us when exporting the script state -->
<WriterProxy group="writers" name="XMLMultiBlockDataWriter" />
</Hints>
<!-- End of XMLMultiBlockDataWriter -->
</SourceProxy>
<SourceProxy name="XMLHierarchicalBoxDataWriter" class="vtkPVNullSource"
label="Parallel Hierarchical Box Data Writer">
<InputProperty name="Input">
<ProxyGroupDomain name="groups">
<Group name="sources" />
<Group name="filters" />
</ProxyGroupDomain>
<DataTypeDomain name="input_type">
<DataType value="vtkHierarchicalBoxDataSet" />
</DataTypeDomain>
<Documentation>
The input.
</Documentation>
</InputProperty>
<StringVectorProperty name="FileName"
number_of_elements="1"
default_values="filename_%t.vth">
</StringVectorProperty>
<Hints>
<!-- TODO: this doesn't work yet -->
<PipelineIcon name=":pqComponents/pqSave32.png" />
<!-- This will help us when exporting the script state -->
<WriterProxy group="writers" name="XMLHierarchicalBoxDataWriter" />
</Hints>
<!-- End of XMLHierarchicalBoxDataWriter -->
</SourceProxy>
</ProxyGroup>
</ServerManagerConfiguration>

View File

@ -0,0 +1,23 @@
<?xml version="1.0" ?>
<pqevents>
<pqevent object="pqClientMainWindow/MainControlsToolbar/actionOpenData" command="activate" arguments="" />
<pqevent object="pqClientMainWindow/FileOpenDialog" command="filesSelected" arguments="$PARAVIEW_DATA_ROOT/blow.vtk" />
<pqevent object="pqClientMainWindow/propertiesDock/propertiesPanel/Accept" command="activate" arguments="" />
<pqevent object="pqClientMainWindow/menubar/menuFilters/pqProxyGroupMenuManager0/Cut" command="activate" arguments="" />
<pqevent object="pqClientMainWindow/propertiesDock/propertiesPanel/Accept" command="activate" arguments="" />
<pqevent object="pqClientMainWindow/menubar" command="activate" arguments="STPProxyWritersMenu" />
<pqevent object="pqClientMainWindow/STPProxyWritersMenu" command="activate" arguments="Parallel PolyData Writer" />
<pqevent object="pqClientMainWindow/propertiesDock/propertiesPanel/Accept" command="activate" arguments="" />
<pqevent object="pqClientMainWindow/SpatioTemporal" command="activate" arguments="Export State" />
<pqevent object="pqClientMainWindow/ExportStateWizard/1QWidget0/__qt__passive_wizardbutton1" command="activate" arguments="" />
<pqevent object="pqClientMainWindow/ExportStateWizard/1QWidget0/1QFrame0/wizardPage2/allInputs" command="mousePress" arguments="1,1,0,72,6,/0:0" />
<pqevent object="pqClientMainWindow/ExportStateWizard/1QWidget0/1QFrame0/wizardPage2/allInputs" command="mouseRelease" arguments="1,0,0,72,6,/0:0" />
<pqevent object="pqClientMainWindow/ExportStateWizard/1QWidget0/1QFrame0/wizardPage2/addButton" command="activate" arguments="" />
<pqevent object="pqClientMainWindow/ExportStateWizard/1QWidget0/__qt__passive_wizardbutton1" command="activate" arguments="" />
<pqevent object="pqClientMainWindow/ExportStateWizard/1QWidget0" command="mouseMove" arguments="1,0,0,433,502" />
<pqevent object="pqClientMainWindow/ExportStateWizard/1QWidget0" command="mouseRelease" arguments="1,0,0,433,502" />
<pqevent object="pqClientMainWindow/ExportStateWizard/1QWidget0/__qt__passive_wizardbutton1" command="activate" arguments="" />
<pqevent object="pqClientMainWindow/ExportStateWizard/1QWidget0/1QFrame0/wizardPage_2/timeCompartmentSize" command="spin" arguments="up" />
<pqevent object="pqClientMainWindow/ExportStateWizard/1QWidget0/finishButton" command="activate" arguments="" />
<pqevent object="pqClientMainWindow/ExportStateWizard/ExportSpatio-TemporalStateFileDialog" command="filesSelected" arguments="$PARAVIEW_TEST_ROOT/stpscript.py" />
</pqevents>

View File

@ -0,0 +1,4 @@
if (PARAVIEW_BUILD_QT_GUI AND PARAVIEW_ENABLE_PYTHON)
pv_plugin(TemporalParallelismScriptGenerator
DESCRIPTION "Plugin for creating Python spatio-temporal processing scripts")
endif()

View File

@ -0,0 +1,60 @@
/*=========================================================================
Program: ParaView
Module: pqTPActionsGroup.cxx
Copyright (c) 2005,2006 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.
========================================================================*/
#include "pqTPActionsGroup.h"
#include "pqTPExportStateWizard.h"
#include <pqCoreUtilities.h>
//-----------------------------------------------------------------------------
pqTPActionsGroup::pqTPActionsGroup(QObject* parentObject)
: Superclass(parentObject)
{
QAction* export_action = this->addAction("Export State");
export_action->setToolTip("Export state for spatio-temporal parallelism");
export_action->setStatusTip("Export state for spatio-temporal parallelism");
QObject::connect(export_action, SIGNAL(triggered()),
this, SLOT(exportState()));
}
//-----------------------------------------------------------------------------
pqTPActionsGroup::~pqTPActionsGroup()
{
}
//-----------------------------------------------------------------------------
void pqTPActionsGroup::exportState()
{
pqTPExportStateWizard wizard(pqCoreUtilities::mainWidget());
wizard.customize();
wizard.exec();
}

View File

@ -0,0 +1,53 @@
/*=========================================================================
Program: ParaView
Module: pqTPActionsGroup.h
Copyright (c) 2005,2006 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.
========================================================================*/
#ifndef pqTPActionsGroup_h
#define pqTPActionsGroup_h
#include <QActionGroup>
// Adds actions for co-processing.
class pqTPActionsGroup : public QActionGroup
{
Q_OBJECT
typedef QActionGroup Superclass;
public:
pqTPActionsGroup(QObject* parent=0);
virtual ~pqTPActionsGroup();
protected slots:
void exportState();
private:
Q_DISABLE_COPY(pqTPActionsGroup)
};
#endif

View File

@ -0,0 +1,207 @@
/*=========================================================================
Program: ParaView
Module: pqTPExportStateWizard.cxx
Copyright (c) 2005,2006 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.
========================================================================*/
#include "pqTPExportStateWizard.h"
#include <vtkSMProxyManager.h>
#include <vtkSMSessionProxyManager.h>
#include <vtkSMSourceProxy.h>
#include <vtkSMViewProxy.h>
#include <vtkPVXMLElement.h>
#include <pqApplicationCore.h>
#include <pqFileDialog.h>
#include <pqImageOutputInfo.h>
#include <pqPipelineSource.h>
#include <pqPythonDialog.h>
#include <pqPythonManager.h>
#include <pqServerManagerModel.h>
#include <pqView.h>
#include <QMessageBox>
extern const char* tp_export_py;
//-----------------------------------------------------------------------------
pqTPExportStateWizard::pqTPExportStateWizard(
QWidget *parentObject, Qt::WindowFlags parentFlags)
: Superclass(parentObject, parentFlags)
{
}
//-----------------------------------------------------------------------------
pqTPExportStateWizard::~pqTPExportStateWizard()
{
}
//-----------------------------------------------------------------------------
void pqTPExportStateWizard::customize()
{
// for spatio-temporal scripts we don't care about frequency or fitting
// the image to screen
QList<pqImageOutputInfo*> infos = this->getImageOutputInfos();
for(QList<pqImageOutputInfo*>::iterator it=infos.begin();
it!=infos.end();it++)
{
(*it)->hideFrequencyInput();
(*it)->hideFitToScreen();
}
this->Internals->wizardPage1->setTitle("Export Spatio-Temporal Parallel Script");
this->Internals->label->setText("This wizard will guide you through the steps required to export the current visualization state as a Python script that can be run with spatio-temporal parallelism with ParaView. Make sure to add appropriate writers for the desired pipelines to be used in the Writers menu.");
QStringList labels;
labels << "Pipeline Name" << "File Location";
this->Internals->nameWidget->setHorizontalHeaderLabels(labels);
this->Internals->liveViz->hide();
this->Internals->rescaleDataRange->hide();
this->Internals->outputCinema->hide();
this->Internals->wCinemaTrackSelection->hide();
}
//-----------------------------------------------------------------------------
bool pqTPExportStateWizard::getCommandString(QString& command)
{
command.clear();
QString export_rendering = "True";
QString rendering_info; // a map from the render view name to render output params
if (this->Internals->outputRendering->isChecked() == 0)
{
export_rendering = "False";
// check to make sure that there is a writer hooked up since we aren't
// exporting an image
vtkSMSessionProxyManager* proxyManager =
vtkSMProxyManager::GetProxyManager()->GetActiveSessionProxyManager();
pqServerManagerModel* smModel =
pqApplicationCore::instance()->getServerManagerModel();
bool haveSomeWriters = false;
QStringList filtersWithoutConsumers;
for(unsigned int i=0;i<proxyManager->GetNumberOfProxies("sources");i++)
{
if(vtkSMSourceProxy* proxy = vtkSMSourceProxy::SafeDownCast(
proxyManager->GetProxy("sources", proxyManager->GetProxyName("sources", i))))
{
vtkPVXMLElement* proxyHint = proxy->GetHints();
if(proxyHint && proxyHint->FindNestedElementByName("WriterProxy"))
{
haveSomeWriters = true;
}
else
{
pqPipelineSource* input = smModel->findItem<pqPipelineSource*>(proxy);
if(input && input->getNumberOfConsumers() == 0)
{
filtersWithoutConsumers << proxyManager->GetProxyName("sources", i);
}
}
}
}
if(!haveSomeWriters)
{
QMessageBox messageBox;
QString message(tr("No output writers specified. Either add writers in the pipeline or check <b>Output rendering components</b>."));
messageBox.setText(message);
messageBox.exec();
return false;
}
if(filtersWithoutConsumers.size() != 0)
{
QMessageBox messageBox;
QString message(tr("The following filters have no consumers and will not be saved:\n"));
for(QStringList::const_iterator iter=filtersWithoutConsumers.constBegin();
iter!=filtersWithoutConsumers.constEnd();iter++)
{
message.append(" ");
message.append(iter->toLocal8Bit().constData());
message.append("\n");
}
messageBox.setText(message);
messageBox.exec();
}
}
else // we are creating an image so we need to get the proper information from there
{
QString itemFormat = " '%1' : ['%2', '%5', '%6', '%7']";
rendering_info = this->Internals->wViewSelection->getSelectionAsPythonScript(itemFormat, false);
}
QString filters ="ParaView Python State Files (*.py);;All files (*)";
pqFileDialog file_dialog (NULL, this,
tr("Save Server State:"), QString(), filters);
file_dialog.setObjectName("ExportSpatio-TemporalStateFileDialog");
file_dialog.setFileMode(pqFileDialog::AnyFile);
if (!file_dialog.exec())
{
return false;
}
QString filename = file_dialog.getSelectedFiles()[0];
#ifdef _WIN32
// Convert to forward slashes. The issue is that the path is interpreted as a
// Python string when passed to the interpreter, so a path such as "C:\tests"
// is read as "C:<TAB>ests" which isn't what we want. Since Windows is
// flexible anyways, just use Unix separators.
filename.replace('\\', '/');
#endif
// Last Page, export the state.
pqPythonManager* manager = qobject_cast<pqPythonManager*>(
pqApplicationCore::instance()->manager("PYTHON_MANAGER"));
pqPythonDialog* dialog = 0;
if (manager)
{
dialog = manager->pythonShellDialog();
}
if (!dialog)
{
qCritical("Failed to locate Python dialog. Cannot save state.");
return true;
}
// mapping from readers and their filenames on the current machine
// to the filenames on the remote machine
QString reader_inputs_map;
for (int cc=0; cc < this->Internals->nameWidget->rowCount(); cc++)
{
QTableWidgetItem* item0 = this->Internals->nameWidget->item(cc, 0);
QTableWidgetItem* item1 = this->Internals->nameWidget->item(cc, 1);
reader_inputs_map +=
QString(" '%1' : '%2',").arg(item0->text()).arg(item1->text());
}
// remove last ","
reader_inputs_map.chop(1);
int timeCompartmentSize = this->Internals->timeCompartmentSize->value();
command = QString(tp_export_py).arg(export_rendering).arg(reader_inputs_map).arg(rendering_info).arg(timeCompartmentSize).arg(filename);
return true;
}

View File

@ -0,0 +1,55 @@
/*=========================================================================
Program: ParaView
Module: pqTPExportStateWizard.h
Copyright (c) 2005,2006 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.
========================================================================*/
#ifndef pqTPExportStateWizard_h
#define pqTPExportStateWizard_h
#include "pqSGExportStateWizard.h"
class pqTPExportStateWizard : public pqSGExportStateWizard
{
Q_OBJECT
typedef pqSGExportStateWizard Superclass;
public:
pqTPExportStateWizard(
QWidget *parentObject=0, Qt::WindowFlags parentFlags=0);
virtual ~pqTPExportStateWizard();
void customize();
protected:
virtual bool getCommandString(QString& command);
private:
Q_DISABLE_COPY(pqTPExportStateWizard)
};
#endif

View File

@ -0,0 +1,55 @@
/*=========================================================================
Program: ParaView
Module: pqTPPluginManager.cxx
Copyright (c) 2005,2006 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.
========================================================================*/
#include "pqTPPluginManager.h"
//-----------------------------------------------------------------------------
pqTPPluginManager::pqTPPluginManager(QObject* parentObject):
Superclass(parentObject)
{
}
//-----------------------------------------------------------------------------
pqTPPluginManager::~pqTPPluginManager()
{
}
//-----------------------------------------------------------------------------
const char* pqTPPluginManager::getWritersMenuName()
{
return "&STP Writers";
}
//-----------------------------------------------------------------------------
const char* pqTPPluginManager::getObjectMenuName()
{
return "STPProxyWritersMenu";
}

View File

@ -0,0 +1,58 @@
/*=========================================================================
Program: ParaView
Module: pqTPPluginManager.h
Copyright (c) 2005,2006 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.
========================================================================*/
#ifndef pqTPPluginManager_h
#define pqTPPluginManager_h
#include <pqSGPluginManager.h>
/// pqTPPluginManager is the central class that orchestrates the behaviour of
/// this spatio-temporal script creator plugin.
class pqTPPluginManager : public pqSGPluginManager
{
Q_OBJECT
typedef pqSGPluginManager Superclass;
public:
pqTPPluginManager(QObject* parent=0);
~pqTPPluginManager();
/// Get the name of the writers menu from the concrete subclass.
virtual const char* getWritersMenuName();
/// Get the Qt name of the writers menu from the concrete subclass.
virtual const char* getObjectMenuName();
private:
pqTPPluginManager(const pqTPPluginManager&); // Not implemented.
void operator=(const pqTPPluginManager&); // Not implemented.
};
#endif

View File

@ -0,0 +1,176 @@
from paraview import smtrace, servermanager, smstate
# boolean telling if we want to export rendering.
export_rendering = %1
# string->string map with key being the proxyname while value being the
# file name on the system the generated python script is to be run on.
reader_input_map = { %2 };
# list of views along with a file name and magnification flag
screenshot_info = {%3}
# the number of processes working together on a single time step
timeCompartmentSize = %4
# the name of the Python script to be outputted
scriptFileName = "%5"
class ReaderFilter(smtrace.PipelineProxyFilter):
def should_never_trace(self, prop):
if smtrace.PipelineProxyFilter.should_never_trace(self, prop): return True
# skip filename related properties.
return prop.get_property_name() in [\
"FilePrefix", "XMLFileName", "FilePattern", "FileRange", "FileName",
"FileNames"]
# -----------------------------------------------------------------------------
class ReaderAccessor(smtrace.RealProxyAccessor):
"""This accessor is created instead of the standard one for proxies that
are the temporal readers. This accessor override the
trace_ctor() method to trace the constructor as the RegisterReader() call,
since the proxy is a dummy, in this case.
"""
def __init__(self, varname, proxy, filenameglob):
smtrace.RealProxyAccessor.__init__(self, varname, proxy)
self.FileNameGlob = filenameglob
def trace_ctor(self, ctor, filter, ctor_args=None, skip_assignment=False):
# FIXME: ensures thate FileName doesn't get traced.
# change to call STP.CreateReader instead.
ctor_args = "%s, fileInfo='%s'" % (ctor, self.FileNameGlob)
ctor = "STP.CreateReader"
original_trace = smtrace.RealProxyAccessor.trace_ctor(\
self, ctor, ReaderFilter(), ctor_args, skip_assignment)
trace = smtrace.TraceOutput()
trace.append(original_trace)
trace.append(\
"timeSteps = %s.TimestepValues if len(%s.TimestepValues) != 0 else [0]" % (self, self))
return trace.raw_data()
# -----------------------------------------------------------------------------
class ViewAccessor(smtrace.RealProxyAccessor):
"""Accessor for views. Overrides trace_ctor() to trace registering of the
view with the STP. (I wonder if this registering should be moved to
the end of the state for better readability of the generated state files.
"""
def __init__(self, varname, proxy, screenshot_info):
smtrace.RealProxyAccessor.__init__(self, varname, proxy)
self.ScreenshotInfo = screenshot_info
def trace_ctor(self, ctor, filter, ctor_args=None, skip_assignment=False):
original_trace = smtrace.RealProxyAccessor.trace_ctor(\
self, ctor, filter, ctor_args, skip_assignment)
trace = smtrace.TraceOutput(original_trace)
trace.append_separated(["# register the view with coprocessor",
"# and provide it with information such as the filename to use,",
"# how frequently to write the images, etc."])
params = self.ScreenshotInfo
assert len(params) == 4
trace.append([
"STP.RegisterView(%s," % self,
" filename='%s', magnification=%s, width=%s, height=%s, tp_views)" %\
(params[0], params[1], params[2], params[3])])
trace.append_separator()
return trace.raw_data()
# -----------------------------------------------------------------------------
class WriterAccessor(smtrace.RealProxyAccessor):
"""Accessor for writers. Overrides trace_ctor() to use the actual writer
proxy name instead of the dummy-writer proxy's name.
"""
def __init__(self, varname, proxy):
smtrace.RealProxyAccessor.__init__(self, varname, proxy)
def get_proxy_label(self, xmlgroup, xmlname):
pxm = servermanager.ProxyManager()
prototype = pxm.GetPrototypeProxy(xmlgroup, xmlname)
if not prototype:
# a bit of a hack but we assume that there's a stub of some
# writer that's not available in this build but is available
# with the build used by the simulation code (probably through a plugin)
# this stub must have the proper name in the coprocessing hints
print "WARNING: Could not find", xmlname, "writer in", xmlgroup, \
"XML group. This is not a problem as long as the writer is available with " \
"the ParaView build used by the simulation code."
ctor = servermanager._make_name_valid(xmlname)
else:
ctor = servermanager._make_name_valid(prototype.GetXMLLabel())
# TODO: use servermanager.ProxyManager().NewProxy() instead
# we create the writer proxy such that it is not registered with the
# ParaViewPipelineController, so its state is not sent to ParaView Live.
return "servermanager.%s.%s" % (xmlgroup, ctor)
def trace_ctor(self, ctor, filter, ctor_args=None, skip_assignment=False):
xmlElement = self.get_object().GetHints().FindNestedElementByName("WriterProxy")
xmlgroup = xmlElement.GetAttribute("group")
xmlname = xmlElement.GetAttribute("name")
filename = self.get_object().FileName
ctor = self.get_proxy_label(xmlgroup, xmlname)
original_trace = smtrace.RealProxyAccessor.trace_ctor(\
self, ctor, filter, ctor_args, skip_assignment)
trace = smtrace.TraceOutput(original_trace)
trace.append_separated(["# register the writer with STP",
"# and provide it with information such as the filename to use"])
trace.append("STP.RegisterWriter(%s, '%s', tp_writers)" % \
(self, filename))
trace.append_separator()
return trace.raw_data()
class tpstate_filter_proxies_to_serialize(object):
"""filter used to skip views and representations a when export_rendering is
disabled."""
def __call__(self, proxy):
global export_rendering
if not smstate.visible_representations()(proxy): return False
if (not export_rendering) and \
(proxy.GetXMLGroup() in ["views", "representations"]): return False
return True
def tp_hook(varname, proxy):
global export_rendering, screenshot_info, reader_input_map
"""callback to create our special accessors instead of the default ones."""
pname = smtrace.Trace.get_registered_name(proxy, "sources")
if pname and reader_input_map.has_key(pname):
# this is a reader.
return ReaderAccessor(varname, proxy, reader_input_map[pname])
if pname and proxy.GetHints() and proxy.GetHints().FindNestedElementByName("WriterProxy"):
return WriterAccessor(varname, proxy)
if smtrace.Trace.get_registered_name(proxy, "views"):
# since view is being accessed, ensure that we were indeed saving
# rendering components.
assert export_rendering
return ViewAccessor(varname, proxy, screenshot_info[pname])
raise NotImplementedError
# Start trace
filter = tpstate_filter_proxies_to_serialize()
smtrace.RealProxyAccessor.register_create_callback(tp_hook)
state = smstate.get_state(filter=filter)
smtrace.RealProxyAccessor.unregister_create_callback(tp_hook)
output_contents = """
from paraview.simple import *
from paraview import spatiotemporalparallelism as STP
tp_writers = []
tp_views = []
timeCompartmentSize = %s
globalController, temporalController, timeCompartmentSize = STP.CreateControllers(timeCompartmentSize)
%s
STP.IterateOverTimeSteps(globalController, timeCompartmentSize, timeSteps, tp_writers, tp_views)
""" % (timeCompartmentSize, state)
outFile = open(scriptFileName, 'w')
outFile.write(output_contents)
outFile.close()