<div dir="ltr">You can simply delete this line:<div><br></div><div><span style="font-family:arial,sans-serif;font-size:13px">Grid-></span><span style="font-family:arial,sans-serif;font-size:13px">SetNumberOfScalarComponents(2)</span><span style="font-family:arial,sans-serif;font-size:13px">;</span><br>
</div><div><span style="font-family:arial,sans-serif;font-size:13px"><br></span></div><div style><span style="font-family:arial,sans-serif;font-size:13px">It is redundant given the </span><font face="arial, sans-serif">following later:</font></div>
<div style><font face="arial, sans-serif"><br></font></div><div style><span style="font-family:arial,sans-serif;font-size:13px">field->SetNumberOfComponents(</span><span style="font-family:arial,sans-serif;font-size:13px">2);</span><font face="arial, sans-serif"><br>
</font></div><div style><span style="font-family:arial,sans-serif;font-size:13px"><br></span></div><div style><span style="font-family:arial,sans-serif;font-size:13px">You also need to #include <vtkSmartPointer.h>.</span></div>
<div style><span style="font-family:arial,sans-serif;font-size:13px"><br></span></div><div style><span style="font-family:arial,sans-serif;font-size:13px">Best,</span></div><div style><span style="font-family:arial,sans-serif;font-size:13px">-berk</span></div>
<div style><font face="arial, sans-serif"><br></font></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, Mar 19, 2013 at 2:31 PM, Pettey . Lucas <span dir="ltr"><<a href="mailto:LPettey@drc.com" target="_blank">LPettey@drc.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hello everyone,<br>
<br>
I am trying to run a simple Fortran coprocessing example with a complex data type. I am following the example here:<br>
<br>
<a href="http://en.wikibooks.org/wiki/Parallel_Spectral_Numerical_Methods/Visualization_with_ParaView_CoProcessing#ParaView_CoProcessing_Resources" target="_blank">http://en.wikibooks.org/wiki/Parallel_Spectral_Numerical_Methods/Visualization_with_ParaView_CoProcessing#ParaView_CoProcessing_Resources</a><br>
<br>
I have written a basic Fortran code that outputs the data in binary, opened that in ParaView, output the coprocessing script and then written the adaptor following the example in the above link. My adaptor looks like:<br>
<br>
extern "C" void createcpimagedata_(int* nx, int* ny, int* nz)<br>
{<br>
if (!ParaViewCoProcessing::GetCoProcessorData()) {<br>
vtkGenericWarningMacro("Unable to access CoProcessorData.");<br>
return;<br>
}<br>
<br>
// The simulation grid is a 2-dimensional topologically and geometrically<br>
// regular grid. In VTK/ParaView, this is considered an image data set.<br>
vtkImageData* Grid = vtkImageData::New();<br>
<br>
// assuming dimZ == 1 for now<br>
Grid->SetDimensions(*nx, *ny, *nz);<br>
Grid->SetNumberOfScalarComponents(2);<br>
<br>
// Setting the Origin and Spacing are also options.<br>
<br>
// Name should be consistent between here, Fortran and Python client script.<br>
ParaViewCoProcessing::GetCoProcessorData()->GetInputDescriptionByName("input")->SetGrid(Grid);<br>
}<br>
<br>
// Add field(s) to the data container.<br>
// Separate from above because this will be dynamic, grid is static.<br>
// Might be an issue, VTK probably assumes row major, but<br>
// omeg probably passed column major...<br>
// by hand name mangling for fortran<br>
extern "C" void addfield_(double* scalars, char* name)<br>
{<br>
vtkCPInputDataDescription *idd = ParaViewCoProcessing::GetCoProcessorData()->GetInputDescriptionByName("input");<br>
<br>
vtkImageData* Image = vtkImageData::SafeDownCast(idd->GetGrid());<br>
<br>
if (!Image) {<br>
vtkGenericWarningMacro("No adaptor grid to attach field data to.");<br>
return;<br>
}<br>
<br>
<br>
// field name must match that in the fortran code.<br>
if (idd->IsFieldNeeded(name)) {<br>
vtkSmartPointer<vtkDoubleArray> field = vtkSmartPointer<vtkDoubleArray>::New();<br>
field->SetNumberOfComponents(2);<br>
field->SetName(name);<br>
field->SetArray(scalars, 2* Image->GetNumberOfPoints(), 1);<br>
Image->GetPointData()->AddArray(field);<br>
<br>
}<br>
}<br>
<br>
I am getting some errors from the Makefile generated by Cmake:<br>
<br>
/Users/lucaspettey/codes/BEC/coprocVTK.cxx:40:38: error: too few arguments to function call, expected 2, have 1<br>
Grid->SetNumberOfScalarComponents(2);<br>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^<br>
/Users/lucaspettey/ParaView-git/ParaView/VTK/Common/DataModel/vtkImageData.h:298:3: note: 'SetNumberOfScalarComponents' declared here<br>
static void SetNumberOfScalarComponents( int n, vtkInformation* meta_data);<br>
^<br>
/Users/lucaspettey/codes/BEC/coprocVTK.cxx:67:5: error: unknown type name 'vtkSmartPointer'; did you mean 'vtkSmartPointerBase'?<br>
vtkSmartPointer<vtkDoubleArray> field = vtkSmartPointer<vtkDoubleArray>::New();<br>
^~~~~~~~~~~~~~~<br>
vtkSmartPointerBase<br>
/Users/lucaspettey/ParaView-git/ParaView/VTK/Common/Core/vtkOStreamWrapper.h:36:7: note: 'vtkSmartPointerBase' declared here<br>
class vtkSmartPointerBase;<br>
^<br>
/Users/lucaspettey/codes/BEC/coprocVTK.cxx:67:20: error: expected unqualified-id<br>
vtkSmartPointer<vtkDoubleArray> field = vtkSmartPointer<vtkDoubleArray>::New();<br>
^<br>
/Users/lucaspettey/codes/BEC/coprocVTK.cxx:68:5: error: use of undeclared identifier 'field'<br>
field->SetNumberOfComponents(2);<br>
^<br>
/Users/lucaspettey/codes/BEC/coprocVTK.cxx:69:5: error: use of undeclared identifier 'field'<br>
field->SetName(name);<br>
^<br>
/Users/lucaspettey/codes/BEC/coprocVTK.cxx:70:5: error: use of undeclared identifier 'field'<br>
field->SetArray(scalars, 2* Image->GetNumberOfPoints(), 1);<br>
^<br>
/Users/lucaspettey/codes/BEC/coprocVTK.cxx:71:37: error: use of undeclared identifier 'field'<br>
Image->GetPointData()->AddArray(field);<br>
^<br>
<br>
Any help is appreciated.<br>
<br>
Thanks,<br>
Lucas<br>
<br>
________________________________<br>
This electronic message transmission and any attachments that accompany it contain information from DRCĀ® (Dynamics Research Corporation) or its subsidiaries, or the intended recipient, which is privileged, proprietary, business confidential, or otherwise protected from disclosure and is the exclusive property of DRC and/or the intended recipient. The information in this email is solely intended for the use of the individual or entity that is the intended recipient. If you are not the intended recipient, any use, dissemination, distribution, retention, or copying of this communication, attachments, or substance is prohibited. If you have received this electronic transmission in error, please immediately reply to the author via email that you received the message by mistake and also promptly and permanently delete this message and all copies of this email and any attachments. We thank you for your assistance and apologize for any inconvenience.<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>
</blockquote></div><br></div>