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