# Returning data to simulation from catalyst

**URL:** https://discourse.paraview.org/t/returning-data-to-simulation-from-catalyst/4734
**Category:** In Situ Support
**Created:** [July 1, 2020, 6:44pm UTC](https://discourse.paraview.org/t/returning-data-to-simulation-from-catalyst/4734 "2020-07-01T18:44:49Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![Seshu](https://discourse.paraview.org/user_avatar/discourse.paraview.org/seshu/32/4385_2.png) [@Seshu](https://discourse.paraview.org/u/Seshu)
#### Post date: [July 1, 2020, 6:44pm UTC](https://discourse.paraview.org/t/returning-data-to-simulation-from-catalyst/4734/1 "2020-07-01T18:44:49Z")

</div>

Is it possible to return data from a catalyst python pipeline to say a c++ simulation?

I think I have some idea of how to return a rendered image with vtk to the simulation.

---

<div class="post-metadata">

### Author: ![Andy\_Bauer](https://discourse.paraview.org/user_avatar/discourse.paraview.org/andy_bauer/32/5442_2.png) [@Andy\_Bauer](https://discourse.paraview.org/u/Andy_Bauer)
#### Post date: [July 1, 2020, 9:01pm UTC](https://discourse.paraview.org/t/returning-data-to-simulation-from-catalyst/4734/2 "2020-07-01T21:01:46Z")

</div>

This should be possible but it’s going to take some customization between the adaptor and the Python scripts. I think you may be able to avoid modifying Catalyst directly to accomplish this goal though.

---

<div class="post-metadata">

### Author: ![Seshu](https://discourse.paraview.org/user_avatar/discourse.paraview.org/seshu/32/4385_2.png) [@Seshu](https://discourse.paraview.org/u/Seshu)
#### Post date: [July 2, 2020, 6:02pm UTC](https://discourse.paraview.org/t/returning-data-to-simulation-from-catalyst/4734/3 "2020-07-02T18:02:16Z")

</div>

I guess what you want to do is after calling CoProcess, loop over all the pipelines and see if they have anything to return. After looking through the paraview code though, [this](https://github.com/Kitware/ParaView/blob/master/Clients/PythonCatalyst/vtkCPPythonScriptPipeline.cxx#L216) makes it seem like its not possible right now.

Alternatively another option is to just have the pipeline save an image and read the image back into the simulation. Thats not very efficient though.

I could just not use catalyst and call vtk directly for now I guess? I really like the idea of a user being able to make their own pipeline and pick which one they want to use at runtime.

---

<div class="post-metadata">

### Author: ![Seshu](https://discourse.paraview.org/user_avatar/discourse.paraview.org/seshu/32/4385_2.png) [@Seshu](https://discourse.paraview.org/u/Seshu)
#### Post date: [July 2, 2020, 6:48pm UTC](https://discourse.paraview.org/t/returning-data-to-simulation-from-catalyst/4734/4 "2020-07-02T18:48:58Z")

</div>

Just doing some more digging, I believe the root of the problem is here: [https://github.com/Kitware/VTK/blob/master/Utilities/PythonInterpreter/vtkPythonInterpreter.cxx#L595](https://github.com/Kitware/VTK/blob/master/Utilities/PythonInterpreter/vtkPythonInterpreter.cxx#L595)

From what I’ve read PyRun\_SimpleString does not let you get at the return value of the string it executes. You need to use PyRun\_String for that.
