Thanks Pat, <br><br>I am trying to compile my first attempt.<br>Although I do find the headers I need, I am having some trouble identifying which libraries I need to link to. <br>For example, I assume that I should be linking to libvtkCoProcessor.so ... Although I find this library in the compilation folder (under bin), I do not find it in the make installed version under lib... <br>
Is this normal ? <br><br>Best, <br>Jacques<br><br><div class="gmail_quote">2010/8/4 pat marion <span dir="ltr"><<a href="mailto:pat.marion@kitware.com">pat.marion@kitware.com</a>></span><br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
Below is a simple cxx program I have used for testing. It creates one sphere per process, positions the sphere as a function of the process id, and the spheres grow/shrink over time.<br><br>Pat<br><br>#include "vtkCPProcessor.h"<br>
#include "vtkCPPythonScriptPipeline.h"<br>#include "vtkMultiProcessController.h"<br>#include "vtkXMLUnstructuredGridReader.h"<br>#include "vtkUnstructuredGrid.h"<br>#include "vtkCPDataDescription.h"<br>
#include "vtkCPInputDataDescription.h"<br>#include "vtkSmartPointer.h"<br>#include "vtkPolyData.h"<br>#include "vtkSphereSource.h"<br><br>#include <stdio.h><br>#include <string><br>
#include <sstream><br><br>static unsigned int procId;<br><br>void myprint(const std::string& str)<br>{<br> printf("driver (%u): %s\n", procId, str.c_str());<br>}<br><br>class DataGenerator {<br>public:<br>
<br> DataGenerator()<br> {<br> this->Sphere = vtkSmartPointer<vtkSphereSource>::New();<br> this->Sphere->SetThetaResolution(30);<br> this->Sphere->SetPhiResolution(30);<br> this->Sphere->SetCenter(procId*4.0, 0, 0);<br>
this->Index = 0;<br> }<br><br> vtkSmartPointer<vtkPolyData> GetNext()<br> {<br> double radius = fabs(sin(0.1 * this->Index));<br> this->Index++;<br> this->Sphere->SetRadius(1.0 + radius);<br>
this->Sphere->Update();<br> vtkSmartPointer<vtkPolyData> ret = vtkSmartPointer<vtkPolyData>::New();<br> ret->DeepCopy(this->Sphere->GetOutput());<br> return ret;<br> }<br><br>protected:<br>
<br> int Index;<br> vtkSmartPointer<vtkSphereSource> Sphere;<br> <br><br>};<br><br>int main(int argc, char* argv[])<br>{<br> if (argc < 3)<br> {<br> printf("Usage: %s <cp python file> <number of steps>\n", argv[0]);<br>
return 1;<br> }<br><br> std::string cpPythonFile = argv[1];<br> int nSteps = atoi(argv[2]);<br><br> myprint("starting coprocessor");<br><br> vtkCPProcessor* processor = vtkCPProcessor::New();<br> processor->Initialize();<br>
vtkCPPythonScriptPipeline* pipeline = vtkCPPythonScriptPipeline::New();<br><br> // mpi was initialized when we called vtkCPPythonScriptPipeline::New()<br> procId = vtkMultiProcessController::GetGlobalController()->GetLocalProcessId();<br>
<br><br> // read the coprocessing python file<br> myprint("loading pipeline python file: " + cpPythonFile);<br> int success = pipeline->Initialize(cpPythonFile.c_str());<br> if (!success)<br> {<br> myprint("aborting");<br>
return 1;<br> }<br><br> processor->AddPipeline(pipeline);<br> pipeline->Delete();<br><br> if (nSteps == 0)<br> {<br> return 0;<br> }<br><br> // create a data source<br> DataGenerator generator;<br>
<br> // do coprocessing<br> double tStart = 0.0;<br> double tEnd = 1.0;<br> double stepSize = (tEnd - tStart)/nSteps;<br><br> vtkCPDataDescription* dataDesc = vtkCPDataDescription::New();<br> dataDesc->AddInput("input");<br>
<br> for (int i = 0; i < nSteps; ++i)<br> {<br><br> double currentTime = tStart + stepSize*i;<br> std::stringstream timeStr;<br> timeStr << "time(" << i << ", " << currentTime << ")";<br>
<br><br> dataDesc->SetTimeData(currentTime, i);<br><br> myprint("call RequestDataDescription, " + timeStr.str());<br> int do_coprocessing = processor->RequestDataDescription(dataDesc);<br><br> if (do_coprocessing)<br>
{<br> myprint("calling CoProcess, " + timeStr.str());<br><br> vtkSmartPointer<vtkDataObject> dataObject =<br> generator.GetNext();<br><br> dataDesc->GetInputDescriptionByName("input")->SetGrid(dataObject);<br>
processor->CoProcess(dataDesc);<br> }<br> }<br><br><br> myprint("finalizing");<br> dataDesc->Delete();<br> processor->Finalize();<br> processor->Delete();<br><br> return 0;<div><div>
</div><div class="h5"><br>}<br>
<br><br><br><div class="gmail_quote">On Wed, Aug 4, 2010 at 12:14 PM, Andy Bauer <span dir="ltr"><<a href="mailto:andy.bauer@kitware.com" target="_blank">andy.bauer@kitware.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
Hi Jacques,<br><br>There is a polyhedra cell type in VTK now -- <a href="http://www.vtk.org/doc/nightly/html/classvtkPolyhedron.html" target="_blank">http://www.vtk.org/doc/nightly/html/classvtkPolyhedron.html</a><br>As far as I know it works with all of the proper filters but since I haven't tried it yet I won't promise that. The good news is that Will Schroeder had a high interest in it and probably worked on some of it so I'd assume that it's working quite well right now.<br>
<br>As for Phasta, it does run in parallel (as props to their developers it was a finalist for the 2009 Gordon Bell prize). The grid is already partitioned and each process runs the adaptor and creates an unstructured grid from its portion of the partitioned mesh. Thus, there isn't any need for mpi calls in the adaptor code. If you had ghost cell information in your partitioned mesh and wanted to get fancy you should be able to add that to your partitioned grid to make some of the filters faster but I haven't tried that.<br>
<font color="#888888">
<br>Andy</font><div><div></div><div><br><br><div class="gmail_quote">On Wed, Aug 4, 2010 at 11:58 AM, Jacques Papper <span dir="ltr"><<a href="mailto:jacques.papper@gmail.com" target="_blank">jacques.papper@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
Thanks a lot Andy, Takuya,<br><br>I'm using the PhastaAdaptor, and the FortranAdaptorAPI as a guide for the moment. <br>I know there were talks of getting POLYHEDRAL cell support in VTK. Do you know if this is there yet?<br>
My dataset is multiregion unstructured polyhedral mesh domain decomposed amongst each processor. <br><br>Is the Phasta code parallelized ? If so, I do not see any MPI statements in the adaptor code ?<br><br>Jacques<br><br>
<div class="gmail_quote">2010/8/4 Andy Bauer <span dir="ltr"><<a href="mailto:andy.bauer@kitware.com" target="_blank">andy.bauer@kitware.com</a>></span><div><div></div><div><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hi Jacques,<br><br>What type of data set do you have? Even though the PHASTA adaptor ( ParaView/CoProcessing/Adaptors/FortranAdaptors/PhastaAdaptor) is for fortran code it may give you an idea. Also stepping through the example in ParaView/CoProcessing/CoProcessor/Testing/Cxx/PythonScriptCoProcessingExample.cxx may help as well.<br>
<br>I'll spend some time this week putting up a skeleton of a simulation code on the coprocessing wiki that should hopefully be easier to follow. I'll let you know when it's done.<br><font color="#888888"><br>
Andy<br><br></font><div class="gmail_quote"><div><div></div><div>
On Wed, Aug 4, 2010 at 8:02 AM, Jacques Papper <span dir="ltr"><<a href="mailto:jacques.papper@gmail.com" target="_blank">jacques.papper@gmail.com</a>></span> wrote:<br></div></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div><div></div><div>
Hi All,<br><br>Sorry for my last post, I figured out that I had wrongly set my PYTHONPATH.. <br>All the tests work ok now. Still interested in CoProcessing adaptors examples though :) <br><br>Thanks <br>Jacques<br><br><div class="gmail_quote">
2010/8/4 Jacques Papper <span dir="ltr"><<a href="mailto:jacques.papper@gmail.com" target="_blank">jacques.papper@gmail.com</a>></span><div><div></div><div><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<br><div class="gmail_quote">Hi All, <br><br>I'm starting to look into the ParaView CoProcessing libraries. <br>I just pulled from git today, and compiled it all up following the guidelines in :<br><a href="http://www.paraview.org/Wiki/CoProcessing" target="_blank">http://www.paraview.org/Wiki/CoProcessing</a><br>
I didn't find :<br><b>BUILD_PYTHON_COPROCESSING_ADAPTOR<br></b>but instead :<br>PARAVIEW_BUILD_PLUGIN_CoProcessingScriptGenerator<br>anyway the compilation went through without any issues.<br>I then tried :<br><br>ctest -R CoProcessing<br>
Test project /users/boreas01/jacques/PARAVIEW/ParaView-bin<br> Start 491: CoProcessingTestPythonScript<br>1/3 Test #491: CoProcessingTestPythonScript ........... Passed 0.45 sec<br> Start 492: CoProcessingPythonScriptGridPlot<br>
2/3 Test #492: CoProcessingPythonScriptGridPlot .......***Failed 0.09 sec<br> Start 493: CoProcessingPythonScriptPressurePlot<br>3/3 Test #493: CoProcessingPythonScriptPressurePlot ...***Failed 0.09 sec<br><br>33% tests passed, 2 tests failed out of 3<br>
<br>Total Test time (real) = 0.68 sec<br><br>The following tests FAILED:<br> 492 - CoProcessingPythonScriptGridPlot (Failed)<br> 493 - CoProcessingPythonScriptPressurePlot (Failed)<br>Errors while running CTest<br>
<br>Is this a problem in my current installation or on the master branch ? <br><br>Finally, I would like to start writing an adaptor to a C++ parallelised code. Can you tell me what is the closest code I can inspire myself from ? <br>
<br><br>Thank you, <br><font color="#888888"><font color="#888888">Jacques<br>
</font></font></div><br><br>PS sorry mixed up the subjects.. <br>
</blockquote></div></div></div><br>
<br></div></div><div>_______________________________________________<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Please keep messages on-topic and check the ParaView Wiki at: <a href="http://paraview.org/Wiki/ParaView" target="_blank">http://paraview.org/Wiki/ParaView</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.paraview.org/mailman/listinfo/paraview" target="_blank">http://www.paraview.org/mailman/listinfo/paraview</a><br>
<br></div></blockquote></div><br>
</blockquote></div></div></div><br>
</blockquote></div><br>
</div></div><br>_______________________________________________<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Please keep messages on-topic and check the ParaView Wiki at: <a href="http://paraview.org/Wiki/ParaView" target="_blank">http://paraview.org/Wiki/ParaView</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.paraview.org/mailman/listinfo/paraview" target="_blank">http://www.paraview.org/mailman/listinfo/paraview</a><br>
<br></blockquote></div><br>
</div></div></blockquote></div><br>