Skip to content

Commit

Permalink
Add initial Catalyst co-processing output.
Browse files Browse the repository at this point in the history
git-svn-id: https://svn.isais.edf.fr/mfee/saturne/trunk@5038 e44c5d27-f830-0410-8ce8-974f7a764be6
  • Loading branch information
Yvan Fournier committed Jun 26, 2013
1 parent cd9441b commit f8dcbd4
Show file tree
Hide file tree
Showing 17 changed files with 1,881 additions and 22 deletions.
1 change: 1 addition & 0 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ sbin/rmb \
config/cs_auto_flags.sh \
m4/acx_pthread.m4 \
m4/cs_blas.m4 \
m4/cs_catalyst.m4 \
m4/cs_ccm.m4 \
m4/cs_cgns.m4 \
m4/cs_docs.m4 \
Expand Down
2 changes: 2 additions & 0 deletions NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ Changes:
Architectural changes
---------------------

- Added experimental ParaView Catalyst co-processing output option.

- Added new all-to-all infrastructure, allowing alternative algorithms such as
Crystal Router to MPI_Altoall/MPI_alltoallv as an option.

Expand Down
10 changes: 10 additions & 0 deletions build-aux/catalyst/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
cmake_minimum_required(VERSION 2.6)

PROJECT(CoProcessingTest)

FIND_PACKAGE(ParaView REQUIRED)
INCLUDE(${PARAVIEW_USE_FILE})

ADD_EXECUTABLE(CoProcessingTest CoProcessingTest.cxx)
TARGET_LINK_LIBRARIES(CoProcessingTest vtkPVCatalyst vtkPVPythonCatalystPythonD)

119 changes: 119 additions & 0 deletions build-aux/catalyst/CoProcessingTest.cxx
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
#include "vtkCPDataDescription.h"
#include "vtkCPInputDataDescription.h"
#include "vtkCPProcessor.h"
#include "vtkCPPythonScriptPipeline.h"
#include "vtkElevationFilter.h"
#include "vtkPolyData.h"
#include "vtkSmartPointer.h"
#include "vtkSphereSource.h"
#include "vtkXMLUnstructuredGridReader.h"

#include <mpi.h>
#include <string>

class DataGenerator {
public:
DataGenerator()
{
this->Sphere = vtkSmartPointer<vtkSphereSource>::New();
this->Sphere->SetThetaResolution(30);
this->Sphere->SetPhiResolution(30);
int procId;
MPI_Comm_rank(MPI_COMM_WORLD, &procId);
this->Sphere->SetCenter(procId*4.0, 0, 0);
this->Elevation = vtkSmartPointer<vtkElevationFilter>::New();
this->Elevation->SetInputConnection(this->Sphere->GetOutputPort());
this->Index = 0;
}

vtkSmartPointer<vtkPolyData> GetNext()
{
double radius = fabs(sin(0.1 * this->Index));
this->Index++;
this->Sphere->SetRadius(1.0 + radius);
this->Elevation->Update();
vtkSmartPointer<vtkPolyData> ret = vtkSmartPointer<vtkPolyData>::New();
ret->DeepCopy(this->Elevation->GetOutput());
return ret;
}

protected:
int Index;
vtkSmartPointer<vtkSphereSource> Sphere;
vtkSmartPointer<vtkElevationFilter> Elevation;
};

int main(int argc, char* argv[])
{
if (argc < 3)
{
printf("Usage: %s <python coprocessing script> <number of time steps>\n", argv[0]);
return 1;
}
// we assume that this is done in parallel
MPI_Init(&argc, &argv);

std::string cpPythonFile = argv[1];
int nSteps = atoi(argv[2]);

vtkCPProcessor* processor = vtkCPProcessor::New();
processor->Initialize();
vtkCPPythonScriptPipeline* pipeline = vtkCPPythonScriptPipeline::New();

// read the coprocessing python file
if(pipeline->Initialize(cpPythonFile.c_str()) == 0)
{
cout << "Problem reading the python script.\n";
return 1;
}

processor->AddPipeline(pipeline);
pipeline->Delete();

if (nSteps == 0)
{
return 0;
}

// create a data source, typically this will come from the adaptor
// but here we use generator to create it ourselves
DataGenerator generator;

// do coprocessing
double tStart = 0.0;
double tEnd = 1.0;
double stepSize = (tEnd - tStart)/nSteps;

vtkCPDataDescription* dataDesc = vtkCPDataDescription::New();
dataDesc->AddInput("input");

for (int i = 0; i < nSteps; ++i)
{
double currentTime = tStart + stepSize*i;
// set the current time and time step
dataDesc->SetTimeData(currentTime, i);

// check if the script says we should do coprocessing now
if(processor->RequestDataDescription(dataDesc) != 0)
{
// we are going to do coprocessing so use generator to
// create our grid at this timestep and provide it to
// the coprocessing library
vtkSmartPointer<vtkDataObject> dataObject =
generator.GetNext();

dataDesc->GetInputDescriptionByName("input")->SetGrid(dataObject);
processor->CoProcess(dataDesc);
}
}

dataDesc->Delete();
processor->Finalize();
processor->Delete();

MPI_Finalize();

return 0;
}


2 changes: 2 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -504,6 +504,7 @@ CS_AC_TEST_EOS
CS_AC_TEST_ZLIB
CS_AC_TEST_SALOME
CS_AC_TEST_MEDCOUPLING
CS_AC_TEST_CATALYST

CS_AC_TEST_DOCS

Expand Down Expand Up @@ -951,6 +952,7 @@ echo " MEDCoupling support: "$cs_have_medcoupling""
if test x$cs_have_medcoupling = xyes ; then
echo " ParaMEDMEM support: "$cs_have_paramedmem""
fi
echo " Catalyst (ParaView co-processing) support: "$cs_have_catalyst""
echo " EOS support: "$cs_have_eos""
echo " SALOME GUI support: "$cs_have_salome_gui""
echo " SALOME Kernel support: "$cs_have_salome_kernel""
Expand Down
1 change: 1 addition & 0 deletions docs/style/csmacros.sty
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
\newcommand{\ensightg}{EnSight Gold\xspace}
\newcommand{\fluent}{FLUENT\xspace}
\newcommand{\bft}{BFT\xspace}
\newcommand{\catalyst}{Catalyst\xspace}
\newcommand{\fvm}{FVM\xspace}
\newcommand{\gambit}{GAMBIT\xspace}
\newcommand{\gmsh}{Gmsh\xspace}
Expand Down
47 changes: 45 additions & 2 deletions docs/user/saturne1.tex
Original file line number Diff line number Diff line change
Expand Up @@ -812,7 +812,8 @@ \subsection{Supported mesh and post-processing output formats
\item \hyperref[sec:fmtdesc_ensightg]{\ensightg}
\item \hyperref[sec:fmtdesc_neu]{\gambit neutral}
\item \hyperref[sec:fmtdesc_gmsh]{\gmsh}
\item \hyperref[fmtdesc:ccm]{STAR-CCM+}
\item \hyperref[sec:fmtdesc:ccm]{STAR-CCM+}
\item \hyperref[sec:fmtdesc_catalyst]{\catalyst (co-processing)}
\end{list}

These formats are described in greater detail in the following sections.
Expand Down Expand Up @@ -1279,7 +1280,7 @@ \subsubsubsection{CGNS}\hyperdef{sec}{cgns}{}
\end{tabular}

\subsubsubsection{\starccmp%
\label{fmtdesc:ccm}}
\label{sec:fmtdesc:ccm}}

This polyhedral format is the current CD-Adapco format, and is based on
CD-Adapco's libccmio, which is based on ADF (the low-level file format
Expand Down Expand Up @@ -1336,6 +1337,48 @@ \subsubsubsection{\starccmp%
\hline
\end{tabular}

%==================================
\subsubsection{Formats supported for output only\label{sec:formats_out}}
%==================================

\subsubsubsection{\catalyst%
\label{sec:fmtdesc_catalyst}}

This is not a ``true'' output format in the sense that output is not written
directly to file, but is exported to the \catalyst co-processor.
In turn, this co-processor will execute operations based on a
special \paraview Python script, and directly generate output such
as images or movies.

Co-processing scripts may be generated using \paraview 4, with the
CoProcessing plugin, using initial output in another format (such as \ensightg).
A \CS postprocessing writer will try to read a script named
\texttt{\emph{<writer\_name>}.py}, which should be places in a case's
\texttt{DATA} directory.

Note the this output is still an an experimental stage, and is heavily
dependent on \paraview. Some operations may work very well, while other,
similar operations may fail.

\smallskip \noindent
\begin{tabular}[top]{|p{4.5cm}%
|>{\PreserveBackslash\raggedright\hspace{0pt}}p{10.5cm}|}
\hline
Default extension: & not applicable\\
\hline
File type: & co-processing\\
\hline
Surface elements: & triangles, quadrangles, polygons\\
\hline
Volume elements: & tetrahedra, pyramids, prisms, hexahedra, convex polyhedra\\
\hline
Compatibility: & \catalyst from \href{http://paraview.org}{\paraview} 4.0\\
\hline
Documentation: & online documentation and Wiki, at:
\url{http://paraview.org/Wiki/Main_Page}\\
\hline
\end{tabular}

%==================================
\subsubsection{Meshing tools and associated formats}
%==================================
Expand Down
2 changes: 1 addition & 1 deletion gui/Pages/OutputControlModel.py
Original file line number Diff line number Diff line change
Expand Up @@ -453,7 +453,7 @@ def setWriterFormat(self, writer_id, format):
Set the format for a writer
"""
self.isInList(writer_id, self.getWriterIdList())
self.isInList(format, ('ensight', 'med', 'cgns', 'ccm'))
self.isInList(format, ('ensight', 'med', 'cgns', 'catalyst', 'ccm'))
node = self.node_out.xmlInitNode('writer', 'label', id = writer_id)
n = node.xmlInitNode('format')
n['name'] = format
Expand Down
19 changes: 14 additions & 5 deletions gui/Pages/OutputControlView.py
Original file line number Diff line number Diff line change
Expand Up @@ -200,13 +200,14 @@ def createEditor(self, parent, option, index):
editor.addItem(QString("EnSight"))
editor.addItem(QString("MED"))
editor.addItem(QString("CGNS"))
editor.addItem(QString("Catalyst"))
editor.addItem(QString("CCM-IO"))
editor.installEventFilter(self)
return editor


def setEditorData(self, comboBox, index):
dico = {"ensight": 0, "med": 1, "cgns": 2, "ccm": 3}
dico = {"ensight": 0, "med": 1, "cgns": 2, "catalyst": 3, "ccm": 4}
row = index.row()
string = index.model().dataWriter[row]['format']
idx = dico[string]
Expand Down Expand Up @@ -747,10 +748,12 @@ def populateModel(self):
self.dicoV2M= {"EnSight": 'ensight',
"MED" : 'med',
"CGNS": 'cgns',
"Catalyst": 'catalyst',
"CCM-IO": 'ccm'}
self.dicoM2V= {"ensight" : 'EnSight',
"med" : 'MED',
"cgns": 'CGNS',
"catalyst": 'Catalyst',
"ccm": 'CCM-IO'}
for id in self.mdl.getWriterIdList():
row = self.rowCount()
Expand Down Expand Up @@ -1950,24 +1953,30 @@ def __updateOptionsFormat(self, options, row):

# enable and disable options related to the format

self.modelPolygon.enableItem(str_model='discard_polygons')
self.modelPolygon.enableItem(str_model='divide_polygons')
self.modelPolyhedra.enableItem(str_model='discard_polyhedra')
self.modelPolyhedra.enableItem(str_model='divide_polyhedra')
self.comboBoxPolygon.setEnabled(True)
self.comboBoxPolyhedra.setEnabled(True)

if format != "ensight":
if format == "cgns":
self.modelPolyhedra.setItem(str_model='divide_polyhedra')
self.modelPolyhedra.disableItem(str_model='display')
elif format == "ccm":
elif format in [ "catalyst", "ccm" ]:
self.modelPolygon.disableItem(str_model='discard_polygons')
self.modelPolygon.disableItem(str_model='divide_polygons')
self.modelPolyhedra.disableItem(str_model='discard_polyhedra')
self.modelPolyhedra.disableItem(str_model='divide_polyhedra')

self.comboBoxPolygon.setEnabled(False)
self.comboBoxPolyhedra.setEnabled(False)
self.modelFormat.setItem(str_model="binary")
self.comboBoxFormat.setEnabled(False)
else:
self.modelFormat.enableItem(str_model='text')
self.modelFormat.enableItem(str_model='big_endian')
self.comboBoxFormat.setEnabled(True)
self.modelPolyhedra.enableItem(str_model='display')
self.comboBoxPolyhedra.setEnabled(True)


def __insertMesh(self, name, mesh_id, mesh_type, selection):
Expand Down
22 changes: 13 additions & 9 deletions gui/Pages/SolutionVerifView.py
Original file line number Diff line number Diff line change
Expand Up @@ -392,6 +392,7 @@ def __init__(self, parent, case):
self.modelFMTCHR.addItem(self.tr("EnSight Gold"), 'ensight')
self.modelFMTCHR.addItem(self.tr("MED"), 'med')
self.modelFMTCHR.addItem(self.tr("CGNS"), 'cgns')
self.modelFMTCHR.addItem(self.tr("Catalyst"), 'catalyst')
self.modelFMTCHR.addItem(self.tr("CCM-IO"), 'ccm')

self.modelFormat.addItem(self.tr("binary"), 'binary')
Expand Down Expand Up @@ -507,17 +508,22 @@ def __updateOptionsFormat(self, line):

# enable and disable options related to the format

if format != "ensight":
self.modelPolygon.enableItem(str_model='discard_polygons')
self.modelPolygon.enableItem(str_model='divide_polygons')
self.modelPolyhedra.enableItem(str_model='discard_polyhedra')
self.modelPolyhedra.enableItem(str_model='divide_polyhedra')
self.comboBoxPolygon.setEnabled(True)
self.comboBoxPolyhedra.setEnabled(True)

if format != "ensight":
if format == "cgns":
self.modelPolyhedra.setItem(str_model='divide_polyhedra')
self.modelPolyhedra.disableItem(str_model='display')
elif format == "ccm":
self.modelPolygon.disableItem(str_model='divide_polygons')
self.modelPolygon.disableItem(str_model='discard_polygons')
self.modelPolyhedra.disableItem(str_model='divide_polyhedra')
self.modelPolyhedra.disableItem(str_model='discard_polyhedra')

elif format in ["catalyst", "ccm"]:
self.modelPolyhedra.setItem(str_model='display')
self.modelPolygon.setItem(str_model='display')
self.comboBoxPolygon.setEnabled(False)
self.comboBoxPolyhedra.setEnabled(False)
self.modelFormat.setItem(str_model="binary")
self.modelFormat.disableItem(str_model='text')
self.labelBigEndian.setEnabled(False)
Expand All @@ -527,8 +533,6 @@ def __updateOptionsFormat(self, line):
self.comboBoxFormat.setEnabled(True)
self.labelBigEndian.setEnabled(True)
self.checkBoxBigEndian.setEnabled(True)
self.modelPolyhedra.enableItem(str_model='display')
self.comboBoxPolyhedra.setEnabled(True)


def __setButtonEnabled(self):
Expand Down
Loading

0 comments on commit f8dcbd4

Please sign in to comment.