CFD Online Logo CFD Online URL
Home > Forums > ParaView

Pvpython find centroid dataset

Register Blogs Members List Search Today's Posts Mark Forums Read

LinkBack Thread Tools Display Modes
Old   February 6, 2014, 07:52
Default Pvpython find centroid dataset
New Member
Join Date: Aug 2013
Location: Europe
Posts: 23
Rep Power: 5
maero21 is on a distinguished road
Dear Paraview users,

I am working on a script to automatically generate pictures from my OpenFOAM cases. In order for it to be fully automated, I want to know the centroid of my dataset in order to focus the camera on it.
Is there any way to find that? Or perhaps a method to convert the VTK data to a numpy array and then use mean?

maero21 is offline   Reply With Quote

Old   February 16, 2014, 13:32
Super Moderator
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 9,978
Blog Entries: 39
Rep Power: 108
wyldckat is a glorious beacon of lightwyldckat is a glorious beacon of lightwyldckat is a glorious beacon of lightwyldckat is a glorious beacon of lightwyldckat is a glorious beacon of lightwyldckat is a glorious beacon of light
Greetings maero21,

I believe what you are looking for is a combination of the following:
  1. Use the "Integrate Variables" filter to calculate the centroid. It will be the array "Points" that gives you the centroid.
  2. On this post: Get data from Calculator filter in python script post #6 - you can see how to get access to this value.
  3. On this post: post #6 - you can see how to update values with each time change.
Best regards,
wyldckat is offline   Reply With Quote


pvpython vtk openfoam

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
OpenFoam171: error /usr/bin/ld: cannot find -llduSolvers Schipper OpenFOAM Programming & Development 5 November 15, 2012 15:13
OpenFoam-1.6-ext Allwmake compilation error - one last barrier Pat84 OpenFOAM Installation 15 July 25, 2012 21:49
CFX-Pre problem, pls help!!! cth_yao CFX 0 February 17, 2012 01:52
OpenFOAM 1.6-ext git installation on Ubuntu 11.10 x64 Attesz OpenFOAM Installation 45 January 13, 2012 13:38
Problem Building OF on Centos cluster (no admin rights) CKH OpenFOAM Installation 5 November 13, 2011 07:32

All times are GMT -4. The time now is 11:38.