[Paraview] CoProcessing with Fortran and ParaView 3.98
Pettey . Lucas
LPettey at drc.com
Thu Mar 21 15:31:30 EDT 2013
Yes I did. I have attached the latest script.
Thank you for your valiant efforts in trying to solve this problem.
Lucas
________________________________
From: Andy Bauer [andy.bauer at kitware.com]
Sent: Thursday, March 21, 2013 2:22 PM
To: Pettey . Lucas
Cc: paraview [paraview at paraview.org]
Subject: Re: [Paraview] CoProcessing with Fortran and ParaView 3.98
Did you also include the w.UpdatePipeline() part after the writer was created? It won't create the file unless that's in there.
Andy
On Thu, Mar 21, 2013 at 3:17 PM, Pettey . Lucas <LPettey at drc.com<mailto:LPettey at drc.com>> wrote:
Hi Andy,
Changing to Scalars=['POINTS','psi01'] did not change anything. I still get the same error and blank image.
I tried adding the XMLPImageDataWriter command, but no file 'fullgrid.pvti' was produced so I can't tell what is being populated into the grid.
I hardwired the C++ adaptor to 'psi01' rather than the character array name in case their was a problem with the way the string was passed. I had checked that name contained the correct characters, but I figured hardwiring would be safer at this stage.
Anything else that you think I should try?
Thanks,
Lucas
________________________________
From: paraview-bounces at paraview.org<mailto:paraview-bounces at paraview.org> [paraview-bounces at paraview.org<mailto:paraview-bounces at paraview.org>] on behalf of Andy Bauer [andy.bauer at kitware.com<mailto:andy.bauer at kitware.com>]
Sent: Thursday, March 21, 2013 12:49 PM
To: Pettey . Lucas
Cc: paraview [paraview at paraview.org<mailto:paraview at paraview.org>]
Subject: Re: [Paraview] CoProcessing with Fortran and ParaView 3.98
I think the problem is that:
Clip1 = Clip( guiName="Clip1", InsideOut=0, Scalars=['POINTS', ''], Value=95.0, UseValueAsOffset=0, Crinkleclip=0, ClipType="Scalar" )
Should probably have the name of the point data field set in it. Do this with (assuming psi01 is the name of the field you want to clip with respect to:
Scalars=['POINTS', 'psi01']
My guess is that the scalar field isn't getting set properly. Try adding in:
w = XMLPImageDataWriter(Input=psi01_, FileName = 'fullgrid.pvti')
w.UpdatePipeline()
right after the CreateProducer() method to see what's in your grid.
By the way, does adding in the "//char(0)" work for converting Fortran strings to C/C++ strings (e.g. in "call addfield(psi,"psi01"//char(0))") ? If it does, will it also work for Fortran77? That's a neat little trick!
Andy
On Wed, Mar 20, 2013 at 5:29 PM, Pettey . Lucas <LPettey at drc.com<mailto:LPettey at drc.com><mailto:LPettey at drc.com<mailto:LPettey at drc.com>>> wrote:
I have solved the C++ to Fortran array issues, but I am still not getting a meaningful visualization. I have attached the latest files, including a screenshot of the exported state and the resulting image that is produced by the coprocessor.
The coprocessor is generating an error:
ERROR: In /Users/lucaspettey/ParaView-git/ParaView/VTK/Filters/General/vtkTableBasedClipDataSet.cxx, line 1956
vtkPVClipDataSet (0x7feaa4998550): no input scalars.
This error is not appearing at the time=0 co-process, but it is appearing each time step the co-processor is being asked to write an image. All of the images are the same blank axes as in the attached image0.png.
I'm not sure what to try next so any help is appreciated.
Thanks,
Lucas
________________________________________
From: paraview-bounces at paraview.org<mailto:paraview-bounces at paraview.org><mailto:paraview-bounces at paraview.org<mailto:paraview-bounces at paraview.org>> [paraview-bounces at paraview.org<mailto:paraview-bounces at paraview.org><mailto:paraview-bounces at paraview.org<mailto:paraview-bounces at paraview.org>>] on behalf of Pettey . Lucas [LPettey at drc.com<mailto:LPettey at drc.com><mailto:LPettey at drc.com<mailto:LPettey at drc.com>>]
Sent: Wednesday, March 20, 2013 11:45 AM
To: Andy Bauer
Cc: paraview [paraview at paraview.org<mailto:paraview at paraview.org><mailto:paraview at paraview.org<mailto:paraview at paraview.org>>]
Subject: Re: [Paraview] CoProcessing with Fortran and ParaView 3.98
So after some troubleshooting it seems that C++ doesn't like the complex data type the way Fortran is sending it.
The code runs when I just send a real value. Images appear, but of course they are meaningless since it isn't the correct data. I may try passing the real and imaginary separate. I may also look into row/column order issues although this grid is 100x100x100 so it shouldn't affect anything.
Lucas
________________________________________
From: paraview-bounces at paraview.org<mailto:paraview-bounces at paraview.org><mailto:paraview-bounces at paraview.org<mailto:paraview-bounces at paraview.org>> [paraview-bounces at paraview.org<mailto:paraview-bounces at paraview.org><mailto:paraview-bounces at paraview.org<mailto:paraview-bounces at paraview.org>>] on behalf of Pettey . Lucas [LPettey at drc.com<mailto:LPettey at drc.com><mailto:LPettey at drc.com<mailto:LPettey at drc.com>>]
Sent: Wednesday, March 20, 2013 11:12 AM
To: Andy Bauer
Cc: paraview [paraview at paraview.org<mailto:paraview at paraview.org><mailto:paraview at paraview.org<mailto:paraview at paraview.org>>]
Subject: Re: [Paraview] CoProcessing with Fortran and ParaView 3.98
Hi Andy and Berk,
Here is the error that I am receiving.
I know that it is initializing ok and failing at the first call to the co-processor. I have attached my python script output as well as my test code and adaptors.
CoProcessingExample(19247,0x7fff77470180) malloc: *** mmap(size=3739605888335872) failed (error code=12)
*** error: can't allocate region
*** set a breakpoint in malloc_error_break to debug
Operating system error: Cannot allocate memory
Memory allocation failed
Thanks for the help,
Lucas
From: Andy Bauer [andy.bauer at kitware.com<mailto:andy.bauer at kitware.com><mailto:andy.bauer at kitware.com<mailto:andy.bauer at kitware.com>>]
Sent: Wednesday, March 20, 2013 9:08 AM
To: Pettey . Lucas
Cc: Berk Geveci; paraview [paraview at paraview.org<mailto:paraview at paraview.org><mailto:paraview at paraview.org<mailto:paraview at paraview.org>>]
Subject: Re: [Paraview] CoProcessing with Fortran and ParaView 3.98
Hi Lucas,
Can you share your co-processing script and any run output? There may be warnings in the output or info in the script that will help figure that out.
Thanks,
Andy
On Wed, Mar 20, 2013 at 10:04 AM, Pettey . Lucas <LPettey at drc.com<mailto:LPettey at drc.com><mailto:LPettey at drc.com<mailto:LPettey at drc.com>><mailto:LPettey at drc.com<mailto:LPettey at drc.com><mailto:LPettey at drc.com<mailto:LPettey at drc.com>>>> wrote:
Hi Berk,
Thanks for the help.
I found that this example is written based on an earlier version of VTK so some of the function calls have changed. Based on your advice and some of the examples contained in the ParaView wiki, I have gotten it to compile and run.
Now I just have to figure out why it isn't generating any VTK objects....
Probably something wrong with my python co-processing script.
Thanks
Lucas
________________________________
From: Berk Geveci [berk.geveci at kitware.com<mailto:berk.geveci at kitware.com><mailto:berk.geveci at kitware.com<mailto:berk.geveci at kitware.com>><mailto:berk.geveci at kitware.com<mailto:berk.geveci at kitware.com><mailto:berk.geveci at kitware.com<mailto:berk.geveci at kitware.com>>>]
Sent: Tuesday, March 19, 2013 6:48 PM
To: Pettey . Lucas
Cc: paraview [paraview at paraview.org<mailto:paraview at paraview.org><mailto:paraview at paraview.org<mailto:paraview at paraview.org>><mailto:paraview at paraview.org<mailto:paraview at paraview.org><mailto:paraview at paraview.org<mailto:paraview at paraview.org>>>]
Subject: Re: [Paraview] CoProcessing with Fortran and ParaView 3.98
You can simply delete this line:
Grid->SetNumberOfScalarComponents(2);
It is redundant given the following later:
field->SetNumberOfComponents(2);
You also need to #include <vtkSmartPointer.h>.
Best,
-berk
On Tue, Mar 19, 2013 at 2:31 PM, Pettey . Lucas <LPettey at drc.com<mailto:LPettey at drc.com><mailto:LPettey at drc.com<mailto:LPettey at drc.com>><mailto:LPettey at drc.com<mailto:LPettey at drc.com><mailto:LPettey at drc.com<mailto:LPettey at drc.com>>><mailto:LPettey at drc.com<mailto:LPettey at drc.com><mailto:LPettey at drc.com<mailto:LPettey at drc.com>><mailto:LPettey at drc.com<mailto:LPettey at drc.com><mailto:LPettey at drc.com<mailto:LPettey at drc.com>>>>> wrote:
Hello everyone,
I am trying to run a simple Fortran coprocessing example with a complex data type. I am following the example here:
http://en.wikibooks.org/wiki/Parallel_Spectral_Numerical_Methods/Visualization_with_ParaView_CoProcessing#ParaView_CoProcessing_Resources
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:
extern "C" void createcpimagedata_(int* nx, int* ny, int* nz)
{
if (!ParaViewCoProcessing::GetCoProcessorData()) {
vtkGenericWarningMacro("Unable to access CoProcessorData.");
return;
}
// The simulation grid is a 2-dimensional topologically and geometrically
// regular grid. In VTK/ParaView, this is considered an image data set.
vtkImageData* Grid = vtkImageData::New();
// assuming dimZ == 1 for now
Grid->SetDimensions(*nx, *ny, *nz);
Grid->SetNumberOfScalarComponents(2);
// Setting the Origin and Spacing are also options.
// Name should be consistent between here, Fortran and Python client script.
ParaViewCoProcessing::GetCoProcessorData()->GetInputDescriptionByName("input")->SetGrid(Grid);
}
// Add field(s) to the data container.
// Separate from above because this will be dynamic, grid is static.
// Might be an issue, VTK probably assumes row major, but
// omeg probably passed column major...
// by hand name mangling for fortran
extern "C" void addfield_(double* scalars, char* name)
{
vtkCPInputDataDescription *idd = ParaViewCoProcessing::GetCoProcessorData()->GetInputDescriptionByName("input");
vtkImageData* Image = vtkImageData::SafeDownCast(idd->GetGrid());
if (!Image) {
vtkGenericWarningMacro("No adaptor grid to attach field data to.");
return;
}
// field name must match that in the fortran code.
if (idd->IsFieldNeeded(name)) {
vtkSmartPointer<vtkDoubleArray> field = vtkSmartPointer<vtkDoubleArray>::New();
field->SetNumberOfComponents(2);
field->SetName(name);
field->SetArray(scalars, 2* Image->GetNumberOfPoints(), 1);
Image->GetPointData()->AddArray(field);
}
}
I am getting some errors from the Makefile generated by Cmake:
/Users/lucaspettey/codes/BEC/coprocVTK.cxx:40:38: error: too few arguments to function call, expected 2, have 1
Grid->SetNumberOfScalarComponents(2);
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^
/Users/lucaspettey/ParaView-git/ParaView/VTK/Common/DataModel/vtkImageData.h:298:3: note: 'SetNumberOfScalarComponents' declared here
static void SetNumberOfScalarComponents( int n, vtkInformation* meta_data);
^
/Users/lucaspettey/codes/BEC/coprocVTK.cxx:67:5: error: unknown type name 'vtkSmartPointer'; did you mean 'vtkSmartPointerBase'?
vtkSmartPointer<vtkDoubleArray> field = vtkSmartPointer<vtkDoubleArray>::New();
^~~~~~~~~~~~~~~
vtkSmartPointerBase
/Users/lucaspettey/ParaView-git/ParaView/VTK/Common/Core/vtkOStreamWrapper.h:36:7: note: 'vtkSmartPointerBase' declared here
class vtkSmartPointerBase;
^
/Users/lucaspettey/codes/BEC/coprocVTK.cxx:67:20: error: expected unqualified-id
vtkSmartPointer<vtkDoubleArray> field = vtkSmartPointer<vtkDoubleArray>::New();
^
/Users/lucaspettey/codes/BEC/coprocVTK.cxx:68:5: error: use of undeclared identifier 'field'
field->SetNumberOfComponents(2);
^
/Users/lucaspettey/codes/BEC/coprocVTK.cxx:69:5: error: use of undeclared identifier 'field'
field->SetName(name);
^
/Users/lucaspettey/codes/BEC/coprocVTK.cxx:70:5: error: use of undeclared identifier 'field'
field->SetArray(scalars, 2* Image->GetNumberOfPoints(), 1);
^
/Users/lucaspettey/codes/BEC/coprocVTK.cxx:71:37: error: use of undeclared identifier 'field'
Image->GetPointData()->AddArray(field);
^
Any help is appreciated.
Thanks,
Lucas
________________________________
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.
_______________________________________________
Powered by www.kitware.com<http://www.kitware.com><http://www.kitware.com><http://www.kitware.com><http://www.kitware.com>
Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
Please keep messages on-topic and check the ParaView Wiki at: http://paraview.org/Wiki/ParaView
Follow this link to subscribe/unsubscribe:
http://www.paraview.org/mailman/listinfo/paraview
_______________________________________________
Powered by www.kitware.com<http://www.kitware.com><http://www.kitware.com><http://www.kitware.com>
Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
Please keep messages on-topic and check the ParaView Wiki at: http://paraview.org/Wiki/ParaView
Follow this link to subscribe/unsubscribe:
http://www.paraview.org/mailman/listinfo/paraview
_______________________________________________
Powered by www.kitware.com<http://www.kitware.com><http://www.kitware.com>
Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
Please keep messages on-topic and check the ParaView Wiki at: http://paraview.org/Wiki/ParaView
Follow this link to subscribe/unsubscribe:
http://www.paraview.org/mailman/listinfo/paraview
-------------- next part --------------
A non-text attachment was scrubbed...
Name: coproc.py
Type: text/x-python-script
Size: 18621 bytes
Desc: coproc.py
URL: <http://www.paraview.org/pipermail/paraview/attachments/20130321/e136180a/attachment-0001.bin>
More information about the ParaView
mailing list