<br><br><div class="gmail_quote">On Wed, Jun 13, 2012 at 4:38 AM, Andrew Parker <span dir="ltr"><<a href="mailto:andy.john.parker@googlemail.com" target="_blank">andy.john.parker@googlemail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Ok,<div><br></div><div>So Jeff to be clear, when you say "the face-based approach", you are referring to what Bill just said below?</div>
</blockquote><div>Bill's approach will give you the total volume of the mesh. But yes, it is face based using massproperties (divergence theorem) to compute the volume. If you want the volume of each cell you need to do what you said before and loop over all cells, triangulate cell faces and get the individual volumes.</div>
<div>Jeff</div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><br></div><div>Cheers,</div><div>Andy<div><div class="h5"><br><br><div class="gmail_quote">
On 12 June 2012 20:20, Bill Lorensen <span dir="ltr"><<a href="mailto:bill.lorensen@gmail.com" target="_blank">bill.lorensen@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
I would try geometry filter followed by triangle filter followed by<br>
massproperties.<br>
<div><div><br>
<br>
On Tue, Jun 12, 2012 at 12:56 PM, Jeff Lee <<a href="mailto:jlee1549@gmail.com" target="_blank">jlee1549@gmail.com</a>> wrote:<br>
> that assumes that the polyhedron can be tetrahedralized - the face-based<br>
> approach is more robust. in practice it is better to assume that arbitrary<br>
> polyhedra cannot be triangulated, and that the tets you get back will not<br>
> actually represent the original polyhedron, especially ones with nonconvex<br>
> faces. I guess it all depends on how accurate you need the volumes to be.<br>
> Jeff<br>
><br>
><br>
> On Tue, Jun 12, 2012 at 10:14 AM, Andrew Parker<br>
> <<a href="mailto:andy.john.parker@googlemail.com" target="_blank">andy.john.parker@googlemail.com</a>> wrote:<br>
>><br>
>> I knew I'd done this before, but that's because I was working inside<br>
>> paraview directly. Frustrating this is not available in pure vtk:<br>
>><br>
>><br>
>> <a href="http://www.paraview.org/ParaView3/Doc/Nightly/html/classvtkCellIntegrator.html" target="_blank">http://www.paraview.org/ParaView3/Doc/Nightly/html/classvtkCellIntegrator.html</a><br>
>><br>
>> Andy<br>
>><br>
>><br>
>> On 12 June 2012 14:43, Jeff Lee <<a href="mailto:jlee1549@gmail.com" target="_blank">jlee1549@gmail.com</a>> wrote:<br>
>>><br>
>>> its kind of the cost of doing business with arbitrary polyhedra, either<br>
>>> you triangulate or it is done internally. your workflow is dealing with<br>
>>> data in vtk format, i.e. cells which may be more tedious/inefficient to<br>
>>> process than with data stored in a face-based datastructure. even<br>
>>> commercial codes need to make assumptions about the face shape - either by<br>
>>> ear-cut triangulation or spoking to the face centroid. it is an expensive<br>
>>> operation either way. it sounds like you are on the right track though, and<br>
>>> perhaps you could contribute whatever you come up with.<br>
>>> Best,<br>
>>><br>
>>> Jeff<br>
>>><br>
>>> On Tue, Jun 12, 2012 at 9:29 AM, Andrew Parker<br>
>>> <<a href="mailto:andy.john.parker@googlemail.com" target="_blank">andy.john.parker@googlemail.com</a>> wrote:<br>
>>>><br>
>>>> Yes this is for an entire mesh. The faces are non-triangular. The<br>
>>>> point I was making/asking was for a method to do this within vtk, without<br>
>>>> having to pre-process my mesh. If there is polyhedral support it would be<br>
>>>> nice if that support extended to basic metrics of a polyhedral.<br>
>>>><br>
>>>> So to be clear my work flow needs to be the following. Read in very<br>
>>>> large unstructured arbitrary shaped polyhedral mesh; loop over mesh; extract<br>
>>>> each cell; triangular each face of the cell; pass this to vtkmassproperties;<br>
>>>> get the cell volume; repeat.<br>
>>>><br>
>>>> I would hate to think how many people are having to reproduce code like<br>
>>>> this for basic metrics of a polyhedral mesh that is said to be<br>
>>>> supported.....<br>
>>>><br>
>>>> Cheers,<br>
>>>> Andy<br>
>>>><br>
>>>><br>
>>>> On 12 June 2012 14:20, Jeff Lee <<a href="mailto:jlee1549@gmail.com" target="_blank">jlee1549@gmail.com</a>> wrote:<br>
>>>>><br>
>>>>> You usually have to triangulate the polyhedron faces anyways because<br>
>>>>> the they will likely be nonplanar, nonconvex, etc. You could either steal<br>
>>>>> the code in vtkMassProperties which computes the volume on the triangle set,<br>
>>>>> or convert to triangles and use an internal instance of vtkMassProperties -<br>
>>>>> I would probably opt for the former, but it depends on whether you are doing<br>
>>>>> a one-off or trying to compute volumes for an entire mesh.<br>
>>>>><br>
>>>>><br>
>>>>> On Tue, Jun 12, 2012 at 9:05 AM, Andrew Parker<br>
>>>>> <<a href="mailto:andy.john.parker@googlemail.com" target="_blank">andy.john.parker@googlemail.com</a>> wrote:<br>
>>>>>><br>
>>>>>> I would have used it except this put me off in the docs:<br>
>>>>>><br>
>>>>>> " vtkMassProperties estimates the volume, the surface area, and the<br>
>>>>>> normalized shape index of a triangle mesh. "<br>
>>>>>><br>
>>>>>><br>
>>>>>> On 12 June 2012 13:56, Jeff Lee <<a href="mailto:jlee1549@gmail.com" target="_blank">jlee1549@gmail.com</a>> wrote:<br>
>>>>>>><br>
>>>>>>> did you look at vtkMassProperties? it uses divergence theorem to<br>
>>>>>>> compute volume which is face based and works on arbitrary polyhedra.<br>
>>>>>>> Jeff<br>
>>>>>>><br>
>>>>>>><br>
>>>>>>> On Tue, Jun 12, 2012 at 8:48 AM, Andrew Parker<br>
>>>>>>> <<a href="mailto:andy.john.parker@googlemail.com" target="_blank">andy.john.parker@googlemail.com</a>> wrote:<br>
>>>>>>>><br>
>>>>>>>> Hi,<br>
>>>>>>>><br>
>>>>>>>> Many thanks, yes, linear only but an arbitrary number of faces. I<br>
>>>>>>>> would have bet there was another way of doing this, and that I've used it, I<br>
>>>>>>>> just can't remember how I did it.<br>
>>>>>>>><br>
>>>>>>>> Do you not think it's rather odd there is a lack of support for<br>
>>>>>>>> simple metrics like this given an arbitrary polyhedra? One needs only the<br>
>>>>>>>> faces and nodes. Under the assumption each face is planer then this sort of<br>
>>>>>>>> thing is quite easy, and would at least make the vtk support for this for<br>
>>>>>>>> type of metric with planer faces much more applicable to a significantly<br>
>>>>>>>> larger number of users. See the following as a good example which is used<br>
>>>>>>>> in CFD and has been for many years:<br>
>>>>>>>><br>
>>>>>>>> <a href="http://www.public.iastate.edu/~zjw/papers/1999-AIAAJ.pdf" target="_blank">http://www.public.iastate.edu/~zjw/papers/1999-AIAAJ.pdf</a><br>
>>>>>>>><br>
>>>>>>>> I appreciate in the non-planer case something else needs to be done,<br>
>>>>>>>> but all of this could be hidden behind a wrapper class that provides metrics<br>
>>>>>>>> regardless of cell type. If this is indeed in vtk and anybody can point me<br>
>>>>>>>> to it then that would be really helpful.<br>
>>>>>>>><br>
>>>>>>>> Cheers,<br>
>>>>>>>> Andy<br>
>>>>>>>><br>
>>>>>>>><br>
>>>>>>>> On 12 June 2012 12:59, Jochen K. <<a href="mailto:jochen.kling@email.de" target="_blank">jochen.kling@email.de</a>> wrote:<br>
>>>>>>>>><br>
>>>>>>>>> Hi Andy,<br>
>>>>>>>>><br>
>>>>>>>>> do you address only linear elements with arbitrary polyhedrons?<br>
>>>>>>>>> Or should support be given to quadratic, biquadratic, triquadratic<br>
>>>>>>>>> and even<br>
>>>>>>>>> convexPointSets elements too?<br>
>>>>>>>>><br>
>>>>>>>>> In any case all cells must be traversed, right?<br>
>>>>>>>>><br>
>>>>>>>>> While traversing all cells I would check the celltype and store the<br>
>>>>>>>>> cellid<br>
>>>>>>>>> (for cell assignment of the calculated volume later on).<br>
>>>>>>>>><br>
>>>>>>>>> If the current cell is a primitve type like tetrahedron etc.<br>
>>>>>>>>> calculate the<br>
>>>>>>>>> volume and traverse next cell.<br>
>>>>>>>>><br>
>>>>>>>>> In case it's a more complicated element I would tetrahedralize it,<br>
>>>>>>>>> and sum<br>
>>>>>>>>> up the volume of each given tetrahedron.<br>
>>>>>>>>><br>
>>>>>>>>> That's it.<br>
>>>>>>>>><br>
>>>>>>>>> If the grid consists of a lot of nonlinear elements the result will<br>
>>>>>>>>> probably<br>
>>>>>>>>> deviate a bit from the correct value. The questionis how exactly<br>
>>>>>>>>> you want<br>
>>>>>>>>> the result to be.<br>
>>>>>>>>><br>
>>>>>>>>> For a cross-check I would apply a surfacefilter to the whole grid,<br>
>>>>>>>>> tetrahedralize it, and sum up the tetrahedron volumes.<br>
>>>>>>>>> Then compare the volume of both approaches. They should be more or<br>
>>>>>>>>> less<br>
>>>>>>>>> identical.<br>
>>>>>>>>><br>
>>>>>>>>><br>
>>>>>>>>> with best regards<br>
>>>>>>>>> Jochen<br>
>>>>>>>>><br>
>>>>>>>>><br>
>>>>>>>>><br>
>>>>>>>>> --<br>
>>>>>>>>> View this message in context:<br>
>>>>>>>>> <a href="http://vtk.1045678.n5.nabble.com/Polyhedral-volume-computation-tp5713778p5713792.html" target="_blank">http://vtk.1045678.n5.nabble.com/Polyhedral-volume-computation-tp5713778p5713792.html</a><br>
>>>>>>>>> Sent from the VTK - Users mailing list archive at Nabble.com.<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<br>
>>>>>>>>> <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 VTK FAQ at:<br>
>>>>>>>>> <a href="http://www.vtk.org/Wiki/VTK_FAQ" target="_blank">http://www.vtk.org/Wiki/VTK_FAQ</a><br>
>>>>>>>>><br>
>>>>>>>>> Follow this link to subscribe/unsubscribe:<br>
>>>>>>>>> <a href="http://www.vtk.org/mailman/listinfo/vtkusers" target="_blank">http://www.vtk.org/mailman/listinfo/vtkusers</a><br>
>>>>>>>><br>
>>>>>>>><br>
>>>>>>>><br>
>>>>>>>><br>
>>>>>>>> --<br>
>>>>>>>><br>
>>>>>>>> __________________________________<br>
>>>>>>>><br>
>>>>>>>> Dr Andrew Parker<br>
>>>>>>>><br>
>>>>>>>> Em@il: <a href="mailto:andrew.parker@cantab.net" target="_blank">andrew.parker@cantab.net</a><br>
>>>>>>>><br>
>>>>>>>><br>
>>>>>>>><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<br>
>>>>>>>> <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 VTK FAQ at:<br>
>>>>>>>> <a href="http://www.vtk.org/Wiki/VTK_FAQ" target="_blank">http://www.vtk.org/Wiki/VTK_FAQ</a><br>
>>>>>>>><br>
>>>>>>>> Follow this link to subscribe/unsubscribe:<br>
>>>>>>>> <a href="http://www.vtk.org/mailman/listinfo/vtkusers" target="_blank">http://www.vtk.org/mailman/listinfo/vtkusers</a><br>
>>>>>>>><br>
>>>>>>><br>
>>>>>><br>
>>>>>><br>
>>>>>><br>
>>>>>> --<br>
>>>>>><br>
>>>>>> __________________________________<br>
>>>>>><br>
>>>>>> Dr Andrew Parker<br>
>>>>>><br>
>>>>>> Em@il: <a href="mailto:andrew.parker@cantab.net" target="_blank">andrew.parker@cantab.net</a><br>
>>>>>><br>
>>>>>><br>
>>>>><br>
>>>><br>
>>>><br>
>>>><br>
>>>> --<br>
>>>><br>
>>>> __________________________________<br>
>>>><br>
>>>> Dr Andrew Parker<br>
>>>><br>
>>>> Em@il: <a href="mailto:andrew.parker@cantab.net" target="_blank">andrew.parker@cantab.net</a><br>
>>>><br>
>>>><br>
>>><br>
>><br>
>><br>
>><br>
>> --<br>
>><br>
>> __________________________________<br>
>><br>
>> Dr Andrew Parker<br>
>><br>
>> Em@il: <a href="mailto:andrew.parker@cantab.net" target="_blank">andrew.parker@cantab.net</a><br>
>><br>
>><br>
><br>
><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<br>
> <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 VTK FAQ at:<br>
> <a href="http://www.vtk.org/Wiki/VTK_FAQ" target="_blank">http://www.vtk.org/Wiki/VTK_FAQ</a><br>
><br>
> Follow this link to subscribe/unsubscribe:<br>
> <a href="http://www.vtk.org/mailman/listinfo/vtkusers" target="_blank">http://www.vtk.org/mailman/listinfo/vtkusers</a><br>
><br>
<br>
<br>
<br>
--<br>
</div></div>Unpaid intern in BillsBasement at noware dot com<br>
</blockquote></div><br><br clear="all"><div><br></div>-- <br><p>__________________________________</p><p> Dr Andrew Parker</p><p> <a href="mailto:Em@il" target="_blank">Em@il</a>: <a href="mailto:andrew.parker@cantab.net" target="_blank">andrew.parker@cantab.net</a></p>
<br>
</div></div></div>
</blockquote></div><br>